- add a way to specify that the windows can be resized or dragged

This commit is contained in:
Richard Alam 2012-12-18 20:01:34 +00:00
parent e5cf191935
commit 20487a75cb
3 changed files with 73 additions and 33 deletions

View File

@ -57,17 +57,17 @@
<window name="VideoDock" width="0.30972222222222223" height="0.4256198347107438" x="0.6902777777777778" y="0.568870523415978" />
</layout>
<layout name="S2SPresentation">
<window name="ChatWindow" hidden="true"/>
<window name="ListenersWindow" hidden="true" />
<window name="ViewersWindow" hidden="true"/>
<window name="PresentationWindow" width="1" height="1" x="0" y="0" />
<window name="VideoDock" hidden="true"/>
<window name="ChatWindow" hidden="true" draggable="false" resizable="false"/>
<window name="ListenersWindow" hidden="true" draggable="false" resizable="false"/>
<window name="ViewersWindow" hidden="true" draggable="false" resizable="false"/>
<window name="PresentationWindow" width="1" height="1" x="0" y="0" draggable="false" resizable="false"/>
<window name="VideoDock" hidden="true" draggable="false" resizable="false"/>
</layout>
<layout name="S2SVideoChat">
<window name="ViewersWindow" hidden="true" />
<window name="VideoDock" width="1" height="1" x="0" y="0"/>
<window name="ChatWindow" hidden="true" />
<window name="PresentationWindow" hidden="true" />
<window name="ListenersWindow" hidden="true"/>
<window name="ViewersWindow" hidden="true" draggable="false" resizable="false"/>
<window name="VideoDock" width="1" height="1" x="0" y="0" draggable="false" resizable="false"/>
<window name="ChatWindow" hidden="true" draggable="false" resizable="false"/>
<window name="PresentationWindow" hidden="true" draggable="false" resizable="false"/>
<window name="ListenersWindow" hidden="true" draggable="false" resizable="false"/>
</layout>
</layouts>

View File

