use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class ColourRampPanel method createFieldPanel.
/**
* Creates the field panel.
*/
private void createFieldPanel() {
JPanel tablePanel = new JPanel();
tablePanel.setLayout(new BorderLayout());
panel.add(tablePanel, BorderLayout.CENTER);
JPanel dataPanel = new JPanel();
tablePanel.add(dataPanel, BorderLayout.NORTH);
dataPanel.setLayout(new BoxLayout(dataPanel, BoxLayout.Y_AXIS));
minValueSpinner = new FieldConfigInteger(new FieldConfigCommonData(getClass(), FieldIdEnum.UNKNOWN, Localisation.getField(ColourRampConfigPanel.class, "ColourRampPanel.minValue"), true));
minValueSpinner.createUI();
FieldPanel fieldPanel = minValueSpinner.getPanel();
dataPanel.add(fieldPanel);
JButton resetValueButton = new JButton(Localisation.getString(ColourRampConfigPanel.class, "ColourRampPanel.reset"));
minValueSpinner.addUI(resetValueButton, 20, BasePanel.WIDGET_BUTTON_WIDTH, BasePanel.WIDGET_HEIGHT);
minValueSpinner.populateField(0);
resetValueButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (parentObj != null) {
ColourMapModel model = parentObj.getColourMapModel();
populate(model.getColourMap());
}
}
});
maxValueSpinner = new FieldConfigInteger(new FieldConfigCommonData(getClass(), FieldIdEnum.UNKNOWN, Localisation.getField(ColourRampConfigPanel.class, "ColourRampPanel.maxValue"), true));
maxValueSpinner.createUI();
maxValueSpinner.populateField(100);
dataPanel.add(maxValueSpinner.getPanel());
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
buttonPanel.setSize(BasePanel.FIELD_PANEL_WIDTH, BasePanel.WIDGET_HEIGHT);
JButton applyButton = new JButton(Localisation.getString(ColourRampConfigPanel.class, "common.apply"));
applyButton.setPreferredSize(new Dimension(BasePanel.WIDGET_BUTTON_WIDTH, BasePanel.WIDGET_HEIGHT));
applyButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (parentObj != null) {
ColourRampData data = new ColourRampData();
data.setMaxValue(maxValueSpinner.getIntValue());
data.setMinValue(minValueSpinner.getIntValue());
data.setReverseColours(reverseCheckbox.isSelected());
ValueComboBoxData selectedItem = (ValueComboBoxData) rampComboBox.getSelectedItem();
ColourRamp colourRamp = colourRampCache.get(selectedItem.getKey());
data.setColourRamp(colourRamp);
parentObj.colourRampUpdate(data);
}
}
});
buttonPanel.add(applyButton);
dataPanel.add(buttonPanel);
}
use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class RuleDetails method createFilter.
/**
* Creates the filter.
*
* @return the j panel
*/
private void createFilter() {
FieldIdEnum filterFieldId = FieldIdEnum.FILTER;
FieldConfigBase fieldConfig = fieldConfigManager.get(filterFieldId);
if (fieldConfig != null) {
FieldPanel fieldPanel = fieldConfig.getPanel();
JButton btnEditFilter = new JButton(Localisation.getString(RuleDetails.class, "RuleDetails.edit"));
btnEditFilter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editFilter(filterFieldId);
}
});
btnEditFilter.setBounds(WIDGET_X_START + WIDGET_EXTENDED_WIDTH, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
fieldPanel.add(btnEditFilter);
JButton btnClearFilter = new JButton(Localisation.getString(RuleDetails.class, "RuleDetails.clear"));
btnClearFilter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
clearFilter(filterFieldId);
}
});
int x = btnEditFilter.getX() + btnEditFilter.getWidth() + 5;
btnClearFilter.setBounds(x, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
fieldPanel.add(btnClearFilter);
}
}
use of com.sldeditor.ui.widgets.FieldPanel 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.FieldPanel in project sldeditor by robward-scisys.
the class FieldConfigBoolean method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (checkBox == null) {
final UndoActionInterface parentObj = this;
int xPos = getXPos();
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
checkBox = new JCheckBox("");
checkBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
fieldPanel.add(checkBox);
checkBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean isSelected = checkBox.isSelected();
Boolean oldValueObj = Boolean.valueOf(!isSelected);
Boolean newValueObj = Boolean.valueOf(isSelected);
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
valueUpdated();
}
});
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Boolean.class, this, isRasterSymbol()));
}
}
}
use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class FieldConfigBoundingBox method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (xMinTextField == null) {
int xPos = getXPos();
FieldPanel fieldPanel = createFieldPanel(xPos, "");
int row = 0;
xMinTextField = createRow(Localisation.getField(FieldConfigBase.class, "FieldConfigBoundingBox.minx"), xPos, fieldPanel, row);
xMaxTextField = createRow(Localisation.getField(FieldConfigBase.class, "FieldConfigBoundingBox.maxx"), xPos, fieldPanel, ++row);
yMinTextField = createRow(Localisation.getField(FieldConfigBase.class, "FieldConfigBoundingBox.miny"), xPos, fieldPanel, ++row);
yMaxTextField = createRow(Localisation.getField(FieldConfigBase.class, "FieldConfigBoundingBox.maxy"), xPos, fieldPanel, ++row);
crsComboBox = createCRSList(Localisation.getField(FieldConfigBase.class, "FieldConfigBoundingBox.crs"), xPos, fieldPanel, ++row);
Dimension preferredSize = new Dimension((int) fieldPanel.getPreferredSize().getWidth(), crsComboBox.getY() + crsComboBox.getHeight());
fieldPanel.setPreferredSize(preferredSize);
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Boolean.class, this, isRasterSymbol()));
}
}
}
Aggregations