Skip to content

Commit

Permalink
Merge pull request #604 from mconf/fix-context-menu-on-master
Browse files Browse the repository at this point in the history
Improvements on MDIWindow context menu
  • Loading branch information
ritzalam committed Apr 9, 2015
2 parents d355312 + aa4ec0c commit ed46391
Show file tree
Hide file tree
Showing 26 changed files with 157 additions and 90 deletions.
4 changes: 1 addition & 3 deletions bigbluebutton-client/src/SharedNotesModule.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.containers.MDIWindow;
import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.CloseWindowEvent;
Expand Down Expand Up @@ -100,4 +98,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
public function stop():void {}
]]>
</mx:Script>
</mx:Module>
</mx:Module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2015 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 3.0 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/>.
*
*/
package org.bigbluebutton.common
{
import flash.ui.ContextMenu;

import flexlib.mdi.containers.MDIWindow;
import flexlib.mdi.managers.MDIManager;

import mx.utils.ObjectUtil;

/**
* This class exists so we can properly handle context menus on MDIWindow
* instances. Also, we'll be able in the future to properly handle shortcuts
* such as SHIFT + LEFT/RIGHT ARROW while in a text area (today, besides
* selecting the text, it will move the window).
*/
public class CustomMdiWindow extends MDIWindow {

private static const IGNORED_MENU_ITEMS:Array = new Array(
MDIWindow.CONTEXT_MENU_LABEL_CLOSE,
MDIManager.CONTEXT_MENU_LABEL_TILE,
MDIManager.CONTEXT_MENU_LABEL_TILE_FILL,
MDIManager.CONTEXT_MENU_LABEL_CASCADE,
MDIManager.CONTEXT_MENU_LABEL_SHOW_ALL );

private var _customContextMenuItems:Array = null;

private function filterContextMenu(item:*, index:int, array:Array):Boolean {
return IGNORED_MENU_ITEMS.indexOf(item.caption) < 0;
}

override public function updateContextMenu():void {
super.updateContextMenu();

var modifiedContextMenuItems:Array = new Array();

if (customContextMenuItems != null) {
if (modifiedContextMenuItems.length > 0 && customContextMenuItems.length > 0) {
modifiedContextMenuItems[0].separatorBefore = true;
}
modifiedContextMenuItems = customContextMenuItems.concat(modifiedContextMenuItems);
}

if (this.contextMenu != null) {
var filteredMenu:Array = this.contextMenu.customItems.filter(filterContextMenu);
if (modifiedContextMenuItems.length > 0 && filteredMenu.length > 0) {
filteredMenu[0].separatorBefore = true;
}
modifiedContextMenuItems = modifiedContextMenuItems.concat(filteredMenu);
}

var modifiedContextMenu:ContextMenu = new ContextMenu();
modifiedContextMenu.hideBuiltInItems();
modifiedContextMenu.customItems = modifiedContextMenuItems;
this.contextMenu = modifiedContextMenu;
}

override public function set showCloseButton(value:Boolean):void {
super.showCloseButton = value;

updateContextMenu();
}

public function get customContextMenuItems():Array {
return _customContextMenuItems;
}

public function set customContextMenuItems(value:Array):void {
_customContextMenuItems = value;

updateContextMenu();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->

<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
title="Log Window" creationComplete="displayLogMessages();"
showCloseButton="true" xmlns:text="flash.text.*">
Expand Down Expand Up @@ -88,4 +88,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:Button label="Refresh" click="displayLogMessages()"/>
</mx:HBox>
</mx:ApplicationControlBar>
</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import flash.events.MouseEvent;
import flash.geom.Point;
import flexlib.mdi.containers.MDIWindow;
import flexlib.mdi.effects.effectsLib.MDIVistaEffects;
import mx.collections.ArrayCollection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->

<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:mate="http://mate.asfusion.com/"
title="Network monitor"
Expand Down Expand Up @@ -136,4 +136,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</mx:VBox>
</mx:Panel>

</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->

<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
showCloseButton="true"
initialize="init()"
Expand Down Expand Up @@ -289,4 +289,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:DataGridColumn dataField="func" headerText="{ResourceUtil.getInstance().getString('bbb.shortcuthelp.headers.function')}"/>
</mx:columns>
</mx:DataGrid>
</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ You should have received a copy of the GNU Lesser General Public License along
with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<bcast:MDIWindow xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:bcast="flexlib.mdi.containers.*"
<bcast:CustomMdiWindow xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:bcast="org.bigbluebutton.common.*"
implements="org.bigbluebutton.common.IBbbModuleWindow"
styleNameFocus="broadcastStyleFocus"
styleNameNoFocus="broadcastStyleNoFocus"
Expand All @@ -30,7 +30,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.

<mx:Script>
<![CDATA[
import flexlib.mdi.events.MDIWindowEvent;
import mx.core.UIComponent;
import mx.events.ResizeEvent;
import mx.skins.Border;
Expand Down Expand Up @@ -146,4 +145,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:Button id="playBtn" label="Play" width="15% " click="playStopVideo()" toggle="true"/>
</mx:HBox>
</mx:ControlBar>
</bcast:MDIWindow>
</bcast:CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import flexlib.controls.tabBarClasses.SuperTab;
import flexlib.controls.textClasses.StringBoundaries;
import flexlib.events.SuperTabEvent;
import flexlib.mdi.containers.MDIWindow;
import mx.collections.ArrayCollection;
import mx.containers.ControlBar;
import mx.controls.Button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->

<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:chat="org.bigbluebutton.modules.chat.views.components.*"
showCloseButton="false"
Expand All @@ -40,7 +40,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<![CDATA[
import org.bigbluebutton.modules.chat.model.ChatOptions;
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import mx.controls.Alert;
import mx.core.Application;
import mx.core.FlexGlobals;
Expand Down Expand Up @@ -192,4 +191,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</mx:Script>

<views:ChatView id="chatView" chatOptions="{chatOptions}" includeInLayout="false"/>
</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->

<dspub:MDIWindow
<dspub:CustomMdiWindow
xmlns:mx="http://www.adobe.com/2006/mxml"
implements="org.bigbluebutton.common.IBbbModuleWindow"
xmlns:mate="http://mate.asfusion.com/"
xmlns:dspub="flexlib.mdi.containers.*"
xmlns:dspub="org.bigbluebutton.common.*"
backgroundColor="#C0C0C0"
initialize="init()"
creationComplete="onCreationComplete()"
Expand All @@ -48,7 +48,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import flexlib.scheduling.scheduleClasses.BackgroundItem;
import mx.core.UIComponent;
Expand Down Expand Up @@ -474,4 +473,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</dspub:states>
<mx:Image id="cursorImg" visible="false" source="@Embed('../../assets/images/cursor4.png')"/>

</dspub:MDIWindow>
</dspub:CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->

<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
width="600" height="400"
initialize="init()"
Expand Down Expand Up @@ -321,4 +321,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
toolTip="{btnActualSize.selected ? ResourceUtil.getInstance().getString('bbb.desktopView.fitToWindow') : ResourceUtil.getInstance().getString('bbb.desktopView.actualSize')}"
tabIndex="{baseIndex+4}"/>
</mx:HBox>
</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<!--
Notes.mxml is the main view of the SharedNotes application
-->
<MDIWindow xmlns="flexlib.mdi.containers.*" xmlns:mx="http://www.adobe.com/2006/mxml"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*" xmlns:mx="http://www.adobe.com/2006/mxml"
width="400" height="300" xmlns:mate="http://mate.asfusion.com/"
implements="org.bigbluebutton.common.IBbbModuleWindow" creationComplete="onCreationComplete()"
label="Example Chat Window" layout="vertical">

<mx:Script>
<![CDATA[
import flexlib.mdi.events.MDIWindowEvent;
import org.bigbluebutton.main.views.MainCanvas;
private var proxy:ExampleChatProxy;
Expand Down Expand Up @@ -65,4 +63,4 @@ Notes.mxml is the main view of the SharedNotes application
<mx:TextInput id="txtInput" width="90%" />
<mx:Button id="btnSendMessage" label="Send Message" click="sendNewMessage()" />
</mx:HBox>
</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import flash.net.FileReference;
import flexlib.mdi.containers.MDICanvas;
import flexlib.mdi.containers.MDIWindow;
import flexlib.mdi.events.MDIManagerEvent;
import flexlib.mdi.events.MDIWindowEvent;
import flexlib.mdi.managers.MDIManager;
import mx.collections.ArrayCollection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ You should have received a copy of the GNU Lesser General Public License along
with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<ns:MDIWindow xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:ns="http://code.google.com/p/flexlib/"
<ns:CustomMdiWindow xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:ns="org.bigbluebutton.common.*"
xmlns:views="org.bigbluebutton.modules.notes.views.*"
implements="org.bigbluebutton.common.IBbbModuleWindow"
title="Notes"
Expand All @@ -46,4 +46,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</mx:Script>

<views:NotesView id="notesView" notesArray="{notesModel}"/>
</ns:MDIWindow>
</ns:CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $Id: $
<!--
Notes.mxml is the main view of the SharedNotes application
-->
<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
width="510" height="600"
xmlns:mate="http://mate.asfusion.com/"
Expand Down Expand Up @@ -46,4 +46,4 @@ Notes.mxml is the main view of the SharedNotes application


<poll:PollCreatePanel width="100%" height="100%"/>
</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$Id: $
-->

<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:poll="org.bigbluebutton.modules.polling.views.*"
height="510"
Expand Down Expand Up @@ -54,4 +54,4 @@
</mx:Script>

<poll:PollResultPanel width="100%" height="100%" viewModel="{viewModel}" pollID="{pollID}"/>
</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $Id: $
<!--
Notes.mxml is the main view of the SharedNotes application
-->
<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
width="510" height="600"
xmlns:mate="http://mate.asfusion.com/"
Expand All @@ -32,8 +32,6 @@ Notes.mxml is the main view of the SharedNotes application
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import mx.collections.ArrayCollection;
import mx.containers.HBox;
import mx.controls.Alert;
Expand Down Expand Up @@ -179,4 +177,4 @@ Notes.mxml is the main view of the SharedNotes application
label="{ResourceUtil.getInstance().getString('bbb.polling.pollPreview.cancel')}" />
</mx:ControlBar>

</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $Id: $
<!--
Notes.mxml is the main view of the SharedNotes application
-->
<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
width="700" height="450"
xmlns:mate="http://mate.asfusion.com/"
Expand Down Expand Up @@ -49,4 +49,4 @@ Notes.mxml is the main view of the SharedNotes application

<poll:PollMainPanel width="100%" height="100%" viewModel="{viewModel}"/>

</MDIWindow>
</CustomMdiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $Id: $
<!--
Notes.mxml is the main view of the SharedNotes application
-->
<MDIWindow xmlns="flexlib.mdi.containers.*"
<CustomMdiWindow xmlns="org.bigbluebutton.common.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
width="510" height="450"
xmlns:mate="http://mate.asfusion.com/"
Expand Down Expand Up @@ -49,4 +49,4 @@ Notes.mxml is the main view of the SharedNotes application


<poll:TakePollPanel id="takePollPanel" width="100%" height="100%" viewModel="{viewModel}" pollID="{pollID}"/>
</MDIWindow>
</CustomMdiWindow>
Loading

0 comments on commit ed46391

Please sign in to comment.