Skip to content

Commit 897cc08

Browse files
committed
Merge branch 'master' into bbb-red5-r4592
2 parents 02296cf + 8697034 commit 897cc08

File tree

7 files changed

+161
-47
lines changed

7 files changed

+161
-47
lines changed

bigbluebutton-client/locale/pt_BR/bbbResources.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@ bbb.desktopView.actualSize = Exibir tamanho original
132132
bbb.toolbar.phone.toolTip = Iniciar Meu Microfone
133133
bbb.toolbar.deskshare.toolTip = Compartilhar Meu Desktop
134134
bbb.toolbar.video.toolTip = Compartilhar Minha Câmera
135+
bbb.layout.addButton.toolTip = Adicionar layout personalizado à lista
136+
bbb.layout.combo.toolTip = Modificar layout atual
137+
bbb.layout.loadButton.toolTip = Carregar layouts de um arquivo
138+
bbb.layout.saveButton.toolTip = Salvar layouts para um arquivo
139+
bbb.layout.lockButton.toolTip = Fixar layout
140+
bbb.layout.combo.prompt = Aplicar layout
141+
bbb.layout.combo.custom = * Layout personalizado
142+
bbb.layout.combo.customName = Layout personalizado
143+
bbb.layout.combo.remote = Remoto
144+
bbb.layout.save.complete = Layouts salvos com sucesso
145+
bbb.layout.load.complete = Layouts carregados com sucesso
146+
bbb.layout.load.failed = Falha ao carregar layouts
135147
bbb.highlighter.toolbar.pencil = Caneta Marcatexto
136148
bbb.highlighter.toolbar.ellipse = Círculo
137149
bbb.highlighter.toolbar.rectangle = Retângulo
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
3+
*
4+
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
5+
*
6+
* This program is free software; you can redistribute it and/or modify it under the
7+
* terms of the GNU Lesser General Public License as published by the Free Software
8+
* Foundation; either version 2.1 of the License, or (at your option) any later
9+
* version.
10+
*
11+
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
12+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13+
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License along
16+
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
17+
*
18+
* Author: Felipe Cecagno <felipe@mconf.org>
19+
*/
20+
package org.bigbluebutton.modules.layout.events
21+
{
22+
import flash.events.Event;
23+
24+
public class ComboBoxCreatedEvent extends Event
25+
{
26+
public static const COMBOBOX_CREATED_EVENT:String = "COMBOBOX_CREATED_EVENT";
27+
28+
public function ComboBoxCreatedEvent(type:String = COMBOBOX_CREATED_EVENT)
29+
{
30+
super(type, true, false);
31+
}
32+
33+
}
34+
}

bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutsLoadedEvent.as

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package org.bigbluebutton.modules.layout.events
2424
public class LayoutsLoadedEvent extends Event
2525
{
2626
public static const LAYOUTS_LOADED_EVENT:String = "LAYOUTS_LOADED_EVENT";
27+
public static const SEND_LAYOUTS_LOADED_EVENT:String = "SEND_LAYOUTS_LOADED_EVENT";
2728
public var layouts:LayoutDefinitionFile = null;
2829
public var success:Boolean = false;
2930
public var error:TypeError = null;

bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as

Lines changed: 71 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,46 +49,84 @@ package org.bigbluebutton.modules.layout.managers
4949
import org.bigbluebutton.modules.layout.model.WindowLayout;
5050
import org.bigbluebutton.util.i18n.ResourceUtil;
5151

52-
public class LayoutManager extends EventDispatcher {
53-
private var _layouts:LayoutDefinitionFile = null;
54-
private var _canvas:MDICanvas = null;
55-
private var _globalDispatcher:Dispatcher = new Dispatcher();
56-
private var _locked:Boolean = false;
57-
private var _currentLayout:LayoutDefinition = null;
58-
private var _detectContainerChange:Boolean = true;
59-
private var _containerDeactivated:Boolean = false;
60-
private var _sendCurrentLayoutUpdateTimer:Timer = new Timer(500,1);
61-
private var _applyCurrentLayoutTimer:Timer = new Timer(150,1);
62-
private var _customLayoutsCount:int = 0;
63-
private var _eventsToDelay:Array = new Array(MDIManagerEvent.WINDOW_RESTORE,
64-
MDIManagerEvent.WINDOW_MINIMIZE,
65-
MDIManagerEvent.WINDOW_MAXIMIZE);
66-
67-
public function LayoutManager() {
68-
_applyCurrentLayoutTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
69-
applyLayout(_currentLayout);
70-
});
71-
_sendCurrentLayoutUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
72-
sendLayoutUpdate(updateCurrentLayout());
73-
});
74-
}
52+
public class LayoutManager extends EventDispatcher {
53+
private var _layouts:LayoutDefinitionFile = null;
54+
private var _canvas:MDICanvas = null;
55+
private var _globalDispatcher:Dispatcher = new Dispatcher();
56+
private var _locked:Boolean = false;
57+
private var _currentLayout:LayoutDefinition = null;
58+
private var _detectContainerChange:Boolean = true;
59+
private var _containerDeactivated:Boolean = false;
60+
private var _sendCurrentLayoutUpdateTimer:Timer = new Timer(500,1);
61+
private var _applyCurrentLayoutTimer:Timer = new Timer(150,1);
62+
private var _delayToSendLayoutsToCombobox:Timer = new Timer(60,0);
63+
private var _customLayoutsCount:int = 0;
64+
private var comboboxIsInitialized:Boolean = false;
65+
private var _eventsToDelay:Array = new Array(MDIManagerEvent.WINDOW_RESTORE,
66+
MDIManagerEvent.WINDOW_MINIMIZE,
67+
MDIManagerEvent.WINDOW_MAXIMIZE);
68+
69+
70+
public function LayoutManager() {
71+
_applyCurrentLayoutTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
72+
applyLayout(_currentLayout);
73+
});
74+
_sendCurrentLayoutUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
75+
sendLayoutUpdate(updateCurrentLayout());
76+
});
77+
78+
_delayToSendLayoutsToCombobox.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
79+
checkIfCanSendLayoutToCombobox();
80+
});
81+
}
82+
83+
84+
public function sendPopulateComboboxEvent():void {
85+
LogUtil.debug("Sending layout to populate combobox");
86+
var sendLayoutsLoaded:LayoutsLoadedEvent = new LayoutsLoadedEvent(LayoutsLoadedEvent.SEND_LAYOUTS_LOADED_EVENT );
87+
sendLayoutsLoaded.layouts = _layouts;
88+
_globalDispatcher.dispatchEvent(sendLayoutsLoaded);
89+
}
90+
91+
92+
public function initDelayTimerUntilComboboxIsInitialized():void {
93+
_delayToSendLayoutsToCombobox.start();
94+
}
95+
96+
97+
public function checkIfCanSendLayoutToCombobox():void {
98+
if(comboboxIsInitialized) {
99+
if(_delayToSendLayoutsToCombobox != null) {
100+
_delayToSendLayoutsToCombobox.stop();
101+
}
102+
sendPopulateComboboxEvent();
103+
}
104+
}
75105

76106
public function loadServerLayouts(layoutUrl:String):void {
77107
LogUtil.debug("LayoutManager: loading server layouts from " + layoutUrl);
78108
var loader:LayoutLoader = new LayoutLoader();
79109
loader.addEventListener(LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT, function(e:LayoutsLoadedEvent):void {
80110
if (e.success) {
81111
_layouts = e.layouts;
82-
LogUtil.debug("LayoutManager: layouts loaded successfully");
83-
84-
112+
if(comboboxIsInitialized) {
113+
sendPopulateComboboxEvent();
114+
}
115+
else {
116+
initDelayTimerUntilComboboxIsInitialized();
117+
}
118+
LogUtil.debug("LayoutManager: layouts loaded successfully");
85119
} else {
86120
LogUtil.error("LayoutManager: layouts not loaded (" + e.error.message + ")");
87121
}
88122
});
89123
loader.loadFromUrl(layoutUrl);
90124
}
91125

