Skip to content

Commit 2af7dfe

Browse files
committed
Add property to configure the 'not_enabled' css styling for widgets
1 parent 70db1cf commit 2af7dfe

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class JFXPreferences
2424
@Preference public static int tooltip_display_sec;
2525
/** make the transparent parts of symbols clickable */
2626
@Preference public static boolean pick_on_bounds;
27+
/** Override the default 'not_enabled' css style */
28+
@Preference public static String not_enabled_style;
2729

2830
static
2931
{

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty;
2828
import org.csstudio.display.builder.representation.WidgetRepresentation;
2929
import org.csstudio.display.builder.representation.javafx.Cursors;
30+
import org.csstudio.display.builder.representation.javafx.JFXPreferences;
3031
import org.csstudio.display.builder.representation.javafx.JFXRepresentation;
3132

3233
import javafx.collections.ObservableList;
@@ -371,10 +372,15 @@ public void updateOrder()
371372
public void setDisabledLook(Boolean enabled, ObservableList<Node> children) {
372373
if (!toolkit.isEditMode()) {
373374
jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
374-
if (children != null) {
375+
if (children != null && !enabled) {
375376
for (Node node : children)
376377
{
377-
Styles.update(node, Styles.NOT_ENABLED, !enabled);
378+
if (!JFXPreferences.not_enabled_style.equals(""))
379+
// Apply users 'not enabled' style
380+
node.setStyle(node.getStyle()+" "+JFXPreferences.not_enabled_style);
381+
else
382+
// Apply default 'not_enabled' style
383+
Styles.update(node, Styles.NOT_ENABLED, !enabled);
378384
}
379385
}
380386
}

app/display/representation-javafx/src/main/resources/jfx_repr_preferences.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ tooltip_display_sec=30
2222
# of the symbol widget. If false, interaction is
2323
# limited to the visible area of the element.
2424
pick_on_bounds=false
25+
26+
# User can set the disabled/not_enabled css styling. Otherwise
27+
# the default will be used which sets the opacity to 0.4.
28+
# E.g. to not change the opacity set
29+
# not_enabled_style=-fx-opacity: 1.0;-fx-background-insets: 0;
30+
# -fx-color: -fx-base; -fx-focus-color: -fx-base;
31+
not_enabled_style=

0 commit comments

Comments
 (0)