org.diamondspin
Class DSMenuBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JMenuBar
                  extended by org.diamondspin.DSMenuBar
All Implemented Interfaces:
MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, Cloneable, EventListener, Accessible, MenuElement, DSElement, JOGLDrawable

public class DSMenuBar
extends JMenuBar
implements MouseMotionListener, MouseListener, DSElement, JOGLDrawable

A DSMenuBar is a menu where the user can activate commands, change the active DSView of DSTabletopPane. There can be many menus like that around the table. Maybe one per user or one per view.

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.

Creation date : 9 april 2001

Version:
: 1.0
Author:
: Frederic vernier, (frederic.vernier@gmail.com) and Meredith Ringel (merrie@stanford.edu) under Chia Shen supervision (chia_shen@harvard.edu).
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JMenuBar
JMenuBar.AccessibleJMenuBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean Active
          if the component is active or not
protected  double alpha
           
protected  HashMap<JMenu,Double> anglesForMenus
           
protected  boolean automaticallyAssignOwner
           
protected  int Behavior
           
protected  int betaAbsFlag
           
protected  boolean DrawArc
           
protected  DSTabletopPane dsTabletopPane
          everything is diplayed in a DSTabletopPane.
static int FOLLOW_CIRCLE
           
static int FOLLOW_RECTANGLE
           
static int FREE
           
protected  Color frontColor
           
static Color HiliteColor
           
protected  int IDOwner
           
protected  int IDWaiter
           
protected  int MaxHeight
           
protected  HashMap<JMenuItem,Integer> MenusHighlighted
           
protected  int openedMenu
           
static int PUSHDOWN_FRAME
           
static int PUSHUP_FRAME
           
static int PUSHUP_SLIDE
           
protected  boolean reverse
           
static double SCALE_WHEN_ARMED
           
protected  double theta
           
protected  int type
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface org.diamondspin.DSElement
HIGH_QUALITY, LOW_QUALITY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DSMenuBar(DSTabletopPane dspane, double a)
          Constructor
 
Method Summary
 boolean acceptSlavery(DSElement dsElement)
          tells if this dselement accept to be slave of an other one.
 boolean acceptSlaveryRelease()
          tells if I accept to be released
 JMenu add(JMenu c)
           
 void addDSElementListener(DSElementListener l)
          Adds a feature to the DSElementListener attribute of the DSMenuBar object
 JMenuItem addMenuItem(String MenuName_Arg, String NewMenuItem_Arg)
          Add an item in a menu
 void beingDragged(double arg, Point touchPoint)
          xxxFred Description of the Method
 void clearMenu(String MenuName_Arg)
          Remove all the sub-menus(items) of a menu
 Object clone()
           
 void collapse()
          Deselect the actual expanded menu
 HashMap<JMenu,Double> computeAngles()
          Compute the angles for all the Jmenus
 boolean doesContain(double x, double y)
          find whether a given cartesian point falls within this element
protected  boolean doesContainSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, boolean firstLevel_Arg)
           
 void drawSubmenu(javax.media.opengl.GL2 gl, AffineTransform localTrans, JMenu menu, boolean isFirstLevel)
          paint a submenu
 void drawVeryTop(javax.media.opengl.GL2 gl)
           
 void fireDSElementDroppedEvent(int type)
          Fire the events to the suscribers
protected  void fireDSElementMovedEvent(double d, double a)
          call all the listener and tell them the menubar moved
 double getAbsoluteScale()
          Gets the absScale attribute of the DSMenuBar object
 double getAlpha()
          The degrees of freedom of the DSElements are their distance to the center, their angle comparing to the right direction (from center to the ful right), a scale (for zooming features) and
 double getBehavior()
           
 double getBeta()
          Unused
 Point getCenterPoint()
           
 double getD()
          just for compatibility
 DSElementListener[] getDSElementListener()
           
 int getHeight()
          Elements are displayed around their center (not around their top left corner) Width and Height are the amount of space used by the repaint.
 int getIDOwner()
          Gets the iDOwner attribute of the DSElement object
 int getMenuHighlight(JMenuItem menu)
           
 ArrayList<String> getMenuItems(String MenuName_Arg)
           
 double getMiddleAngle()
           
 BufferedImage getOpenMenuImage()
          return an image of the openend menu
 Point getOpenMenuPosition()
           
 double getScale()
          just for compatibility
 double getTheta()
          as alpha represent the starting angle (the left) of the menu, Theta represents the end.
 AffineTransform getTransform()
          The matrix decribing how this element is transformed before rendering
 AffineTransform getTransform(int i)
           
 int getWaiter()
          Gets the waiter attribute of the DSMenuBar object
 boolean grabElement(int DX_Arg, int DY_Arg)
          Simulate the element has been dragged.
 boolean hasPermissions(int Id)
           
 boolean isActive()
          in the centralized architecture we have some elements are in the views and one or few element are handled directly by the DSTabletopPane as drag&dropped elements.
 boolean isAutomaticallyAssignOwner()
           
 boolean isBetaAbs()
          indicate how to use beta.
 boolean isDrawArc()
           
 boolean isMouseTarget(MouseEvent event)
          tell whether a mouse click is within a certain element without actually selecting that element
 boolean isReverse()
           
 boolean isSomethingAt(double alpha)
           
 void mouseClicked(MouseEvent event)
          unused mouse callbacks
