Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ public class Messages
WidgetProperties_ShowLoLo,
WidgetProperties_ShowMinorTicks,
WidgetProperties_PerpendicularTickLabels,
WidgetProperties_ShowScaleLabels,
WidgetProperties_ShowOK,
WidgetProperties_ShowScale,
WidgetProperties_ShowUnits,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyCategory;
import org.csstudio.display.builder.model.WidgetPropertyDescriptor;
import org.phoebus.ui.color.NamedWidgetColors;
import org.phoebus.ui.color.WidgetColorService;
import org.csstudio.display.builder.model.properties.EnumWidgetProperty;
import org.phoebus.ui.color.NamedWidgetColors;
import org.phoebus.ui.color.WidgetColor;
import org.phoebus.ui.color.WidgetColorService;
import org.phoebus.ui.vtype.ScaleFormat;

/** Base class for PV widgets that display a numeric value on a scale
Expand All @@ -46,7 +46,7 @@
* overrides the manual LOLO/LO/HI/HIHI levels. New property;
* old Phoebus silently ignores the XML element.</li>
* <li>Manual {@code minimum} / {@code maximum} range.</li>
* <li>A {@code show_limits} toggle for alarm-limit visual markers.</li>
* <li>A {@code show_alarm_limits} toggle for alarm-limit visual markers.</li>
* <li>Manual LOLO / LO / HI / HIHI thresholds (NaN = inactive).</li>
* <li>Configurable minor/major alarm colours defaulting to the named
* {@code ALARM_MINOR} / {@code ALARM_MAJOR} palette entries.</li>
Expand Down Expand Up @@ -125,6 +125,31 @@ public EnumWidgetProperty<ScaleFormat> createProperty(final Widget widget,
newColorPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "major_alarm_color",
Messages.WidgetProperties_MajorAlarmColor);

/** 'scale_visible': show the numeric scale (tick marks and labels) */
public static final WidgetPropertyDescriptor<Boolean> propScaleVisible =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "scale_visible",
Messages.WidgetProperties_ScaleVisible);

/** 'show_minor_ticks': show minor tick marks on the scale */
public static final WidgetPropertyDescriptor<Boolean> propShowMinorTicks =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "show_minor_ticks",
Messages.WidgetProperties_ShowMinorTicks);

/** 'opposite_scale_visible': show a second scale on the opposite side */
public static final WidgetPropertyDescriptor<Boolean> propOppositeScaleVisible =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "opposite_scale_visible",
Messages.WidgetProperties_OppositeScaleVisible);

/** 'perpendicular_tick_labels': draw scale labels perpendicular to the axis */
public static final WidgetPropertyDescriptor<Boolean> propPerpendicularTickLabels =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "perpendicular_tick_labels",
Messages.WidgetProperties_PerpendicularTickLabels);

/** 'show_scale_labels': show tick label text on the scale (ticks are always drawn) */
public static final WidgetPropertyDescriptor<Boolean> propShowScaleLabels =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "show_scale_labels",
Messages.WidgetProperties_ShowScaleLabels);

// ---- Instance fields ------------------------------------------------

private volatile WidgetProperty<ScaleFormat> format;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*******************************************************************************/
package org.csstudio.display.builder.model.widgets;

import static org.csstudio.display.builder.model.properties.CommonWidgetProperties.newBooleanPropertyDescriptor;
import static org.csstudio.display.builder.model.properties.CommonWidgetProperties.newColorPropertyDescriptor;
import static org.csstudio.display.builder.model.properties.CommonWidgetProperties.newIntegerPropertyDescriptor;
import static org.csstudio.display.builder.model.properties.CommonWidgetProperties.propBackgroundColor;
Expand Down Expand Up @@ -84,26 +83,6 @@
/** 'empty_color' */
public static final WidgetPropertyDescriptor<WidgetColor> propEmptyColor =
newColorPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "empty_color", Messages.WidgetProperties_EmptyColor);
/** 'scale_visible' */
public static final WidgetPropertyDescriptor<Boolean> propScaleVisible =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "scale_visible", Messages.WidgetProperties_ScaleVisible);

/** 'show_minor_ticks' */
public static final WidgetPropertyDescriptor<Boolean> propShowMinorTicks =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "show_minor_ticks", Messages.WidgetProperties_ShowMinorTicks);

/** 'perpendicular_tick_labels' &mdash; draw scale labels perpendicular
* to the axis direction (horizontal text beside vertical scale)
*/
public static final WidgetPropertyDescriptor<Boolean> propPerpendicularTickLabels =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "perpendicular_tick_labels", Messages.WidgetProperties_PerpendicularTickLabels);

/** 'opposite_scale_visible' &mdash; show a second scale on the opposite
* side of the tank (right for vertical, bottom for horizontal).
* Inspired by CS-Studio BOY which could show markers on both sides.
*/
public static final WidgetPropertyDescriptor<Boolean> propOppositeScaleVisible =
newBooleanPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "opposite_scale_visible", Messages.WidgetProperties_OppositeScaleVisible);

