@@ -62,8 +62,9 @@ package org.bigbluebutton.modules.layout.managers
62
62
private var _containerDeactivated : Boolean = false ;
63
63
private var _sendCurrentLayoutUpdateTimer : Timer = new Timer (500 ,1 );
64
64
private var _applyCurrentLayoutTimer : Timer = new Timer (150 ,1 );
65
+ private var _delayToSendLayoutsToCombobox : Timer = new Timer (60 ,0 );
65
66
private var _customLayoutsCount : int = 0 ;
66
- private var sendToCombobox : Boolean = false ;
67
+ private var comboboxIsInitialized : Boolean = false ;
67
68
private var _eventsToDelay : Array = new Array (MDIManagerEvent. WINDOW_RESTORE ,
68
69
MDIManagerEvent. WINDOW_MINIMIZE ,
69
70
MDIManagerEvent. WINDOW_MAXIMIZE );
@@ -76,6 +77,31 @@ package org.bigbluebutton.modules.layout.managers
76
77
_sendCurrentLayoutUpdateTimer . addEventListener (TimerEvent . TIMER , function (e: TimerEvent ): void {
77
78
sendLayoutUpdate(updateCurrentLayout());
78
79
});
80
+
81
+ _delayToSendLayoutsToCombobox . addEventListener (TimerEvent . TIMER , function (e: TimerEvent ): void {
82
+ checkIfCanSendLayoutToCombobox();
83
+ });
84
+ }
85
+
86
+
87
+ public function sendPopulateComboboxEvent ():void {
88
+ var sendLayoutsLoaded: LayoutsLoadedEvent = new LayoutsLoadedEvent(LayoutsLoadedEvent. SEND_LAYOUTS_LOADED_EVENT );
89
+ sendLayoutsLoaded. layouts = _layouts ;
90
+ _globalDispatcher . dispatchEvent (sendLayoutsLoaded);
91
+ }
92
+
93
+
94
+ public function initDelayTimerUntilComboboxIsInitialized ():void {
95
+ _delayToSendLayoutsToCombobox . start ();
96
+ }
97
+
98
+
99
+ public function checkIfCanSendLayoutToCombobox ():void {
100
+ LogUtil. debug ("Estou tentando" );
101
+ if (comboboxIsInitialized) {
102
+ _delayToSendLayoutsToCombobox . stop ();
103
+ sendPopulateComboboxEvent();
104
+ }
79
105
}
80
106
81
107
public function loadServerLayouts (layoutUrl :String ):void {
@@ -84,21 +110,23 @@ package org.bigbluebutton.modules.layout.managers
84
110
loader . addEventListener (LayoutsLoadedEvent. LAYOUTS_LOADED_EVENT , function (e: LayoutsLoadedEvent): void {
85
111
if (e. success) {
86
112
_layouts = e. layouts;
113
+ if (comboboxIsInitialized) {
114
+ sendPopulateComboboxEvent();
115
+ }
116
+ else {
117
+ initDelayTimerUntilComboboxIsInitialized();
118
+ }
87
119
LogUtil. debug ("LayoutManager: layouts loaded successfully" );
120
+
88
121
} else {
89
122
LogUtil. error ("LayoutManager: layouts not loaded (" + e. error . message + ")" );
90
123
}
91
124
});
92
125
loader . loadFromUrl(layoutUrl);
93
126
}
94
127
95
- public function sendLayoutToComboboxWhenReceived ():void {
96
- if (_layouts != null ) {
97
- var populateComboboxEvent: PopulateComboboxEvent = new PopulateComboboxEvent();
98
- populateComboboxEvent. layouts = _layouts ;
99
- _globalDispatcher . dispatchEvent (populateComboboxEvent);
100
-
101
- }
128
+ public function comboboxInitialized ():void {
129
+ comboboxIsInitialized = true ;
102
130
}
103
131
104
132
public function saveLayoutsToFile ():void {
@@ -118,13 +146,15 @@ package org.bigbluebutton.modules.layout.managers
118
146
/*
119
147
* \TODO why do I need to create a new Event for this?
120
148
*/
121
- var layoutsLoaded: LayoutsLoadedEvent = new LayoutsLoadedEvent();
122
- layoutsLoaded. layouts = _layouts ;
123
- _globalDispatcher . dispatchEvent (layoutsLoaded);
149
+ // var layoutsLoaded:LayoutsLoadedEvent = new LayoutsLoadedEvent();
150
+ // layoutsLoaded.layouts = _layouts;
151
+ // _globalDispatcher.dispatchEvent(layoutsLoaded);
124
152
/*
125
153
* it will update the ComboBox label, and will go back to this class
126
154
* to apply the default layout
127
155
*/
156
+
157
+ sendPopulateComboboxEvent();
128
158
_globalDispatcher . dispatchEvent (new LayoutEvent (LayoutEvent . APPLY_DEFAULT_LAYOUT_EVENT ));
129
159
130
160
Alert . show (ResourceUtil. getInstance (). getString ('bbb.layout.load.complete' ), "" , Alert . OK , _canvas );
0 commit comments