use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.
the class InlineFeaturePanel method createCRSList.
/**
* Creates the crs list.
*
* @param label the label
* @param xPos the x pos
* @param parentPanel the parent panel
* @return the value combo box
*/
private ValueComboBox createCRSList(String label, int xPos, JPanel parentPanel) {
JLabel lbl = new JLabel(label);
lbl.setHorizontalAlignment(SwingConstants.TRAILING);
lbl.setBounds(xPos, 0, BasePanel.LABEL_WIDTH, BasePanel.WIDGET_HEIGHT);
parentPanel.add(lbl);
// Populate data list
List<ValueComboBoxData> crsDataList = CoordManager.getInstance().getCRSList();
crsComboBox = new ValueComboBox();
crsComboBox.initialiseSingle(crsDataList);
crsComboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_EXTENDED_WIDTH, BasePanel.WIDGET_HEIGHT);
parentPanel.add(crsComboBox);
crsComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!isPopulating()) {
model.updateCRS(crsComboBox.getSelectedValue());
}
}
});
return crsComboBox;
}
use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.
the class FieldConfigEnum method undoAction.
/**
* Undo action.
*
* @param undoRedoObject the undo redo object
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.undo.UndoActionInterface#undoAction(com.sldeditor.undo.UndoInterface)
*/
@Override
public void undoAction(UndoInterface undoRedoObject) {
if ((comboBox != null) && (undoRedoObject != null)) {
if (undoRedoObject.getOldValue() instanceof String) {
String oldValue = (String) undoRedoObject.getOldValue();
ValueComboBoxData valueComboBoxData = comboDataMap.get(oldValue);
if (valueComboBoxData != null) {
comboBox.setSelectedItem(valueComboBoxData);
}
}
}
}
use of com.sldeditor.ui.widgets.ValueComboBoxData 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.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.
the class FieldConfigMarker method accept.
/**
* Accept.
*
* @param symbol the symbol
* @return true, if successful
*/
@Override
public boolean accept(GraphicalSymbol symbol) {
if (symbol != null) {
if (symbol instanceof MarkImpl) {
MarkImpl marker = (MarkImpl) symbol;
Expression expression = marker.getWellKnownName();
if (expression instanceof LiteralExpressionImpl) {
LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;
Object value = lExpression.getValue();
if (value instanceof String) {
String valueString = (String) value;
List<ValueComboBoxData> localSymbolList = getLocalSymbolList();
if (localSymbolList != null) {
for (ValueComboBoxData data : localSymbolList) {
if (data.getKey().compareTo(valueString) == 0) {
return true;
}
}
}
}
}
}
}
return false;
}
use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.
the class VOGeoServerLabelling method internal_updateSymbolEnumField.
/**
* Internal_update symbol enum field.
*
* @param options the options
* @param field the field
* @param key the key
*/
private void internal_updateSymbolEnumField(Map<String, String> options, FieldIdEnum field, String key) {
ValueComboBoxData value = fieldConfigVisitor.getComboBox(field);
Object object = getDefaultFieldValue(field);
String defaultValue = null;
if (object instanceof TextSymbolizer.PolygonAlignOptions) {
TextSymbolizer.PolygonAlignOptions option = (PolygonAlignOptions) object;
defaultValue = option.toString();
} else {
defaultValue = (String) object;
}
if (defaultValue == null) {
ConsoleManager.getInstance().error(this, "Failed to find default for field : " + field);
} else if ((value.getKey().compareToIgnoreCase(defaultValue) != 0) || includeValue(field)) {
options.put(key, value.getKey());
}
}
Aggregations