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;
}
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);
}
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);
}
}
}
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);
}
Aggregations