Search in sources :

Example 66 with UndoEvent

use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.

the class FieldConfigDouble method createUI.

/**
 * Creates the ui.
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
     */
@Override
public void createUI() {
    if (spinner == null) {
        final UndoActionInterface parentObj = this;
        int xPos = getXPos();
        FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
        if (configurationSet) {
            spinner = new DecimalSpinner(minValue, maxValue, stepSize, noOfDecimalPlaces);
        } else {
            spinner = new DecimalSpinner();
        }
        spinner.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
        fieldPanel.add(spinner);
        if (!isValueOnly()) {
            setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Double.class, this, isRasterSymbol()));
        }
        spinner.registerObserver(new SpinnerNotifyInterface() {

            @Override
            public void notify(double oldValue, double newValue) {
                Double oldValueObj = Double.valueOf(oldValue);
                Double newValueObj = Double.valueOf(newValue);
                UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
                valueUpdated();
            }
        });
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent) SpinnerNotifyInterface(com.sldeditor.ui.iface.SpinnerNotifyInterface) DecimalSpinner(com.sldeditor.ui.widgets.DecimalSpinner) FieldPanel(com.sldeditor.ui.widgets.FieldPanel) UndoActionInterface(com.sldeditor.common.undo.UndoActionInterface)

Example 67 with UndoEvent

use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.

the class FieldConfigGeometryField method createUI.

/**
 * Creates the ui.
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
     */
@Override
public void createUI() {
    if (attributeComboBox == null) {
        final UndoActionInterface parentObj = this;
        int xPos = getXPos();
        FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
        attributeComboBox = new JComboBox<String>();
        attributeComboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
        fieldPanel.add(attributeComboBox);
        populateAttributeComboBox();
        if (!isValueOnly()) {
            setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Geometry.class, this, true));
        }
        attributeComboBox.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (isAttributeComboBoxPopulated()) {
                    String newValueObj = (String) attributeComboBox.getSelectedItem();
                    UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, "DataSourceAttribute", oldValueObj, newValueObj));
                    valueUpdated();
                }
            }
        });
    }
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) UndoEvent(com.sldeditor.common.undo.UndoEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) FieldPanel(com.sldeditor.ui.widgets.FieldPanel) UndoActionInterface(com.sldeditor.common.undo.UndoActionInterface)

Example 68 with UndoEvent

use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.

the class FieldConfigFeatureTypeConstraint method populateField.

/**
 * Populate field.
 *
 * @param valueList the value list
 */
@Override
public void populateField(List<FeatureTypeConstraint> valueList) {
    if (filterModel != null) {
        if (valueList != null) {
            filterModel.populate(valueList);
            UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, valueList));
            oldValueObj = valueList;
            valueUpdated();
        }
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent)

Example 69 with UndoEvent

use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.

the class FieldConfigFeatureTypeConstraint method featureTypeConstraintUpdated.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.featuretypeconstraint.FeatureTypeConstraintModelUpdateInterface#featureTypeConstraintUpdated()
     */
@Override
public void featureTypeConstraintUpdated() {
    List<FeatureTypeConstraint> ftc = filterModel.getFeatureTypeConstraint();
    UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, ftc));
    oldValueObj = ftc;
    valueUpdated();
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent) FeatureTypeConstraint(org.geotools.styling.FeatureTypeConstraint)

Example 70 with UndoEvent

use of com.sldeditor.common.undo.UndoEvent in project sldeditor by robward-scisys.

the class WKTDetails method buttonPressed.

/**
 * Button pressed.
 *
 * @param buttonExternal the button external
 */
@Override
public void buttonPressed(Component buttonExternal) {
    WKTDialog dlg = new WKTDialog();
    if (dlg.showDialog(fieldConfigVisitor.getText(FieldIdEnum.WKT))) {
        String wktString = dlg.getWKTString();
        fieldConfigVisitor.populateTextField(FieldIdEnum.WKT, wktString);
        UndoManager.getInstance().addUndoEvent(new UndoEvent(this, FieldIdEnum.WKT, oldValueObj, wktString));
        oldValueObj = wktString;
        EventQueue.invokeLater(new Runnable() {

            public void run() {
                updateSymbol();
            }
        });
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent)

Aggregations

UndoEvent (com.sldeditor.common.undo.UndoEvent)84 Test (org.junit.Test)27 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)20 UndoActionInterface (com.sldeditor.common.undo.UndoActionInterface)16 FieldPanel (com.sldeditor.ui.widgets.FieldPanel)12 ActionEvent (java.awt.event.ActionEvent)11 ActionListener (java.awt.event.ActionListener)11 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)11 TreePath (javax.swing.tree.TreePath)10 Geometry (com.vividsolutions.jts.geom.Geometry)9 ValueComboBoxData (com.sldeditor.ui.widgets.ValueComboBoxData)5 ArrayList (java.util.ArrayList)4 JPanel (javax.swing.JPanel)4 PolygonSymbolizer (org.geotools.styling.PolygonSymbolizer)4 RenderSymbolInterface (com.sldeditor.datasource.RenderSymbolInterface)3 ValueComboBox (com.sldeditor.ui.widgets.ValueComboBox)3 Color (java.awt.Color)3 JButton (javax.swing.JButton)3 JCheckBox (javax.swing.JCheckBox)3 LineSymbolizer (org.geotools.styling.LineSymbolizer)3