Search in sources :

Example 16 with ValueComboBoxData

use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.

the class VOGeoServerFTSComposite method updateSymbol.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
     * styling.FeatureTypeStyle)
     */
@Override
public void updateSymbol(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_COMPOSITE);
    if (groupPanel.isPanelEnabled()) {
        ValueComboBoxData name = fieldConfigVisitor.getComboBox(FieldIdEnum.VO_FTS_COMPOSITE_OPTION);
        double opacity = fieldConfigVisitor.getDouble(FieldIdEnum.VO_FTS_COMPOSITE_OPACITY);
        StringBuilder composite = new StringBuilder();
        composite.append(name.getKey());
        if (!(Math.abs(opacity - DEFAULT_COMPOSITE_OPACITY) < 0.0001)) {
            // Don't add to string if the opacity is set to the default
            composite.append(",");
            composite.append(opacity);
        }
        options.put(FeatureTypeStyle.COMPOSITE, composite.toString());
    } else {
        options.remove(FeatureTypeStyle.COMPOSITE);
    }
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 17 with ValueComboBoxData

use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.

the class VOGeoServerFTSRuleEvaluation method updateSymbol.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
     * styling.FeatureTypeStyle)
     */
@Override
public void updateSymbol(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_RULE_EVALUATION);
    if (groupPanel.isPanelEnabled()) {
        ValueComboBoxData value = fieldConfigVisitor.getComboBox(FieldIdEnum.VO_FTS_RULE_EVALUATION_OPTION);
        options.put(FeatureTypeStyle.KEY_EVALUATION_MODE, value.getKey());
    } else {
        options.remove(FeatureTypeStyle.KEY_EVALUATION_MODE);
    }
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 18 with ValueComboBoxData

use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.

the class SLDTextArea method makeTextAreaPanel.

/**
 * Make text area panel.
 *
 * @return the j component
 */
private JPanel makeTextAreaPanel() {
    JPanel sldSourcePanel = new JPanel(false);
    sldSourcePanel.setLayout(new BorderLayout());
    List<ValueComboBoxData> dataList = new ArrayList<ValueComboBoxData>();
    dataList.add(new ValueComboBoxData(SLDOutputFormatEnum.SLD.name(), "SLD", VendorOptionManager.getInstance().getDefaultVendorOptionVersion()));
    dataList.add(new ValueComboBoxData(SLDOutputFormatEnum.YSLD.name(), "YSLD", VendorOptionManager.getInstance().getDefaultVendorOptionVersion()));
    /*
         * Code to be uncommented to used when gt-mbstyles becomes a supported module.
         * 
         * dataList.add(new ValueComboBoxData(SLDOutputFormatEnum.MAPBOX.name(), "MapBox",
         * VendorOptionManager.getInstance().getDefaultVendorOptionVersion()));
         */
    // Options panel
    JPanel optionsPanel = new JPanel();
    JLabel label = new JLabel(Localisation.getField(SLDTextArea.class, "SLDTextArea.format"));
    optionsPanel.add(label);
    comboBox = new ValueComboBox();
    comboBox.setPreferredSize(new Dimension(BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT));
    comboBox.initialiseSingle(dataList);
    comboBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            ValueComboBox comboBox = (ValueComboBox) e.getSource();
            if (comboBox.getSelectedItem() != null) {
                String name = comboBox.getSelectedValue().getKey();
                outputFormat = SLDOutputFormatEnum.valueOf(SLDOutputFormatEnum.class, name);
                outputText();
            }
        }
    });
    optionsPanel.add(comboBox);
    sldSourcePanel.add(optionsPanel, BorderLayout.NORTH);
    // Scroll pane
    JScrollPane scrollPane = new JScrollPane();
    sldSourcePanel.add(scrollPane);
    sldSourceTextArea = new JTextArea();
    scrollPane.setViewportView(sldSourceTextArea);
    sldSourceTextArea.setEditable(false);
    sldSourceTextArea.setWrapStyleWord(true);
    sldSourceTextArea.setLineWrap(true);
    sldSourcePanel.add(scrollPane, BorderLayout.CENTER);
    return sldSourcePanel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData) BorderLayout(java.awt.BorderLayout) ValueComboBox(com.sldeditor.ui.widgets.ValueComboBox) ActionListener(java.awt.event.ActionListener)

Example 19 with ValueComboBoxData

use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.

the class MenuComboBox method createMenu.

/**
 * Creates the menu.
 *
 * @param listAll the list all
 * @return the combo menu
 */
