Skip to content

Commit 1f00ba7

Browse files
committed
Resolve merge conflict
2 parents 90e116e + d762969 commit 1f00ba7

File tree

85 files changed

+2368
-2478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2368
-2478
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
@@ -22,6 +22,8 @@ public class JFXPreferences
2222
@Preference public static int tooltip_delay_ms;
2323
/** Tooltip duration */
2424
@Preference public static int tooltip_display_sec;
25+
/** make the transparent parts of symbols clickable */
26+
@Preference public static boolean pick_on_bounds;
2527

2628
static
2729
{

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,14 +658,19 @@ private ArchivedStatus getFromArchiver(String pvName) {
658658
}
659659
// Prepend "archiver://"
660660
pvName = "archive://" + pvName + "(" + TimestampFormats.SECONDS_FORMAT.format(Instant.now()) + ")";
661+
PV pv = null;
661662
try {
662-
PV pv = PVPool.getPV(pvName);
663+
pv = PVPool.getPV(pvName);
663664
VType pvValue = pv.read();
664-
PVPool.releasePV(pv);
665665
return pvValue == null ? ArchivedStatus.NO : ArchivedStatus.YES;
666666
} catch (Exception e) {
667667
return ArchivedStatus.UNKNOWN;
668668
}
669+
finally {
670+
if(pv != null){
671+
PVPool.releasePV(pv);
672+
}
673+
}
669674
}
670675

671676
private enum ArchivedStatus {

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
}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class BoolButtonRepresentation extends RegionBaseRepresentation<Pane, Boo
8383
private volatile String value_label;
8484
private volatile ImageView[] state_images;
8585
private volatile ImageView value_image;
86+
protected volatile boolean enabled = true;
8687

8788
private final UntypedWidgetPropertyListener imagesChangedListener = this::imagesChanged;
8889
private final UntypedWidgetPropertyListener representationChangedListener = this::representationChanged;
@@ -138,8 +139,10 @@ protected void attachTooltip()
138139
*/
139140
private void handlePress(final boolean pressed)
140141
{
141-
logger.log(Level.FINE, "{0} pressed", model_widget);
142-
Platform.runLater(() -> confirm(pressed));
142+
if (enabled) {
143+
logger.log(Level.FINE, "{0} pressed", model_widget);
144+
Platform.runLater(() -> confirm(pressed));
145+
}
143146
}
144147

