|
|||||||||||
| 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.JLabel
beowulf.gui.JNode
A JNode is a GUI representation of a node in a graph. JNodes are designed to work
in strong connection with JGraphs. A JGraph will use a JNodeFactory to produce
JNodes for a given graph.
The JNode class is the principle class that needs to be changed in order to customize
a JGraph representation. Subclassing the JNode allows for a different GUI
representation (through overriding the method .paintComponent(Graphics g)), a more
complicated popup menu structure, and more options in the properties window.
The subclass can access the popup menu through the protected variable 'menu', which
is of type JPopupMenu. Menu items can be added/removed etc. The subclass of JNode
will already be an action listener bound to receive action events generated by the
default element of the popup menu - the show properties menu item. If the subclass
of JNode is to have a .actionPerformed(ActionEvent) method, this method should
call super.actionPerformed() so that such events can be processed correctly.
If the subclass of the JNode is to have more elements in the properties window, see
the documentation on the JNode.PropertiesWindow class. Following the architecture
of JNode and JNode.PropertiesWindow should allow for easy customization of both aspects
of the JNode. The recommended method of doing this is to subclass both JNode and
JNode.PropertiesWindow, and have the the subclass of JNode be an enclosing class of
the other subclass.
| Nested Class Summary | |
class |
JNode.PropertiesWindow
This class is a specialized JFrame and will display all relevant properties of a JNode when the "show properties" option in a JNode's popup menu is selected. |
| Nested classes inherited from class javax.swing.JLabel |
JLabel.AccessibleJLabel |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
protected static Class[] |
EMPTY_PARAM_CLASS_LIST
A convenience object for some of the reflection calls in the properties window. |
protected static Object[] |
EMPTY_PARAM_LIST
A convenience object for some of the reflection calls in the properties window. |
protected JPopupMenu |
menu
The popup menu for options associated with this JNode. |
protected JNode.PropertiesWindow |
propertiesWindow
The properties window associated with this JNode. |
protected int |
radius
The radius of self loops, -1 indicates default radius. |
protected static Dimension |
SCREEN_SIZE
A convenience object for sizing and moving the properties window. |
protected static String |
SHOW_PROPERTIES
The string identified with the "show properties" action. |
protected static Class[] |
SINGLE_PARAM_CLASS_LIST
A convenience object for some of the reflection calls in the properties window. |
protected static Object[] |
SINGLE_PARAM_LIST
A convenience object for some of the reflection calls in the properties window. |
protected Object |
value
The node in the underlying graph that this JNode represents |
| Fields inherited from class javax.swing.JLabel |
labelFor |
| 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 javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JNode(Object newValue)
Construct a new JNode with a given node to represent. |
|
| Method Summary | |
void |
actionPerformed(ActionEvent ae)
|
int |
getRadius()
Returns the radius of all self-loops. |
Object |
getValue()
Returns the node that this JNode represents in the underlying graph. |
protected void |
makePopupMenu()
Called from the constructor to make the popup menu and associate it with this JNode object. |
void |
mouseClicked(MouseEvent me)
This method will be called whenever a mouse button is clicked on top of the generating component. |
void |
mouseEntered(MouseEvent me)
This method will be called whenever the mouse cursor enters the generating component. |
void |
mouseExited(MouseEvent me)
This method will be called whenever the mouse cursor exits the generating component. |
void |
mousePressed(MouseEvent me)
This method will be called whenever a mouse button is pressed on top of the generating component. |
void |
mouseReleased(MouseEvent me)
This method will be called whenever a mouse button is released on top of the generating component. |
void |
setRadius(int newRadius)
Sets the radius of self drawn loops. |
void |
setValue(Object newValue)
Sets the node that this JNode represents. |
void |
showProperties()
Called when the "show properties" action is chosen in the popup menu for this JNode. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final Object[] EMPTY_PARAM_LIST
protected static final Object[] SINGLE_PARAM_LIST
protected static final Class[] EMPTY_PARAM_CLASS_LIST
protected static final Class[] SINGLE_PARAM_CLASS_LIST
protected static final Dimension SCREEN_SIZE
protected static final String SHOW_PROPERTIES
protected Object value
protected JPopupMenu menu
protected JNode.PropertiesWindow propertiesWindow
protected int radius
| Constructor Detail |
public JNode(Object newValue)
newValue - The node in the underlying graph.| Method Detail |
public Object getValue()
public int getRadius()
public void setValue(Object newValue)
newValue - The new node that this JNode will represent.public void setRadius(int newRadius)
newRadius - The radius of self drawn loops.protected void makePopupMenu()
public void actionPerformed(ActionEvent ae)
actionPerformed in interface ActionListenerpublic void showProperties()
public void mouseEntered(MouseEvent me)
DCMouseEventReceiver
mouseEntered in interface DCMouseEventReceiverme - The generated event.public void mouseExited(MouseEvent me)
DCMouseEventReceiver
mouseExited in interface DCMouseEventReceiverme - The generated event.public void mouseClicked(MouseEvent me)
DCMouseEventReceiver
mouseClicked in interface DCMouseEventReceiverme - The generated event.public void mousePressed(MouseEvent me)
DCMouseEventReceiver
mousePressed in interface DCMouseEventReceiverme - The generated event.public void mouseReleased(MouseEvent me)
DCMouseEventReceiver
mouseReleased in interface DCMouseEventReceiverme - The generated event.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||