public void setup(DynamicStatistics dynamicStatistics) {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getGraphModel();
AttributeModel attributeModel = graphController.getAttributeModel();
TimeFormat timeFormat = attributeModel.getTimeFormat();
//Bounds
bounds = dynamicStatistics.getBounds();
if (bounds == null) {
bounds = graphModel.getTimeBoundsVisible();
}
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));