Search in sources :

Example 1 with SetWidgetEnumPropertyAction

use of org.csstudio.display.builder.editor.undo.SetWidgetEnumPropertyAction in project org.csstudio.display.builder by kasemir.

the class EnumWidgetPropertyBinding method submit.

/**
 * Submit combo value to model
 */
private void submit() {
    final String entered = jfx_node.getValue();
    // Combo switched to editable, but user never entered anything?
    if (entered == null)
        return;
    updating = true;
    final int ordinal = jfx_node.getItems().indexOf(entered);
    final Object value = (ordinal >= 0) ? ordinal : entered;
    undo.execute(new SetWidgetEnumPropertyAction(widget_property, value));
    if (!other.isEmpty()) {
        final String path = widget_property.getPath();
        for (Widget w : other) {
            final EnumWidgetProperty<?> other_prop = (EnumWidgetProperty<?>) w.getProperty(path);
            undo.execute(new SetWidgetEnumPropertyAction(other_prop, value));
        }
    }
    updating = false;
}
Also used : SetWidgetEnumPropertyAction(org.csstudio.display.builder.editor.undo.SetWidgetEnumPropertyAction) EnumWidgetProperty(org.csstudio.display.builder.model.properties.EnumWidgetProperty) Widget(org.csstudio.display.builder.model.Widget)

Aggregations

SetWidgetEnumPropertyAction (org.csstudio.display.builder.editor.undo.SetWidgetEnumPropertyAction)1 Widget (org.csstudio.display.builder.model.Widget)1 EnumWidgetProperty (org.csstudio.display.builder.model.properties.EnumWidgetProperty)1