org.diamondspin
Class DSPopupMenu

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

public class DSPopupMenu
extends JPopupMenu
implements MouseMotionListener, MouseListener, DSElement, JOGLDrawable

DSPopupMenu is a context sensitive menu. It can be drag&dropped to get closer to the user, then correctly oriented. It can also be called on the background for a menu relative to the view itself.

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 : 6 december 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.JPopupMenu
JPopupMenu.AccessibleJPopupMenu, JPopupMenu.Separator
 
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  double alpha
          0-2PI is better but I solved the angle distance problem in DSTabletopPane so it doesn't matter now !
protected  double alphaOrigin
          Same thing than Alpha at the beginning but Alpha can change if the user drag the component AlphaOrigin will remain the same to remember the origin
protected  double beta
           
protected  int betaAbsFlag
           
static int CENTER_SIZE
           
protected  double d
          D is the distance to the center of the table from the center of the component
protected  double dOrigin
          Same thing than D at the beginning but D can change if the user drag the component DOrigin will remain the same to remember the origin
static int DRAG_ACTION
           
static int DRAG_MENU
           
protected  DSElement DSElemen1
           
protected  DSTabletopPane dsTabletopPane
           
protected  Color frontColor
           
protected  int IDOwner
           
protected  int IDWaiter
           
protected  int InteractionState
           
protected  JMenuItem JMenuItemClicked
           
protected  JMenuItem JMenuItemSelected
           
protected  Point LastMouseClic
           
protected  Point MousePress
           
protected  double Scale
          Scale factor to resize the element at low level (pixel by pixel).
static int SELECTING
           
static int WAITING
           
 
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
DSPopupMenu(DSTabletopPane dspane, double d, double alpha, int id, DSElement elem)
          Constructor
 
Method Summary
 boolean acceptSlavery(DSElement dsElement)
          popup menu dont accept to be slave of an other element
 boolean acceptSlaveryRelease()
          tells if I accept to be released
 void addDSElementListener(DSElementListener l)
          Adds a feature to the DSElementListener attribute of the DSMenuBar object
 Object clone()
           
 boolean doesContain(double x, double y)
          find whether a given cartesian point falls within this element
 void drawVeryTop(javax.media.opengl.GL2 gl)
          draw the popup menu with the opengl toolkit
protected  Point2D.Double findDistanceForRectangle(double alpha, int width, int height, double gamma)
          find how far (from point O) to put the center of a rectangle fo fit so the angle occupied by the rectangle from O in the given Gamma
protected  void fireDSElementMovedEvent(double d, double a)
          call all the listener and tell them the popup menu moved
 double getAbsoluteScale()
          Gets the absScale attribute of the DSPopupMenu 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 getAlphaOrigin()
          Gets the alphaOrigin attribute of the DSPopupMenu object
 double getBeta()
          Unused
 double getD()
          Gets the d attribute of the DSPopupMenu object
 double getDOrigin()
          Gets the dOrigin attribute of the DSPopupMenu object
 DSElementListener[] getDSElementListener()
           
 DSElement getElement()
          Gets the element that this popup menu is on top of null if it is a global popup menu
 int getIDOwner()
          Gets the iDOwner attribute of the DSElement object
 double getScale()
          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
 AffineTransform getTransform()
          return the transform matrix
 boolean grabElement(int DX_Arg, int DY_Arg)
          Simulate the element has been dragged.
 boolean isActive()
          Gets the active attribute of the DSPopupMenu object
 boolean isBetaAbs()
          indicate how to use beta.
 boolean isCorners()
           
 boolean isMouseTarget(MouseEvent MouseEvent_Arg)
          tell whether a mouse click is within a certain element without actually selecting that element
 void mouseClicked(MouseEvent MouseEvent_Arg)
          Handle a mouse click event.
 void mouseDragged(MouseEvent MouseEvent_Arg)
          Handle a mouse drag event.
 void mouseEntered(MouseEvent MouseEvent_Arg)
          Handle a mouse enter event (is not really working in our context).
 void mouseExited(MouseEvent MouseEvent_Arg)
          Handle a mouse exit event (is not really working in our context).
 void mouseMoved(MouseEvent MouseEvent_Arg)
          Handle a mouse move event.
 void mousePressed(MouseEvent MouseEvent_Arg)
          Handle a mouse pressed event.
 void mouseReleased(MouseEvent MouseEvent_Arg)
          Handle a mouse release event.
 void moveElementCenterTo(Point2D.Double touchPoint)
          can be used to make the element change its position to be centered under the given point
 void moveFlower(double d, double alpha)
           
 void movePointerToOrigin()
          move the mouse pointer to the origin of the popup menu
 void paint(Graphics2D g)
          Call the other paint().
 void paint(Graphics2D Graphics_Arg, int Quality)
          Paint the frame ...
 void removeDSElementListener(DSElementListener l)
          register a listener
 void setActive(boolean Active_Arg)
          Sets the active attribute of the DSPopupMenu object
 void setAlpha(double alpha)
          Sets the alpha attribute of the DSPopupMenu object
 void setBeta(double alpha)
          Unused
 void setBetaAbs(boolean betaAbs)
          change how to use beta.
 void setCorners(boolean Corner_Arg)
           
 void setD(double d)
          Sets the d attribute of the DSPopupMenu object
 void setIDOwner(int Id)
          elements can have an owner associated with them -1 means no owner
 void setInteractionState(int state_arg)
          xxxFred Sets the interactionState attribute of the DSPopupMenu object
 void setScale(double scale)
          Sets the scale attribute of the DSPopupMenu object
 
