Merge branch 'layout-module' of https://github.com/mconf/bigbluebutton into mconf-layout-module

Conflicts:
	bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as
	bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml
This commit is contained in:
Markos Calderon 2013-03-08 17:04:02 -05:00
commit 34616c04d8
7 changed files with 161 additions and 47 deletions

View File

@ -132,6 +132,18 @@ bbb.desktopView.actualSize = Exibir tamanho original
bbb.toolbar.phone.toolTip = Iniciar Meu Microfone bbb.toolbar.phone.toolTip = Iniciar Meu Microfone
bbb.toolbar.deskshare.toolTip = Compartilhar Meu Desktop bbb.toolbar.deskshare.toolTip = Compartilhar Meu Desktop
bbb.toolbar.video.toolTip = Compartilhar Minha Câmera bbb.toolbar.video.toolTip = Compartilhar Minha Câmera
bbb.layout.addButton.toolTip = Adicionar layout personalizado à lista
bbb.layout.combo.toolTip = Modificar layout atual
bbb.layout.loadButton.toolTip = Carregar layouts de um arquivo
bbb.layout.saveButton.toolTip = Salvar layouts para um arquivo
bbb.layout.lockButton.toolTip = Fixar layout
bbb.layout.combo.prompt = Aplicar layout
bbb.layout.combo.custom = * Layout personalizado
bbb.layout.combo.customName = Layout personalizado
bbb.layout.combo.remote = Remoto
bbb.layout.save.complete = Layouts salvos com sucesso
bbb.layout.load.complete = Layouts carregados com sucesso
bbb.layout.load.failed = Falha ao carregar layouts
bbb.highlighter.toolbar.pencil = Caneta Marcatexto bbb.highlighter.toolbar.pencil = Caneta Marcatexto
bbb.highlighter.toolbar.ellipse = Círculo bbb.highlighter.toolbar.ellipse = Círculo
bbb.highlighter.toolbar.rectangle = Retângulo bbb.highlighter.toolbar.rectangle = Retângulo

View File

@ -0,0 +1,34 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
* Author: Felipe Cecagno <felipe@mconf.org>
*/
package org.bigbluebutton.modules.layout.events
{
import flash.events.Event;
public class ComboBoxCreatedEvent extends Event
{
public static const COMBOBOX_CREATED_EVENT:String = "COMBOBOX_CREATED_EVENT";
public function ComboBoxCreatedEvent(type:String = COMBOBOX_CREATED_EVENT)
{
super(type, true, false);
}
}
}

View File