145148
/** Check for confirmation, then perform the button action
@@ -403,10 +406,9 @@ public void updateChanges()
403406
}
404407
if (dirty_enablement.checkAndClear())
405408
{
406-
final boolean enabled = model_widget.propEnabled().getValue() &&
409+
enabled = model_widget.propEnabled().getValue() &&
407410
model_widget.runtimePropPVWritable().getValue();
408-
button.setDisable(! enabled);
409-
Styles.update(button, Styles.NOT_ENABLED, !enabled);
411+
setDisabledLook(enabled, jfx_node.getChildren());
410412
}
411413
if (update_value)
412414
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void updateChanges()
229229
// Just apply a style that matches the disabled look.
230230
enabled = model_widget.propEnabled().getValue() &&
231231
model_widget.runtimePropPVWritable().getValue();
232-
Styles.update(jfx_node, Styles.NOT_ENABLED, !enabled);
232+
setDisabledLook(enabled, jfx_node.getChildrenUnmodifiable());
233233
if (model_widget.propAutoSize().getValue())
234234
sizeChanged(null, null, null);
235235
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ private void selectionChanged(final ObservableValue<? extends Toggle> obs, final
181181
{
182182
active = false;
183183
}
184+
}
185+
else if (!enabled && newval == null)
186+
{
187+
// If the choice button is not enabled (no write allowed)
188+
// we still have to ensure the 'oldval' stays selected
189+
// as otherwise clicking on the same value will set an
190+
// unselected look on the ChoiceButton.
191+
toggle.selectToggle(oldval);
184192
}
185193
}
186194

@@ -332,8 +340,7 @@ public void updateChanges()
332340
// Just apply a style that matches the disabled look.
333341
enabled = model_widget.propEnabled().getValue() &&
334342
model_widget.runtimePropPVWritable().getValue();
335-
Styles.update(jfx_node, Styles.NOT_ENABLED, !enabled);
336-
jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
343+
setDisabledLook(enabled, jfx_node.getChildren());
337344
for (Node node : jfx_node.getChildren())
338345
{
339346
final ButtonBase b = (ButtonBase) node;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ public void updateChanges()
296296
// and the cursor will be ignored
297297
// jfx_node.setDisable(! enabled);
298298
// So keep enabled, but indicate that trying to operate the widget is futile
299-
Styles.update(jfx_node, Styles.NOT_ENABLED, !enabled);
300-
jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
299+
setDisabledLook(enabled, jfx_node.getChildrenUnmodifiable());
301300
if (model_widget.propEditable().getValue())
302301
{
303302
jfx_node.getEditor().setEditable(enabled ? model_widget.propEditable().getValue() : false);

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@
2626
import org.csstudio.display.builder.model.widgets.TabsWidget;
2727
import org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty;
2828
import org.csstudio.display.builder.representation.WidgetRepresentation;
29+
import org.csstudio.display.builder.representation.javafx.Cursors;
2930
import org.csstudio.display.builder.representation.javafx.JFXRepresentation;
3031

3132
import javafx.collections.ObservableList;
3233
import javafx.event.EventHandler;
34+
import javafx.scene.Cursor;
3335
import javafx.scene.Node;
3436
import javafx.scene.Parent;
3537
import org.phoebus.core.types.ProcessVariable;
3638
import org.phoebus.ui.dnd.DataFormats;
39+
import org.phoebus.ui.javafx.Styles;
3740

3841
/** Base class for all JavaFX widget representations
3942
* @param <JFX> JFX Widget
@@ -356,4 +359,22 @@ public void updateOrder()
356359
addToParent(parent);
357360
}
358361
}
362+
363+
/**
364+
* We do not want to disable widgets if they cannot be written to as this
365+
* removes the context menu. Instead we replicate the disabled look from Java FX
366+
* and set the cursor to the 'NO_WRITE' cursor to indicate this.
367+
*
368+
* @param enabled boolean as to whether widget interaction is allowed
369+
* @param children list of children nodes under the parent widget
370+
*/
371+
public void setDisabledLook(Boolean enabled, ObservableList<Node> children) {
372+
jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
373+
if (children != null) {
374+
for (Node node : children)
375+
{
376+
Styles.update(node, Styles.NOT_ENABLED, !enabled);
377+
}
378+
}
379+
}
359380
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public void updateChanges()
299299
// Just apply a style that matches the disabled look.
300300
enabled = model_widget.propEnabled().getValue() &&
301301
model_widget.runtimePropPVWritable().getValue();
302-
Styles.update(jfx_node, Styles.NOT_ENABLED, !enabled);
302+
setDisabledLook(enabled, jfx_node.getChildren());
303303
for (Node rb_node : jfx_node.getChildren())
304304
{
305305
final RadioButton rb = (RadioButton) rb_node;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,11 @@ private void valueChanged(final WidgetProperty<? extends VType> property, final
407407
public void updateChanges()
408408
{
409409
super.updateChanges();
410-
if (dirty_enablement.checkAndClear())
410+
if (dirty_enablement.checkAndClear()) {
411411
slider.setDisable(!enabled);
412+
setDisabledLook(enabled, jfx_node.getChildrenUnmodifiable());
413+
}
414+
412415
if (dirty_layout.checkAndClear())
413416
{
414417
final boolean horizontal = model_widget.propHorizontal().getValue();

0 commit comments

Comments
 (0)