protected  boolean mouseClickedTestInside(Point2D.Double pp, Point2D.Double p, double h)
           
 void mouseDragged(MouseEvent event)
          Handle a mouse drag event.
protected  void mouseDraggedSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, MouseEvent event, boolean firstLevel_Arg)
          recursive mousePressed function for submenus
protected  boolean mouseDraggedTestInside(Point2D.Double pp, Point2D.Double p, double h)
           
 void mouseEntered(MouseEvent event)
          unused mouse callbacks
 void mouseExited(MouseEvent event)
          unused mouse callbacks
 void mouseMoved(MouseEvent event)
          Handle a mouse move event.
 void mousePressed(MouseEvent event)
          Handle a mouse pressed event.
protected  void mousePressedSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, MouseEvent event, boolean firstLevel_Arg)
          recursive mousePressed function for submenus
protected  boolean mousePressedTestInside(Point2D.Double pp, Point2D.Double p, double h)
           
 void mouseReleased(MouseEvent event)
          Handle a mouse release event.
protected  void mouseReleasedSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, MouseEvent event, boolean firstLevel_Arg)
          recursive mousePressed function for submenus
protected  boolean mouseReleasedTestInside(Point2D.Double pp, Point2D.Double p, double h)
           
protected  Component mouseTestInside(Point2D.Double pp, Point2D.Double p, double h)
           
 void moveElementCenterTo(Point2D.Double touchPoint)
          can be used to make the element change its position to be centered under the given point
 void paint(Graphics Graphics_Arg)
          Call the other paint().
 void paint(Graphics2D g, int quality)
          Paint the menubar, and sub-menus if necessary ! (open)
 void paintInside(Graphics2D g)
           
 void paintPopupInside(Graphics2D g, Point2D.Double p)
           
 void paintSubmenu(Graphics2D Graphics_Arg, JMenu JMenu_Arg, boolean FirstLevel_Arg)
          paint a submenu
 void partialHighlightMenu(JMenuItem menu, int percentage)
          force the background behavior of the menu to give a feedback on a percentage..
 void removeDSElementListener(DSElementListener l)
          register a listener
 void removeMenuItem(String MenuName_Arg, String NewMenuItem_Arg)
          remove a menu item
 JMenu renameMenu(String OldName_Arg, String NewName_Arg)
          rename a menu (not an item in a menu)
 void setActive(boolean Active_Arg)
          Sets the active attribute of the DSMenuBar object
 void setAlpha(double alpha)
          Sets the alpha attribute of the DSMenuBar object
 void setAutomaticallyAssignOwner(boolean automaticallyAssignOwner)
           
 void setBehavior(int Behavior_Arg)
          Sets the behavior of the menubar
 void setBeta(double beta)
          Unused
 void setBetaAbs(boolean betaAbs)
          change how to use beta.
 void setD(double d)
          Sets the d attribute of the DSMenuBar object
 void setDrawArc(boolean DrawArc_Arg)
          sets whether the border around the menu is drawn as an arc useful if the menus are going in a circular view
 void setHidden(boolean value)
          tells if the menubar will be hidden
 void setIDOwner(int id)
          elements can have an owner associated with them -1 means no owner
 void setReverse(boolean reverse)
           
 void setScale(double scale)
          Sets the scale attribute of the DSMenuBar object
 void setWaiter(int Id)
          Sets the waiter attribute of the DSMenuBar object
 String toString()
           
 void update()
          do nothing by default.
 
