Search in sources :

Example 1 with TimestampSet

use of org.gephi.graph.api.types.TimestampSet 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 2 with TimestampSet

use of org.gephi.graph.api.types.TimestampSet in project gephi by gephi.

the class TimestampSetGraphicsComponentProvider method getTimeIntervalGraphicsParameters.

@Override
public TimeIntervalGraphicsParameters getTimeIntervalGraphicsParameters(TimeSet value) {
    TimestampSet timestampSet = (TimestampSet) value;
    double[] timestamps = timestampSet.toPrimitiveArray();
    double[] starts = new double[timestamps.length];
    double[] ends = new double[timestamps.length];
    for (int i = 0; i < timestamps.length; i++) {
        starts[i] = timestamps[i];
        ends[i] = timestamps[i];
    }
    return new TimeIntervalGraphicsParameters(starts, ends);
}
Also used : TimestampSet(org.gephi.graph.api.types.TimestampSet)

Example 3 with TimestampSet

use of org.gephi.graph.api.types.TimestampSet in project gephi by gephi.

the class ElementDraftImpl method addTimestamps.

@Override
public void addTimestamps(String timestamps) {
    if (!container.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) {
        String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_NotTimestampRepresentation", id);
        container.getReport().logIssue(new Issue(message, Issue.Level.SEVERE));
        return;
    }
    TimestampSet t = (TimestampSet) AttributeUtils.parse(timestamps, TimestampSet.class);
    if (timeSet == null) {
        timeSet = t;
    } else {
        for (Double d : t.toArray()) {
            timeSet.add(d);
        }
    }
}
Also used : Issue(org.gephi.io.importer.api.Issue) TimestampSet(org.gephi.graph.api.types.TimestampSet)

Example 4 with TimestampSet

use of org.gephi.graph.api.types.TimestampSet in project gephi by gephi.

the class ElementDraftImpl method addTimestamp.

@Override
public void addTimestamp(double timestamp) {
    if (!container.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) {
        String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_NotTimestampRepresentation", id);
        container.getReport().logIssue(new Issue(message, Issue.Level.SEVERE));
        return;
    }
    if (timeSet == null) {
        timeSet = new TimestampSet();
    }
    timeSet.add(timestamp);
}
Also used : Issue(org.gephi.io.importer.api.Issue) TimestampSet(org.gephi.graph.api.types.TimestampSet)

Aggregations

TimestampSet (org.gephi.graph.api.types.TimestampSet)4 Issue (org.gephi.io.importer.api.Issue)2 TimeFormat (org.gephi.graph.api.TimeFormat)1 IntervalSet (org.gephi.graph.api.types.IntervalSet)1 DateTimeZone (org.joda.time.DateTimeZone)1