Methods inherited from class javax.swing.JPopupMenu
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, createActionChangeListener, createActionComponent, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, insert, insert, isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, paintBorder, paramString, processFocusEvent, processKeyEvent, processKeyEvent, processMouseEvent, remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, setLocation, setPopupSize, setPopupSize, setSelected, setSelectionModel, setUI, setVisible, show, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, getHeight, 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, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, 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, 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, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, 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, setName, setSize, setSize, show, show, size, toString, 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
getHeight, getWidth, isVisible, paint, setSize, setVisible
 

Field Detail

CENTER_SIZE

public static final int CENTER_SIZE
See Also:
Constant Field Values

dsTabletopPane

protected DSTabletopPane dsTabletopPane

JMenuItemSelected

protected JMenuItem JMenuItemSelected

JMenuItemClicked

protected JMenuItem JMenuItemClicked

MousePress

protected Point MousePress

LastMouseClic

protected Point LastMouseClic

IDOwner

protected int IDOwner

IDWaiter

protected int IDWaiter

WAITING

public static final int WAITING
See Also:
Constant Field Values

DRAG_MENU

public static final int DRAG_MENU
See Also:
Constant Field Values

SELECTING

public static final int SELECTING
See Also:
Constant Field Values

DRAG_ACTION

public static final int DRAG_ACTION
See Also:
Constant Field Values

InteractionState

protected int InteractionState

frontColor

protected Color frontColor

alpha

protected double alpha
0-2PI is better but I solved the angle distance problem in DSTabletopPane so it doesn't matter now !


beta

protected double beta

betaAbsFlag

protected int betaAbsFlag

d

protected double d
D is the distance to the center of the table from the center of the component


dOrigin

protected double dOrigin
Same thing than D at the beginning but D can change if the user drag the component DOrigin will remain the same to remember the origin


alphaOrigin

protected double alphaOrigin
Same thing than Alpha at the beginning but Alpha can change if the user drag the component AlphaOrigin will remain the same to remember the origin


Scale

protected double Scale
Scale factor to resize the element at low level (pixel by pixel). 1.0 most of the time.


DSElemen1

protected DSElement DSElemen1
Constructor Detail

DSPopupMenu

public DSPopupMenu(DSTabletopPane dspane,
                   double d,
                   double alpha,
                   int id,
                   DSElement elem)
Constructor

Parameters:
dspane - The container in which the popup menu exists
d - The initial distance
alpha - The initial angle
id - The Owner of the poup menu
elem - The element concerned by the popup menu. null if a global(view) popup menu
Method Detail

clone

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

setInteractionState

public void setInteractionState(int state_arg)
xxxFred Sets the interactionState attribute of the DSPopupMenu object

Parameters:
state_arg - The new interactionState value