Methods inherited from class javax.swing.JMenuBar
addNotify, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getHelpMenu, getMargin, getMenu, getMenuCount, getSelectionModel, getSubElements, getUI, getUIClassID, isBorderPainted, isSelected, menuSelectionChanged, paintBorder, paramString, processKeyBinding, processKeyEvent, processMouseEvent, removeNotify, setBorderPainted, setHelpMenu, setMargin, setSelected, setSelectionModel, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.diamondspin.DSElement
getWidth, isVisible, setSize, setVisible
 

Field Detail

IDOwner

protected int IDOwner

betaAbsFlag

protected int betaAbsFlag

reverse

protected boolean reverse

type

protected int type

FREE

public static final int FREE
See Also:
Constant Field Values

PUSHUP_SLIDE

public static final int PUSHUP_SLIDE
See Also:
Constant Field Values

PUSHUP_FRAME

public static final int PUSHUP_FRAME
See Also:
Constant Field Values

PUSHDOWN_FRAME

public static final int PUSHDOWN_FRAME
See Also:
Constant Field Values

frontColor

protected Color frontColor

IDWaiter

protected int IDWaiter

SCALE_WHEN_ARMED

public static final double SCALE_WHEN_ARMED
See Also:
Constant Field Values

automaticallyAssignOwner

protected boolean automaticallyAssignOwner

Active

protected boolean Active
if the component is active or not


DrawArc

protected boolean DrawArc

dsTabletopPane

protected DSTabletopPane dsTabletopPane
everything is diplayed in a DSTabletopPane. We work in a centralized architecture


alpha

protected double alpha

HiliteColor

public static final Color HiliteColor

MaxHeight

protected int MaxHeight

FOLLOW_CIRCLE

public static final int FOLLOW_CIRCLE
See Also:
Constant Field Values

FOLLOW_RECTANGLE

public static final int FOLLOW_RECTANGLE
See Also:
Constant Field Values

Behavior

protected int Behavior

anglesForMenus

protected HashMap<JMenu,Double> anglesForMenus

theta

protected double theta

openedMenu

protected int openedMenu

MenusHighlighted

protected HashMap<JMenuItem,Integer> MenusHighlighted
Constructor Detail

DSMenuBar

public DSMenuBar(DSTabletopPane dspane,
                 double a)
Constructor

Parameters:
dspane - the container in which the menu exists
a - the starting angle
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

isReverse

public boolean isReverse()

setReverse

public void setReverse(boolean reverse)

getIDOwner

public int getIDOwner()
Description copied from interface: DSElement
Gets the iDOwner attribute of the DSElement object

Specified by:
getIDOwner in interface DSElement
Returns:
the ID of the owner of this element (-1 means no owner)

setIDOwner

public void setIDOwner(int id)
elements can have an owner associated with them -1 means no owner

Specified by:
setIDOwner in interface DSElement
Parameters:
id - The new iDOwner value

getWaiter

public int getWaiter()
Gets the waiter attribute of the DSMenuBar object

Returns:
the person who is waiting next in line to use this menu under the "some sharing/release" policy

setWaiter

public void setWaiter(int Id)
Sets the waiter attribute of the DSMenuBar object

Parameters:
Id - the user id of the person next in line to use the menu under the release policy

getD

public double getD()
just for compatibility

Specified by:
getD in interface DSElement
Returns:
The d value

setD

public void setD(double d)
Sets the d attribute of the DSMenuBar object

Specified by:
setD in interface DSElement
Parameters:
d - The new d value

getScale

public double getScale()
just for compatibility

Specified by:
getScale in interface DSElement
Returns:
The scale value

setScale

public void setScale(double scale)
Sets the scale attribute of the DSMenuBar object

Specified by:
setScale in interface DSElement
Parameters:
scale - The new scale value

isActive

public boolean isActive()
Description copied from interface: DSElement
in the centralized architecture we have some elements are in the views and one or few element are handled directly by the DSTabletopPane as drag&dropped elements. the element have to know if they are selected (or active) to repaint differently. We didn't choose the word selected which can also be implemented independently in a view to select elements.

Specified by:
isActive in interface DSElement
Returns:
if the component is active or not

setActive

public void setActive(boolean Active_Arg)
Sets the active attribute of the DSMenuBar object

Specified by:
setActive in interface DSElement
Parameters:
Active_Arg - The new active value

setDrawArc