@ -24,6 +24,7 @@ package org.bigbluebutton.modules.layout.events
public class LayoutsLoadedEvent extends Event public class LayoutsLoadedEvent extends Event
{ {
public static const LAYOUTS_LOADED_EVENT:String = "LAYOUTS_LOADED_EVENT"; public static const LAYOUTS_LOADED_EVENT:String = "LAYOUTS_LOADED_EVENT";
public static const SEND_LAYOUTS_LOADED_EVENT:String = "SEND_LAYOUTS_LOADED_EVENT";
public var layouts:LayoutDefinitionFile = null; public var layouts:LayoutDefinitionFile = null;
public var success:Boolean = false; public var success:Boolean = false;
public var error:TypeError = null; public var error:TypeError = null;

View File

@ -49,29 +49,59 @@ package org.bigbluebutton.modules.layout.managers
import org.bigbluebutton.modules.layout.model.WindowLayout; import org.bigbluebutton.modules.layout.model.WindowLayout;
import org.bigbluebutton.util.i18n.ResourceUtil; import org.bigbluebutton.util.i18n.ResourceUtil;
public class LayoutManager extends EventDispatcher { public class LayoutManager extends EventDispatcher {
private var _layouts:LayoutDefinitionFile = null; private var _layouts:LayoutDefinitionFile = null;
private var _canvas:MDICanvas = null; private var _canvas:MDICanvas = null;
private var _globalDispatcher:Dispatcher = new Dispatcher(); private var _globalDispatcher:Dispatcher = new Dispatcher();
private var _locked:Boolean = false; private var _locked:Boolean = false;
private var _currentLayout:LayoutDefinition = null; private var _currentLayout:LayoutDefinition = null;
private var _detectContainerChange:Boolean = true; private var _detectContainerChange:Boolean = true;
private var _containerDeactivated:Boolean = false; private var _containerDeactivated:Boolean = false;
private var _sendCurrentLayoutUpdateTimer:Timer = new Timer(500,1); private var _sendCurrentLayoutUpdateTimer:Timer = new Timer(500,1);
private var _applyCurrentLayoutTimer:Timer = new Timer(150,1); private var _applyCurrentLayoutTimer:Timer = new Timer(150,1);
private var _customLayoutsCount:int = 0; private var _delayToSendLayoutsToCombobox:Timer = new Timer(60,0);
private var _eventsToDelay:Array = new Array(MDIManagerEvent.WINDOW_RESTORE, private var _customLayoutsCount:int = 0;
MDIManagerEvent.WINDOW_MINIMIZE, private var comboboxIsInitialized:Boolean = false;
MDIManagerEvent.WINDOW_MAXIMIZE); private var _eventsToDelay:Array = new Array(MDIManagerEvent.WINDOW_RESTORE,
MDIManagerEvent.WINDOW_MINIMIZE,
MDIManagerEvent.WINDOW_MAXIMIZE);
public function LayoutManager() {
_applyCurrentLayoutTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void { public function LayoutManager() {
applyLayout(_currentLayout); _applyCurrentLayoutTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
}); applyLayout(_currentLayout);
_sendCurrentLayoutUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void { });
sendLayoutUpdate(updateCurrentLayout()); _sendCurrentLayoutUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
}); sendLayoutUpdate(updateCurrentLayout());
} });
_delayToSendLayoutsToCombobox.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
checkIfCanSendLayoutToCombobox();
});
}
public function sendPopulateComboboxEvent():void {
LogUtil.debug("Sending layout to populate combobox");
var sendLayoutsLoaded:LayoutsLoadedEvent = new LayoutsLoadedEvent(LayoutsLoadedEvent.SEND_LAYOUTS_LOADED_EVENT );
sendLayoutsLoaded.layouts = _layouts;
_globalDispatcher.dispatchEvent(sendLayoutsLoaded);
}
public function initDelayTimerUntilComboboxIsInitialized():void {
_delayToSendLayoutsToCombobox.start();
}
public function checkIfCanSendLayoutToCombobox():void {
if(comboboxIsInitialized) {
if(_delayToSendLayoutsToCombobox != null) {
_delayToSendLayoutsToCombobox.stop();
}
sendPopulateComboboxEvent();
}
}
public function loadServerLayouts(layoutUrl:String):void { public function loadServerLayouts(layoutUrl:String):void {
LogUtil.debug("LayoutManager: loading server layouts from " + layoutUrl); LogUtil.debug("LayoutManager: loading server layouts from " + layoutUrl);
@ -79,9 +109,13 @@ package org.bigbluebutton.modules.layout.managers
loader.addEventListener(LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT, function(e:LayoutsLoadedEvent):void { loader.addEventListener(LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT, function(e:LayoutsLoadedEvent):void {
if (e.success) { if (e.success) {
_layouts = e.layouts; _layouts = e.layouts;
if(comboboxIsInitialized) {
sendPopulateComboboxEvent();
}
else {
initDelayTimerUntilComboboxIsInitialized();
}
LogUtil.debug("LayoutManager: layouts loaded successfully"); LogUtil.debug("LayoutManager: layouts loaded successfully");
} else { } else {
LogUtil.error("LayoutManager: layouts not loaded (" + e.error.message + ")"); LogUtil.error("LayoutManager: layouts not loaded (" + e.error.message + ")");
} }
@ -89,6 +123,10 @@ package org.bigbluebutton.modules.layout.managers
loader.loadFromUrl(layoutUrl); loader.loadFromUrl(layoutUrl);
} }
public function comboboxInitialized():void {
comboboxIsInitialized = true;
}
public function saveLayoutsToFile():void { public function saveLayoutsToFile():void {
var _fileRef:FileReference = new FileReference(); var _fileRef:FileReference = new FileReference();
_fileRef.addEventListener(Event.COMPLETE, function(e:Event):void { _fileRef.addEventListener(Event.COMPLETE, function(e:Event):void {
@ -106,13 +144,15 @@ package org.bigbluebutton.modules.layout.managers
/* /*
* \TODO why do I need to create a new Event for this? * \TODO why do I need to create a new Event for this?
*/ */
var layoutsLoaded:LayoutsLoadedEvent = new LayoutsLoadedEvent(); //var layoutsLoaded:LayoutsLoadedEvent = new LayoutsLoadedEvent();
layoutsLoaded.layouts = _layouts; //layoutsLoaded.layouts = _layouts;
_globalDispatcher.dispatchEvent(layoutsLoaded); //_globalDispatcher.dispatchEvent(layoutsLoaded);
/* /*
* it will update the ComboBox label, and will go back to this class * it will update the ComboBox label, and will go back to this class
* to apply the default layout * to apply the default layout
*/ */
sendPopulateComboboxEvent();
_globalDispatcher.dispatchEvent(new LayoutEvent(LayoutEvent.APPLY_DEFAULT_LAYOUT_EVENT)); _globalDispatcher.dispatchEvent(new LayoutEvent(LayoutEvent.APPLY_DEFAULT_LAYOUT_EVENT));
Alert.show(ResourceUtil.getInstance().getString('bbb.layout.load.complete'), "", Alert.OK, _canvas); Alert.show(ResourceUtil.getInstance().getString('bbb.layout.load.complete'), "", Alert.OK, _canvas);

View File

@ -21,18 +21,19 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<EventMap xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://mate.asfusion.com/"> <EventMap xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://mate.asfusion.com/">
<mx:Script> <mx:Script>
<![CDATA[ <![CDATA[
import mx.events.FlexEvent; import mx.events.FlexEvent;
import org.bigbluebutton.core.EventConstants; import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.main.events.MadePresenterEvent; import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.layout.events.ConnectionEvent; import org.bigbluebutton.modules.layout.events.ComboBoxCreatedEvent;
import org.bigbluebutton.modules.layout.events.LayoutEvent; import org.bigbluebutton.modules.layout.events.ConnectionEvent;
import org.bigbluebutton.modules.layout.events.RedefineLayoutEvent; import org.bigbluebutton.modules.layout.events.LayoutEvent;
import org.bigbluebutton.modules.layout.events.StartLayoutModuleEvent; import org.bigbluebutton.modules.layout.events.RedefineLayoutEvent;
import org.bigbluebutton.modules.layout.events.UpdateLayoutEvent; import org.bigbluebutton.modules.layout.events.StartLayoutModuleEvent;
import org.bigbluebutton.modules.layout.events.ViewInitializedEvent; import org.bigbluebutton.modules.layout.events.UpdateLayoutEvent;
import org.bigbluebutton.modules.layout.managers.LayoutManager; import org.bigbluebutton.modules.layout.events.ViewInitializedEvent;
import org.bigbluebutton.modules.layout.services.LayoutService; import org.bigbluebutton.modules.layout.managers.LayoutManager;
import org.bigbluebutton.modules.layout.services.LayoutService;
]]> ]]>
</mx:Script> </mx:Script>
@ -52,6 +53,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{LayoutService}" method="join" /> <MethodInvoker generator="{LayoutService}" method="join" />
</EventHandlers> </EventHandlers>
<EventHandlers type="{ComboBoxCreatedEvent.COMBOBOX_CREATED_EVENT}">
<MethodInvoker generator="{LayoutManager}" method="comboboxInitialized"/>
</EventHandlers>
<EventHandlers type="{LayoutEvent.STOP_LAYOUT_MODULE_EVENT}"> <EventHandlers type="{LayoutEvent.STOP_LAYOUT_MODULE_EVENT}">
<MethodInvoker generator="{LayoutService}" method="leave" /> <MethodInvoker generator="{LayoutService}" method="leave" />
<MethodInvoker generator="{LayoutEventMapDelegate}" method="stopModule" /> <MethodInvoker generator="{LayoutEventMapDelegate}" method="stopModule" />

View File

@ -69,7 +69,7 @@ package org.bigbluebutton.modules.layout.model
public function toXml():XML { public function toXml():XML {
var xml:XML = <layouts/>; var xml:XML = <layouts/>;
for each (var layoutDefinition:LayoutDefinition in _layouts) { for each (var layoutDefinition:LayoutDefinition in _layouts) {
for each (var value:XML in layoutDefinition.toXml()) { for each (var value:XML in layoutDefinition.toXml().children()) {
xml.appendChild(value); xml.appendChild(value);
} }
} }

View File

@ -31,8 +31,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{LayoutEvent.REMOTE_LOCK_LAYOUT_EVENT}" receive="{enabled=false || UserManager.getInstance().getConference().amIModerator()}" /> <mate:Listener type="{LayoutEvent.REMOTE_LOCK_LAYOUT_EVENT}" receive="{enabled=false || UserManager.getInstance().getConference().amIModerator()}" />
<mate:Listener type="{LayoutEvent.REMOTE_UNLOCK_LAYOUT_EVENT}" receive="{enabled=true}" /> <mate:Listener type="{LayoutEvent.REMOTE_UNLOCK_LAYOUT_EVENT}" receive="{enabled=true}" />
<mate:Listener type="{LayoutEvent.INVALIDATE_LAYOUT_EVENT}" method="invalidadeLayout" /> <mate:Listener type="{LayoutEvent.INVALIDATE_LAYOUT_EVENT}" method="invalidadeLayout" />
<mate:Listener type="{LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT}" method="populateLayoutsList" />
<mate:Listener type="{RedefineLayoutEvent.REDEFINE_LAYOUT_EVENT}" method="onRedefineLayout" /> <mate:Listener type="{RedefineLayoutEvent.REDEFINE_LAYOUT_EVENT}" method="onRedefineLayout" />
<mate:Listener type="{LayoutsLoadedEvent.SEND_LAYOUTS_LOADED_EVENT}" method="populateLayoutsList"/>
<mx:Script> <mx:Script>
<![CDATA[ <![CDATA[
@ -60,6 +61,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.main.views.MainToolbar; import org.bigbluebutton.main.views.MainToolbar;
import org.bigbluebutton.util.i18n.ResourceUtil; import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.modules.layout.events.LayoutEvent; import org.bigbluebutton.modules.layout.events.LayoutEvent;
import org.bigbluebutton.modules.layout.events.ComboBoxCreatedEvent;
import org.bigbluebutton.modules.layout.events.LayoutsLoadedEvent; import org.bigbluebutton.modules.layout.events.LayoutsLoadedEvent;
import org.bigbluebutton.modules.layout.events.RedefineLayoutEvent; import org.bigbluebutton.modules.layout.events.RedefineLayoutEvent;
import org.bigbluebutton.modules.layout.events.ViewInitializedEvent; import org.bigbluebutton.modules.layout.events.ViewInitializedEvent;
@ -68,12 +70,21 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.layout.model.WindowLayout; import org.bigbluebutton.modules.layout.model.WindowLayout;
import org.bigbluebutton.modules.layout.views.LayoutButton; import org.bigbluebutton.modules.layout.views.LayoutButton;
private var populated:Boolean = false;
private var _dispatcher:Dispatcher = new Dispatcher(); private var _dispatcher:Dispatcher = new Dispatcher();
private var _defaultLayout:Object = null; private var _defaultLayout:Object = null;
private var shouldSelectedItemGoToDefaultBecauseTheEventWasLost:Boolean = false;
private function init():void { private function init():void {
LogUtil.debug("LayoutsCombo: view initialized"); LogUtil.debug("LayoutsCombo: view initialized");
var comboBoxCreated:ComboBoxCreatedEvent = new ComboBoxCreatedEvent();
_dispatcher.dispatchEvent(comboBoxCreated);
} }
private function populateLayoutsList(e:LayoutsLoadedEvent):void { private function populateLayoutsList(e:LayoutsLoadedEvent):void {
@ -89,11 +100,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
idx++; idx++;
} }
invalidateDisplayList(); invalidateDisplayList();
if(shouldSelectedItemGoToDefaultBecauseTheEventWasLost) {
onApplyDefaultLayout();
}
else {
shouldSelectedItemGoToDefaultBecauseTheEventWasLost = false;
}
} }
private function onApplyDefaultLayout(e:Event):void { private function onApplyDefaultLayout(e:Event = null):void {
if (_defaultLayout != null) if (_defaultLayout != null)
selectedItem = _defaultLayout; selectedItem = _defaultLayout;
else
shouldSelectedItemGoToDefaultBecauseTheEventWasLost = true;
} }
private function onRedefineLayout(e:RedefineLayoutEvent):void { private function onRedefineLayout(e:RedefineLayoutEvent):void {