@ -35,15 +35,11 @@ package org.bigbluebutton.modules.layout.model {
[Bindable] public var defaultLayout:Boolean = false;
private var _windows:Dictionary = new Dictionary();
static private var _ignoredWindows:Array = new Array("PublishWindow",
static private var _ignoredWindows:Array = new Array("AvatarWindow", "PublishWindow",
"VideoWindow", "DesktopPublishWindow", "DesktopViewWindow",
"LogWindow");
static private var _roles:Array = new Array(Role.VIEWER, Role.MODERATOR, Role.PRESENTER);
public function LayoutDefinition() {
}
private function loadLayout(vxml:XML):void {
if (vxml.@name != undefined) {
name = vxml.@name.toString();
@ -81,18 +77,19 @@ package org.bigbluebutton.modules.layout.model {
var hasModeratorLayout:Boolean = _windows.hasOwnProperty(Role.MODERATOR);
var hasPresenterLayout:Boolean = _windows.hasOwnProperty(Role.PRESENTER);
if (UserManager.getInstance().getConference().amIPresenter() && hasPresenterLayout)
return _windows[Role.PRESENTER];
else if (UserManager.getInstance().getConference().amIModerator() && hasModeratorLayout)
return _windows[Role.MODERATOR];
else if (hasViewerLayout)
return _windows[Role.VIEWER];
else if (hasModeratorLayout)
return _windows[Role.MODERATOR];
else if (hasPresenterLayout)
return _windows[Role.PRESENTER];
else {
if (UserManager.getInstance().getConference().amIPresenter() && hasPresenterLayout) {
return _windows[Role.PRESENTER];
} else if (UserManager.getInstance().getConference().amIModerator() && hasModeratorLayout) {
return _windows[Role.MODERATOR];
} else if (hasViewerLayout) {
return _windows[Role.VIEWER];
} else if (hasModeratorLayout) {
return _windows[Role.MODERATOR];
} else if (hasPresenterLayout) {
return _windows[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");
return null;
}
}
@ -189,11 +186,15 @@ package org.bigbluebutton.modules.layout.model {
}
public function applyToWindow(canvas:MDICanvas, window:MDIWindow, type:String=null):void {
if (type == null)
type = WindowLayout.getType(window);
if (type == null) {
type = WindowLayout.getType(window);
}
if (!ignoreWindowByType(type))
WindowLayout.setLayout(canvas, window, myLayout[type]);
if (!ignoreWindowByType(type)) {
trace("LayoutDefinition::applyToWindow [" + window.name + ", type=" + type + "]");
WindowLayout.setLayout(canvas, window, myLayout[type]);
}
}
static private function ignoreWindowByType(type:String):Boolean {

View File

@ -47,12 +47,15 @@ package org.bigbluebutton.modules.layout.model {
[Bindable] public var minimized:Boolean = false;
[Bindable] public var maximized:Boolean = false;
[Bindable] public var hidden:Boolean = false;
[Bindable] public var resizable:Boolean = true;
[Bindable] public var draggable:Boolean = true;
[Bindable] public var order:int = -1;
static private var EVENT_DURATION:int = 500;
public function load(vxml:XML):void {
trace("Load layout \n" + vxml.toXMLString() + "\n");
if (vxml != null) {
if (vxml.@name != undefined) {
name = vxml.@name.toString();
@ -78,10 +81,19 @@ package org.bigbluebutton.modules.layout.model {
if (vxml.@hidden != undefined) {
hidden = (vxml.@hidden.toString().toUpperCase() == "TRUE") ? true : false;
}
if (vxml.@draggable != undefined) {
draggable = (vxml.@draggable.toString().toUpperCase() == "TRUE") ? true : false;
}
if (vxml.@resizable != undefined) {
resizable = (vxml.@resizable.toString().toUpperCase() == "TRUE") ? true : false;
}
if (vxml.@order != undefined) {
order = int(vxml.@order);
}
}
trace("WindowLayout::load for " + name + " [minimized=" + minimized + ",maximized="
+ maximized + ",hidden=" + hidden + ",drag=" + draggable + ",resize=" + resizable + "]");
}
static public function getLayout(canvas:MDICanvas, window:MDIWindow):WindowLayout {
@ -93,13 +105,27 @@ package org.bigbluebutton.modules.layout.model {
layout.y = window.y / canvas.height;
layout.minimized = window.minimized;
layout.maximized = window.maximized;
layout.resizable = window.resizable;
layout.draggable = window.draggable;
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 + "]");
return layout;
}
static public function setLayout(canvas:MDICanvas, window:MDIWindow, layout:WindowLayout):void {
if (layout == null) return;
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 + "]");
layout.applyToWindow(canvas, window);
}
@ -113,11 +139,14 @@ package org.bigbluebutton.modules.layout.model {
}
private function onTimerComplete(event:TimerEvent = null):void {
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 + "]");
var effect:Parallel = new Parallel();
effect.duration = EVENT_DURATION;
effect.target = window;
@ -130,6 +159,9 @@ package org.bigbluebutton.modules.layout.model {
window.visible = true;
}
window.draggable = this.draggable;
window.resizable = this.resizable;
if (this.minimized) {
if (!window.minimized) window.minimize();
} else if (this.maximized) {
@ -168,6 +200,12 @@ package org.bigbluebutton.modules.layout.model {
if (window.visible && this.hidden) {
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 Window = [minimized=" + window.minimized + ",maximized=" + window.maximized + ",visible=" + window.visible
+ ",drag=" + window.draggable + ",resize=" + window.resizable + "]");
/*
var layoutHidden:Boolean = this.hidden;
@ -188,8 +226,9 @@ package org.bigbluebutton.modules.layout.model {
effect.addChild(fader);
}
*/
if (effect.children.length > 0)
if (effect.children.length > 0) {
effect.play();
}
}
static public function getType(obj:Object):String {