Merge branch 'mood-menu' of github.com:pedrobmarin/bigbluebutton into mconf

This commit is contained in:
Felipe Cecagno 2016-11-14 13:16:17 -02:00
commit 8dca32d23b
2 changed files with 18 additions and 19 deletions

View File

@ -22,6 +22,7 @@ package org.bigbluebutton.modules.users.views {
import flash.geom.Point; import flash.geom.Point;
import mx.collections.ArrayCollection; import mx.collections.ArrayCollection;
import mx.containers.VBox; import mx.containers.VBox;
import mx.controls.Button;
import mx.controls.Menu; import mx.controls.Menu;
import mx.core.ScrollPolicy; import mx.core.ScrollPolicy;
import mx.events.FlexMouseEvent; import mx.events.FlexMouseEvent;
@ -30,6 +31,7 @@ package org.bigbluebutton.modules.users.views {
import org.bigbluebutton.common.Images; import org.bigbluebutton.common.Images;
import org.bigbluebutton.core.managers.UserManager; import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.model.users.events.EmojiStatusEvent; import org.bigbluebutton.main.model.users.events.EmojiStatusEvent;
import org.bigbluebutton.main.views.WellPositionedMenu;
import org.bigbluebutton.util.i18n.ResourceUtil; import org.bigbluebutton.util.i18n.ResourceUtil;
public class MoodMenu extends VBox { public class MoodMenu extends VBox {
@ -42,20 +44,26 @@ package org.bigbluebutton.modules.users.views {
private var menu:Menu; private var menu:Menu;
private var _btn:Button;
public function set btn(btn:Button):void {
_btn = btn;
drawMoodMenu();
}
public function MoodMenu() { public function MoodMenu() {
dispatcher = new Dispatcher(); dispatcher = new Dispatcher();
images = new Images(); images = new Images();
addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, mouseDownOutsideHandler, false, 0, true); addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, mouseDownOutsideHandler, false, 0, true);
this.horizontalScrollPolicy = ScrollPolicy.OFF; this.horizontalScrollPolicy = ScrollPolicy.OFF;
this.verticalScrollPolicy = ScrollPolicy.OFF; this.verticalScrollPolicy = ScrollPolicy.OFF;
drawMoodMenu();
} }
public function show(position:Point):void { public function show():void {
menu.x = position.x; if (menu != null) {
menu.y = position.y;
menu.show(); menu.show();
} }
}
private function drawMoodMenu():void { private function drawMoodMenu():void {
var moods:ArrayCollection = new ArrayCollection(); var moods:ArrayCollection = new ArrayCollection();
@ -71,7 +79,7 @@ package org.bigbluebutton.modules.users.views {
moods.addItem(item); moods.addItem(item);
} }
menu = Menu.createMenu(null, moods.toArray(), true); menu = WellPositionedMenu.createMenu(null, moods.toArray(), _btn, true);
menu.addEventListener(MenuEvent.ITEM_CLICK, buttonMouseEventHandler, false, 0, true); menu.addEventListener(MenuEvent.ITEM_CLICK, buttonMouseEventHandler, false, 0, true);
} }

View File

@ -69,6 +69,7 @@
import org.bigbluebutton.main.model.users.events.KickUserEvent; import org.bigbluebutton.main.model.users.events.KickUserEvent;
import org.bigbluebutton.main.model.users.events.RoleChangeEvent; import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
import org.bigbluebutton.main.views.MainCanvas; import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.main.views.WellPositionedMenu;
import org.bigbluebutton.modules.users.events.MeetingMutedEvent; import org.bigbluebutton.modules.users.events.MeetingMutedEvent;
import org.bigbluebutton.modules.users.events.UsersRollEvent; import org.bigbluebutton.modules.users.events.UsersRollEvent;
import org.bigbluebutton.modules.users.model.UsersOptions; import org.bigbluebutton.modules.users.model.UsersOptions;
@ -241,8 +242,8 @@
private function openEmojiStatusMenu() : void private function openEmojiStatusMenu() : void
{ {
var moodMenu:MoodMenu = PopUpManager.createPopUp(DisplayObject(FlexGlobals.topLevelApplication), MoodMenu, false) as MoodMenu; var moodMenu:MoodMenu = PopUpManager.createPopUp(DisplayObject(FlexGlobals.topLevelApplication), MoodMenu, false) as MoodMenu;
var menuXY:Point = emojiStatusBtn.localToGlobal(new Point(emojiStatusBtn.width + 2, emojiStatusBtn.height - moodMenu.height)); moodMenu.btn = emojiStatusBtn;
moodMenu.show(menuXY); moodMenu.show();
} }
private function openSettings():void { private function openSettings():void {
@ -264,14 +265,11 @@
// but it would require an extra listener for the MenuCloseEvent. // but it would require an extra listener for the MenuCloseEvent.
if (paramsMenu) { if (paramsMenu) {
paramsMenu.removeEventListener(MenuEvent.ITEM_CLICK, menuClickHandler); paramsMenu.removeEventListener(MenuEvent.ITEM_CLICK, menuClickHandler);
paramsMenu.removeEventListener(MenuEvent.MENU_SHOW, menuShowHandler);
paramsMenu.hide(); paramsMenu.hide();
} }
paramsMenu = Menu.createMenu(null, paramsMenuData, true); paramsMenu = WellPositionedMenu.createMenu(null, paramsMenuData, settingsBtn, true);
paramsMenu.variableRowHeight = false;
paramsMenu.addEventListener(MenuEvent.ITEM_CLICK, menuClickHandler); paramsMenu.addEventListener(MenuEvent.ITEM_CLICK, menuClickHandler);
paramsMenu.addEventListener(MenuEvent.MENU_SHOW, menuShowHandler);
paramsMenu.show(); paramsMenu.show();
} }
@ -281,13 +279,6 @@
} }
} }
private function menuShowHandler(e:MenuEvent):void {
paramsMenu.setFocus();
var menuXY:Point = settingsBtn.localToGlobal(new Point(settingsBtn.width + 2, settingsBtn.height - paramsMenu.height));
paramsMenu.x = menuXY.x;
paramsMenu.y = menuXY.y;
}
private function handleChangedLockSettingsEvent(e:LockControlEvent):void { private function handleChangedLockSettingsEvent(e:LockControlEvent):void {
var lockSettings:LockSettingsVO = UserManager.getInstance().getConference().getLockSettings(); var lockSettings:LockSettingsVO = UserManager.getInstance().getConference().getLockSettings();
roomLocked = lockSettings.isAnythingLocked() && ( lockSettings.getLockOnJoin() || UsersUtil.isAnyoneLocked()); roomLocked = lockSettings.isAnythingLocked() && ( lockSettings.getLockOnJoin() || UsersUtil.isAnyoneLocked());