use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class FieldConfigSymbolType method optionSelected.
/**
* Symbol type menu option selected.
*
* @param selectedData the selected data
*/
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.menucombobox.ValueComboBoxDataSelectedInterface#optionSelected(com.sldeditor
* .ui.ValueComboBoxData)
*/
@Override
public void optionSelected(ValueComboBoxData selectedData) {
if (selectedData != null) {
String newValueObj = selectedData.getKey();
// Show the correct panel in the card layout for the selected symbol type
CardLayout cl = (CardLayout) (containingPanel.getLayout());
String name = selectedData.getPanelId().getName();
cl.show(containingPanel, name);
FieldConfigBase fieldConfig = fieldConfigMap.get(selectedData.getPanelId());
if (fieldConfig == null) {
ConsoleManager.getInstance().error(this, "Failed to find field config for panel id :" + selectedData.getPanelId());
} else {
fieldConfig.justSelected();
JPanel p = fieldConfig.getPanel();
Dimension preferredSize = null;
if (p.isPreferredSizeSet()) {
preferredSize = p.getPreferredSize();
} else {
preferredSize = new Dimension(BasePanel.FIELD_PANEL_WIDTH, BasePanel.WIDGET_HEIGHT);
}
containingPanel.setPreferredSize(preferredSize);
if (oldValueObj == null) {
oldValueObj = comboBox.getDefaultValue();
}
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, newValueObj));
oldValueObj = new String(newValueObj);
if (symbolSelectedListener != null) {
logger.debug(String.format("Field %s selected %s", getFieldId(), selectedData.getKey()));
symbolSelectedListener.optionSelected(selectedData.getPanelId(), selectedData.getKey());
} else {
valueUpdated();
}
}
}
}
use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class FieldConfigSortBy method populateField.
/**
* Populate field.
*
* @param value the value
*/
@Override
public void populateField(String value) {
if (sortbyPanel != null) {
sortbyPanel.setText(value);
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 FieldConfigSortBy method sortByUpdated.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.detail.config.sortby.SortByUpdateInterface#sortByUpdated(java.lang.String)
*/
@Override
public void sortByUpdated(String sortByString) {
if (!Controller.getInstance().isPopulating()) {
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, new String(sortByString)));
oldValueObj = new String(sortByString);
valueUpdated();
}
}
use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class ExternalGraphicDetails method userSelectedFileURL.
/**
* User selected file URL.
*
* @param url the url
*/
protected void userSelectedFileURL(URL url) {
if (url != null) {
externalURL = url;
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, FieldIdEnum.EXTERNAL_GRAPHIC, oldValueObj, externalURL));
oldValueObj = externalURL;
lastURLValue = RelativePath.convert(externalURL, useRelativePaths);
fieldConfigVisitor.populateTextField(FieldIdEnum.EXTERNAL_GRAPHIC, lastURLValue);
updateSymbol();
}
}
use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.
the class ExternalGraphicDetails method setValue.
/**
* Sets the value.
*
* @param externalGraphic the new value
*/
public void setValue(ExternalGraphicImpl externalGraphic) {
if (externalGraphic != null) {
try {
externalURL = externalGraphic.getLocation();
} catch (MalformedURLException e) {
ConsoleManager.getInstance().exception(this, e);
}
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, FieldIdEnum.EXTERNAL_GRAPHIC, oldValueObj, externalURL));
oldValueObj = externalURL;
String path = RelativePath.convert(externalURL, useRelativePaths);
populateExpression(path);
}
}
Aggregations