utilities
Class Graph

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JSplitPane
                          |
                          +--utilities.Graph
All Implemented Interfaces:
javax.accessibility.Accessible, java.lang.Cloneable, ConfiguredObject, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Graph
extends javax.swing.JSplitPane
implements java.io.Serializable, java.lang.Cloneable, ConfiguredObject

This class encapsulates the display of a graph, using GraphNodes, GraphEdges, and derived classes. It is not an efficient class; there is redundant data storage, things like that, that made certain other things easier. However, any speed loss due to this is negligable compared to the speed loss from swing. We're using java, so what does it matter, anyway?

See Also:
Serialized Form

Inner Class Summary
 class Graph.GraphCanvas
          This class encapsulates the placement of nodes and the mouse handling
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static Graph globalhack
           
 
Fields inherited from class javax.swing.JSplitPane
BOTTOM, CONTINUOUS_LAYOUT_PROPERTY, DIVIDER, DIVIDER_LOCATION_PROPERTY, DIVIDER_SIZE_PROPERTY, HORIZONTAL_SPLIT, LAST_DIVIDER_LOCATION_PROPERTY, LEFT, ONE_TOUCH_EXPANDABLE_PROPERTY, ORIENTATION_PROPERTY, RESIZE_WEIGHT_PROPERTY, RIGHT, TOP, VERTICAL_SPLIT
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Graph()
          blank constructor
Graph(java.lang.String l)
          default constructor
 
Method Summary
 void addLayer(java.lang.String s)
           
 void addMenuItem(javax.swing.JMenuItem item)
           
 void addNode(GraphNode n)
           
 void addNode(GraphNode n, javax.swing.JPanel p, java.lang.String layer)
          Adds a node to the graph
 void addToLayer(java.lang.String layer, GraphNode n, javax.swing.JPanel p)
           
 void addTree(GraphNode n)
           
 java.lang.Object clone()
          clones the object
 void exciseNode(GraphNode n)
          Removes a node and excises it from its surrounding connections
 GraphNode findNode(GraphNode n)
          returns a node matching n
 java.util.Enumeration findNodes(GraphNode n)
          returns an enumeration of nodes matching n
 java.util.Enumeration getAllNodes()
          Returns all nodes in the graph
 java.lang.String getLabel()
          accessors
 GraphLayers getLayers()
           
 java.util.Enumeration getNodes()
          returns an enumeration of the nodes contained in the graph note that this will only return the high level nodes, use getAllNodes to return everything in the graph.
 void mergeGraph(Graph g)
          merges a Graph g into this one
 void removeNode(GraphNode n)
          Removes a node from the graph
 void saveCfg()
          saves the information in this object to the proper location in the CfgManager.
 void setDefaultLayer(java.lang.String s)
           
 void setLabel(java.lang.String l)
           
 java.lang.String toString()
           
 void unmergeGraph(Graph g)
          unmerges a graph based on g from the graph
 void updateCfg()
          updates the information in this object with information currently in the CfgManager.
 
Methods inherited from class javax.swing.JSplitPane
getAccessibleContext, getBottomComponent, getDividerLocation, getDividerSize, getLastDividerLocation, getLeftComponent, getMaximumDividerLocation, getMinimumDividerLocation, getOrientation, getResizeWeight, getRightComponent, getTopComponent, getUI, getUIClassID, isContinuousLayout, isOneTouchExpandable, isValidateRoot, remove, remove, removeAll, resetToPreferredSizes, setBottomComponent, setContinuousLayout, setDividerLocation, setDividerLocation, setDividerSize, setLastDividerLocation, setLeftComponent, setOneTouchExpandable, setOrientation, setResizeWeight, setRightComponent, setTopComponent, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, removeContainerListener, setLayout, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, contains, createImage, createImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

globalhack

public static Graph globalhack
Constructor Detail

Graph

public Graph(java.lang.String l)
default constructor
Parameters:
l - The graph's label

Graph

public Graph()
blank constructor
Method Detail

getLabel

public java.lang.String getLabel()
accessors

setLabel

public void setLabel(java.lang.String l)

getLayers

public GraphLayers getLayers()

setDefaultLayer

public void setDefaultLayer(java.lang.String s)

addNode

public void addNode(GraphNode n)

addNode

public void addNode(GraphNode n,
                    javax.swing.JPanel p,
                    java.lang.String layer)
Adds a node to the graph

addTree

public void addTree(GraphNode n)

removeNode

public void removeNode(GraphNode n)
Removes a node from the graph

exciseNode

public void exciseNode(GraphNode n)
Removes a node and excises it from its surrounding connections
See Also:
GraphNode.excise()

getNodes

public java.util.Enumeration getNodes()
returns an enumeration of the nodes contained in the graph note that this will only return the high level nodes, use getAllNodes to return everything in the graph.

getAllNodes

public java.util.Enumeration getAllNodes()
Returns all nodes in the graph

findNodes

public java.util.Enumeration findNodes(GraphNode n)
returns an enumeration of nodes matching n

findNode

public GraphNode findNode(GraphNode n)
returns a node matching n

mergeGraph

public void mergeGraph(Graph g)
merges a Graph g into this one

unmergeGraph

public void unmergeGraph(Graph g)
unmerges a graph based on g from the graph

clone

public java.lang.Object clone()
clones the object

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

addLayer

public void addLayer(java.lang.String s)

addToLayer

public void addToLayer(java.lang.String layer,
                       GraphNode n,
                       javax.swing.JPanel p)

addMenuItem

public void addMenuItem(javax.swing.JMenuItem item)

updateCfg

public void updateCfg()
Description copied from interface: ConfiguredObject
updates the information in this object with information currently in the CfgManager.
Specified by:
updateCfg in interface ConfiguredObject

saveCfg

public void saveCfg()
Description copied from interface: ConfiguredObject
saves the information in this object to the proper location in the CfgManager.
Specified by:
saveCfg in interface ConfiguredObject