use of com.sldeditor.ui.widgets.IntegerSpinner in project sldeditor by robward-scisys.
the class FieldConfigInteger method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (spinner == null) {
final UndoActionInterface parentObj = this;
int xPos = getXPos();
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
spinner = new IntegerSpinner(minValue, maxValue, stepSize);
spinner.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(spinner);
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Double.class, this, isRasterSymbol()));
}
spinner.registerObserver(new SpinnerNotifyInterface() {
@Override
public void notify(double oldValue, double newValue) {
Integer oldValueObj = Double.valueOf(oldValue).intValue();
Integer newValueObj = Double.valueOf(newValue).intValue();
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
valueUpdated();
}
});
}
}
Aggregations