org.diamondspin
Class DSMenuBarManager

java.lang.Object
  extended by org.diamondspin.DSMenuBarManager

public class DSMenuBarManager
extends Object

DSMenuBarManager is a utility class for DSTabletopPane. It manages all the menubars.

Copyright 2002-2009 DiamondSpin project. All Rights Reserved.

Permission to use, copy, modify and distribute this software and its documentation for educational, research and non-profit purposes, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and the following three paragraphs appear in all copies.

To request Permission to incorporate this software into commercial products contact one of the authors of the project.
  • Frederic Vernier (frederic.vernier@limsi.fr)
  • Chia Shen (chia_shen@harvard.edu)
  • Guillaume Besacier (guillaume.besacier@limsi.fr)
  • Daniel Wigdor (dwigdor@microsoft.com)

IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

created Sept 11, 2003

Version:
: 1.0
Author:
: Frederic vernier, (frederic.vernier@gmail.com) under Chia Shen supervision (chia_shen@harvard.edu).

Field Summary
protected  ArrayList<DSMenuBar> DSMenuBarList
          There are multiple menubars.
 
Constructor Summary
protected DSMenuBarManager(DSTabletopPane dsTabletopPane_Arg)
          Constructor for the DSPopupMenuManager object
 
Method Summary
 void addDSMenuBar(DSMenuBar dsMenuBar)
          add a menubar in the list
 int checkMenubarAsEventTarget(MouseEvent event)
          checks if an event(mouse, DT, any spatial event) is targetting a menubar or not (-1)
 void collapseMenu(int id)
          collapses the submenu from a menubar belonging to a certain owner
 DSMenuBar getDSMenuBar(int index)
           
 int getDSMenuBarCount()
           
 ArrayList<DSMenuBar> getDSMenuBarList()
           
 double getMenuAngle(int id)
          return the angle of someone's menubar or a default angle if they have no menubar
 boolean hasAMenuBar(int id)
          check if someone owns a menubar
 boolean isDSMenuBarAt(double angle)
          determine if there is a menubar at a given angle
 boolean isMenuBarNearUser(DSMenuBar Menu_Arg, int id)
          For oriented sharing mode for menus, since I don't know what angle determines a certain user outside of table mode, I will make an educated guess by assuming it is the angle of their personal menu bar if they have one
 boolean mouseClickedMenuBar(MouseEvent event, int id)
          Dispatch a mouse click event to the menubars to see it they are interested
 boolean mousePressedMenubar(MouseEvent event, int id)
          Dispatch a mouse release event to the menubars to see it they are interested
 boolean mouseReleasedMenuBar(MouseEvent event, int id)
          Dispatch a mouse release event to the menubars to see it they are interested
protected  void paintDSMenubars(Graphics2D Graphics_Arg, boolean drawDragObject)
          paint the menubars in their own layer.
 void pressMenubar(MouseEvent event, int id, DSMenuBar dsMenuBar)
          send a mousePressed() event to a given menubar
 void removeAllDSMenuBars()
          remove all menubar around the table
 void removeDSMenuBar(DSMenuBar dsMenuBar)
          remove a menubar in the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DSMenuBarList

protected ArrayList<DSMenuBar> DSMenuBarList
There are multiple menubars. maybe one per user, maybe more , maybe less

Constructor Detail

DSMenuBarManager

protected DSMenuBarManager(DSTabletopPane dsTabletopPane_Arg)
Constructor for the DSPopupMenuManager object

Parameters:
dsTabletopPane_Arg - the DSTabletopPane with whom I'm working with
Method Detail

getDSMenuBarCount

public int getDSMenuBarCount()
Returns:
the number of menubars

getDSMenuBar

public DSMenuBar getDSMenuBar(int index)
Parameters:
index - the index of the menubar in the list of menubars
Returns:
a menubar in the list

getDSMenuBarList

public ArrayList<DSMenuBar> getDSMenuBarList()
Returns:
The list of menubar as a vector

removeDSMenuBar

public void removeDSMenuBar(DSMenuBar dsMenuBar)
remove a menubar in the list

Parameters:
dsMenuBar - the menubar to remove

removeAllDSMenuBars

public void removeAllDSMenuBars()
remove all menubar around the table


addDSMenuBar

public void addDSMenuBar(DSMenuBar dsMenuBar)
add a menubar in the list

Parameters:
dsMenuBar - the menubar to add

isDSMenuBarAt

public boolean isDSMenuBarAt(double angle)
determine if there is a menubar at a given angle

Parameters:
angle - the angle we want to know if a menu is on it. 0 means the angle on the right
Returns:
if a menu cover this angle, along the edge of the table

mousePressedMenubar

public boolean mousePressedMenubar(MouseEvent event,
                                   int id)
Dispatch a mouse release event to the menubars to see it they are interested

Parameters:
event - the mouse event to dispatch
id - the id of the used
Returns:
true if consumed

mouseReleasedMenuBar

public boolean mouseReleasedMenuBar(MouseEvent event,
                                    int id)
Dispatch a mouse release event to the menubars to see it they are interested

Parameters:
event - the mouse event to dispatch
id - the id of the used
Returns:
true if consumed

mouseClickedMenuBar

public boolean mouseClickedMenuBar(MouseEvent event,
                                   int id)
Dispatch a mouse click event to the menubars to see it they are interested

Parameters:
event - the mouse event to dispatch
id - the id of the used
Returns:
true if consumed

pressMenubar

public void pressMenubar(MouseEvent event,
                         int id,
                         DSMenuBar dsMenuBar)
send a mousePressed() event to a given menubar

Parameters:
event - The event to give as argument
id - the user id of the initiator
dsMenuBar - The target menubar

paintDSMenubars

protected void paintDSMenubars(Graphics2D Graphics_Arg,
                               boolean drawDragObject)
paint the menubars in their own layer. This is the 2rd layer drawing.

Parameters:
Graphics_Arg - a graphic context on the general component = the back buffer of this component

checkMenubarAsEventTarget

public int checkMenubarAsEventTarget(MouseEvent event)
checks if an event(mouse, DT, any spatial event) is targetting a menubar or not (-1)

Parameters:
event - the event to test
Returns:
returns the index of the touched menubar or -1 if none was touched

hasAMenuBar

public boolean hasAMenuBar(int id)
check if someone owns a menubar

Parameters:
id - The user ID to check
Returns:
if the guy owns a menubar

getMenuAngle

public double getMenuAngle(int id)
return the angle of someone's menubar or a default angle if they have no menubar

Parameters:
id - The user ID to check
Returns:
The better angle for this person

collapseMenu

public void collapseMenu(int id)
collapses the submenu from a menubar belonging to a certain owner

Parameters:
id - menu owner

isMenuBarNearUser

public boolean isMenuBarNearUser(DSMenuBar Menu_Arg,
                                 int id)
For oriented sharing mode for menus, since I don't know what angle determines a certain user outside of table mode, I will make an educated guess by assuming it is the angle of their personal menu bar if they have one

Parameters:
Menu_Arg - The menubar to check
id - The user ID to check
Returns:
if the known position of a user correspond the menubar -+ PI / 4


Copyright © 2006 Frederic Vernier(LIMSI) Chia Shen(MERL) Guillaume Besacier(LIMSI). All Rights Reserved.