feat (display): RTTank-based Progress Bar backend — scale, alarm limits, and stacking support (opt-in via preference) - #3768
Open
emilioheredia-source wants to merge 4 commits into
Conversation
|
Author
SonarCloud findings — triage noteSonarCloud flagged 54 issues on this PR. I reviewed all of them; here is the breakdown. Fixed (2 issues introduced by this PR)
Both fixes are in the latest commit on this branch. Pre-existing / false positives (52 issues not touched)
|
6 tasks
emilioheredia-source
force-pushed
the
progressbar_scale
branch
from
September 18, 2026 17:45
395fc79 to
9f87201
Compare
…scale_labels to Tank Move everything in TankRepresentation that only depends on the ScaledPVWidget contract into an abstract RTScaledWidgetRepresentation: creating the RTTank, forwarding value and range updates, evaluating the alarm limits, the orientation transform and the update scheduling. TankRepresentation keeps the Tank specific listeners and colors. The behaviour of the Tank widget does not change. Add a 'show_scale_labels' property (default true) to the Tank so that stacked widgets can share one labelled scale: with the property off, YAxisImpl draws the tick marks and the axis line only. Tick positions are the same as with labels. TankWidgetUnitTest covers the new property.
Move the progress bar onto the ScaledPVWidget base class that the Tank already uses, so it carries the same range, scale and alarm limit properties, plus an inner padding. The scale look properties (font, foreground and fill color, log scale, scale visibility, tick options, border width) now live in ScaledPVWidget with a defineScaleLookProperties() helper, and the Tank uses the same fields in its own order. The border keeps the Tank's 'tank_border_width' name for all scaled widgets: legacy BOY files carry a 'border_width' element for every widget, which must not become a bar border. The stock renderer ignores the additions, and existing .bob files keep loading unchanged since the pre-existing properties keep their names. The BOY importer picks up 'show_scale', 'scale_font' and the 'level_hi' and 'level_lo' names that differ from ours. ProgressBarWidgetUnitTest covers defaults, legacy .bob and BOY files, the XML round trip and the list of renderer-only properties.
Add RTProgressBarRepresentation, which draws the progress bar with the
RTTank engine shared with the Tank widget. This gives the bar a numeric
scale with format and precision, an optional opposite scale, minor
ticks, tick-only mode for stacked bars, and alarm limit lines.
RTTank gains an inner padding and a flat track for the progress bar
look. RTScaledWidgetRepresentation gains registerScaleLookListeners()
and applyScaleLook() for the scale look properties that ScaledPVWidget
defines; TankRepresentation and the new representation use them and
only handle their own extras.
The renderer is selected with the new preference
org.csstudio.display.builder.representation/progressbar_scale_mode
which defaults to false. With the default, the stock JavaFX
ProgressBarRepresentation is used and nothing changes for existing
displays. The property panel hides the renderer-only properties while
the stock renderer is in use.
The EDM 'activeBar' carries a scale flag, a fixed range, a precision and a border flag that the progress bar can now represent.
emilioheredia-source
force-pushed
the
progressbar_scale
branch
from
September 18, 2026 20:38
9f87201 to
1774da5
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Update (Sep 2026)
Rebased onto current master and reworked after re-reading it:
ProgressBarRepresentationis no longer touched. An earlier revision of this PR edited it and, as a side effect, dropped its handling of inverted ranges (minimum > maximum, added in 2023). That is gone: with the default preference the widget is byte-for-byte the code on master, including the recent fix for vertical bars inside a Group (Vertical progress bar causes Group widget to extend further than it should #3833).parallel_renderingchanges that used to be part of this PR were merged separately as perf(rtplot): add parallel_rendering preference for RTTank UpdateThrottle #3766 and are dropped here.RTTankfix in fix (rtplot): RTTank ignores inverted ranges and the label format on linear scales #3929. Without that fix an inverted range is ignored, as it is for the Tank on master today.tank_border_width, the name the Tank already uses, for all scaled widgets: every legacy BOY.opiwidget carries a<border_width>element, and a property of that name would have turned it into a bar border on import.ProgressBarWidgetUnitTesthas a BOY import test for exactly that, and the importer now also maps BOY'slevel_hi/level_lo.TankRepresentationuses the same shared listener/look helpers as the new representation, so the Tank and the Progress Bar really share the code.Summary
This PR adds a second rendering backend for the existing
ProgressBarwidget, based onRTTank, the engine behind the Tank widget. It is opt-in through a preference:false(default): the stock JavaFXProgressBarRepresentationis used. Nothing changes for existing displays.true:RTProgressBarRepresentationis used for all Progress Bar widgets of that Phoebus instance.The RTTank backend uses a different rendering path than the stock control (Java2D offscreen, blitted to a Canvas), which costs more CPU while the widget updates. For a discussion with side-by-side recordings see the comments in #3766. The widget also looks slightly different from the stock control (font, scale, fill), so making it the default would change every existing screen. Hence the preference.
Screenshots
New renderer (
progressbar_scale_mode=true), same.bobfile:Stock renderer (default), same

.bobfile; the scale properties are simply ignored:What the new renderer adds
scale_visible, off by default so a bar looks like a bar until asked otherwise), withformat,precision,major_ticks/minor_ticks,show_minor_ticks,perpendicular_tick_labelsopposite_scale_visible)show_scale_labels=falsedraws tick marks without text, for stacking several bars under one labelled scale (see screenshot)level_*properties; PV limits are solid, manual ones dashedlog_scalewith a proper log axistank_border_widthandinner_padding(gap between widget edge and bar, default 3 px to match the stock CSS inset)fontandforeground_colorfor the scaleModel changes
ProgressBarWidgetnow extendsScaledPVWidget(shared withTankWidgetsince #3760), which is where the range, format and alarm limit properties come from. The scale look properties (font, fill color, log scale, scale visibility, tick options, border width) are defined once inScaledPVWidget.defineScaleLookProperties()so the Thermometer PR can reuse them; the Tank keeps its own definitions and its releasedtank_border_widthname. Existing.bobfiles load unchanged:fill_color,background_color,horizontal,limits_from_pv,minimum,maximumandlog_scalekeep their names. Older Phoebus versions ignore the new elements.The property panel hides the scale-only properties while the stock renderer is selected (
ProgressBarWidget.SCALE_MODE_PROPS), so operators do not see settings that have no effect. This is a deliberate, small coupling between the editor and the renderer preference; if you would rather keep the editor widget-agnostic, that check can simply be dropped and the properties shown.The BOY
.opiimporter picks upshow_scaleandscale_font; the EDM converter maps theactiveBarscale flag, range, precision and border.Design note
Two renderers for one widget type, selected globally, is a compromise. A new widget type would force every existing
.bobto be migrated; a per-widget renderer property would leak the representation choice into the model. The preference keeps the model untouched, is reversible, and lets sites try the new renderer on real screens without editing files. If it proves out, it can become the default in a later release.Files changed
ProgressBarWidget.java,ScaledPVWidget.java(shared scale look properties),TankWidget.java(uses them),Messages.java,messages*.properties,ProgressBarWidgetUnitTest.java,TankWidgetUnitTest.javaRTProgressBarRepresentation.java(new),RTScaledWidgetRepresentation.java(shared listener/look helpers),TankRepresentation.java(uses them),BaseWidgetRepresentations.javaRTTank.java(inner_padding, flat track)Preferences.java,display_representation_preferences.propertiesPropertyPanelSection.javaConvert_activeBarClass.javaTesting
Default:
minimum > maximumbars.With
progressbar_scale_mode=true:2. Existing
.bobfiles open normally; the property panel shows the new properties.3.
scale_visibleon/off,minimum/maximum,major_ticks/minor_ticks,show_minor_ticks,perpendicular_tick_labels.4.
format/precision: labels update.5.
limits_from_pvwith a PV that carries LOLO/LO/HI/HIHI (e.g.sim://sine(0,100,2)) andshow_alarm_limits=true: lines at the right positions;alarm_limits_from_pv=falsewithlevel_*gives dashed lines.6.
show_scale_labels=falseon stacked bars: ticks stay, text goes.7.
inner_padding0..20,tank_border_width0..5,foreground_colorfor the scale.8.
horizontal=false;minimum > maximumin both orientations (needs #3929).9. Tank widgets on the same display are unaffected.
Checklist
ProgressBarWidgetUnitTest: defaults, legacy file loads unchanged, XML round trip of the new properties, default widget writes no new elements, hidden-property list matches real properties)mvn installwith tests on the touched modules, plus the manual checks above)