use of org.gephi.graph.api.TimeFormat 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));
}
}
use of org.gephi.graph.api.TimeFormat in project gephi by gephi.
the class DynamicSettingsPanel method unsetup.
public void unsetup(DynamicStatistics dynamicStatistics) {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getGraphModel();
TimeFormat timeFormat = graphModel.getTimeFormat();
//Bounds is the same
dynamicStatistics.setBounds(bounds);
//Window
double window;
if (timeFormat == TimeFormat.DOUBLE) {
window = Double.parseDouble(windowTextField.getText());
} else {
TimeUnit timeUnit = getSelectedTimeUnit(windowTimeUnitCombo.getModel());
window = getTimeInMilliseconds(windowTextField.getText(), timeUnit);
}
dynamicStatistics.setWindow(window);
//Tick
double tick;
if (timeFormat == TimeFormat.DOUBLE) {
tick = Double.parseDouble(tickTextField.getText());
} else {
TimeUnit timeUnit = getSelectedTimeUnit(tickTimeUnitCombo.getModel());
tick = getTimeInMilliseconds(tickTextField.getText(), timeUnit);
}
dynamicStatistics.setTick(tick);
//Save latest selected item
if (timeFormat != TimeFormat.DOUBLE) {
saveDefaultTimeUnits();
}
}
Aggregations