126+
public function comboboxInitialized():void {
127+
comboboxIsInitialized = true;
128+
}
129+
92130
public function saveLayoutsToFile():void {
93131
var _fileRef:FileReference = new FileReference();
94132
_fileRef.addEventListener(Event.COMPLETE, function(e:Event):void {
@@ -106,13 +144,15 @@ package org.bigbluebutton.modules.layout.managers
106144
/*
107145
* \TODO why do I need to create a new Event for this?
108146
*/
109-
var layoutsLoaded:LayoutsLoadedEvent = new LayoutsLoadedEvent();
110-
layoutsLoaded.layouts = _layouts;
111-
_globalDispatcher.dispatchEvent(layoutsLoaded);
147+
//var layoutsLoaded:LayoutsLoadedEvent = new LayoutsLoadedEvent();
148+
//layoutsLoaded.layouts = _layouts;
149+
//_globalDispatcher.dispatchEvent(layoutsLoaded);
112150
/*
113151
* it will update the ComboBox label, and will go back to this class
114152
* to apply the default layout
115153
*/
154+
155+
sendPopulateComboboxEvent();
116156
_globalDispatcher.dispatchEvent(new LayoutEvent(LayoutEvent.APPLY_DEFAULT_LAYOUT_EVENT));
117157

118158
Alert.show(ResourceUtil.getInstance().getString('bbb.layout.load.complete'), "", Alert.OK, _canvas);
@@ -346,5 +386,5 @@ package org.bigbluebutton.modules.layout.managers
346386
if (_canvas != null)
347387
applyLayout(_currentLayout);
348388
}
349-
}
350-
}
389+
}
390+
}

bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
2020
-->
2121
<EventMap xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://mate.asfusion.com/">
2222
<mx:Script>
23-
<![CDATA[
24-
import mx.events.FlexEvent;
25-
26-
import org.bigbluebutton.core.EventConstants;
27-
import org.bigbluebutton.main.events.MadePresenterEvent;
28-
import org.bigbluebutton.modules.layout.events.ConnectionEvent;
29-
import org.bigbluebutton.modules.layout.events.LayoutEvent;
30-
import org.bigbluebutton.modules.layout.events.RedefineLayoutEvent;
31-
import org.bigbluebutton.modules.layout.events.StartLayoutModuleEvent;
32-
import org.bigbluebutton.modules.layout.events.UpdateLayoutEvent;
33-
import org.bigbluebutton.modules.layout.events.ViewInitializedEvent;
34-
import org.bigbluebutton.modules.layout.managers.LayoutManager;
35-
import org.bigbluebutton.modules.layout.services.LayoutService;
23+
<![CDATA[
24+
import mx.events.FlexEvent;
25+
26+
import org.bigbluebutton.core.EventConstants;
27+
import org.bigbluebutton.main.events.MadePresenterEvent;
28+
import org.bigbluebutton.modules.layout.events.ComboBoxCreatedEvent;
29+
import org.bigbluebutton.modules.layout.events.ConnectionEvent;
30+
import org.bigbluebutton.modules.layout.events.LayoutEvent;
31+
import org.bigbluebutton.modules.layout.events.RedefineLayoutEvent;
32+
import org.bigbluebutton.modules.layout.events.StartLayoutModuleEvent;
33+
import org.bigbluebutton.modules.layout.events.UpdateLayoutEvent;
34+
import org.bigbluebutton.modules.layout.events.ViewInitializedEvent;
35+
import org.bigbluebutton.modules.layout.managers.LayoutManager;
36+
import org.bigbluebutton.modules.layout.services.LayoutService;
3637
]]>
3738
</mx:Script>
3839

@@ -52,6 +53,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
5253
<MethodInvoker generator="{LayoutService}" method="join" />
5354
</EventHandlers>
5455

56+
<EventHandlers type="{ComboBoxCreatedEvent.COMBOBOX_CREATED_EVENT}">
57+
<MethodInvoker generator="{LayoutManager}" method="comboboxInitialized"/>
58+
</EventHandlers>
59+
60+
61+
5562
<EventHandlers type="{LayoutEvent.STOP_LAYOUT_MODULE_EVENT}">
5663
<MethodInvoker generator="{LayoutService}" method="leave" />
5764
<MethodInvoker generator="{LayoutEventMapDelegate}" method="stopModule" />

bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutDefinitionFile.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ package org.bigbluebutton.modules.layout.model
6969
public function toXml():XML {
7070
var xml:XML = <layouts/>;
7171
for each (var layoutDefinition:LayoutDefinition in _layouts) {
72-
for each (var value:XML in layoutDefinition.toXml()) {
72+
for each (var value:XML in layoutDefinition.toXml().children()) {
7373
xml.appendChild(value);
7474
}
7575
}

bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/LayoutsCombo.mxml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
3131
<mate:Listener type="{LayoutEvent.REMOTE_LOCK_LAYOUT_EVENT}" receive="{enabled=false || UserManager.getInstance().getConference().amIModerator()}" />
3232
<mate:Listener type="{LayoutEvent.REMOTE_UNLOCK_LAYOUT_EVENT}" receive="{enabled=true}" />
3333
<mate:Listener type="{LayoutEvent.INVALIDATE_LAYOUT_EVENT}" method="invalidadeLayout" />
34-
<mate:Listener type="{LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT}" method="populateLayoutsList" />
3534
<mate:Listener type="{RedefineLayoutEvent.REDEFINE_LAYOUT_EVENT}" method="onRedefineLayout" />
35+
<mate:Listener type="{LayoutsLoadedEvent.SEND_LAYOUTS_LOADED_EVENT}" method="populateLayoutsList"/>
36+
3637

3738
<mx:Script>
3839
<![CDATA[
@@ -60,6 +61,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
6061
import org.bigbluebutton.main.views.MainToolbar;
6162
import org.bigbluebutton.util.i18n.ResourceUtil;
6263
import org.bigbluebutton.modules.layout.events.LayoutEvent;
64+
import org.bigbluebutton.modules.layout.events.ComboBoxCreatedEvent;
6365
import org.bigbluebutton.modules.layout.events.LayoutsLoadedEvent;
6466
import org.bigbluebutton.modules.layout.events.RedefineLayoutEvent;
6567
import org.bigbluebutton.modules.layout.events.ViewInitializedEvent;
@@ -68,12 +70,21 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
6870
import org.bigbluebutton.modules.layout.model.WindowLayout;
6971
import org.bigbluebutton.modules.layout.views.LayoutButton;
7072
73+
74+
75+
private var populated:Boolean = false;
76+
77+
7178
private var _dispatcher:Dispatcher = new Dispatcher();
7279
7380
private var _defaultLayout:Object = null;
81+
private var shouldSelectedItemGoToDefaultBecauseTheEventWasLost:Boolean = false;
82+
7483
7584
private function init():void {
7685
LogUtil.debug("LayoutsCombo: view initialized");
86+
var comboBoxCreated:ComboBoxCreatedEvent = new ComboBoxCreatedEvent();
87+
_dispatcher.dispatchEvent(comboBoxCreated);
7788
}
7889
7990
private function populateLayoutsList(e:LayoutsLoadedEvent):void {
@@ -89,11 +100,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
89100
idx++;
90101
}
91102
invalidateDisplayList();
103+
104+
if(shouldSelectedItemGoToDefaultBecauseTheEventWasLost) {
105+
onApplyDefaultLayout();
106+
}
107+
else {
108+
shouldSelectedItemGoToDefaultBecauseTheEventWasLost = false;
109+
}
92110
}
93111
94-
private function onApplyDefaultLayout(e:Event):void {
112+
private function onApplyDefaultLayout(e:Event = null):void {
95113
if (_defaultLayout != null)
96114
selectedItem = _defaultLayout;
115+
else
116+
shouldSelectedItemGoToDefaultBecauseTheEventWasLost = true;
97117
}
98118
99119
private function onRedefineLayout(e:RedefineLayoutEvent):void {

0 commit comments

Comments
 (0)