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 @@ -48,6 +48,7 @@ public class Messages
Confirm_BOTH,
Confirm_PUSH,
Confirm_RELEASE,
DefaultTab,
DisplayMode,
EmbeddedDisplayWidget_GroupName,
EnableGradient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
static final WidgetPropertyDescriptor<Integer> propTabHeight =
CommonWidgetProperties.newIntegerPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "tab_height", Messages.Tab_Height);

static final WidgetPropertyDescriptor<Integer> propDefaultTab =
CommonWidgetProperties.newIntegerPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "default_tab", Messages.DefaultTab,
-1, Integer.MAX_VALUE);

static final WidgetPropertyDescriptor<Integer> propActiveTab =
CommonWidgetProperties.newIntegerPropertyDescriptor(WidgetPropertyCategory.DISPLAY, "active_tab", Messages.ActiveTab,
0, Integer.MAX_VALUE);
Expand Down Expand Up @@ -180,6 +184,7 @@

private volatile WidgetProperty<WidgetColor> background;
private volatile WidgetProperty<WidgetFont> font;
private volatile WidgetProperty<Integer> default_tab;

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

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

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

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AaClgiBaZ0oG5J6LJGHx&open=AaClgiBaZ0oG5J6LJGHx&pullRequest=3923
private volatile WidgetProperty<Integer> active;
private volatile ArrayWidgetProperty<TabItemProperty> tabs;
private volatile WidgetProperty<Direction> direction;
Expand All @@ -198,6 +203,7 @@
super.defineProperties(properties);
properties.add(font = propFont.createProperty(this, WidgetFontService.get(NamedWidgetFonts.DEFAULT)));
properties.add(background = propBackgroundColor.createProperty(this, WidgetColorService.getColor(NamedWidgetColors.BACKGROUND)));
properties.add(default_tab = propDefaultTab.createProperty(this, -1));

Check warning on line 206 in app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/TabsWidget.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=AaClgiBaZ0oG5J6LJGHw&open=AaClgiBaZ0oG5J6LJGHw&pullRequest=3923
properties.add(active = propActiveTab.createProperty(this, 0));
properties.add(tabs = propTabs.createProperty(this, Arrays.asList(new TabItemProperty(this, 0),
new TabItemProperty(this, 1))));
Expand Down Expand Up @@ -243,6 +249,12 @@
return font;
}

/** @return 'default_tab' property */
public WidgetProperty<Integer> propDefaultTab()
{
return default_tab;
}

/** @return 'active_tab' property */
public WidgetProperty<Integer> propActiveTab()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Confirm_NONE=No
Confirm_BOTH=On Both
Confirm_PUSH=On Set
Confirm_RELEASE=On Clear
DefaultTab=Default Tab
DisplayMode=Display Mode
EmbeddedDisplayWidget_GroupName=Group name
EnableGradient=Enable Gradient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,15 @@ protected void registerListeners()
model_widget.propTabs().addPropertyListener(tabsListener);
model_widget.propDirection().addUntypedPropertyListener(layoutListener);
model_widget.propTabHeight().addUntypedPropertyListener(layoutListener);
model_widget.propDefaultTab().addUntypedPropertyListener(layoutListener);

// Select initial tab
track_active_model_tab.propertyChanged(model_widget.propActiveTab(), null, null);
// For backward compatibility, default tab property default value is -1
// In this case the initial tab is set according to the active tab property
if (model_widget.propDefaultTab().getValue() == -1)
track_active_model_tab.propertyChanged(model_widget.propActiveTab(), null, null);
else
track_active_model_tab.propertyChanged(model_widget.propDefaultTab(), null, null);
model_widget.propActiveTab().addPropertyListener(track_active_model_tab);

// Update model when UI selects a tab
Expand Down Expand Up @@ -179,6 +185,7 @@ protected void unregisterListeners()
model_widget.propTabs().removePropertyListener(tabsListener);
model_widget.propDirection().removePropertyListener(layoutListener);
model_widget.propTabHeight().removePropertyListener(layoutListener);
model_widget.propDefaultTab().removePropertyListener(layoutListener);
model_widget.propActiveTab().addPropertyListener(track_active_model_tab);

super.unregisterListeners();
Expand Down
Loading