1313class WidgetManager {
1414 // This holds all of the widgets. When creating/adding new widgets, we will add them to this ArrayList (below)
1515 private ArrayList<Widget > widgets;
16- private ArrayList<String > widgetOptions; // List of Widget Titles, used to populate cp5 widgetSelector dropdown of all widgets
1716 private int currentContainerLayout; // This is the Layout structure for the main body of the GUI
1817 private ArrayList<Layout > layouts = new ArrayList<Layout > (); // This holds all of the different layouts ...
1918
2019 private boolean visible = true ;
2120
2221 WidgetManager () {
2322 widgets = new ArrayList<Widget > ();
24- widgetOptions = new ArrayList<String > ();
2523
2624 // DO NOT re-order the functions below
2725 setupLayouts();
@@ -97,14 +95,17 @@ class WidgetManager {
9795 }
9896
9997 private void setupWidgetSelectorDropdowns () {
100- // Populate the dropdown options with widget titles
98+ // Create a temporary list of widget titles for dropdown setup
99+ ArrayList<String > widgetTitles = new ArrayList<String > ();
100+
101+ // Populate the titles list by calling getWidgetTitle() on each widget
101102 for (Widget widget : widgets) {
102- widgetOptions . add(widget. widgetTitle );
103+ widgetTitles . add(widget. getWidgetTitle() );
103104 }
104105
105- // Setup the dropdown for each widget
106+ // Setup the dropdown for each widget using the temporary list
106107 for (Widget widget : widgets) {
107- widget. setupWidgetSelectorDropdown(widgetOptions );
108+ widget. setupWidgetSelectorDropdown(widgetTitles );
108109 widget. setupNavDropdowns();
109110 }
110111 }
@@ -310,4 +311,8 @@ class WidgetManager {
310311 public W_TimeSeries getTimeSeriesWidget () {
311312 return (W_TimeSeries ) getWidget(" W_TimeSeries" );
312313 }
314+
315+ public int getWidgetCount () {
316+ return widgets. size();
317+ }
313318};
0 commit comments