|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JMenuBar
org.diamondspin.DSMenuBar
public class DSMenuBar
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.
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.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 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 |
---|
protected int IDOwner
protected int betaAbsFlag
protected boolean reverse
protected int type
public static final int FREE
public static final int PUSHUP_SLIDE
public static final int PUSHUP_FRAME
public static final int PUSHDOWN_FRAME
protected Color frontColor
protected int IDWaiter
public static final double SCALE_WHEN_ARMED
protected boolean automaticallyAssignOwner
protected boolean Active
protected boolean DrawArc
protected DSTabletopPane dsTabletopPane
protected double alpha
public static final Color HiliteColor
protected int MaxHeight
public static final int FOLLOW_CIRCLE
public static final int FOLLOW_RECTANGLE
protected int Behavior
protected HashMap<JMenu,Double> anglesForMenus
protected double theta
protected int openedMenu
protected HashMap<JMenuItem,Integer> MenusHighlighted
Constructor Detail |
---|
public DSMenuBar(DSTabletopPane dspane, double a)
dspane
- the container in which the menu existsa
- the starting angleMethod Detail |
---|
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public boolean isReverse()
public void setReverse(boolean reverse)
public int getIDOwner()
DSElement
getIDOwner
in interface DSElement
public void setIDOwner(int id)
setIDOwner
in interface DSElement
id
- The new iDOwner valuepublic int getWaiter()
public void setWaiter(int Id)
Id
- the user id of the person next in line to use the menu under the release policypublic double getD()
getD
in interface DSElement
public void setD(double d)
setD
in interface DSElement
d
- The new d valuepublic double getScale()
getScale
in interface DSElement
public void setScale(double scale)
setScale
in interface DSElement
scale
- The new scale valuepublic boolean isActive()
DSElement
isActive
in interface DSElement
public void setActive(boolean Active_Arg)
setActive
in interface DSElement
Active_Arg
- The new active valuepublic void setDrawArc(boolean DrawArc_Arg)
DrawArc_Arg
- The new drawArc valuepublic boolean isDrawArc()
public double getBehavior()
public void setBehavior(int Behavior_Arg)
Behavior_Arg
- The new behavior valuepublic double getAlpha()
DSElement
getAlpha
in interface DSElement
public void setAlpha(double alpha)
setAlpha
in interface DSElement
alpha
- The new alpha valuepublic void setBeta(double beta)
setBeta
in interface DSElement
beta
- The new beta valuepublic double getBeta()
getBeta
in interface DSElement
public double getTheta()
public double getMiddleAngle()
public Point getOpenMenuPosition()
public BufferedImage getOpenMenuImage()
public String toString()
toString
in class Component
public void collapse()
public JMenu add(JMenu c)
add
in class JMenuBar
public void update()
public JMenuItem addMenuItem(String MenuName_Arg, String NewMenuItem_Arg)
MenuName_Arg
- the menu name (must have been created)NewMenuItem_Arg
- the name of the new item to add in this menu
public void removeMenuItem(String MenuName_Arg, String NewMenuItem_Arg)
MenuName_Arg
- the menu name (must have been created). do nothing if not existsNewMenuItem_Arg
- the name of the new item to remove in the specified menu. do nothing if not existspublic ArrayList<String> getMenuItems(String MenuName_Arg)
MenuName_Arg
- the menu name (must have been created).return null if not exists
public JMenu renameMenu(String OldName_Arg, String NewName_Arg)
OldName_Arg
- the menu to rename. return null if not existsNewName_Arg
- the new name
public void clearMenu(String MenuName_Arg)
MenuName_Arg
- the menu name to clearpublic void partialHighlightMenu(JMenuItem menu, int percentage)
menu
- the menu to force the background to display this partial feedbackpercentage
- the feedback in value (0-100). if 0 the background reflects normally the selection.public int getMenuHighlight(JMenuItem menu)
menu
- the menu to force the background to display this partial feedback
public boolean isSomethingAt(double alpha)
alpha
- the angle in a traditionnal trigonometric circle
public AffineTransform getTransform(int i)
public AffineTransform getTransform()
DSElement
getTransform
in interface DSElement
public Point getCenterPoint()
public void mouseDragged(MouseEvent event)
mouseDragged
in interface MouseMotionListener
mouseDragged
in interface DSElement
event
- mouse event objectprotected void mouseDraggedSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, MouseEvent event, boolean firstLevel_Arg)
public void mouseMoved(MouseEvent event)
mouseMoved
in interface MouseMotionListener
mouseMoved
in interface DSElement
event
- Description of the Parameterpublic boolean isMouseTarget(MouseEvent event)
isMouseTarget
in interface DSElement
event
- the mouse event
public boolean doesContain(double x, double y)
doesContain
in interface DSElement
x
- cartesian x coordinatey
- cartesian y coordinate
protected boolean doesContainSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, boolean firstLevel_Arg)
public void mousePressed(MouseEvent event)
mousePressed
in interface MouseListener
mousePressed
in interface DSElement
event
- mouse event objectprotected void mousePressedSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, MouseEvent event, boolean firstLevel_Arg)
public void mouseReleased(MouseEvent event)
mouseReleased
in interface MouseListener
mouseReleased
in interface DSElement
event
- mouse event objectprotected void mouseReleasedSubmenu(JMenu jMenu_Arg, Point mousePosition_Arg, MouseEvent event, boolean firstLevel_Arg)
public void mouseClicked(MouseEvent event)
mouseClicked
in interface MouseListener
mouseClicked
in interface DSElement
event
- Description of the Parameterpublic void mouseEntered(MouseEvent event)
mouseEntered
in interface MouseListener
event
- Description of the Parameterpublic void mouseExited(MouseEvent event)
mouseExited
in interface MouseListener
event
- Description of the Parameterpublic final HashMap<JMenu,Double> computeAngles()
public int getHeight()
DSElement
getHeight
in interface DSElement
getHeight
in class JComponent
public void paint(Graphics Graphics_Arg)
paint
in interface DSElement
paint
in class JComponent
Graphics_Arg
- the graphics contextprotected Component mouseTestInside(Point2D.Double pp, Point2D.Double p, double h)
protected boolean mouseClickedTestInside(Point2D.Double pp, Point2D.Double p, double h)
protected boolean mouseDraggedTestInside(Point2D.Double pp, Point2D.Double p, double h)
protected boolean mouseReleasedTestInside(Point2D.Double pp, Point2D.Double p, double h)
protected boolean mousePressedTestInside(Point2D.Double pp, Point2D.Double p, double h)
public void paintPopupInside(Graphics2D g, Point2D.Double p)
public void paintInside(Graphics2D g)
public void setHidden(boolean value)
value
- The new hidden valuepublic void drawVeryTop(javax.media.opengl.GL2 gl)
drawVeryTop
in interface JOGLDrawable
public void paint(Graphics2D g, int quality)
paint
in interface DSElement
g
- a graphic context on the general componentquality
- the quality of the renderingpublic void paintSubmenu(Graphics2D Graphics_Arg, JMenu JMenu_Arg, boolean FirstLevel_Arg)
public void drawSubmenu(javax.media.opengl.GL2 gl, AffineTransform localTrans, JMenu menu, boolean isFirstLevel)
public 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 void fireDSElementDroppedEvent(int type)
public boolean hasPermissions(int Id)
Id
- the user whose permissions you want to check
public 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 void beingDragged(double arg, Point touchPoint)
arg
- Description of the ParametertouchPoint
- Description of the Parameterpublic boolean acceptSlavery(DSElement dsElement)
DSElement
acceptSlavery
in interface DSElement
public boolean acceptSlaveryRelease()
DSElement
acceptSlaveryRelease
in interface DSElement
public void setBetaAbs(boolean betaAbs)
DSElement
setBetaAbs
in interface DSElement
public boolean isBetaAbs()
DSElement
isBetaAbs
in interface DSElement
public boolean isAutomaticallyAssignOwner()
public void setAutomaticallyAssignOwner(boolean automaticallyAssignOwner)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |