Skip to content

Commit 7051802

Browse files
committed
Merge branch 'master' into CSSTUDIO-1582
2 parents bdda2e3 + 5dface5 commit 7051802

File tree

30 files changed

+779
-182
lines changed

30 files changed

+779
-182
lines changed

app/alarm/Readme.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ kafka in `/opt/kafka`.
2424
# that can be used with a kafka server in the same directory
2525
cd examples
2626

27-
# Use wget, 'curl -O', or web browser
28-
wget http://ftp.wayne.edu/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz
29-
tar -vzxf kafka_2.12-2.3.0.tgz
30-
ln -s kafka_2.12-2.3.0 kafka
27+
# Use wget, 'curl -O', or web browser to fetch a recent version of kafka
28+
wget https://dlcdn.apache.org/kafka/3.2.0/kafka_2.13-3.2.0.tgz
29+
tar -vzxf kafka_2.13-3.2.0.tgz
30+
ln -s kafka_2.13-3.2.0 kafka
3131

3232
Check `config/zookeeper.properties` and `config/server.properties`.
3333
By default these contain settings for keeping data in `/tmp/`, which works for initial tests,
@@ -45,11 +45,11 @@ Similarly, change the directory setting in `server.properties`
4545
log.dirs=/tmp/kafka-logs
4646

4747

48-
Kafka depends on Zookeeper. By default, Kafka will quit if it cannot connect to Zookeeper within 6 seconds.
49-
When the Linux host boots up, this may not be long enough to allow Zookeeper to start.
48+
Kafka depends on Zookeeper. Kafka will quit if it cannot connect to Zookeeper within some timeout.
49+
When the Linux host boots up, the default timeout may not be long enough to allow Zookeeper to start.
5050

51-
# Timeout in ms for connecting to zookeeper defaults to 6000ms.
52-
# Suggest a much longer time (5 minutes)
51+
# Timeout in ms for connecting to zookeeper
52+
# Suggest about 5 minutes
5353
zookeeper.connection.timeout.ms=300000
5454

5555
By default, Kafka will automatically create topics.
@@ -66,6 +66,7 @@ If the following "First steps" generate errors of the type
6666

6767
WARN Error while fetching metadata with correlation id 39 : .. LEADER_NOT_AVAILABLE
6868
or
69+
6970
ERROR ..TimeoutException: Timed out waiting for a node assignment
7071

7172
then define the host name in `config/server.properties`.

app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018-2020 Oak Ridge National Laboratory.
2+
* Copyright (c) 2018-2022 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -22,7 +22,6 @@
2222
import java.util.logging.Level;
2323
import java.util.stream.Collectors;
2424

25-
import javafx.scene.image.ImageView;
2625
import org.phoebus.applications.alarm.client.AlarmClient;
2726
import org.phoebus.applications.alarm.client.AlarmClientLeaf;
2827
import org.phoebus.applications.alarm.client.AlarmClientListener;
@@ -62,6 +61,7 @@
6261
import javafx.scene.control.Tooltip;
6362
import javafx.scene.control.TreeItem;
6463
import javafx.scene.control.TreeView;
64+
import javafx.scene.image.ImageView;
6565
import javafx.scene.input.ClipboardContent;
6666
import javafx.scene.input.Dragboard;
6767
import javafx.scene.input.TransferMode;
@@ -493,7 +493,7 @@ private void addClickSupport()
493493

494494
final AlarmTreeItem<?> item = tree_view.getSelectionModel().getSelectedItems().get(0).getValue();
495495
final ItemConfigDialog dialog = new ItemConfigDialog(model, item);
496-
DialogHelper.positionDialog(dialog, tree_view, -250, -400);
496+
DialogHelper.positionDialog(dialog, tree_view, -150, -300);
497497
// Show dialog, not waiting for it to close with OK or Cancel
498498
dialog.show();
499499
});

