Search in sources :

Example 1 with ColourNotifyInterface

use of com.sldeditor.ui.iface.ColourNotifyInterface in project sldeditor by robward-scisys.

the class ColourButton method notifyListeners.

/**
 * Notify listeners.
 */
public void notifyListeners() {
    String colourString = getColourString();
    double opacity = getColourOpacity();
    for (ColourNotifyInterface observer : observers) {
        observer.notify(colourString, opacity);
    }
}
Also used : ColourNotifyInterface(com.sldeditor.ui.iface.ColourNotifyInterface)

Example 2 with ColourNotifyInterface

use of com.sldeditor.ui.iface.ColourNotifyInterface in project sldeditor by robward-scisys.

the class FieldConfigColour method createUI.

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

            @Override
            public void notify(String colourString, double opacity) {
                Color newValueObj = colourButton.getColour();
                UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
                oldValueObj = newValueObj;
                valueUpdated();
            }
        });
    }
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent) Color(java.awt.Color) ColourButton(com.sldeditor.ui.widgets.ColourButton) FieldPanel(com.sldeditor.ui.widgets.FieldPanel) UndoActionInterface(com.sldeditor.common.undo.UndoActionInterface) ColourNotifyInterface(com.sldeditor.ui.iface.ColourNotifyInterface)

Aggregations

ColourNotifyInterface (com.sldeditor.ui.iface.ColourNotifyInterface)2 UndoActionInterface (com.sldeditor.common.undo.UndoActionInterface)1 UndoEvent (com.sldeditor.common.undo.UndoEvent)1 ColourButton (com.sldeditor.ui.widgets.ColourButton)1 FieldPanel (com.sldeditor.ui.widgets.FieldPanel)1 Color (java.awt.Color)1