Search in sources :

Example 61 with UndoEvent

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

the class ExternalGraphicDetails method setValue.

/**
 * Sets the value.
 *
 * @param filename the new value
 */
public void setValue(String filename) {
    if (filename != null) {
        externalURL = parseString(filename);
        UndoManager.getInstance().addUndoEvent(new UndoEvent(this, FieldIdEnum.EXTERNAL_GRAPHIC, oldValueObj, externalURL));
        oldValueObj = externalURL;
        populateExpression(filename);
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent)

Example 62 with UndoEvent

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

the class ExternalGraphicDetails method updateSymbol.

/**
 * Update symbol.
 */
private void updateSymbol() {
    if (!Controller.getInstance().isPopulating()) {
        Expression expression = fieldConfigVisitor.getExpression(FieldIdEnum.EXTERNAL_GRAPHIC);
        if (!lastURLValue.equals(expression.toString())) {
            externalURL = parseString(expression.toString());
            lastURLValue = expression.toString();
            UndoManager.getInstance().addUndoEvent(new UndoEvent(this, FieldIdEnum.EXTERNAL_GRAPHIC, oldValueObj, externalURL));
            oldValueObj = externalURL;
        }
        if (parentObj != null) {
            parentObj.externalGraphicValueUpdated();
        }
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent) Expression(org.opengis.filter.expression.Expression)

Example 63 with UndoEvent

use of com.sldeditor.common.undo.UndoEvent 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 64 with UndoEvent

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

the class FieldConfigTimePeriod method populateField.

/**
 * Populate field.
 *
 * @param value the value
 */
@Override
public void populateField(TimePeriod value) {
    if (value != null) {
        populateDuration(start, value.getStart());
        populateDuration(end, value.getEnd());
        UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, value));
        oldValueObj = value;
        valueUpdated();
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent)

Example 65 with UndoEvent

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

the class FieldConfigDate method populateField.

/**
 * Populate field.
 *
 * @param value the value
 */
@Override
public void populateField(Date value) {
    if ((dateModel != null) && (timePicker != null) && (value != null)) {
        dateModel.setValue(value);
        timePicker.setValue(value);
        UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, value));
        oldValueObj = value;
        valueUpdated();
    }
}
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