use of com.sldeditor.common.undo.UndoActionInterface in project sldeditor by robward-scisys.
the class FieldConfigRange method createRow.
/**
* Creates the row.
*
* @param fieldPanel the field panel
* @param xPos the x pos
* @param y the y coordinate
* @param rangeConfig the range config
* @param label the label
*/
private void createRow(FieldPanel fieldPanel, int xPos, int y, RangeData rangeConfig, String label) {
final UndoActionInterface parentObj = this;
if (configurationSet) {
rangeConfig.spinner = new DecimalSpinner(rangeConfig.minValue, rangeConfig.maxValue, rangeConfig.stepSize, rangeConfig.noOfDecimalPlaces);
} else {
rangeConfig.spinner = new DecimalSpinner();
}
JLabel lbl = new JLabel(label);
lbl.setHorizontalAlignment(SwingConstants.TRAILING);
lbl.setBounds(xPos, y, BasePanel.LABEL_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(lbl);
rangeConfig.spinner.setBounds(xPos + BasePanel.WIDGET_X_START, y, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(rangeConfig.spinner);
rangeConfig.includedCheckBox = new JCheckBox(Localisation.getString(FieldConfigBase.class, "FieldConfigRange.included"));
rangeConfig.includedCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
uiInteraction(parentObj);
}
});
rangeConfig.includedCheckBox.setBounds(rangeConfig.spinner.getX() + rangeConfig.spinner.getWidth() + 5, y, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(rangeConfig.includedCheckBox);
rangeConfig.spinner.registerObserver(new SpinnerNotifyInterface() {
@Override
public void notify(double oldValue, double newValue) {
uiInteraction(parentObj);
}
});
}
use of com.sldeditor.common.undo.UndoActionInterface in project sldeditor by robward-scisys.
the class FieldConfigSlider method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (slider == null) {
final UndoActionInterface parentObj = this;
int xPos = getXPos();
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
slider = new JSlider();
slider.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(slider);
slider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider) e.getSource();
Integer newValueObj = (int) source.getValue();
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
oldValueObj = newValueObj;
valueUpdated();
}
});
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Double.class, this, isRasterSymbol()));
}
}
}
use of com.sldeditor.common.undo.UndoActionInterface in project sldeditor by robward-scisys.
the class FieldConfigDouble 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());
if (configurationSet) {
spinner = new DecimalSpinner(minValue, maxValue, stepSize, noOfDecimalPlaces);
} else {
spinner = new DecimalSpinner();
}
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) {
Double oldValueObj = Double.valueOf(oldValue);
Double newValueObj = Double.valueOf(newValue);
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
valueUpdated();
}
});
}
}
use of com.sldeditor.common.undo.UndoActionInterface in project sldeditor by robward-scisys.
the class FieldConfigGeometryField method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (attributeComboBox == null) {
final UndoActionInterface parentObj = this;
int xPos = getXPos();
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
attributeComboBox = new JComboBox<String>();
attributeComboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(attributeComboBox);
populateAttributeComboBox();
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Geometry.class, this, true));
}
attributeComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (isAttributeComboBoxPopulated()) {
String newValueObj = (String) attributeComboBox.getSelectedItem();
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, "DataSourceAttribute", oldValueObj, newValueObj));
valueUpdated();
}
}
});
}
}
Aggregations