public void setDrawArc(boolean DrawArc_Arg)
sets whether the border around the menu is drawn as an arc useful if the menus are going in a circular view

Parameters:
DrawArc_Arg - The new drawArc value

isDrawArc

public boolean isDrawArc()

getBehavior

public double getBehavior()
Returns:
the behavior of the menubar

setBehavior

public void setBehavior(int Behavior_Arg)
Sets the behavior of the menubar

Parameters:
Behavior_Arg - The new behavior value

getAlpha

public double getAlpha()
Description copied from interface: DSElement
The degrees of freedom of the DSElements are their distance to the center, their angle comparing to the right direction (from center to the ful right), a scale (for zooming features) and

Specified by:
getAlpha in interface DSElement
Returns:
the left angle of the menu (if reading from left to right)

setAlpha

public void setAlpha(double alpha)
Sets the alpha attribute of the DSMenuBar object

Specified by:
setAlpha in interface DSElement
Parameters:
alpha - The new alpha value

setBeta

public void setBeta(double beta)
Unused

Specified by:
setBeta in interface DSElement
Parameters:
beta - The new beta value

getBeta

public double getBeta()
Unused

Specified by:
getBeta in interface DSElement
Returns:
The beta value

getTheta

public double getTheta()
as alpha represent the starting angle (the left) of the menu, Theta represents the end. cannot be changet because depend on alpha and size of the menubar.

Returns:
The theta value

getMiddleAngle

public double getMiddleAngle()
Returns:
an average between alpha and Theta

getOpenMenuPosition

public Point getOpenMenuPosition()
Returns:
the relative position of the openend menu to the menubar (null if no menu open)

getOpenMenuImage

public BufferedImage getOpenMenuImage()
return an image of the openend menu

Returns:
the image of the opened menu

toString

public String toString()
Overrides:
toString in class Component
Returns:
a string representation of this object

collapse

public void collapse()
Deselect the actual expanded menu


add

public JMenu add(JMenu c)
Overrides:
add in class JMenuBar

update