private ComboMenu createMenu(List<ValueComboBoxDataGroup> listAll) {
    ComboMenu menu = new ComboMenu("");
    if (listAll != null) {
        for (ValueComboBoxDataGroup group : listAll) {
            if (group.isSubMenu()) {
                JMenu subMenu = new JMenu(group.getGroupName());
                for (ValueComboBoxData data : group.getDataList()) {
                    if (VendorOptionManager.getInstance().isAllowed(vendorOptionVersionsList, data.getVendorOption())) {
                        ComboMenuItem menuItem = new ComboMenuItem(data);
                        subMenu.add(menuItem);
                        dataMap.put(data.getKey(), data);
                        if (firstValue == null) {
                            firstValue = data;
                        }
                    }
                }
                if (subMenu.getMenuComponentCount() > 1) {
                    menu.add(subMenu);
                }
            } else {
                for (ValueComboBoxData data : group.getDataList()) {
                    if (VendorOptionManager.getInstance().isAllowed(vendorOptionVersionsList, data.getVendorOption())) {
                        ComboMenuItem menuItem = new ComboMenuItem(data);
                        menu.add(menuItem);
                        dataMap.put(data.getKey(), data);
                        if (firstValue == null) {
                            firstValue = data;
                        }
                    }
                }
            }
        }
    }
    return menu;
}
Also used : ValueComboBoxDataGroup(com.sldeditor.ui.widgets.ValueComboBoxDataGroup) JMenu(javax.swing.JMenu) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 20 with ValueComboBoxData

use of com.sldeditor.ui.widgets.ValueComboBoxData in project sldeditor by robward-scisys.

the class MenuComboBox method main.

/**
 * The main method.
 *
 * @param args the arguments
 */
public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception evt) {
    // Do nothing
    }
    List<ValueComboBoxData> list1 = new ArrayList<ValueComboBoxData>();
    list1.add(new ValueComboBoxData("circle", "Circle", MenuComboBox.class));
    ValueComboBoxData square = new ValueComboBoxData("square", "Square", MenuComboBox.class);
    list1.add(square);
    list1.add(new ValueComboBoxData("triangle", "Triangle", MenuComboBox.class));
    List<ValueComboBoxData> list2 = new ArrayList<ValueComboBoxData>();
    list2.add(new ValueComboBoxData("shp://lArrow", "shp://lArrow", MenuComboBox.class));
    list2.add(new ValueComboBoxData("shp://star", "shp://star", MenuComboBox.class));
    list2.add(new ValueComboBoxData("shp://dot", "shp://dot", MenuComboBox.class));
    List<ValueComboBoxDataGroup> listAll = new ArrayList<ValueComboBoxDataGroup>();
    listAll.add(new ValueComboBoxDataGroup("", list1, false));
    listAll.add(new ValueComboBoxDataGroup("Shapes", list2, true));
    MenuComboBox comboMenu = new MenuComboBox(null);
    comboMenu.initialiseMenu(listAll);
    comboMenu.setSelectedData(square);
    JFrame frame = new JFrame();
    JPanel panel = new JPanel();
    panel.add(comboMenu);
    frame.getContentPane().setLayout(new FlowLayout());
    frame.getContentPane().add(panel);
    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    frame.setSize(370, 100);
    frame.setVisible(true);
}
Also used : ValueComboBoxDataGroup(com.sldeditor.ui.widgets.ValueComboBoxDataGroup) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) ArrayList(java.util.ArrayList) WindowAdapter(java.awt.event.WindowAdapter) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Aggregations

ValueComboBoxData (com.sldeditor.ui.widgets.ValueComboBoxData)39 ArrayList (java.util.ArrayList)13 ValueComboBox (com.sldeditor.ui.widgets.ValueComboBox)8 ActionEvent (java.awt.event.ActionEvent)8 ActionListener (java.awt.event.ActionListener)8 ValueComboBoxDataGroup (com.sldeditor.ui.widgets.ValueComboBoxDataGroup)7 Test (org.junit.Test)7 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)6 JPanel (javax.swing.JPanel)6 UndoEvent (com.sldeditor.common.undo.UndoEvent)5 Dimension (java.awt.Dimension)4 JLabel (javax.swing.JLabel)4 UndoActionInterface (com.sldeditor.common.undo.UndoActionInterface)3 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)3 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)3 FieldPanel (com.sldeditor.ui.widgets.FieldPanel)3 BorderLayout (java.awt.BorderLayout)3 JCheckBox (javax.swing.JCheckBox)3 Expression (org.opengis.filter.expression.Expression)3 ColourRamp (com.sldeditor.colourramp.ColourRamp)2