app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/ConfigureComponentAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018 Oak Ridge National Laboratory.
2+
* Copyright (c) 2018-2022 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -33,7 +33,7 @@ public ConfigureComponentAction(final Node node, final AlarmClient model, final
3333
setOnAction(event -> Platform.runLater(() ->
3434
{
3535
final ItemConfigDialog dialog = new ItemConfigDialog(model, item);
36-
DialogHelper.positionDialog(dialog, node, -250, -400);
36+
DialogHelper.positionDialog(dialog, node, -150, -300);
3737
// Show dialog, not waiting for it to close with OK or Cancel
3838
dialog.show();
3939
}));

app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/ItemConfigDialog.java

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import javafx.beans.value.ChangeListener;
2525
import javafx.event.ActionEvent;
2626
import javafx.event.EventHandler;
27+
import javafx.geometry.Pos;
2728
import javafx.scene.control.Button;
2829
import javafx.scene.control.ButtonType;
2930
import javafx.scene.control.CheckBox;
@@ -34,6 +35,7 @@
3435
import javafx.scene.control.Spinner;
3536
import javafx.scene.control.TextField;
3637
import javafx.scene.control.Tooltip;
38+
import javafx.scene.layout.ColumnConstraints;
3739
import javafx.scene.layout.GridPane;
3840
import javafx.scene.layout.HBox;
3941
import javafx.scene.layout.Priority;
@@ -69,6 +71,13 @@ public ItemConfigDialog(final AlarmClient model, final AlarmTreeItem<?> item)
6971
layout.setHgap(5);
7072
layout.setVgap(5);
7173

74+
// First fixed-size column for labels
75+
// Second column grows
76+
final ColumnConstraints col1 = new ColumnConstraints(190);
77+
final ColumnConstraints col2 = new ColumnConstraints();
78+
col2.setHgrow(Priority.ALWAYS);
79+
layout.getColumnConstraints().setAll(col1, col2);
80+
7281
int row = 0;
7382

7483
// Show item path, allow copying it out.
@@ -90,9 +99,10 @@ public ItemConfigDialog(final AlarmClient model, final AlarmTreeItem<?> item)
9099

91100
layout.add(new Label("Behavior:"), 0, row);
92101
enabled = new CheckBox("Enabled");
93-
enabled.setTooltip(new Tooltip("Enable alarms? See also filter expression"));
102+
enabled.setTooltip(new Tooltip("Enable alarms? See also 'Enabling Filter'"));
94103
enabled.setSelected(leaf.isEnabled());
95-
enabled.setOnAction((event) -> {
104+
enabled.setOnAction((event) ->
105+
{
96106
relative_date.getSelectionModel().clearSelection();
97107
relative_date.setValue(null);
98108
enabled_date_picker.getEditor().clear();
@@ -112,34 +122,41 @@ public ItemConfigDialog(final AlarmClient model, final AlarmTreeItem<?> item)
112122

113123
layout.add(new Label("Disable until:"), 0, row);
114124
enabled_date_picker = new DateTimePicker();
125+
enabled_date_picker.setTooltip(new Tooltip("Select a date until which the alarm should be disabled"));
115126
enabled_date_picker.setDateTimeValue(leaf.getEnabledDate());
127+
enabled_date_picker.setPrefSize(280, 25);
128+
116129
relative_date = new ComboBox<String>();
130+
relative_date.setTooltip(new Tooltip("Select a predefined duration for disabling the alarm"));
117131
relative_date.getItems().addAll(AlarmSystem.shelving_options);
132+
relative_date.setPrefSize(200, 25);
118133

119-
final EventHandler<ActionEvent> relative_event_handler = new EventHandler<>() {
120-
@Override public void handle(ActionEvent e) {
121-
enabled.setSelected(false);
122-
enabled_date_picker.getEditor().clear();
123-
}
134+
final EventHandler<ActionEvent> relative_event_handler = (ActionEvent e) ->
135+
{
136+
enabled.setSelected(false);
137+
enabled_date_picker.getEditor().clear();
124138
};
125139

126140
relative_date.setOnAction(relative_event_handler);
127141

128142
// setOnAction for relative date must be set to null as to not trigger event when setting value
129-
enabled_date_picker.setOnAction(new EventHandler<ActionEvent>() {
130-
@Override public void handle(ActionEvent e) {
131-
if (enabled_date_picker.getDateTimeValue() != null) {
132-
relative_date.setOnAction(null);
133-
enabled.setSelected(false);
134-
enabled_date_picker.getEditor().commitValue();
135-
relative_date.getSelectionModel().clearSelection();
136-
relative_date.setValue(null);
137-
relative_date.setOnAction(relative_event_handler);
138-
};
139-
}
143+
enabled_date_picker.setOnAction((ActionEvent e) ->
144+
{
145+
if (enabled_date_picker.getDateTimeValue() != null)
146+
{
147+
relative_date.setOnAction(null);
148+
enabled.setSelected(false);
149+
enabled_date_picker.getEditor().commitValue();
150+
relative_date.getSelectionModel().clearSelection();
151+
relative_date.setValue(null);
152+
relative_date.setOnAction(relative_event_handler);
153+
};
140154
});
141155

142-
layout.add(new HBox(10, enabled_date_picker, relative_date), 1, row++);
156+
final HBox until_box = new HBox(10, enabled_date_picker, relative_date);
157+
until_box.setAlignment(Pos.CENTER);
158+
HBox.setHgrow(relative_date, Priority.ALWAYS);
159+
layout.add(until_box, 1, row++);
143160

144161
layout.add(new Label("Alarm Delay [seconds]:"), 0, row);
145162
delay = new Spinner<>(0, Integer.MAX_VALUE, leaf.getDelay());
@@ -170,7 +187,7 @@ public ItemConfigDialog(final AlarmClient model, final AlarmTreeItem<?> item)
170187
count.setPrefWidth(80);
171188
layout.add(count, 1, row++);
172189

173-
layout.add(new Label("Enabling Filter"), 0, row);
190+
layout.add(new Label("Enabling Filter:"), 0, row);
174191
filter = new TextField(leaf.getFilter());
175192
filter.setTooltip(new Tooltip("Optional expression for enabling the alarm"));
176193
layout.add(filter, 1, row++);
@@ -201,28 +218,25 @@ public ItemConfigDialog(final AlarmClient model, final AlarmTreeItem<?> item)
201218
// 'dummy' is used for that.
202219

203220
// Guidance:
204-
layout.add(new Label("Guidance:"), 0, row);
205-
final Label dummy = new Label("");
206-
GridPane.setHgrow(dummy, Priority.ALWAYS);
207-
layout.add(dummy, 1, row++);
221+
layout.add(new Label("Guidance:"), 0, row++, 2, 1);
208222
guidance = new TitleDetailTable(item.getGuidance());
209223
guidance.setPrefHeight(100);
210224
layout.add(guidance, 0, row++, 2, 1);
211225

212226
// Displays:
213-
layout.add(new Label("Displays:"), 0, row++);
227+
layout.add(new Label("Displays:"), 0, row++, 2, 1);
214228
displays = new TitleDetailTable(item.getDisplays());
215229
displays.setPrefHeight(100);
216230
layout.add(displays, 0, row++, 2, 1);
217231

218232
// Commands:
219-
layout.add(new Label("Commands:"), 0, row++);
233+
layout.add(new Label("Commands:"), 0, row++, 2, 1);
220234
commands = new TitleDetailTable(item.getCommands());
221235
commands.setPrefHeight(100);
222236
layout.add(commands, 0, row++, 2, 1);
223237

224238
// Automated Actions:
225-
layout.add(new Label("Automated Actions:"), 0, row++);
239+
layout.add(new Label("Automated Actions:"), 0, row++, 2, 1);
226240
actions = new TitleDetailDelayTable(item.getActions());
227241
actions.setPrefHeight(100);
228242
layout.add(actions, 0, row++, 2, 1);
@@ -231,9 +245,9 @@ public ItemConfigDialog(final AlarmClient model, final AlarmTreeItem<?> item)
231245
final ScrollPane scroll = new ScrollPane(layout);
232246

233247
// Scroll pane stops the content from resizing,
234-
// so tell content to use the widths of the scroll pane,
235-
// minus some border, and suggest minimum width
236-
scroll.widthProperty().addListener((p, old, width) -> layout.setPrefWidth(Math.max(width.doubleValue()-25, 450)));
248+
// so tell content to use the widths of the scroll pane
249+
// minus 40 to provide space for the scroll bar, and suggest minimum width
250+
scroll.widthProperty().addListener((p, old, width) -> layout.setPrefWidth(Math.max(width.doubleValue()-40, 450)));
237251

238252
getDialogPane().setContent(scroll);
239253
setResizable(true);

app/display/editor/src/main/java/org/csstudio/display/builder/editor/app/DisplayEditorInstance.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017-2020 Oak Ridge National Laboratory.
2+
* Copyright (c) 2017-2022 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@
2222
import org.csstudio.display.builder.editor.EditorGUI;
2323
import org.csstudio.display.builder.editor.EditorUtil;
2424
import org.csstudio.display.builder.editor.Messages;
25+
import org.csstudio.display.builder.editor.WidgetSelectionHandler;
2526
import org.csstudio.display.builder.editor.actions.ActionDescription;
2627
import org.csstudio.display.builder.model.DisplayModel;
2728
import org.csstudio.display.builder.model.ModelPlugin;
@@ -386,9 +387,20 @@ void loadWidgetClasses()
386387
ModelThreadPool.getExecutor().execute(() ->
387388
{
388389
// get widget classes and apply to model
390+
// (which triggers editor UI updates, so perform in UI thread)
389391
final DisplayModel model = editor_gui.getDisplayEditor().getModel();
390392
if (model != null)
391-
WidgetClassesService.getWidgetClasses().apply(model);
393+
Platform.runLater( () ->
394+
{
395+
// Save/restore selection to force update of property panel
396+
final WidgetSelectionHandler selection = editor_gui.getDisplayEditor().getWidgetSelectionHandler();
397+
final List<Widget> save = selection.getSelection();
398+
selection.clear();
399+
// Apply class settings
400+
WidgetClassesService.getWidgetClasses().apply(model);
401+
// Restore selection
402+
selection.setSelection(save);
403+
});
392404
});
393405
}
394406

app/display/editor/src/main/java/org/csstudio/display/builder/editor/properties/PropertyPanelSection.java

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015-2018 Oak Ridge National Laboratory.
2+
* Copyright (c) 2015-2022 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -499,19 +499,22 @@ else if (property instanceof PointsWidgetProperty)
499499
* @param property Property (on primary widget)
500500
* @param other Zero or more additional widgets that have same type of property
501501
* @param structureIndex Index of the array structure (element) being added. It is meaningful
502-
* only for properties instance of {@link StructuredWidgetProperty}.
502+
* only for properties instance of {@link StructuredWidgetProperty}
503+
* @param indentationLevel Indentation level
503504
*/
504505
private void createPropertyUI(
505506
final UndoableActionManager undo,
506507
final WidgetProperty<?> property,
507508
final List<Widget> other,
508509
final int structureIndex,
509-
final int indentationLevel
510-
) {
510+
final int indentationLevel)
511+
{
511512
// Skip runtime properties
512513
if (property.getCategory() == WidgetPropertyCategory.RUNTIME)
513514
return;
514515

516+
// System.out.println("Index " + structureIndex + ", level " + indentationLevel + ": " + property.getPath());
517+
515518
final Label label = new Label(property.getDescription());
516519
label.setMaxWidth(Double.MAX_VALUE);
517520
final String tooltip = property.getDescription() + " (" + property.getPath() + ")";
@@ -567,9 +570,7 @@ else if (property instanceof RulesWidgetProperty)
567570
field = rules_field;
568571
}
569572
else if (property instanceof StructuredWidgetProperty)
570-
{ // Don't allow editing structures and their elements in class mode
571-
if (class_mode)
572-
return;
573+
{
573574
final StructuredWidgetProperty struct = (StructuredWidgetProperty) property;
574575
final Label header = new Label(struct.getDescription() + ( structureIndex > 0 ? " " + String.valueOf(1 + structureIndex) : ""));
575576
header.getStyleClass().add("structure_property_name");
@@ -589,9 +590,7 @@ else if (property instanceof StructuredWidgetProperty)
589590
return;
590591
}
591592
else if (property instanceof ArrayWidgetProperty)
592-
{ // Don't allow editing arrays and their elements in class mode
593-
if (class_mode)
594-
return;
593+
{
595594
@SuppressWarnings("unchecked")
596595
final ArrayWidgetProperty<WidgetProperty<?>> array = (ArrayWidgetProperty<WidgetProperty<?>>) property;
597596

@@ -611,6 +610,28 @@ else if (property instanceof ArrayWidgetProperty)
611610

612611
fillHeaderIndent(indentationLevel, row);
613612
add(label, indentationLevel, row, 4 - indentationLevel, 1);
613+
614+
if (class_mode)
615+
{ // Checkbox to select if array is included in class definition
616+
final CheckBox check = new CheckBox();
617+
check.setPadding(new Insets(0, 5, 0, 0));
618+
check.setTooltip(use_class_tooltip);
619+
final WidgetPropertyBinding<?,?> binding = new UseWidgetClassBinding(undo, check, spinner, property, other);
620+
bindings.add(binding);
621+
binding.bind();
622+
add(check, 3, row);
623+
}
624+
else
625+
{ // Show if property is set by the class, not editable.
626+
final Label indicator = new Label();
627+
indicator.setPadding(new Insets(0, 5, 0, 0));
628+
indicator.setTooltip(using_class_tooltip);
629+
final WidgetPropertyBinding<?,?> binding = new ShowWidgetClassBinding(spinner, property, indicator);
630+
bindings.add(binding);
631+
binding.bind();
632+
add(indicator, 3, row);
633+
}
634+
614635
add(spinner, 4, row, 2 - indentationLevel, 1);
615636

616637
Separator separator = new Separator();
@@ -683,14 +704,20 @@ else if (property instanceof ArrayWidgetProperty)
683704
{
684705
if (class_mode)
685706
{ // Class definition mode:
686-
// Check box for 'use_class'
687-
final CheckBox check = new CheckBox();
688-
check.setPadding(new Insets(0, 5, 0, 0));
689-
check.setTooltip(use_class_tooltip);
690-
final WidgetPropertyBinding<?,?> binding = new UseWidgetClassBinding(undo, check, field, property, other);
691-
bindings.add(binding);
692-
binding.bind();
693-
add(check, 3, row);
707+
// Check box for 'use_class', but only on the top level
708+
// For nested properties inside an array or struct,
709+
// the class behavior is controlled at the top-level
710+
// for the complete array or struct
711+
if (indentationLevel == 0)
712+
{
713+
final CheckBox check = new CheckBox();
714+
check.setPadding(new Insets(0, 5, 0, 0));
715+
check.setTooltip(use_class_tooltip);
716+
final WidgetPropertyBinding<?,?> binding = new UseWidgetClassBinding(undo, check, field, property, other);
717+
bindings.add(binding);
718+
binding.bind();
719+
add(check, 3, row);
720+
}
694721
}
695722
else
696723
{ // Display file mode:

0 commit comments

Comments
 (0)