Search in sources :

Example 16 with TimeFormat

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));
    }
}
Also used : TimeFormat(org.gephi.graph.api.TimeFormat) PositiveNumberValidator(org.gephi.lib.validation.PositiveNumberValidator) GraphModel(org.gephi.graph.api.GraphModel) GraphController(org.gephi.graph.api.GraphController)

Example 17 with TimeFormat

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();
    }
}
Also used : TimeFormat(org.gephi.graph.api.TimeFormat) GraphModel(org.gephi.graph.api.GraphModel) TimeUnit(java.util.concurrent.TimeUnit) GraphController(org.gephi.graph.api.GraphController)

Aggregations

TimeFormat (org.gephi.graph.api.TimeFormat)17 DateTimeZone (org.joda.time.DateTimeZone)13 Column (org.gephi.graph.api.Column)7 GraphController (org.gephi.graph.api.GraphController)5 GraphModel (org.gephi.graph.api.GraphModel)5 Element (org.gephi.graph.api.Element)4 ArrayList (java.util.ArrayList)3 Matcher (java.util.regex.Matcher)3 AttributeColumnsController (org.gephi.datalab.api.AttributeColumnsController)3 Edge (org.gephi.graph.api.Edge)3 Node (org.gephi.graph.api.Node)3 Table (org.gephi.graph.api.Table)3 GraphElementsController (org.gephi.datalab.api.GraphElementsController)2 SearchResult (org.gephi.datalab.api.SearchReplaceController.SearchResult)2 CsvWriter (com.csvreader.CsvWriter)1 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 HashMap (java.util.HashMap)1 List (java.util.List)1 TimeUnit (java.util.concurrent.TimeUnit)1