- send switched layout event

This commit is contained in:
Richard Alam 2013-01-08 21:34:22 +00:00
parent a78929af0c
commit 048e5ba6b4
5 changed files with 60 additions and 47 deletions

View File

@ -0,0 +1,16 @@
package org.bigbluebutton.core.events
{
import flash.events.Event;
public class SwitchedLayoutEvent extends Event
{
public static const SWITCHED_LAYOUT_EVENT:String = "switched layout event";
public var layoutID:String;
public function SwitchedLayoutEvent(bubbles:Boolean=true, cancelable:Boolean=false)
{
super(SWITCHED_LAYOUT_EVENT, bubbles, cancelable);
}
}
}

View File

@ -8,6 +8,7 @@ package org.bigbluebutton.main.api
import org.bigbluebutton.core.events.AmIPresenterQueryEvent;
import org.bigbluebutton.core.events.AmISharingWebcamQueryEvent;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.events.SwitchedLayoutEvent;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.core.vo.CameraSettingsVO;
import org.bigbluebutton.main.events.BBBEvent;
@ -22,6 +23,14 @@ package org.bigbluebutton.main.api
public class ExternalApiCalls {
public function handleSwitchedLayoutEvent(event:SwitchedLayoutEvent):void {
var payload:Object = new Object();
payload.eventName = EventConstants.SWITCHED_LAYOUT;
payload.layoutID = event.layoutID;
broadcastEvent(payload);
}
public function handleStreamStartedEvent(event:StreamStartedEvent):void {
var vidConf:VideoConfOptions = new VideoConfOptions();
@ -142,13 +151,6 @@ package org.bigbluebutton.main.api
broadcastEvent(payload);
}
public function handleSwitchedLayoutEvent(layoutID:String):void {
var payload:Object = new Object();
payload.eventName = EventConstants.SWITCHED_LAYOUT;
payload.layoutID = layoutID;
broadcastEvent(payload);
}
public function handleNewPublicChatEvent(event:CoreEvent):void {
var payload:Object = new Object();
payload.eventName = EventConstants.NEW_PUBLIC_CHAT;

View File

@ -26,6 +26,7 @@
import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.core.events.AmIPresenterQueryEvent;
import org.bigbluebutton.core.events.AmISharingWebcamQueryEvent;
import org.bigbluebutton.core.events.SwitchedLayoutEvent;
import org.bigbluebutton.main.api.ExternalApiCalls;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.MadePresenterEvent;
@ -81,6 +82,10 @@
<MethodInvoker generator="{ExternalApiCalls}" method="handleGetMyRoleResponse" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{SwitchedLayoutEvent.SWITCHED_LAYOUT_EVENT}" >
<MethodInvoker generator="{ExternalApiCalls}" method="handleSwitchedLayoutEvent" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{AmIPresenterQueryEvent.AM_I_PRESENTER_QUERY}" >
<MethodInvoker generator="{ExternalApiCalls}" method="handleAmIPresenterQueryEvent" arguments="{event}"/>
</EventHandlers>

View File

@ -39,6 +39,7 @@ package org.bigbluebutton.modules.layout.managers
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.EventBroadcaster;
import org.bigbluebutton.core.events.SwitchedLayoutEvent;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.core.model.Config;
import org.bigbluebutton.main.events.ModuleLoadEvent;
@ -195,9 +196,11 @@ package org.bigbluebutton.modules.layout.managers
var newLayout:LayoutDefinition = _layouts.getLayout(name);
if (newLayout == null) return;
LogUtil.debug("************** USING [" + newLayout.name + "] as new LAYOUT ***************************");
trace("************** USING [" + newLayout.name + "] as new LAYOUT ***************************");
applyLayout(newLayout);
sendLayoutUpdate(_currentLayout);
dispatchSwitchedLayoutEvent(newLayout.name);
}
public function applyDefaultLayout():void {
@ -220,11 +223,19 @@ package org.bigbluebutton.modules.layout.managers
defaultLayout = _layouts.getDefault();
}
LogUtil.debug("************** USING [" + defaultLayout.name + "] as default LAYOUT ***************************");
trace("************** USING [" + defaultLayout.name + "] as default LAYOUT ***************************");
applyLayout(defaultLayout);
sendLayoutUpdate(_currentLayout);
dispatchSwitchedLayoutEvent(defaultLayout.name);
}
private function dispatchSwitchedLayoutEvent(layoutID:String):void {
var layoutEvent:SwitchedLayoutEvent = new SwitchedLayoutEvent();
layoutEvent.layoutID = layoutID;
_globalDispatcher.dispatchEvent(layoutEvent);
}
public function lockLayout():void {
_locked = true;
LogUtil.debug("LayoutManager: layout locked by myself");

View File

@ -23,13 +23,11 @@ package org.bigbluebutton.modules.layout.model {
import flexlib.mdi.containers.MDICanvas;
import flexlib.mdi.containers.MDIWindow;
import mx.effects.Fade;
import mx.effects.Move;
import mx.effects.Parallel;
import mx.effects.Resize;
import mx.events.EffectEvent;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.utils.Dictionary;
@ -55,7 +53,7 @@ package org.bigbluebutton.modules.layout.model {
static private var EVENT_DURATION:int = 500;
public function load(vxml:XML):void {
trace("Load layout \n" + vxml.toXMLString() + "\n");
// trace("Load layout \n" + vxml.toXMLString() + "\n");
if (vxml != null) {
if (vxml.@name != undefined) {
name = vxml.@name.toString();
@ -92,8 +90,8 @@ package org.bigbluebutton.modules.layout.model {
}
}
trace("WindowLayout::load for " + name + " [minimized=" + minimized + ",maximized="
+ maximized + ",hidden=" + hidden + ",drag=" + draggable + ",resize=" + resizable + "]");
// trace("WindowLayout::load for " + name + " [minimized=" + minimized + ",maximized="
// + maximized + ",hidden=" + hidden + ",drag=" + draggable + ",resize=" + resizable + "]");
}
static public function getLayout(canvas:MDICanvas, window:MDIWindow):WindowLayout {
@ -110,21 +108,21 @@ package org.bigbluebutton.modules.layout.model {
layout.hidden = !window.visible;
layout.order = OrderManager.getInstance().getOrderByRef(window);
trace("WindowLayout::getLayout for " + layout.name + " [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
+ ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
// trace("WindowLayout::getLayout for " + layout.name + " [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
// + ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
return layout;
}
static public function setLayout(canvas:MDICanvas, window:MDIWindow, layout:WindowLayout):void {
trace("WindowLayout::setLayout for " + window.name + ",layout=" + layout.name + "]");
// trace("WindowLayout::setLayout for " + window.name + ",layout=" + layout.name + "]");
if (layout == null) {
return;
}
trace("WindowLayout::setLayout [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
+ ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
// trace("WindowLayout::setLayout [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
// + ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
layout.applyToWindow(canvas, window);
}
@ -139,13 +137,13 @@ package org.bigbluebutton.modules.layout.model {
}
private function onTimerComplete(event:TimerEvent = null):void {
trace("::onTimerComplete");
// trace("::onTimerComplete");
var obj:Object = _delayedEffects.pop();
applyToWindow(obj.canvas, obj.window);
}
public function applyToWindow(canvas:MDICanvas, window:MDIWindow):void {
trace("WindowLayout::applyToWindow for " + window.name + " using layout " + this.name + "]");
// trace("WindowLayout::applyToWindow for " + window.name + " using layout " + this.name + "]");
var effect:Parallel = new Parallel();
effect.duration = EVENT_DURATION;
@ -201,31 +199,12 @@ package org.bigbluebutton.modules.layout.model {
window.visible = false;
}
trace("WindowLayout::applyToWindow Layout= [minimized=" + this.minimized + ",maximized=" + this.maximized + ",visible=" + !this.hidden
+ ",drag=" + this.draggable + ",resize=" + this.resizable + "]");
// trace("WindowLayout::applyToWindow Layout= [minimized=" + this.minimized + ",maximized=" + this.maximized + ",visible=" + !this.hidden
// + ",drag=" + this.draggable + ",resize=" + this.resizable + "]");
trace("WindowLayout::applyToWindow Window = [minimized=" + window.minimized + ",maximized=" + window.maximized + ",visible=" + window.visible
+ ",drag=" + window.draggable + ",resize=" + window.resizable + "]");
// trace("WindowLayout::applyToWindow Window = [minimized=" + window.minimized + ",maximized=" + window.maximized + ",visible=" + window.visible
// + ",drag=" + window.draggable + ",resize=" + window.resizable + "]");
/*
var layoutHidden:Boolean = this.hidden;
// var windowVisible:Boolean = (window.alpha == 1);
var windowVisible:Boolean = window.visible;
if (windowVisible == layoutHidden) {
var fader:Fade = new Fade();
fader.alphaFrom = (layoutHidden? 1: 0);
fader.alphaTo = (layoutHidden? 0: 1);
fader.addEventListener(EffectEvent.EFFECT_START, function(e:EffectEvent):void {
if (!windowVisible)
window.enabled = window.visible = true;
});
fader.addEventListener(EffectEvent.EFFECT_END, function(e:EffectEvent):void {
if (windowVisible)
window.enabled = window.visible = false;
});
effect.addChild(fader);
}
*/
if (effect.children.length > 0) {
effect.play();
}