setActive

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

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

isActive

public boolean isActive()
Gets the active attribute of the DSPopupMenu object

Specified by:
isActive in interface DSElement
Returns:
The active value

setCorners

public void setCorners(boolean Corner_Arg)

isCorners

public boolean isCorners()
Returns:
if this element shows the resize and rotate corners : ALWAYS FALSE HERE

setD

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

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

moveFlower

public void moveFlower(double d,
                       double alpha)

getD

public double getD()
Gets the d attribute of the DSPopupMenu object

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

setAlpha

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

Specified by:
setAlpha in interface DSElement
Parameters:
alpha - The new alpha 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 angle from the right horitontal direction. Like the trigonometric circle ! 0-2PI

getAlphaOrigin

public double getAlphaOrigin()
Gets the alphaOrigin attribute of the DSPopupMenu object

Returns:
The alphaOrigin value

getDOrigin

public double getDOrigin()
Gets the dOrigin attribute of the DSPopupMenu object

Returns:
The alphaOrigin value

setBeta

public void setBeta(double alpha)
Unused

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

getBeta

public double getBeta()
Unused

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

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

getScale

public double getScale()
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:
getScale in interface DSElement
Returns:
the scale factor to resize the element at low level (pixel by pixel).

setScale

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

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

getElement

public DSElement getElement()
Gets the element that this popup menu is on top of null if it is a global popup menu

Returns:
The element this popup is modifying

movePointerToOrigin

public void movePointerToOrigin()
move the mouse pointer to the origin of the popup menu


mouseDragged

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

Specified by:
mouseDragged in interface MouseMotionListener
Specified by:
mouseDragged in interface DSElement
Parameters:
MouseEvent_Arg - Description of the Parameter

mouseMoved

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

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

mouseClicked

public void mouseClicked(MouseEvent MouseEvent_Arg)
Handle a mouse click event.

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

mouseExited

public void mouseExited(MouseEvent MouseEvent_Arg)
Handle a mouse exit event (is not really working in our context).

Specified by:
mouseExited in interface MouseListener
Parameters:
MouseEvent_Arg - the mouse event

mouseEntered

public void mouseEntered(MouseEvent MouseEvent_Arg)
Handle a mouse enter event (is not really working in our context).

Specified by:
mouseEntered in interface MouseListener
Parameters:
MouseEvent_Arg - the mouse event

isMouseTarget

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

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

getTransform

public AffineTransform getTransform()
return the transform matrix

Specified by:
getTransform in interface DSElement

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

mousePressed

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

Specified by:
mousePressed in interface MouseListener
Specified by:
mousePressed in interface DSElement
Parameters:
MouseEvent_Arg - Description of the Parameter

mouseReleased

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

Specified by:
mouseReleased in interface MouseListener
Specified by:
mouseReleased in interface DSElement
Parameters:
MouseEvent_Arg - Description of the Parameter

findDistanceForRectangle

protected Point2D.Double findDistanceForRectangle(double alpha,
                                                  int width,
                                                  int height,
                                                  double gamma)
find how far (from point O) to put the center of a rectangle fo fit so the angle occupied by the rectangle from O in the given Gamma

Parameters:
alpha - in which direction to look for
width - the width of the sub menu to place
height - the height of the sub menu to place
gamma - the angle occupied by the sub menu.
Returns:
the distance and the angle of the center of the submenu to place

paint

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

Parameters:
g - the graphics context

drawVeryTop

public void drawVeryTop(javax.media.opengl.GL2 gl)
draw the popup menu with the opengl toolkit

Specified by:
drawVeryTop in interface JOGLDrawable
Parameters:
gl -

paint

public void paint(Graphics2D Graphics_Arg,
                  int Quality)
Paint the frame ... and hopefully every swing component which has been added in it

Specified by:
paint in interface DSElement
Parameters:
Graphics_Arg - a graphic context on the general component
Quality - Description of the Parameter

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 popup menu moved

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

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 final 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

getAbsoluteScale

public double getAbsoluteScale()
Gets the absScale attribute of the DSPopupMenu 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)

acceptSlavery

public boolean acceptSlavery(DSElement dsElement)
popup menu dont accept to be slave of an other element

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


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