use of org.gephi.lib.validation.PositiveNumberValidator in project gephi by gephi.
the class RandomGraphPanel method createValidationPanel.
public static ValidationPanel createValidationPanel(RandomGraphPanel innerPanel) {
ValidationPanel validationPanel = new ValidationPanel();
if (innerPanel == null) {
innerPanel = new RandomGraphPanel();
}
validationPanel.setInnerComponent(innerPanel);
ValidationGroup group = validationPanel.getValidationGroup();
//Node field
group.add(innerPanel.nodeField, Validators.REQUIRE_NON_EMPTY_STRING, new PositiveNumberValidator());
//Edge field
group.add(innerPanel.edgeField, Validators.REQUIRE_NON_EMPTY_STRING, new BetweenZeroAndOneValidator());
return validationPanel;
}
use of org.gephi.lib.validation.PositiveNumberValidator in project gephi by gephi.
the class DynamicSettingsPanel method createValidation.
public void createValidation(ValidationGroup group) {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getGraphModel();
TimeFormat timeFormat = graphModel.getTimeFormat();
if (timeFormat == TimeFormat.DOUBLE) {
group.add(windowTextField, Validators.REQUIRE_NON_EMPTY_STRING, Validators.numberRange(Double.MIN_VALUE, (bounds.getHigh() - bounds.getLow())));
group.add(tickTextField, Validators.REQUIRE_NON_EMPTY_STRING, Validators.numberRange(Double.MIN_VALUE, (bounds.getHigh() - bounds.getLow())));
} else {
//TODO validation with dates
group.add(windowTextField, Validators.REQUIRE_NON_EMPTY_STRING, new PositiveNumberValidator(), new DateRangeValidator(windowTimeUnitCombo.getModel()));
group.add(tickTextField, Validators.REQUIRE_NON_EMPTY_STRING, new PositiveNumberValidator(), new DateRangeValidator(tickTimeUnitCombo.getModel()), new TickUnderWindowValidator(timeFormat != TimeFormat.DOUBLE));
}
}
Aggregations