use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class FieldConfigColourMap method colourMapUpdated.
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.colourmap.ColourMapModelUpdateInterface#colourMapUpdated()
*/
@Override
public void colourMapUpdated() {
ColorMap colourMap = model.getColourMap();
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, colourMap));
oldValueObj = colourMap;
valueUpdated();
}
use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class FieldConfigColour method setTestValue.
/**
* Sets the test value.
*
* @param fieldId the field id
* @param testValue the test value
*/
@Override
public void setTestValue(FieldIdEnum fieldId, String testValue) {
if (colourButton != null) {
colourButton.populate(testValue, null);
Color value = ColourUtils.toColour(testValue);
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, value));
oldValueObj = value;
valueUpdated();
}
}
use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class FieldConfigDSProperties method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
final UndoActionInterface parentObj = this;
int xPos = getXPos();
comboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, isValueOnly() ? BasePanel.WIDGET_EXTENDED_WIDTH : BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
fieldPanel.add(comboBox);
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (isAttributeComboBoxPopulated()) {
if (comboBox.getSelectedItem() != null) {
String newValueObj = new String((String) comboBox.getSelectedItem());
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
oldValueObj = new String(newValueObj);
valueUpdated();
}
}
}
});
}
use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class FieldConfigEnum method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (comboBox == null) {
final UndoActionInterface parentObj = this;
List<ValueComboBoxData> dataList = new ArrayList<ValueComboBoxData>();
for (String key : keyList) {
dataList.add(new ValueComboBoxData(key, valueMap.get(key), getPanelId()));
}
if (!dataList.isEmpty()) {
defaultValue = dataList.get(0).getKey();
}
int xPos = getXPos();
comboBox = new ValueComboBox();
comboBox.initialiseSingle(dataList);
comboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, isValueOnly() ? BasePanel.WIDGET_EXTENDED_WIDTH : BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
fieldPanel.add(comboBox);
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(String.class, this, isRasterSymbol()));
}
if (dataList != null) {
for (ValueComboBoxData data : dataList) {
this.comboDataMap.put(data.getKey(), data);
}
}
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ValueComboBox comboBox = (ValueComboBox) e.getSource();
if (comboBox.getSelectedItem() != null) {
Object newValueObj = comboBox.getSelectedValue().getKey();
if ((oldValueObj == null) && comboBox.getItemCount() > 0) {
oldValueObj = comboBox.getFirstItem().getKey();
}
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
oldValueObj = newValueObj;
valueUpdated();
}
}
});
}
}
use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class FieldConfigGeometry method populateField.
/**
* Populate field.
*
* @param value the value
*/
@Override
public void populateField(String value) {
if (textField != null) {
textField.setText(value);
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, value));
oldValueObj = value;
valueUpdated();
}
}
Aggregations