Search in sources :

Example 21 with FieldPanel

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

the class FieldConfigFilename method createUI.

/**
 * Creates the ui.
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
     */
@Override
public void createUI() {
    if (externalGraphicPanel == null) {
        FieldPanel fieldPanel = createFieldPanel(0, "");
        fieldPanel.setLayout(new BorderLayout());
        externalGraphicPanel = new ExternalGraphicDetails(this);
        fieldPanel.add(externalGraphicPanel, BorderLayout.CENTER);
        Dimension panelSize = externalGraphicPanel.getPanelSize();
        fieldPanel.setPreferredSize(panelSize);
    }
}
Also used : BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension) FieldPanel(com.sldeditor.ui.widgets.FieldPanel)

Example 22 with FieldPanel

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

the class MultiOptionGroup method populateOptionGroup.

/**
 * Populate option group.
 *
 * @param fieldConfigManager the field config manager
 * @param optionBox the option box
 * @param groupConfigList the group config list
 */
private void populateOptionGroup(GraphicPanelFieldManager fieldConfigManager, Box optionBox, List<GroupConfigInterface> groupConfigList) {
    for (GroupConfigInterface groupConfigI : groupConfigList) {
        groupConfigI.createTitle(optionBox, null);
        if (groupConfigI instanceof GroupConfig) {
            GroupConfig groupConfig = (GroupConfig) groupConfigI;
            for (FieldConfigBase field : groupConfig.getFieldConfigList()) {
                field.createUI();
                field.revertToDefaultValue();
                FieldPanel component = field.getPanel();
                optionBox.add(component);
                fieldConfigManager.addField(field);
                optionFieldList.add(field);
                if (field instanceof FieldConfigVendorOption) {
                    ((FieldConfigVendorOption) field).addToOptionBox(optionBox);
                }
            }
            populateOptionGroup(fieldConfigManager, optionBox, groupConfig.getSubGroupList());
        } else if (groupConfigI instanceof MultiOptionGroup) {
            MultiOptionGroup multiOptionGroupConfig = (MultiOptionGroup) groupConfigI;
            fieldConfigManager.addMultiOptionGroup(multiOptionGroupConfig);
            multiOptionGroupConfig.createUI(fieldConfigManager, optionBox, parent, this.panelId);
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigVendorOption(com.sldeditor.ui.detail.config.FieldConfigVendorOption) FieldPanel(com.sldeditor.ui.widgets.FieldPanel)

Example 23 with FieldPanel

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

the class FieldConfigRange method createUI.

/**
 * Creates the ui.
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
     */
@Override
public void createUI() {
    if (startRange.spinner == null) {
        int xPos = getXPos();
        FieldPanel fieldPanel = createFieldPanel(xPos, "");
        createRow(fieldPanel, xPos, 0, startRange, Localisation.getField(FieldConfigBase.class, "FieldConfigRange.minValue"));
        createRow(fieldPanel, xPos, BasePanel.WIDGET_HEIGHT, endRange, Localisation.getField(FieldConfigBase.class, "FieldConfigRange.maxValue"));
        Dimension preferredSize = new Dimension((int) fieldPanel.getPreferredSize().getWidth(), endRange.spinner.getY() + endRange.spinner.getHeight());
        fieldPanel.setPreferredSize(preferredSize);
        revertToDefaultValue();
    }
}
Also used : Dimension(java.awt.Dimension) FieldPanel(com.sldeditor.ui.widgets.FieldPanel)

Example 24 with FieldPanel

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

the class FieldConfigSlider method createUI.

/**
 * Creates the ui.
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
     */
@Override
public void createUI() {
    if (slider == null) {
        final UndoActionInterface parentObj = this;
        int xPos = getXPos();
        FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
        slider = new JSlider();
        slider.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
        fieldPanel.add(slider);
        slider.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                JSlider source = (JSlider) e.getSource();
                Integer newValueObj = (int) source.getValue();
                UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
                oldValueObj = newValueObj;
                valueUpdated();
            }
        });
        if (!isValueOnly()) {
            setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Double.class, this, isRasterSymbol()));
        }
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent) ChangeEvent(javax.swing.event.ChangeEvent) JSlider(javax.swing.JSlider) ChangeListener(javax.swing.event.ChangeListener) FieldPanel(com.sldeditor.ui.widgets.FieldPanel) UndoActionInterface(com.sldeditor.common.undo.UndoActionInterface)

Example 25 with FieldPanel

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

the class FieldConfigDate method createUI.

/**
 * Creates the ui.
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
     */
@Override
public void createUI() {
    if (datePicker == null) {
        int xPos = getXPos();
        FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
        JDatePanelImpl datePanel = new JDatePanelImpl(dateModel);
        datePicker = new JDatePickerImpl(datePanel);
        datePicker.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
        fieldPanel.add(datePicker);
        dateModel.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                valueUpdated();
            }
        });
        // Time picker
        SpinnerDateModel model = new SpinnerDateModel();
        Calendar calendar = Calendar.getInstance();
        model.setValue(calendar.getTime());
        timePicker = new JSpinner(model);
        timePicker.setBounds(datePicker.getX() + datePicker.getWidth() + 10, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
        timePicker.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                valueUpdated();
            }
        });
        fieldPanel.add(timePicker);
        timeEditor = new JSpinner.DateEditor(timePicker, "HH:mm:ss");
        timePicker.setEditor(timeEditor);
        DateFormatter formatter = (DateFormatter) timeEditor.getTextField().getFormatter();
        formatter.setAllowsInvalid(false);
        formatter.setOverwriteMode(true);
        if (!isValueOnly()) {
            setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Double.class, this, isRasterSymbol()));
        }
    }
}
Also used : Calendar(java.util.Calendar) JDatePanelImpl(net.sourceforge.jdatepicker.impl.JDatePanelImpl) SpinnerDateModel(javax.swing.SpinnerDateModel) JDatePickerImpl(net.sourceforge.jdatepicker.impl.JDatePickerImpl) ChangeEvent(javax.swing.event.ChangeEvent) DateFormatter(javax.swing.text.DateFormatter) JSpinner(javax.swing.JSpinner) ChangeListener(javax.swing.event.ChangeListener) FieldPanel(com.sldeditor.ui.widgets.FieldPanel)

Aggregations

FieldPanel (com.sldeditor.ui.widgets.FieldPanel)31 UndoActionInterface (com.sldeditor.common.undo.UndoActionInterface)13 UndoEvent (com.sldeditor.common.undo.UndoEvent)12 ActionEvent (java.awt.event.ActionEvent)12 ActionListener (java.awt.event.ActionListener)12 Dimension (java.awt.Dimension)9 BorderLayout (java.awt.BorderLayout)6 JButton (javax.swing.JButton)6 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)3 ValueComboBox (com.sldeditor.ui.widgets.ValueComboBox)3 ValueComboBoxData (com.sldeditor.ui.widgets.ValueComboBoxData)3 ArrayList (java.util.ArrayList)3 JScrollPane (javax.swing.JScrollPane)3 ColourRampConfigPanel (com.sldeditor.colourramp.ColourRampConfigPanel)2 SpinnerNotifyInterface (com.sldeditor.ui.iface.SpinnerNotifyInterface)2 Geometry (com.vividsolutions.jts.geom.Geometry)2 JCheckBox (javax.swing.JCheckBox)2 JPanel (javax.swing.JPanel)2 JTextArea (javax.swing.JTextArea)2 ChangeEvent (javax.swing.event.ChangeEvent)2