//Associate the data with the formLayout columns and load the data. 
private void configureComponents() {
        //Associate the data with the formLayout columns and load the data. 
        try 
        {
            //1 - Set properties of the form
            this.formLayout.addClassName("fichier-form");
            this.formLayout.setSizeFull(); //sets the form size to fill the screen.
            //2 - Define the Fields instances to use - We don't use .setLabel since we will use addFormItem instead of add to add items to the form - addFormItem allows us to set SuperTextField with on a FormaLayout when add doesn't
            this.txtCodeDomaineActivite.setWidth(100, Unit.PIXELS);
            this.txtCodeDomaineActivite.setRequired(true);
            this.txtCodeDomaineActivite.setRequiredIndicatorVisible(true);
            this.txtCodeDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL);
            this.txtLibelleDomaineActivite.setWidth(400, Unit.PIXELS);
            this.txtLibelleDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL);
            this.txtLibelleCourtDomaineActivite.setWidth(400, Unit.PIXELS);
            this.txtLibelleCourtDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL);
            this.cboCodeSecteurActivite.setWidth(400, Unit.PIXELS);
            this.cboCodeSecteurActivite.addClassName(COMBOBOX_LEFT_LABEL);
            // Choose which property from SecteurActivite is the presentation value
            this.cboCodeSecteurActivite.setItemLabelGenerator(SecteurActivite::getLibelleSecteurActivite);
            this.cboCodeSecteurActivite.setRequired(true);
            this.cboCodeSecteurActivite.setRequiredIndicatorVisible(true);
            //???this.cboCodeSecteurActivite.setLabel("SecteurActivite");
            //???this.cboCodeSecteurActivite.setId("person");
            this.cboCodeSecteurActivite.setClearButtonVisible(true);
            //Add Filtering
            this.cboCodeSecteurActivite.setAllowCustomValue(true);
            this.cboCodeSecteurActivite.setPreventInvalidInput(true);
            this.cboCodeSecteurActivite.addValueChangeListener(event -> {
                if (event.getValue() != null) {
                    //BeforeUpdate CodeSecteurActivite (CIF): Contrôle de Inactif
                    if (event.getValue().isInactif() == true) {
                        MessageDialogHelper.showWarningDialog("Erreur de Saisie", "Le Secteur d'Activité choisi est actuellement désactivé. Veuillez en saisir un autre.");
                        //Cancel
                        this.cboCodeSecteurActivite.setValue(event.getOldValue());
                    } //if (event.getValue() != null) {
                }
            });
            /**
            * Allow users to enter a value which doesn't exist in the data set, and
            * set it as the value of the ComboBox.
            */
            this.cboCodeSecteurActivite.addCustomValueSetListener(event -> {
                this.cboCodeSecteurActivite_NotInList(event.getDetail(), 50);
            });
            this.chkInactif.setAutofocus(false); //Sepecific for isInactif
            //3 - Bind Fields instances to use (Manual Data Binding)
            // Easily bind forms to beans and manage validation and buffering
            //To bind a component to read-only data, use a null value for the setter.
            Label lblCodeDomaineActiviteValidationStatus = new Label();
            this.binder.forField(this.txtCodeDomaineActivite)
                .asRequired("La Saisie du Code Domaine d'Activité est Obligatoire. Veuillez saisir le Code Domaine d'Activité.")
                .withValidator(text -> text != null && text.length() <= 10, "Code Domaine d'Activité ne peut contenir au plus 10 caractères")
                .withValidationStatusHandler(status -> {lblCodeDomaineActiviteValidationStatus.setText(status.getMessage().orElse(""));       
                         lblCodeDomaineActiviteValidationStatus.setVisible(status.isError());})
                .bind(DomaineActivite::getCodeDomaineActivite, DomaineActivite::setCodeDomaineActivite); 
            Label lblLibelleDomaineActiviteValidationStatus = new Label();
            this.binder.forField(this.txtLibelleDomaineActivite)
                .withValidator(text -> text.length() <= 50, "Libellé Domaine d'Activité ne peut contenir au plus 50 caractères.")
                .withValidationStatusHandler(status -> {lblLibelleDomaineActiviteValidationStatus.setText(status.getMessage().orElse(""));       
                         lblLibelleDomaineActiviteValidationStatus.setVisible(status.isError());})
                .bind(DomaineActivite::getLibelleDomaineActivite, DomaineActivite::setLibelleDomaineActivite); 
            Label lblLibelleCourtDomaineActiviteValidationStatus = new Label();
            this.binder.forField(this.txtLibelleCourtDomaineActivite)
                .withValidator(text -> text.length() <= 20, "Libellé Abrégé Domaine d'Activité ne peut contenir au plus 20 caractères.")
                .withValidationStatusHandler(status -> {lblLibelleCourtDomaineActiviteValidationStatus.setText(status.getMessage().orElse(""));       
                         lblLibelleCourtDomaineActiviteValidationStatus.setVisible(status.isError());})
                .bind(DomaineActivite::getLibelleCourtDomaineActivite, DomaineActivite::setLibelleCourtDomaineActivite); 
            Label lblSecteurActiviteValidationStatus = new Label();
            this.binder.forField(this.cboCodeSecteurActivite)
                .asRequired("La Saisie du Secteur d'Activité est requise. Veuillez sélectionner un Secteur d'Activité")
                .bind(DomaineActivite::getSecteurActivite, DomaineActivite::setSecteurActivite); 
            this.binder.forField(this.chkInactif)
                .bind(DomaineActivite::isInactif, DomaineActivite::setInactif); 
            /* 3 - Alternative : Bind Fields instances that need validators manually and then bind all remaining fields using the bindInstanceFields method
            this.binder.bindInstanceFields(this.formLayout); //Automatic Data Binding
            //bindInstanceFields matches fields in DomaineActivite and DomaineActiviteView based on their names.
            */
            //4 - Add input fields to formLayout - We don't use .setLabel since we will use addFormItem instead of add to add items to the form - addFormItem allows us to set SuperTextField with on a FormaLayout when add doesn't
            //this.formLayout.add(this.txtCodeDomaineActivite, this.txtLibelleDomaineActivite, this.txtLibelleCourtDomaineActivite, this.chkInactif);
            //4 - Alternative
            this.formLayout.addFormItem(this.txtCodeDomaineActivite, "Code Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250);
            this.formLayout.addFormItem(this.txtLibelleDomaineActivite, "Libellé Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250);
            this.formLayout.addFormItem(this.txtLibelleCourtDomaineActivite, "Libellé Abrégé Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250);
            this.formLayout.addFormItem(this.cboCodeSecteurActivite, "Secteur d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250);
            this.formLayout.addFormItem(this.chkInactif, "Inactif :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250);
            //5 - Making the Layout Responsive : Custom responsive layouting
            //breakpoint at 600px, with the label to the side. At resolutions lower than 600px, the label will be at the top. In both cases there is only 1 column.
            this.formLayout.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1, FormLayout.ResponsiveStep.LabelsPosition.TOP), 
                    new FormLayout.ResponsiveStep(PANEL_FLEX_BASIS, 1, FormLayout.ResponsiveStep.LabelsPosition.ASIDE));
        } 
        catch (Exception e) 
        {
            MessageDialogHelper.showAlertDialog("EditerDomaineActiviteDialog.configureComponents", e.toString());
            e.printStackTrace();
        }
    }
private void configureComponents() {
//Associate the data with the formLayout columns and load the data.
try
{
private void configureComponents() {
//Associate the data with the formLayout columns and load the data.
try
{
//1 - Set properties of the form
this.formLayout.addClassName("fichier-form");
this.formLayout.setSizeFull(); //sets the form size to fill the screen.
//2 - Define the Fields instances to use - We don't use .setLabel since we will use addFormItem instead of add to add items to the form - addFormItem allows us to set SuperTextField with on a FormaLayout when add doesn't
this.txtCodeDomaineActivite.setWidth(100, Unit.PIXELS);
this.txtCodeDomaineActivite.setRequired(true);
this.txtCodeDomaineActivite.setRequiredIndicatorVisible(true);
this.txtCodeDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL);
private void configureComponents() {
//Associate the data with the formLayout columns and load the data.
try
{
//1 - Set properties of the form
this.formLayout.addClassName("fichier-form");
this.formLayout.setSizeFull(); //sets the form size to fill the screen.
//2 - Define the Fields instances to use - We don't use .setLabel since we will use addFormItem instead of add to add items to the form - addFormItem allows us to set SuperTextField with on a FormaLayout when add doesn't
this.txtCodeDomaineActivite.setWidth(100, Unit.PIXELS);
this.txtCodeDomaineActivite.setRequired(true);
this.txtCodeDomaineActivite.setRequiredIndicatorVisible(true);
this.txtCodeDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL);
this.txtLibelleDomaineActivite.setWidth(400, Unit.PIXELS);
this.txtLibelleDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL);
this.txtLibelleCourtDomaineActivite.setWidth(400, Unit.PIXELS);
this.txtLibelleCourtDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL);
this.cboCodeSecteurActivite.setWidth(400, Unit.PIXELS);
this.cboCodeSecteurActivite.addClassName(COMBOBOX_LEFT_LABEL);
// Choose which property from SecteurActivite is the presentation value
this.cboCodeSecteurActivite.setItemLabelGenerator(SecteurActivite::getLibelleSecteurActivite);
this.cboCodeSecteurActivite.setRequired(true);
this.cboCodeSecteurActivite.setRequiredIndicatorVisible(true);