fi.paatti.research.paattiapplication.views.eventview.tools
Class ContextMenu

java.lang.Object
  extended by fi.paatti.research.paattiapplication.views.eventview.tools.Clickable
      extended by fi.paatti.research.paattiapplication.views.eventview.tools.ContextMenu
All Implemented Interfaces:
Serializable

public class ContextMenu
extends Clickable
implements Serializable

ContextMenu is a simple clickable "container" that holds other clickables knows as MenuItems. ContextMenu acts merely as a larger click detector around the defined sub-clickables, returning the values of the selected menu items (if any).

Author:
Tapio Keränen, t.tapio.keranen@student.jyu.fi
See Also:
Serialized Form
 

Nested Class Summary
 class ContextMenu.MenuItem
          MenuItem is a clickable that contains event tree tool enums used in controlling the tool states and the types of nodes to be added to the tree (if any).
 
Field Summary
 
Fields inherited from class fi.paatti.research.paattiapplication.views.eventview.tools.Clickable
height, width, x, y
 
Constructor Summary
ContextMenu()
          ContextMenu constructor.
 
Method Summary
 ContextMenu.MenuItem getMenu(int x, int y)
          Returns the menu item found at (x,y) and hides the context menu.
 boolean isVisible()
          Returns the visibilty state of the context menu.
 void paint(Graphics g)
          Paints the items added to the context menu.
 void show(int x, int y, NodeFactory.TreeNode node)
          Moves the context menu to the given coordinates and sets the menu visible, displaying a list of clickable items based on the type of the node given as a parameter.
 
Methods inherited from class fi.paatti.research.paattiapplication.views.eventview.tools.Clickable
contains
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextMenu

public ContextMenu()
ContextMenu constructor.

Method Detail

show

public void show(int x,
                 int y,
                 NodeFactory.TreeNode node)
Moves the context menu to the given coordinates and sets the menu visible, displaying a list of clickable items based on the type of the node given as a parameter.

Parameters:
x - the x coordinate.
y - the y coordinate.
node - the node that was clicked (if any).

isVisible

public boolean isVisible()
Returns the visibilty state of the context menu.

Returns:
true if visible, otherwise false.

getMenu

public ContextMenu.MenuItem getMenu(int x,
                                    int y)
Returns the menu item found at (x,y) and hides the context menu. If no menu item was found, a null value is returned instead.

Parameters:
x - the x coordinate.
y - the y coordinate.
Returns:
the context menu item found, if any.

paint

public void paint(Graphics g)
Paints the items added to the context menu.

Specified by:
paint in class Clickable
Parameters:
g - graphics context.


Copyright © 2012. All Rights Reserved.