Search in sources :

Example 1 with Problems

use of org.netbeans.validation.api.Problems in project gephi by gephi.

the class CreateTimeIntervalUI method buildValidationPanel.

private void buildValidationPanel() {
    validationPanel = new ValidationPanel();
    validationPanel.setInnerComponent(this);
    ValidationGroup group = validationPanel.getValidationGroup();
    group.add(dateFormatComboBox, new Validator<String>() {

        @Override
        public boolean validate(Problems prblms, String string, String t) {
            boolean valid = validateDateFormat(t);
            if (!valid) {
                prblms.add(NbBundle.getMessage(CreateTimeIntervalUI.class, "CreateTimeIntervalUI.invalid.dateformat"));
            }
            return valid;
        }
    });
    Validator<String> emptyOrNumberValidator = new Validator<String>() {

        @Override
        public boolean validate(Problems prblms, String string, String t) {
            boolean valid = validateNumberOrEmpty(t);
            if (!valid) {
                prblms.add(NbBundle.getMessage(CreateTimeIntervalUI.class, "CreateTimeIntervalUI.invalid.number"));
            }
            return valid;
        }
    };
    group.add(defaultStartNumberText, emptyOrNumberValidator);
    group.add(defaultEndNumberText, emptyOrNumberValidator);
    validationPanel.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            refreshOkButton();
        }
    });
}
Also used : Problems(org.netbeans.validation.api.Problems) ChangeEvent(javax.swing.event.ChangeEvent) ValidationGroup(org.netbeans.validation.api.ui.ValidationGroup) ChangeListener(javax.swing.event.ChangeListener) ValidationPanel(org.netbeans.validation.api.ui.ValidationPanel) Validator(org.netbeans.validation.api.Validator)

Example 2 with Problems

use of org.netbeans.validation.api.Problems in project gephi by gephi.

the class WizardVisualPanel1CSV method getValidationPanel.

public ValidationPanel getValidationPanel() {
    if (validationPanel != null) {
        return validationPanel;
    }
    validationPanel = new ValidationPanel();
    validationPanel.setInnerComponent(WizardVisualPanel1CSV.this);
    ValidationGroup validationGroup = validationPanel.getValidationGroup();
    validationGroup.add(pathTextField, new Validator<String>() {

        @Override
        public boolean validate(Problems prblms, String string, String t) {
            if (!areValidColumnsForTable()) {
                prblms.add(getMessage("WizardVisualPanel1CSV.validation.edges.no-source-target-columns"));
                return false;
            }
            if (hasRowsMissingSourcesOrTargets()) {
                prblms.add(NbBundle.getMessage(WizardVisualPanel1CSV.class, "WizardVisualPanel1CSV.validation.edges.empty-sources-or-targets"), Severity.WARNING);
            }
            return true;
        }
    });
    validationPanel.setName(getName());
    return validationPanel;
}
Also used : Problems(org.netbeans.validation.api.Problems) ValidationGroup(org.netbeans.validation.api.ui.ValidationGroup) ValidationPanel(org.netbeans.validation.api.ui.ValidationPanel)

Example 3 with Problems

use of org.netbeans.validation.api.Problems in project gephi by gephi.

the class WizardVisualPanel1Excel method getValidationPanel.

public ValidationPanel getValidationPanel() {
    if (validationPanel != null) {
        return validationPanel;
    }
    validationPanel = new ValidationPanel();
    validationPanel.setInnerComponent(WizardVisualPanel1Excel.this);
    ValidationGroup validationGroup = validationPanel.getValidationGroup();
    validationGroup.add(pathTextField, new Validator<String>() {

        @Override
        public boolean validate(Problems prblms, String string, String t) {
            if (!areValidColumnsForMode()) {
                prblms.add(getMessage("WizardVisualPanel1CSV.validation.edges.no-source-target-columns"));
                return false;
            }
            if (hasRowsMissingSourcesOrTargets()) {
                prblms.add(NbBundle.getMessage(WizardVisualPanel1Excel.class, "WizardVisualPanel1CSV.validation.edges.empty-sources-or-targets"), Severity.WARNING);
            }
            return true;
        }
    });
    validationPanel.setName(getName());
    return validationPanel;
}
Also used : Problems(org.netbeans.validation.api.Problems) ValidationGroup(org.netbeans.validation.api.ui.ValidationGroup) ValidationPanel(org.netbeans.validation.api.ui.ValidationPanel)

Aggregations

Problems (org.netbeans.validation.api.Problems)3 ValidationGroup (org.netbeans.validation.api.ui.ValidationGroup)3 ValidationPanel (org.netbeans.validation.api.ui.ValidationPanel)3 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1 Validator (org.netbeans.validation.api.Validator)1