Skip to content

Commit 7176afa

Browse files
authored
Merge pull request #3486 from ControlSystemStudio/CSSTUDIO-2954
CSSTUDIO-2954 Add support for informative tooltips for widget properties
2 parents 334379a + e4780db commit 7176afa

File tree

7 files changed

+106
-43
lines changed

7 files changed

+106
-43
lines changed

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

Lines changed: 53 additions & 43 deletions
Large diffs are not rendered by default.

app/display/model/src/main/java/org/csstudio/display/builder/model/Messages.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ public class Messages
5252
FontStyle_Regular,
5353
GroupWidget_Description,
5454
GroupWidget_Name,
55+
InformativeTooltipActions,
56+
InformativeTooltipAlarmBorder,
57+
InformativeTooltipHeight,
58+
InformativeTooltipName,
59+
InformativeTooltipPVName,
60+
InformativeTooltipRules,
61+
InformativeTooltipScripts,
62+
InformativeTooltipTooltip,
63+
InformativeTooltipVisible,
64+
InformativeTooltipWidgetClass,
65+
InformativeTooltipWidth,
66+
InformativeTooltipX,
67+
InformativeTooltipY,
5568
Interpolation_Automatic,
5669
Interpolation_Interpolate,
5770
Interpolation_None,

app/display/model/src/main/java/org/csstudio/display/builder/model/Widget.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,23 @@ public Widget(final String type, final int default_width, final int default_heig
211211
// -- Mandatory properties --
212212
prelim_properties.add(this.type = propType.createProperty(this, type));
213213
prelim_properties.add(name = propName.createProperty(this, ""));
214+
name.setInformativeTooltip(Messages.InformativeTooltipName);
214215
prelim_properties.add(widget_class = propWidgetClass.createProperty(this, WidgetClassSupport.DEFAULT));
216+
widget_class.setInformativeTooltip(Messages.InformativeTooltipWidgetClass);
215217
prelim_properties.add(x = propX.createProperty(this, 0));
218+
x.setInformativeTooltip(Messages.InformativeTooltipX);
216219
prelim_properties.add(y = propY.createProperty(this, 0));
220+
y.setInformativeTooltip(Messages.InformativeTooltipY);
217221
prelim_properties.add(width = propWidth.createProperty(this, default_width));
222+
width.setInformativeTooltip(Messages.InformativeTooltipWidth);
218223
prelim_properties.add(height = propHeight.createProperty(this, default_height));
224+
height.setInformativeTooltip(Messages.InformativeTooltipHeight);
219225
prelim_properties.add(actions = propActions.createProperty(this, ActionInfos.EMPTY));
226+
actions.setInformativeTooltip(Messages.InformativeTooltipActions);
220227
prelim_properties.add(rules = propRules.createProperty(this, Collections.emptyList()));
228+
rules.setInformativeTooltip(Messages.InformativeTooltipRules);
221229
prelim_properties.add(scripts = propScripts.createProperty(this, Collections.emptyList()));
230+
scripts.setInformativeTooltip(Messages.InformativeTooltipScripts);
222231

223232
// -- Widget-specific properties --
224233
defineProperties(prelim_properties);

app/display/model/src/main/java/org/csstudio/display/builder/model/WidgetProperty.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import java.lang.reflect.Constructor;
1313
import java.util.Objects;
14+
import java.util.Optional;
1415
import java.util.logging.Level;
1516

1617
import javax.xml.stream.XMLStreamWriter;
@@ -70,6 +71,8 @@ protected WidgetProperty(
7071
this.value = this.default_value;
7172
}
7273

74+
private Optional<String> informativeTooltip = Optional.empty();
75+
7376
@SuppressWarnings("unchecked")
7477
@Override
7578
public WidgetProperty<T> clone()
@@ -121,6 +124,15 @@ public String getName()
121124
return descriptor.getName();
122125
}
123126

127+
public void setInformativeTooltip(String informativeTooltip) {
128+
this.informativeTooltip = Optional.of(informativeTooltip);
129+
}
130+
131+
/** @return Optional informative tooltip describing the property */
132+
public Optional<String> getInformativeTooltip() {
133+
return informativeTooltip;
134+
}
135+
124136
/** Get full path to property
125137
*
126138
* <p>A widget property 'visible' might be the basic

app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/PVWidget.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ protected void defineProperties (final List<WidgetProperty<?>> properties )
8282
{
8383
super.defineProperties(properties);
8484
properties.add(pv_name = propPVName.createProperty(this, ""));
85+
pv_name.setInformativeTooltip(Messages.InformativeTooltipPVName);
8586
pv_name.addPropertyListener((property, oldValue, newValue) -> pv_value.setValue(null));
8687
properties.add(pv_value = runtimePropPVValue.createProperty(this, null));
8788
properties.add(alarm_border = propBorderAlarmSensitive.createProperty(this, true));
89+
alarm_border.setInformativeTooltip(Messages.InformativeTooltipAlarmBorder);
90+
var s = Messages.InformativeTooltipHeight;
8891
}
8992

9093
@Override

app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/VisibleWidget.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import java.util.List;
1515

16+
import org.csstudio.display.builder.model.Messages;
1617
import org.csstudio.display.builder.model.Widget;
1718
import org.csstudio.display.builder.model.WidgetProperty;
1819

@@ -57,7 +58,9 @@ protected void defineProperties(final List<WidgetProperty<?>> properties)
5758
{
5859
super.defineProperties(properties);
5960
properties.add(visible = propVisible.createProperty(this, true));
61+
visible.setInformativeTooltip(Messages.InformativeTooltipVisible);
6062
properties.add(tooltip = propTooltip.createProperty(this, getInitialTooltip()));
63+
tooltip.setInformativeTooltip(Messages.InformativeTooltipTooltip);
6164
// Start 'connected', assuming there are no PVs
6265
properties.add(connected = runtimePropConnected.createProperty(this, true));
6366
}

app/display/model/src/main/resources/org/csstudio/display/builder/model/messages.properties

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ FontStyle_Italic=Italic
3434
FontStyle_Regular=Regular
3535
GroupWidget_Description=Group of widgets
3636
GroupWidget_Name=Group
37+
InformativeTooltipActions=Actions to execute when the widget is clicked on.
38+
InformativeTooltopAlarmBorder=Should an alarm border be shown around the widget when the displayed PV signals an alarm?
39+
InformativeTooltipHeight=The height of the widget in pixels.
40+
InformativeTooltipName=The name of the widget.
41+
InformativTooltipPVName=The name of the PV to connect to and to display in the widget.
42+
InformativeTooltipRules=Rules associated with the widget.
43+
InformativeTooltipScripts=Scripts associated with the widget.
44+
InformativeTooltipTooltip=Text to display in the tooltip of the widget when hovering with the mouse over the widget.
45+
InformativeTooltipVisible=Should the widget be visible?
46+
InformativeTooltipWidgetClass=The style class of the widget.
47+
InformativeTooltipWidth=The width of the widget in pixels.
48+
InformativeTooltipX=The x-coordinate of the widget counted in pixels from the left side of the screen.
49+
InformativeTooltipY=The y-coordinate of the widget counted in pixels from the top of the screen.
3750
Interpolation_Automatic=Automatic
3851
Interpolation_Interpolate=Interpolate
3952
Interpolation_None=None

0 commit comments

Comments
 (0)