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();
}
});
}
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;
}
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;
}
Aggregations