Search in sources :

Example 1 with TimeFormat

use of org.gephi.graph.api.TimeFormat in project gephi by gephi.

the class IntervalMapSparklinesGraphicsComponentProvider method getTextFromValue.

@Override
public String getTextFromValue(Object value) {
    if (value == null) {
        return null;
    }
    TimeFormat timeFormat = graphModelProvider.getGraphModel().getTimeFormat();
    DateTimeZone timeZone = graphModelProvider.getGraphModel().getTimeZone();
    return ((IntervalMap) value).toString(timeFormat, timeZone);
}
Also used : TimeFormat(org.gephi.graph.api.TimeFormat) DateTimeZone(org.joda.time.DateTimeZone) IntervalMap(org.gephi.graph.api.types.IntervalMap)

Example 2 with TimeFormat

use of org.gephi.graph.api.TimeFormat in project gephi by gephi.

the class TimestampMapSparklinesGraphicsComponentProvider method getTextFromValue.

@Override
public String getTextFromValue(Object value) {
    if (value == null) {
        return null;
    }
    TimeFormat timeFormat = graphModelProvider.getGraphModel().getTimeFormat();
    DateTimeZone timeZone = graphModelProvider.getGraphModel().getTimeZone();
    return ((TimestampMap) value).toString(timeFormat, timeZone);
}
Also used : TimeFormat(org.gephi.graph.api.TimeFormat) TimestampMap(org.gephi.graph.api.types.TimestampMap) DateTimeZone(org.joda.time.DateTimeZone)

Example 3 with TimeFormat

use of org.gephi.graph.api.TimeFormat in project gephi by gephi.

the class AttributeTypesSupportCellEditor method getTableCellEditorComponent.

@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    TimeFormat timeFormat = graphModelProvider.getGraphModel().getTimeFormat();
    DateTimeZone timeZone = graphModelProvider.getGraphModel().getTimeZone();
    String valueStr;
    if (value == null) {
        valueStr = "";
    } else if (isTimestampSetType) {
        valueStr = ((TimestampSet) value).toString(timeFormat, timeZone);
    } else if (isTimestampMapType) {
        valueStr = ((TimestampMap) value).toString(timeFormat, timeZone);
    } else if (isIntervalSetType) {
        valueStr = ((IntervalSet) value).toString(timeFormat, timeZone);
    } else if (isIntervalMapType) {
        valueStr = ((IntervalMap) value).toString(timeFormat, timeZone);
    } else if (isArrayType) {
        valueStr = AttributeUtils.printArray(value);
    } else if (isDecimalType) {
        valueStr = DoubleStringConverter.FORMAT.format(value);
    } else {
        valueStr = AttributeUtils.print(value, timeFormat, timeZone);
    }
    textField.setBorder(originalBorder);
    textField.setEditable(true);
    textField.setText(valueStr);
    return textField;
}
Also used : TimeFormat(org.gephi.graph.api.TimeFormat) IntervalSet(org.gephi.graph.api.types.IntervalSet) TimestampSet(org.gephi.graph.api.types.TimestampSet) DateTimeZone(org.joda.time.DateTimeZone)

Example 4 with TimeFormat

use of org.gephi.graph.api.TimeFormat in project gephi by gephi.

the class DynamicSettingsPanel method setup.

public void setup(DynamicStatistics dynamicStatistics) {
    GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
    GraphModel graphModel = graphController.getGraphModel();
    TimeFormat timeFormat = graphModel.getTimeFormat();
    //Bounds
    GraphView currentView = graphModel.getVisibleView();
    if (currentView.isMainView()) {
        bounds = graphModel.getTimeBounds();
    } else {
        bounds = currentView.getTimeInterval();
    }
    String boundsStr = timeFormat.print(bounds.getLow()) + " - " + timeFormat.print(bounds.getHigh());
    currentIntervalLabel.setText(boundsStr);
    //TimeUnit
    if (timeFormat.equals(TimeFormat.DOUBLE)) {
        windowTimeUnitCombo.setVisible(false);
        tickTimeUnitCombo.setVisible(false);
    }
    //Set latest selected item
    if (!timeFormat.equals(TimeFormat.DOUBLE)) {
        loadDefaultTimeUnits();
    }
    //Window and tick
    double initValue = 0.;
    if (bounds.getHigh() - bounds.getLow() > 1) {
        initValue = 1.;
    }
    if (timeFormat.equals(TimeFormat.DOUBLE)) {
        windowTextField.setText(initValue + "");
        tickTextField.setText(initValue + "");
    } else {
        windowTextField.setText("" + windowTimeUnit.convert((long) initValue, TimeUnit.MILLISECONDS));
        tickTextField.setText("" + tickTimeUnit.convert((long) initValue, TimeUnit.MILLISECONDS));
    }
    //Add listeners
    windowTimeUnitCombo.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getItem() != windowTimeUnitCombo.getSelectedItem()) {
                refreshWindowTimeUnit();
            }
        }
    });
    tickTimeUnitCombo.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getItem() != tickTimeUnitCombo.getSelectedItem()) {
                refreshTickTimeUnit();
            }
        }
    });
}
Also used : TimeFormat(org.gephi.graph.api.TimeFormat) ItemEvent(java.awt.event.ItemEvent) GraphModel(org.gephi.graph.api.GraphModel) ItemListener(java.awt.event.ItemListener) GraphView(org.gephi.graph.api.GraphView) GraphController(org.gephi.graph.api.GraphController)

Example 5 with TimeFormat

use of org.gephi.graph.api.TimeFormat in project gephi by gephi.

the class TimeFormatDialog method setup.

public void setup(TimelineModel model) {
    this.timelineController = Lookup.getDefault().lookup(TimelineController.class);
    TimeFormat timeFormat = model.getTimeFormat();
    switch(timeFormat) {
        case DATE:
            dateRadio.setSelected(true);
            break;
        case DATETIME:
            dateTimeRadio.setSelected(true);
            break;
        case DOUBLE:
            numericRadio.setSelected(true);
            break;
    }
}
Also used : TimeFormat(org.gephi.graph.api.TimeFormat) TimelineController(org.gephi.timeline.api.TimelineController)

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