|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.vergil.toolbox.PtolemyMenuFactory
public class PtolemyMenuFactory
A menu factory that contains a list of item factories. When asked to create a context menu, This class first takes the figure and finds the ptolemy object associated with it. Then it passes the ptolemy object to each menu item factory that it contains to add the menu items. Lastly, it returns the resulting menu. This seems simple, except for the fact that for different types of figures, and different visual notations, the mapping between figure and the interesting ptolemy object is different. Hence, Node and Edge Controllers will often need subclasses of this factory to get the correct ptolemy object.
Red (johnr) |
Red (eal) |
Field Summary | |
---|---|
private GraphController |
_controller
The graph controller. |
private java.util.List |
_factoryList
The menu item factories. |
Constructor Summary | |
---|---|
PtolemyMenuFactory(GraphController controller)
Create a new menu factory that contains no menu item factories. |
Method Summary | |
---|---|
protected NamedObj |
_getObjectFromFigure(Figure figure)
Return the Ptolemy object that the given figure represents. |
void |
addMenuItemFactory(MenuItemFactory factory)
Add a menu item factory to this creator. |
JContextMenu |
create(Figure figure)
Create an instance of the menu associated with this factory. |
GraphController |
getController()
Return the graph controller that created this menu factory. |
java.util.List |
menuItemFactoryList()
Return the list of menu item factories. |
void |
removeMenuItemFactory(MenuItemFactory factory)
Remove the given menu item factory from the factory list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private GraphController _controller
private java.util.List _factoryList
Constructor Detail |
---|
public PtolemyMenuFactory(GraphController controller)
controller
- The controller.Method Detail |
---|
public void addMenuItemFactory(MenuItemFactory factory)
factory
- The menu item factory to add.public JContextMenu create(Figure figure)
create
in interface MenuFactory
figure
- The figure for which to create a context menu.
public GraphController getController()
public java.util.List menuItemFactoryList()
public void removeMenuItemFactory(MenuItemFactory factory)
factory
- The factory to be removed.protected NamedObj _getObjectFromFigure(Figure figure)
figure
- The figure.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |