|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPopupMenu org.diamondspin.DSPopupMenu
public class DSPopupMenu
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.
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. |
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 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 |
---|
public static final int CENTER_SIZE
protected DSTabletopPane dsTabletopPane
protected JMenuItem JMenuItemSelected
protected JMenuItem JMenuItemClicked
protected Point MousePress
protected Point LastMouseClic
protected int IDOwner
protected int IDWaiter
public static final int WAITING
public static final int DRAG_MENU
public static final int SELECTING
public static final int DRAG_ACTION
protected int InteractionState
protected Color frontColor
protected double alpha
protected double beta
protected int betaAbsFlag
protected double d
protected double dOrigin
protected double alphaOrigin
protected double Scale
protected DSElement DSElemen1
Constructor Detail |
---|
public DSPopupMenu(DSTabletopPane dspane, double d, double alpha, int id, DSElement elem)
dspane
- The container in which the popup menu existsd
- The initial distancealpha
- The initial angleid
- The Owner of the poup menuelem
- The element concerned by the popup menu. null if a global(view) popup menuMethod Detail |
---|
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void setInteractionState(int state_arg)
state_arg
- The new interactionState valuepublic void setActive(boolean Active_Arg)
setActive
in interface DSElement
Active_Arg
- The new active valuepublic boolean isActive()
isActive
in interface DSElement
public void setCorners(boolean Corner_Arg)
public boolean isCorners()
public void setD(double d)
setD
in interface DSElement
d
- The new d valuepublic void moveFlower(double d, double alpha)
public double getD()
getD
in interface DSElement
public void setAlpha(double alpha)
setAlpha
in interface DSElement
alpha
- The new alpha valuepublic double getAlpha()
DSElement
getAlpha
in interface DSElement
public double getAlphaOrigin()
public double getDOrigin()
public void setBeta(double alpha)
setBeta
in interface DSElement
alpha
- The new beta valuepublic double getBeta()
getBeta
in interface DSElement
public void setBetaAbs(boolean betaAbs)
DSElement
setBetaAbs
in interface DSElement
public boolean isBetaAbs()
DSElement
isBetaAbs
in interface DSElement
public double getScale()
DSElement
getScale
in interface DSElement
public void setScale(double scale)
setScale
in interface DSElement
scale
- The new scale valuepublic DSElement getElement()
public void movePointerToOrigin()
public void mouseDragged(MouseEvent MouseEvent_Arg)
mouseDragged
in interface MouseMotionListener
mouseDragged
in interface DSElement
MouseEvent_Arg
- Description of the Parameterpublic void mouseMoved(MouseEvent MouseEvent_Arg)
mouseMoved
in interface MouseMotionListener
mouseMoved
in interface DSElement
MouseEvent_Arg
- Description of the Parameterpublic void mouseClicked(MouseEvent MouseEvent_Arg)
mouseClicked
in interface MouseListener
mouseClicked
in interface DSElement
MouseEvent_Arg
- Description of the Parameterpublic void mouseExited(MouseEvent MouseEvent_Arg)
mouseExited
in interface MouseListener
MouseEvent_Arg
- the mouse eventpublic void mouseEntered(MouseEvent MouseEvent_Arg)
mouseEntered
in interface MouseListener
MouseEvent_Arg
- the mouse eventpublic boolean isMouseTarget(MouseEvent MouseEvent_Arg)
isMouseTarget
in interface DSElement
MouseEvent_Arg
- the mouse event
public AffineTransform getTransform()
getTransform
in interface DSElement
public boolean doesContain(double x, double y)
doesContain
in interface DSElement
x
- cartesian x coordinatey
- cartesian y coordinate
public void mousePressed(MouseEvent MouseEvent_Arg)
mousePressed
in interface MouseListener
mousePressed
in interface DSElement
MouseEvent_Arg
- Description of the Parameterpublic void mouseReleased(MouseEvent MouseEvent_Arg)
mouseReleased
in interface MouseListener
mouseReleased
in interface DSElement
MouseEvent_Arg
- Description of the Parameterprotected Point2D.Double findDistanceForRectangle(double alpha, int width, int height, double gamma)
alpha
- in which direction to look forwidth
- the width of the sub menu to placeheight
- the height of the sub menu to placegamma
- the angle occupied by the sub menu.
public void paint(Graphics2D g)
g
- the graphics contextpublic void drawVeryTop(javax.media.opengl.GL2 gl)
drawVeryTop
in interface JOGLDrawable
gl
- public void paint(Graphics2D Graphics_Arg, int Quality)
paint
in interface DSElement
Graphics_Arg
- a graphic context on the general componentQuality
- Description of the Parameterpublic boolean grabElement(int DX_Arg, int DY_Arg)
grabElement
in interface DSElement
DX_Arg
- Description of the ParameterDY_Arg
- Description of the Parameterpublic void addDSElementListener(DSElementListener l)
addDSElementListener
in interface DSElement
l
- The feature to be added to the DSElementListener attributepublic void removeDSElementListener(DSElementListener l)
removeDSElementListener
in interface DSElement
l
- Description of the Parameterpublic DSElementListener[] getDSElementListener()
protected void fireDSElementMovedEvent(double d, double a)
d
- new distance to the centera
- new angle from horizontalpublic int getIDOwner()
DSElement
getIDOwner
in interface DSElement
public final void setIDOwner(int Id)
setIDOwner
in interface DSElement
Id
- The new iDOwner valuepublic double getAbsoluteScale()
getAbsoluteScale
in interface DSElement
public void moveElementCenterTo(Point2D.Double touchPoint)
moveElementCenterTo
in interface DSElement
touchPoint
- (the cartesian point under which to center the element)public boolean acceptSlavery(DSElement dsElement)
acceptSlavery
in interface DSElement
public boolean acceptSlaveryRelease()
DSElement
acceptSlaveryRelease
in interface DSElement
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |