Search in sources :

Example 1 with TextField

use of io.jmix.ui.component.TextField in project jmix by jmix-framework.

the class FilterSaveAsAction method initInputDialogFormFields.

@SuppressWarnings("unchecked")
protected void initInputDialogFormFields(Form form) {
    CheckBox generatedIdField = (CheckBox) form.getComponentNN("generatedIdField");
    TextField<String> idField = (TextField<String>) form.getComponentNN("idField");
    idField.setEnabled(!generatedIdField.isChecked());
    generatedIdField.addValueChangeListener(valueChangeEvent -> {
        boolean checked = BooleanUtils.isTrue(valueChangeEvent.getValue());
        idField.setEnabled(!checked);
    });
    TextField<String> nameField = (TextField<String>) form.getComponentNN("nameField");
    nameField.addValueChangeListener(valueChangeEvent -> {
        if (generatedIdField.isChecked()) {
            idField.setValue(generateConfigurationId(valueChangeEvent.getValue()));
        }
    });
    generatedIdField.setVisible(componentProperties.isFilterShowConfigurationIdField());
    idField.setVisible(componentProperties.isFilterShowConfigurationIdField());
}
Also used : CheckBox(io.jmix.ui.component.CheckBox) TextField(io.jmix.ui.component.TextField)

Aggregations

CheckBox (io.jmix.ui.component.CheckBox)1 TextField (io.jmix.ui.component.TextField)1