public void update()
do nothing by default. you may overload it to syncrhonise this menubar with others (but you'll have to call update by yourself when an other menubar is modified)


addMenuItem

public JMenuItem addMenuItem(String MenuName_Arg,
                             String NewMenuItem_Arg)
Add an item in a menu

Parameters:
MenuName_Arg - the menu name (must have been created)
NewMenuItem_Arg - the name of the new item to add in this menu
Returns:
the created Menuitem (not the string, the JCheckBoxMenuItem). null if MenuName_Arg not found

removeMenuItem

public void removeMenuItem(String MenuName_Arg,
                           String NewMenuItem_Arg)
remove a menu item

Parameters:
MenuName_Arg - the menu name (must have been created). do nothing if not exists
NewMenuItem_Arg - the name of the new item to remove in the specified menu. do nothing if not exists

getMenuItems

public ArrayList<String> getMenuItems(String MenuName_Arg)
Parameters:
MenuName_Arg - the menu name (must have been created).return null if not exists
Returns:
a vector of all the names of the sub-menus of a menu entry

renameMenu

public JMenu renameMenu(String OldName_Arg,
                        String NewName_Arg)
rename a menu (not an item in a menu)

Parameters:
OldName_Arg - the menu to rename. return null if not exists
NewName_Arg - the new name
Returns:
the JMenu modified

clearMenu

public void clearMenu(String MenuName_Arg)
Remove all the sub-menus(items) of a menu

Parameters:
MenuName_Arg - the menu name to clear

partialHighlightMenu

public void partialHighlightMenu(JMenuItem menu,
                                 int percentage)
force the background behavior of the menu to give a feedback on a percentage..

Parameters:
menu - the menu to force the background to display this partial feedback
percentage - the feedback in value (0-100). if 0 the background reflects normally the selection.

getMenuHighlight

public int getMenuHighlight(JMenuItem menu)
Parameters:
menu - the menu to force the background to display this partial feedback
Returns:
the level of hightlighting of a menu

isSomethingAt

public boolean isSomethingAt(double alpha)
Parameters:
alpha - the angle in a traditionnal trigonometric circle
Returns:
if this menu overlap this a direction given by an angle

getTransform

public AffineTransform getTransform(int i)
Returns:
the transform used for painting the ith menu

getTransform

public AffineTransform getTransform()
Description copied from interface: DSElement
The matrix decribing how this element is transformed before rendering

Specified by:
getTransform in interface DSElement
Returns:
the transform used for painting the menubar

getCenterPoint

public Point getCenterPoint()
Returns:
if a point in the center of the menubar in cartesian coordinate system

mouseDragged

public void mouseDragged(MouseEvent event)
Handle a mouse drag event.

Specified by:
mouseDragged in interface MouseMotionListener
Specified by:
mouseDragged in interface DSElement
Parameters:
event - mouse event object

mouseDraggedSubmenu

protected void mouseDraggedSubmenu(JMenu jMenu_Arg,
                                   Point mousePosition_Arg,
                                   MouseEvent event,
                                   boolean firstLevel_Arg)
recursive mousePressed function for submenus


mouseMoved

public void mouseMoved(MouseEvent event)
Handle a mouse move event.

Specified by:
mouseMoved in interface MouseMotionListener
Specified by:
mouseMoved in interface DSElement
Parameters:
event - Description of the Parameter

isMouseTarget

public boolean isMouseTarget(MouseEvent event)
tell whether a mouse click is within a certain element without actually selecting that element

Specified by:
isMouseTarget in interface DSElement
Parameters:
event - the mouse event
Returns:
whether the event was within this element

doesContain

public boolean doesContain(double x,
                           double y)
find whether a given cartesian point falls within this element

Specified by:
doesContain in interface DSElement
Parameters:
x - cartesian x coordinate
y - cartesian y coordinate
Returns:
whether the given x,y coords fall within this element

doesContainSubmenu

protected boolean doesContainSubmenu(JMenu jMenu_Arg,
                                     Point mousePosition_Arg,
                                     boolean firstLevel_Arg)

mousePressed

public void mousePressed(MouseEvent event)
Handle a mouse pressed event.

Specified by:
mousePressed in interface MouseListener
Specified by:
mousePressed in interface DSElement
Parameters:
event - mouse event object

mousePressedSubmenu

protected void mousePressedSubmenu(JMenu jMenu_Arg,
                                   Point mousePosition_Arg,
                                   MouseEvent event,
                                   boolean firstLevel_Arg)
recursive mousePressed function for submenus


mouseReleased

public void mouseReleased(MouseEvent event)
Handle a mouse release event.

Specified by:
mouseReleased in interface MouseListener
Specified by:
mouseReleased in interface DSElement
Parameters:
event - mouse event object

mouseReleasedSubmenu

protected void mouseReleasedSubmenu(JMenu jMenu_Arg,
                                    Point mousePosition_Arg,
                                    MouseEvent event,
                                    boolean firstLevel_Arg)
recursive mousePressed function for submenus


mouseClicked

public void mouseClicked(MouseEvent event)
unused mouse callbacks

Specified by:
mouseClicked in interface MouseListener
Specified by:
mouseClicked in interface DSElement
Parameters:
event - Description of the Parameter

mouseEntered

public void mouseEntered(MouseEvent event)
unused mouse callbacks

Specified by:
mouseEntered in interface MouseListener
Parameters:
event - Description of the Parameter

mouseExited

public void mouseExited(MouseEvent event)
unused mouse callbacks

Specified by:
mouseExited in interface MouseListener
Parameters:
event - Description of the Parameter

computeAngles

public final HashMap<JMenu,Double> computeAngles()
Compute the angles for all the Jmenus

Returns:
a list of the angles for each submenus

getHeight

public int getHeight()
Description copied from interface: DSElement
Elements are displayed around their center (not around their top left corner) Width and Height are the amount of space used by the repaint. some pixels can be transparent anyway

Specified by:
getHeight in interface DSElement
Overrides:
getHeight in class JComponent
Returns:
The height value

paint

public void paint(Graphics Graphics_Arg)
Call the other paint(). The one by default. There are no 2 qualities of repaint for this element

Specified by:
paint in interface DSElement
Overrides:
paint in class JComponent
Parameters:
Graphics_Arg - the graphics context

mouseTestInside

protected Component mouseTestInside(Point2D.Double pp,
                                    Point2D.Double p,
                                    double h)

mouseClickedTestInside

protected boolean mouseClickedTestInside(Point2D.Double pp,
                                         Point2D.Double p,
                                         double h)

mouseDraggedTestInside

protected boolean mouseDraggedTestInside(Point2D.Double pp,
                                         Point2D.Double p,
                                         double h)

mouseReleasedTestInside

protected boolean mouseReleasedTestInside(Point2D.Double pp,
                                          Point2D.Double p,
                                          double h)

mousePressedTestInside

protected boolean mousePressedTestInside(Point2D.Double pp,
                                         Point2D.Double p,
                                         double h)

paintPopupInside

public void paintPopupInside(Graphics2D g,
                             Point2D.Double p)

paintInside

public void paintInside(Graphics2D g)

setHidden

public void setHidden(boolean value)
tells if the menubar will be hidden

Parameters:
value - The new hidden value

drawVeryTop

public void drawVeryTop(javax.media.opengl.GL2 gl)
Specified by:
drawVeryTop in interface JOGLDrawable

paint

public void paint(Graphics2D g,
                  int quality)
Paint the menubar, and sub-menus if necessary ! (open)

Specified by:
paint in interface DSElement
Parameters:
g - a graphic context on the general component
quality - the quality of the rendering

paintSubmenu

public void paintSubmenu(Graphics2D Graphics_Arg,
                         JMenu JMenu_Arg,
                         boolean FirstLevel_Arg)
paint a submenu


drawSubmenu

public void drawSubmenu(javax.media.opengl.GL2 gl,
                        AffineTransform localTrans,
                        JMenu menu,
                        boolean isFirstLevel)
paint a submenu


grabElement

public boolean grabElement(int DX_Arg,
                           int DY_Arg)
Simulate the element has been dragged. uses the coordinates given as grab point in the local coordinate system

Specified by:
grabElement in interface DSElement
Parameters:
DX_Arg - Description of the Parameter
DY_Arg - Description of the Parameter

addDSElementListener

public void addDSElementListener(DSElementListener l)
Adds a feature to the DSElementListener attribute of the DSMenuBar object

Specified by:
addDSElementListener in interface DSElement
Parameters:
l - The feature to be added to the DSElementListener attribute

removeDSElementListener

public void removeDSElementListener(DSElementListener l)
register a listener

Specified by:
removeDSElementListener in interface DSElement
Parameters:
l - Description of the Parameter

getDSElementListener

public DSElementListener[] getDSElementListener()

fireDSElementMovedEvent

protected void fireDSElementMovedEvent(double d,
                                       double a)
call all the listener and tell them the menubar moved

Parameters:
d - new distance to the center
a - new angle from horizontal

fireDSElementDroppedEvent

public void fireDSElementDroppedEvent(int type)
Fire the events to the suscribers


hasPermissions

public boolean hasPermissions(int Id)
Parameters:
Id - the user whose permissions you want to check
Returns:
whether the given user has permission to access this element

getAbsoluteScale

public double getAbsoluteScale()
Gets the absScale attribute of the DSMenuBar object

Specified by:
getAbsoluteScale in interface DSElement
Returns:
The absScale value

moveElementCenterTo

public void moveElementCenterTo(Point2D.Double touchPoint)
can be used to make the element change its position to be centered under the given point

Specified by:
moveElementCenterTo in interface DSElement
Parameters:
touchPoint - (the cartesian point under which to center the element)

beingDragged

public void beingDragged(double arg,
                         Point touchPoint)
xxxFred Description of the Method

Parameters:
arg - Description of the Parameter
touchPoint - Description of the Parameter

acceptSlavery

public boolean acceptSlavery(DSElement dsElement)
Description copied from interface: DSElement
tells if this dselement accept to be slave of an other one.

Specified by:
acceptSlavery in interface DSElement

acceptSlaveryRelease

public boolean acceptSlaveryRelease()
Description copied from interface: DSElement
tells if I accept to be released

Specified by:
acceptSlaveryRelease in interface DSElement

setBetaAbs

public void setBetaAbs(boolean betaAbs)
Description copied from interface: DSElement
change how to use beta. if false beta is used as an extra angle around the element center. if true, beta is used to achieve such absolute angle for the top of the document

Specified by:
setBetaAbs in interface DSElement

isBetaAbs

public boolean isBetaAbs()
Description copied from interface: DSElement
indicate how to use beta. if false beta is used as an extra angle around the element center. if true, beta is used to achieve such absolute angle for the top of the document

Specified by:
isBetaAbs in interface DSElement

isAutomaticallyAssignOwner

public boolean isAutomaticallyAssignOwner()

setAutomaticallyAssignOwner

public void setAutomaticallyAssignOwner(boolean automaticallyAssignOwner)


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