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