/** Widget configurator to read legacy *.opi files*/
private static class CustomConfigurator extends WidgetConfigurator
Expand Down Expand Up @@ -168,6 +147,7 @@
private volatile WidgetProperty<WidgetColor> empty_color;
private volatile WidgetProperty<Boolean> scale_visible;
private volatile WidgetProperty<Boolean> show_minor_ticks;
private volatile WidgetProperty<Boolean> show_scale_labels;

Check warning on line 150 in app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/TankWidget.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "show_scale_labels" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AaC1ol5cQphYVlHbufBz&open=AaC1ol5cQphYVlHbufBz&pullRequest=3767
private volatile WidgetProperty<Boolean> perpendicular_tick_labels;
private volatile WidgetProperty<Boolean> opposite_scale_visible;
private volatile WidgetProperty<Boolean> log_scale;
Expand All @@ -193,6 +173,7 @@
properties.add(scale_visible = propScaleVisible.createProperty(this, true));
properties.add(opposite_scale_visible = propOppositeScaleVisible.createProperty(this, false));
properties.add(show_minor_ticks = propShowMinorTicks.createProperty(this, true));
properties.add(show_scale_labels = propShowScaleLabels.createProperty(this, true));

Check warning on line 176 in app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/TankWidget.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Extract the assignment out of this expression.

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AaC1ol5cQphYVlHbufBx&open=AaC1ol5cQphYVlHbufBx&pullRequest=3767
properties.add(perpendicular_tick_labels = propPerpendicularTickLabels.createProperty(this, false));
properties.add(log_scale = propLogscale.createProperty(this, false));
properties.add(horizontal = propHorizontal.createProperty(this, false));
Expand Down Expand Up @@ -250,6 +231,12 @@
return show_minor_ticks;
}

/** @return 'show_scale_labels' property */
public WidgetProperty<Boolean> propShowScaleLabels()

Check failure on line 235 in app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/TankWidget.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename method "propShowScaleLabels" to prevent any misunderstanding/clash with field "propShowScaleLabels" defined in superclass "org.csstudio.display.builder.model.widgets.ScaledPVWidget".

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AaC1ol5cQphYVlHbufB0&open=AaC1ol5cQphYVlHbufB0&pullRequest=3767
{
return show_scale_labels;
}

/** @return 'perpendicular_tick_labels' property */
public WidgetProperty<Boolean> propPerpendicularTickLabels()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ WidgetProperties_ShowLimits=Show Limits
WidgetProperties_ShowLow=Show Low
WidgetProperties_ShowLoLo=Show LoLo
WidgetProperties_ShowMinorTicks=Show minor ticks
WidgetProperties_ShowScaleLabels=Show scale labels
WidgetProperties_PerpendicularTickLabels=Labels perpendicular to axis
WidgetProperties_ShowOK=Show OK
WidgetProperties_ShowScale=Show Scale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ WidgetProperties_ShowLimits=Afficher les limites
WidgetProperties_ShowLow=Afficher Low
WidgetProperties_ShowLoLo=Afficher LoLo
WidgetProperties_ShowMinorTicks=Afficher les petites graduations
WidgetProperties_ShowScaleLabels=Afficher les labels de l'échelle
WidgetProperties_PerpendicularTickLabels=Labels perpendiculaires à l'axe
WidgetProperties_ShowOK=Afficher OK
WidgetProperties_ShowScale=Afficher l'échelle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public void testTankWidgetDefaults()
assertThat(tank.propScaleVisible().getValue(), equalTo(true));
assertThat(tank.propOppositeScaleVisible().getValue(), equalTo(false));
assertThat(tank.propShowMinorTicks().getValue(), equalTo(true));
assertThat(tank.propShowScaleLabels().getValue(), equalTo(true));
assertThat(tank.propPerpendicularTickLabels().getValue(), equalTo(false));
assertThat(tank.propFormat().getValue(), equalTo(ScaleFormat.DEFAULT));
assertThat(tank.propPrecision().getValue(), equalTo(2));
Expand Down Expand Up @@ -138,6 +139,7 @@ public void testXmlRoundTrip() throws Exception
original.propOppositeScaleVisible().setValue(true);
original.propBorderWidth().setValue(3);
original.propPerpendicularTickLabels().setValue(true);
original.propShowScaleLabels().setValue(false);
original.propFormat().setValue(ScaleFormat.DECIMAL);
original.propPrecision().setValue(3);

Expand Down Expand Up @@ -184,6 +186,7 @@ public void testXmlRoundTrip() throws Exception
assertThat(tank.propOppositeScaleVisible().getValue(), equalTo(true));
assertThat(tank.propBorderWidth().getValue(), equalTo(3));
assertThat(tank.propPerpendicularTickLabels().getValue(), equalTo(true));
assertThat(tank.propShowScaleLabels().getValue(), equalTo(false));
assertThat(tank.propFormat().getValue(), equalTo(ScaleFormat.DECIMAL));
assertThat(tank.propPrecision().getValue(), equalTo(3));
}
Expand Down Expand Up @@ -213,5 +216,6 @@ public void testNewPropertiesAreOptional() throws Exception
assertThat(xml, not(containsString("<level_lolo>")));
assertThat(xml, not(containsString("<opposite_scale_visible>")));
assertThat(xml, not(containsString("<tank_border_width>")));
assertThat(xml, not(containsString("<show_scale_labels>")));
}
}
Loading
Loading