/** Validate fields values */ public void validateFields() { // casTb is a required field if (casTb.getValue() == null) delegate.recordError(BaseNLS.messages().error_required(), null, "casTb"); // date is a required field if (date.getValueWithoutParseException() == null && date.isValid()) delegate.recordError(BaseNLS.messages().error_required(), null, "date"); // raisonDepistage is a required field if (raisonDepistage.getValue() == null) delegate.recordError(BaseNLS.messages().error_required(), null, "raisonDepistage"); // resultat is a required field if (resultat.getValue() == null) delegate.recordError(BaseNLS.messages().error_required(), null, "resultat"); }
@Override public void showErrors(List<EditorError> errors) { if (errors != null && errors.size() > 0) { List<EditorError> casTbFieldErrors = new ArrayList<EditorError>(); List<EditorError> dateFieldErrors = new ArrayList<EditorError>(); List<EditorError> raisonDepistageFieldErrors = new ArrayList<EditorError>(); List<EditorError> resultatFieldErrors = new ArrayList<EditorError>(); for (EditorError error : errors) { Object userData = error.getUserData(); if (userData != null && userData instanceof String) { String field = (String) userData; if (field.equals("casTb")) casTbFieldErrors.add(error); if (field.equals("date")) dateFieldErrors.add(error); if (field.equals("raisonDepistage")) raisonDepistageFieldErrors.add(error); if (field.equals("resultat")) resultatFieldErrors.add(error); } } if (casTbFieldErrors.size() > 0) casTb.showErrors(casTbFieldErrors); if (dateFieldErrors.size() > 0) date.showErrors(dateFieldErrors); if (raisonDepistageFieldErrors.size() > 0) raisonDepistage.showErrors(raisonDepistageFieldErrors); if (resultatFieldErrors.size() > 0) resultat.showErrors(resultatFieldErrors); } }
private void setAllLabelWith(String width) { /* CentreExamen field group */ CDT.setLabelWidth(width); laboratoireReference.setLabelWidth(width); /* Examen field group */ casTb.setLabelWidth(width); date.setLabelWidth(width); raisonDepistage.setLabelWidth(width); resultat.setLabelWidth(width); observations.setLabelWidth(width); }
/** * Sets the edition mode * * @param isEdited true to enable the edition of the form */ public void setEdited(boolean isEdited) { if (isEdited) setFieldEditAccess(); else setFieldReadAccess(); /* CentreExamen section widgets */ CDT.setEdited(isEdited); laboratoireReference.setEdited(isEdited); /* Examen section widgets */ casTb.setEdited(isEdited); date.setEdited(isEdited); raisonDepistage.setEdited(isEdited); resultat.setEdited(isEdited); observations.setEdited(isEdited); }
/** Sets the properties of the fields */ private void properties() { /* CentreExamen section widgets */ centreExamenSection.setGroupTitle(NLS.constants().examenMicroscopie_group_centreExamen()); CDT.setLabel(NLS.constants().examenMicroscopie_field_cDT()); laboratoireReference.setLabel(NLS.constants().examenMicroscopie_field_laboratoireReference()); /* Examen section widgets */ examenSection.setGroupTitle(NLS.constants().examenMicroscopie_group_examen()); casTb.setLabel(NLS.constants().examenMicroscopie_field_casTb()); date.setLabel(NLS.constants().examenMicroscopie_field_date()); raisonDepistage.setLabel(NLS.constants().examenMicroscopie_field_raisonDepistage()); raisonDepistage.addItem( EpicamEnumConstants.EXAMENMICROSCOPIE_RAISONDEPISTAGE_DIAGNOSTIC, NLS.constants().examenMicroscopie_raisonDepistage_diagnostic_option()); raisonDepistage.addItem( EpicamEnumConstants.EXAMENMICROSCOPIE_RAISONDEPISTAGE_SUIVI, NLS.constants().examenMicroscopie_raisonDepistage_suivi_option()); resultat.setLabel(NLS.constants().examenMicroscopie_field_resultat()); resultat.addItem( EpicamEnumConstants.EXAMENMICROSCOPIE_RESULTAT_NEGATIF, NLS.constants().examenMicroscopie_resultat_negatif_option()); resultat.addItem( EpicamEnumConstants.EXAMENMICROSCOPIE_RESULTAT_RARE, NLS.constants().examenMicroscopie_resultat_rare_option()); resultat.addItem( EpicamEnumConstants.EXAMENMICROSCOPIE_RESULTAT_UNPLUS, NLS.constants().examenMicroscopie_resultat_unPlus_option()); resultat.addItem( EpicamEnumConstants.EXAMENMICROSCOPIE_RESULTAT_DEUXPLUS, NLS.constants().examenMicroscopie_resultat_deuxPlus_option()); resultat.addItem( EpicamEnumConstants.EXAMENMICROSCOPIE_RESULTAT_TROISPLUS, NLS.constants().examenMicroscopie_resultat_troisPlus_option()); observations.setLabel(NLS.constants().examenMicroscopie_field_observations()); }