Richard Alam 2015-03-23 22:28:28 +00:00
parent 7a33b04a9a
commit bd4b95b0af
3 changed files with 37 additions and 17 deletions

View File

@ -89,13 +89,15 @@ package org.bigbluebutton.modules.layout.managers
public function LayoutManager() {
_applyCurrentLayoutTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
trace(LOG + " timerEvent layout [" + _currentLayout.name + "]");
applyLayout(_currentLayout);
trace(LOG + "Applied layout after user resized browser");
});
_sendCurrentLayoutUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
trace(LOG + "Applying layout due to window resize");
if (_autoSync)
sendLayoutUpdate(updateCurrentLayout());
trace(LOG + "Applying layout on autoSync");
sendLayoutUpdate(updateCurrentLayout(_currentLayout));
});
}
@ -162,6 +164,7 @@ package org.bigbluebutton.modules.layout.managers
_canvas.windowManager.addEventListener(MDIManagerEvent.WINDOW_RESTORE, onActionOverWindowFinished);
_canvas.windowManager.addEventListener(MDIManagerEvent.WINDOW_ADD, function(e:MDIManagerEvent):void {
checkPermissionsOverWindow(e.window);
trace(LOG + " setCanvas layout [" + _currentLayout.name + "]");
applyLayout(_currentLayout);
});
@ -200,14 +203,14 @@ package org.bigbluebutton.modules.layout.managers
defaultLayout = _layoutModel.getDefaultLayout();
}
trace("************** USING [" + defaultLayout.name + "] as default LAYOUT ***************************");
trace(LOG + " Using [" + defaultLayout.name + "] as default LAYOUT.");
applyLayout(defaultLayout);
}
private function dispatchSwitchedLayoutEvent(layoutID:String):void {
if (_currentLayout != null && _currentLayout.name == layoutID) return;
trace("************** DISPATCHING [" + layoutID + "] as new LAYOUT ***************************");
trace(LOG + " Dispatch [" + layoutID + "] as new LAYOUT");
var layoutEvent:SwitchedLayoutEvent = new SwitchedLayoutEvent();
layoutEvent.layoutID = layoutID;
_globalDispatcher.dispatchEvent(layoutEvent);
@ -245,7 +248,7 @@ package org.bigbluebutton.modules.layout.managers
layout.applyToCanvas(_canvas);
dispatchSwitchedLayoutEvent(layout.name);
}
trace(LOG + " applyLayout layout [" + layout.name + "]");
updateCurrentLayout(layout);
_detectContainerChange = true;
}
@ -262,6 +265,7 @@ package org.bigbluebutton.modules.layout.managers
public function applyRemoteLayout(e:LayoutFromRemoteEvent):void {
var layout:LayoutDefinition = e.layout;
trace(LOG + " applyRemoteLayout layout [" + layout.name + "]");
applyLayout(layout);
}
@ -317,7 +321,7 @@ package org.bigbluebutton.modules.layout.managers
checkPermissionsOverWindow(e.window);
trace(LOG + "Window is being resized. Event=[" + e.type + "]");
updateCurrentLayout();
updateCurrentLayout(_currentLayout);
/*
* some events related to animated actions must be delayed because if it's not, the
* current layout doesn't get properly updated
@ -328,13 +332,16 @@ package org.bigbluebutton.modules.layout.managers
}
}
private function updateCurrentLayout(layout:LayoutDefinition=null):LayoutDefinition {
private function updateCurrentLayout(layout:LayoutDefinition):LayoutDefinition {
trace(LOG + "updateCurrentLayout");
if (layout != null) {
if (_currentLayout) _currentLayout.currentLayout = false;
_currentLayout = layout;
trace(LOG + "updateCurrentLayout - currentLayout = [" + layout.name + "]");
layout.currentLayout = true;
} else {
_currentLayout = LayoutDefinition.getLayout(_canvas, ResourceUtil.getInstance().getString('bbb.layout.combo.customName'));
trace(LOG + "updateCurrentLayout - layout is NULL! Setting currentLayout = [" + _currentLayout.name + "]");
}
return _currentLayout;
@ -345,8 +352,11 @@ package org.bigbluebutton.modules.layout.managers
* on the role of the participant
*/
public function presenterChanged():void {
if (_canvas != null)
if (_canvas != null) {
trace(LOG + " presenterChanged layout [" + _currentLayout.name + "]");
applyLayout(_currentLayout);
}
}
}
}

View File

@ -28,6 +28,8 @@ package org.bigbluebutton.modules.layout.model {
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.modules.layout.managers.OrderManager;
private static const LOG:String = "Layout::LayoutDefinition - ";
[Bindable] public var name:String;
// default is a reserved word in actionscript
[Bindable] public var defaultLayout:Boolean = false;
@ -90,7 +92,7 @@ package org.bigbluebutton.modules.layout.model {
return _layoutsPerRole[Role.PRESENTER];
} else {
LogUtil.error("There's no layout that fits the participants profile");
trace("LayoutDefinition::getMyLayout There's no layout that fits the participants profile");
trace(LOG + "getMyLayout There's no layout that fits the participants profile");
return null;
}
}
@ -188,9 +190,13 @@ package org.bigbluebutton.modules.layout.model {
var type:String;
for each (var window:MDIWindow in windows) {
type = WindowLayout.getType(window);
if (!ignoreWindowByType(type))
trace(LOG + "Determine if we need to apply layout [" + name + "] for window [" + type + "]");
if (!ignoreWindowByType(type)) {
trace(LOG + "Applying layout [" + name + "] to window [" + type + "]");
WindowLayout.setLayout(canvas, window, transformedLayout[type]);
} else {
trace(LOG + "Ignoring layout [" + name + "] to window [" + type + "]");
}
}
}

View File

@ -136,21 +136,25 @@ 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 + "]");
if (window == null) trace("WindowLayout::setLayout - window is NULL!!!");
if (layout == null) trace("WindowLayout::setLayout - layout is NULL!!!");
if (layout.name == null) trace("WindowLayout::setLayout - layout.name is NULL!!!");
trace("WindowLayout::setLayout for " + getType(window) + ",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);
}