Skip to content

Commit d4f2134

Browse files
authored
Merge pull request #3465 from ControlSystemStudio/CSSTUDIO-3346
CSSTUDIO-3346 Linear Meter: Add widget property "Show Warnings"
2 parents 09b7db2 + 3623288 commit d4f2134

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterRepresentation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public Pane createJFXNode()
8484
model_widget.propNeedleWidth().getValue(),
8585
widgetColorToAWTColor(model_widget.propNeedleColor().getValue()),
8686
model_widget.propKnobSize().getValue(),
87-
widgetColorToAWTColor(model_widget.propKnobColor().getValue()));
87+
widgetColorToAWTColor(model_widget.propKnobColor().getValue()),
88+
model_widget.propShowWarnings().getValue());
8889
meter.setSize(model_widget.propWidth().getValue(),model_widget.propHeight().getValue());
8990
meter.setHorizontal(model_widget.propDisplayHorizontal().getValue());
9091
meter.setManaged(false);
@@ -114,6 +115,11 @@ protected void registerListeners()
114115
addUntypedWidgetPropertyListener(model_widget.propFont(), layoutChangedListener);
115116
addUntypedWidgetPropertyListener(model_widget.propNeedleColor(), layoutChangedListener);
116117

118+
addWidgetPropertyListener(model_widget.propShowWarnings(), (property, oldValue, newValue) -> {
119+
meter.setShowWarnings(newValue);
120+
layoutChanged(null, null, null);
121+
});
122+
117123
addWidgetPropertyListener(model_widget.propShowUnits(), (property, old_value, new_value) -> {
118124
meter.setShowUnits(new_value);
119125
layoutChanged(null, null, null);

app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterWidget.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ else if (xml_version.getMajor() < 3)
103103
public static WidgetPropertyDescriptor<Boolean> propShowLimits =
104104
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "show_limits", Messages.WidgetProperties_ShowLimits);
105105

106+
public static WidgetPropertyDescriptor<Boolean> propShowWarnings =
107+
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "show_warnings", Messages.WidgetProperties_ShowWarnings);
108+
106109
public static WidgetPropertyDescriptor<Boolean> propDisplayHorizontal =
107110
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "displayHorizontal", Messages.WidgetProperties_Horizontal);
108111

@@ -162,6 +165,7 @@ else if (xml_version.getMajor() < 3)
162165
private WidgetProperty<FormatOption> format;
163166
private WidgetProperty<Boolean> show_units;
164167
private WidgetProperty<Boolean> show_limits;
168+
private WidgetProperty<Boolean> show_warnings;
165169
private WidgetProperty<WidgetColor> needle_color;
166170
private WidgetProperty<Boolean> scale_visible;
167171
private WidgetProperty<WidgetColor> knob_color;
@@ -206,6 +210,7 @@ protected void defineProperties(List<WidgetProperty<?>> properties)
206210
properties.add(show_units = propShowUnits.createProperty(this, true));
207211
properties.add(scale_visible = propScaleVisible.createProperty(this, true));
208212
properties.add(show_limits = propShowLimits.createProperty(this, true));
213+
properties.add(show_warnings = propShowWarnings.createProperty(this, true));
209214
properties.add(limits_from_pv = propLimitsFromPV.createProperty(this, true));
210215
properties.add(minimum = propMinimum.createProperty(this, 0.0));
211216
properties.add(maximum = propMaximum.createProperty(this, 100.0));
@@ -281,6 +286,12 @@ public WidgetProperty<Boolean> propShowLimits()
281286
return show_limits;
282287
}
283288

289+
/** @return 'show_warnings' property */
290+
public WidgetProperty<Boolean> propShowWarnings()
291+
{
292+
return show_warnings;
293+
}
294+
284295
/** @return 'needle_color' property */
285296
public WidgetProperty<WidgetColor> propNeedleColor()
286297
{

app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/RTLinearMeter.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import java.awt.image.DataBufferInt;
2222
import java.io.IOException;
2323
import java.util.Arrays;
24-
import java.util.concurrent.ExecutionException;
25-
import java.util.concurrent.FutureTask;
2624
import java.util.logging.Level;
2725

2826
import javafx.application.Platform;
@@ -76,7 +74,8 @@ public RTLinearMeter(double initialValue,
7674
int needleWidth,
7775
Color needleColor,
7876
int knobSize,
79-
Color knobColor)
77+
Color knobColor,
78+
boolean showWarnings)
8079
{
8180
if (warningTriangle == null) {
8281
try {
@@ -109,6 +108,7 @@ public RTLinearMeter(double initialValue,
109108
this.hiHi = hiHi;
110109
this.showUnits = showUnits;
111110
this.showLimits = showLimits;
111+
this.showWarnings = showWarnings;
112112

113113
layout();
114114

@@ -576,6 +576,11 @@ public void setFont(javafx.scene.text.Font font)
576576
});
577577
}
578578

579+
private boolean showWarnings = true;
580+
581+
public void setShowWarnings(boolean showWarnings) {
582+
runOnJavaFXThread(() -> { this.showWarnings = showWarnings; });
583+
}
579584

580585
private boolean lag = false;
581586
private Boolean isValueWaitingToBeDrawn = false;
@@ -633,7 +638,10 @@ else if (!Double.isNaN(oldValue)) {
633638
}
634639

635640
private WARNING determineWarning() {
636-
if (lag) {
641+
if (!showWarnings) {
642+
return WARNING.NONE;
643+
}
644+
else if (lag) {
637645
return WARNING.LAG;
638646
}
639647
else if (showUnits && units.equals("")) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ public class Messages
296296
WidgetProperties_ShowScale,
297297
WidgetProperties_ShowUnits,
298298
WidgetProperties_ShowValue,
299+
WidgetProperties_ShowWarnings,
299300
WidgetProperties_Skin,
300301
WidgetProperties_Square,
301302
WidgetProperties_StartFromZero,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ WidgetProperties_ShowOK=Show OK
281281
WidgetProperties_ShowScale=Show Scale
282282
WidgetProperties_ShowUnits=Show Units
283283
WidgetProperties_ShowValue=Show Value
284+
WidgetProperties_ShowWarnings=Show Warnings
284285
WidgetProperties_Skin=Skin
285286
WidgetProperties_Square=Square
286287
WidgetProperties_StartFromZero=Start From Zero

0 commit comments

Comments
 (0)