Skip to content

Commit 3c88e1b

Browse files
committed
Update logic in ActionButton to identify when it should look disabled
This should occur when there is only a single action to write to a PV that is non-writeable. In any other case the actionbutton should be enabled to run other actions attached to it.
1 parent f0c8588 commit 3c88e1b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/ActionButtonRepresentation.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,17 @@ private ButtonBase makeBaseButton() {
166166
final Button button = new Button();
167167
button.setOnAction(event -> confirm(() -> handleActions(actions.getActions())));
168168
result = button;
169+
if (actions.getActions().size() == 1) {
170+
// If the ActionButton only has a single action and that is to
171+
// write to a PV then is_writePV should be true.
172+
// This means that if the PV is non-writable then the
173+
// ActionButton will be disabled.
174+
if (actions.getActions().get(0).getType().equals("write_pv"))
175+
is_writePV = true;
176+
}
169177
} else {
170178
// If there is at least one non-WritePVAction then is_writePV should be false
171-
is_writePV = !has_non_writePVAction;
179+
is_writePV = has_non_writePVAction;
172180

173181
final MenuButton button = new MenuButton();
174182

@@ -461,11 +469,7 @@ public void updateChanges() {
461469
// Don't disable the widget, because that would also remove the
462470
// tooltip
463471
// Just apply a style that matches the disabled look.
464-
Styles.update(base, Styles.NOT_ENABLED, !enabled);
465-
// Apply the cursor to the pane and not to the button
466-
if (!toolkit.isEditMode()) {
467-
jfx_node.setCursor(enabled ? Cursor.HAND : Cursors.NO_WRITE);
468-
}
472+
setDisabledLook(enabled, jfx_node.getChildren());
469473
}
470474
}
471475
}

0 commit comments

Comments
 (0)