Search in sources :

Example 1 with ValueComboBox

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());
        }
    });
}
Also used : JPanel(javax.swing.JPanel) ValueComboBox(com.sldeditor.ui.widgets.ValueComboBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) Dimension(java.awt.Dimension) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 2 with ValueComboBox

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);
}
Also used : ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) UndoActionInterface(com.sldeditor.common.undo.UndoActionInterface) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) ValueComboBox(com.sldeditor.ui.widgets.ValueComboBox) FieldPanel(com.sldeditor.ui.widgets.FieldPanel)

Example 3 with ValueComboBox

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;
}
Also used : ValueComboBox(com.sldeditor.ui.widgets.ValueComboBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 4 with ValueComboBox

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()));
        }
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent) ValueComboBox(com.sldeditor.ui.widgets.ValueComboBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) FieldPanel(com.sldeditor.ui.widgets.FieldPanel) UndoActionInterface(com.sldeditor.common.undo.UndoActionInterface) Font(org.geotools.styling.Font)

Example 5 with ValueComboBox

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;
}
Also used : ValueComboBox(com.sldeditor.ui.widgets.ValueComboBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Aggregations

ValueComboBox (com.sldeditor.ui.widgets.ValueComboBox)8 ActionEvent (java.awt.event.ActionEvent)8 ActionListener (java.awt.event.ActionListener)8 ValueComboBoxData (com.sldeditor.ui.widgets.ValueComboBoxData)7 UndoActionInterface (com.sldeditor.common.undo.UndoActionInterface)4 ArrayList (java.util.ArrayList)4 JLabel (javax.swing.JLabel)4 UndoEvent (com.sldeditor.common.undo.UndoEvent)3 FieldPanel (com.sldeditor.ui.widgets.FieldPanel)3 Dimension (java.awt.Dimension)3 JPanel (javax.swing.JPanel)3 JCheckBox (javax.swing.JCheckBox)2 FieldConfigInteger (com.sldeditor.ui.detail.config.FieldConfigInteger)1 BorderLayout (java.awt.BorderLayout)1 JScrollPane (javax.swing.JScrollPane)1 JTextArea (javax.swing.JTextArea)1 Font (org.geotools.styling.Font)1