use of com.sldeditor.ui.widgets.ValueComboBox in project sldeditor by robward-scisys.
the class ColourRampConfigPanel method createTopPanel.
/**
* Creates the top panel.
*/
private void createTopPanel() {
JPanel topPanel = new JPanel();
topPanel.setLayout(null);
topPanel.setPreferredSize(new Dimension(BasePanel.FIELD_PANEL_WIDTH, BasePanel.WIDGET_HEIGHT));
add(topPanel, BorderLayout.NORTH);
List<ValueComboBoxData> dataList = new ArrayList<ValueComboBoxData>();
if (colourRampMap != null) {
for (ColourRampPanelInterface data : colourRampMap.keySet()) {
Class<?> panel = null;
if (data.getPanel() != null) {
panel = data.getPanel().getClass();
}
String key = data.getTitle();
ValueComboBoxData valueData = new ValueComboBoxData(key, data.getTitle(), panel);
dataList.add(valueData);
colourRampMapCache.put(key, data);
}
}
typeComboBox = new ValueComboBox();
typeComboBox.initialiseSingle(dataList);
typeComboBox.setBounds(BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_EXTENDED_WIDTH, BasePanel.WIDGET_HEIGHT);
topPanel.add(typeComboBox);
typeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
typeChanged(typeComboBox.getSelectedValue());
}
});
}
use of com.sldeditor.ui.widgets.ValueComboBox in project sldeditor by robward-scisys.
the class MultiOptionGroup method createUI.
/**
* Creates the ui.
*
* @param fieldConfigManager the field config manager
* @param box the box
* @param parent the parent
* @param panelId the panel id
*/
public void createUI(GraphicPanelFieldManager fieldConfigManager, Box box, UpdateSymbolInterface parent, Class<?> panelId) {
final UndoActionInterface parentObj = this;
this.fieldConfigManager = fieldConfigManager;
this.parentBox = box;
this.parent = parent;
this.panelId = panelId;
int x = 2;
box.add(GroupConfig.createSeparator());
fieldPanel = new FieldPanel(0, "", BasePanel.WIDGET_HEIGHT * 2, false, null);
// Set up title
if (isOptional()) {
groupTitleCheckbox = new JCheckBox(getLabel());
groupTitleCheckbox.setBounds(x, 0, BasePanel.WIDGET_EXTENDED_WIDTH, BasePanel.WIDGET_HEIGHT);
groupTitleCheckbox.setOpaque(true);
fieldPanel.add(groupTitleCheckbox);
multiOptionGroupEnabled = false;
groupTitleCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
enable(groupTitleCheckbox.isSelected());
if (parent != null) {
if (!Controller.getInstance().isPopulating()) {
parent.dataChanged(FieldIdEnum.UNKNOWN);
}
}
}
});
} else {
JLabel groupTitle = new JLabel(getLabel());
groupTitle.setBounds(x, 0, BasePanel.WIDGET_EXTENDED_WIDTH, BasePanel.WIDGET_HEIGHT);
groupTitle.setOpaque(true);
fieldPanel.add(groupTitle);
}
// Set up options in the drop down
List<ValueComboBoxData> valueComboDataMap = new ArrayList<ValueComboBoxData>();
for (OptionGroup optionGroup : optionList) {
valueComboDataMap.add(new ValueComboBoxData(optionGroup.getId().toString(), optionGroup.getLabel(), panelId));
}
comboBox = new ValueComboBox();
comboBox.initialiseSingle(valueComboDataMap);
comboBox.setBounds(BasePanel.WIDGET_X_START, BasePanel.WIDGET_HEIGHT, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(comboBox);
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
optionSelected(parentBox, fieldConfigManager, fieldPanel, parentObj);
if (parent != null) {
if (!Controller.getInstance().isPopulating()) {
parent.dataChanged(FieldIdEnum.UNKNOWN);
}
}
}
});
box.add(fieldPanel);
}
use of com.sldeditor.ui.widgets.ValueComboBox in project sldeditor by robward-scisys.
the class FieldConfigBoundingBox method createCRSList.
/**
* Creates the crs list.
*
* @param label the label
* @param xPos the x pos
* @param fieldPanel the field panel
* @param row the row
* @return the value combo box
*/
private ValueComboBox createCRSList(String label, int xPos, FieldPanel fieldPanel, int row) {
JLabel lbl = new JLabel(label);
lbl.setHorizontalAlignment(SwingConstants.TRAILING);
lbl.setBounds(xPos, getRowY(row), BasePanel.LABEL_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(lbl);
// Populate data list
List<ValueComboBoxData> crsDataList = CoordManager.getInstance().getCRSList();
crsComboBox = new ValueComboBox();
crsComboBox.initialiseSingle(crsDataList);
crsComboBox.setBounds(xPos + BasePanel.WIDGET_X_START, getRowY(row), this.isValueOnly() ? BasePanel.WIDGET_EXTENDED_WIDTH : BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(crsComboBox);
crsComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
valueUpdated();
}
});
return crsComboBox;
}
use of com.sldeditor.ui.widgets.ValueComboBox in project sldeditor by robward-scisys.
the class FieldConfigFont 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;
populateFontFamilyList();
if (!fontFamilyList.isEmpty()) {
defaultValue = fontFamilyList.get(0).getKey();
}
comboBox = new ValueComboBox();
comboBox.initialiseSingle(fontFamilyList);
int xPos = getXPos();
comboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
fieldPanel.add(comboBox);
comboBox.setSelectValueKey(defaultValue);
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();
}
}
});
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Font.class, this, isRasterSymbol()));
}
}
}
use of com.sldeditor.ui.widgets.ValueComboBox 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;
}
Aggregations