|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.touchgraph.graphlayout.TGPanel
TGPanel contains code for drawing the graph, and storing which nodes are selected, and which ones the mouse is over. It houses methods to activate TGLayout, which performs dynamic layout. Whenever the graph is moved, or repainted, TGPanel fires listner methods on associated objects.
Parts of this code build upon Sun's Graph Layout example. http://java.sun.com/applets/jdk/1.1/demo/GraphLayout/Graph.java
Nested Class Summary | |
protected class |
TGPanel.AdjustOriginLens
|
class |
TGPanel.SwitchSelectUI
|
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
static java.awt.Color |
BACK_COLOR
|
protected com.touchgraph.graphlayout.TGPanel.BasicMouseMotionListener |
basicMML
|
protected boolean |
maintainMouseOver
|
protected Edge |
mouseOverE
|
protected Node |
mouseOverN
|
protected java.awt.Point |
mousePos
|
protected Node |
select
|
TGLayout |
tgLayout
|
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
TGPanel()
Default constructor. |
Method Summary | |
void |
addEdge(Edge e)
|
Edge |
addEdge(Node f,
Node t,
int tens)
|
void |
addGraphListener(GraphListener gl)
|
Node |
addNode()
Adds a Node, with its ID and label being the current node count plus 1. |
void |
addNode(Node node)
Add the Node node to the visibleLocality, checking for ID uniqueness. |
Node |
addNode(java.lang.String label)
Adds a Node, provided its label. |
Node |
addNode(java.lang.String id,
java.lang.String label)
Adds a Node, provided its ID and label. |
void |
addPaintListener(TGPaintListener pl)
|
void |
clearAll()
|
void |
clearSelect()
|
void |
collapseNode(Node collapseNode)
|
void |
deleteEdge(Edge edge)
|
void |
deleteEdge(Node from,
Node to)
|
boolean |
deleteNode(Node node)
|
boolean |
deleteNodeById(java.lang.String id)
Remove the Node object matching the ID id , returning true if the
deletion occurred, false if a Node matching the ID does not exist (or if the ID
value was null). |
int |
edgeNum()
Deprecated. this method has been replaced by the visibleEdgeCount() method. |
void |
expandNode(Node node)
|
void |
fastFinishAnimation()
|
Edge |
findEdge(Node f,
Node t)
|
protected void |
findMouseOver()
|
Node |
findNode(java.lang.String id)
Return the Node whose ID matches the String id, null if no match is found. |
Node |
findNodeLabelContaining(java.lang.String substring)
Return the first Nodes whose label contains the String substring, null if no match is found. |
java.util.Collection |
findNodesByLabel(java.lang.String label)
Return a Collection of all Nodes whose label matches the String label, null if no match is found. |
void |
fireResetEvent()
|
TGPanel.AdjustOriginLens |
getAdjustOriginLens()
|
java.util.Iterator |
getAllEdges()
Returns an Iterator over all edges in the complete graph. |
java.util.Iterator |
getAllNodes()
Returns an Iterator over all nodes in the complete graph. |
TGPoint2D |
getBottomRightDraw()
|
TGPoint2D |
getCenter()
|
Node |
getDragNode()
|
TGPoint2D |
getDrawCenter()
|
int |
getEdgeCount()
Returns the current edge count in the complete graph. |
ImmutableGraphEltSet |
getGES()
Return the current visible locality. |
Edge |
getMouseOverE()
|
Node |
getMouseOverN()
|
java.awt.Point |
getMousePos()
|
int |
getNodeCount()
Returns the current node count. |
Node |
getSelect()
|
TGPanel.SwitchSelectUI |
getSwitchSelectUI()
|
TGPoint2D |
getTopLeftDraw()
|
void |
hideEdge(Edge hideEdge)
|
void |
hideNode(Node hideNode)
|
void |
kstartDamper()
|
void |
kstopDamper()
|
static void |
main(java.lang.String[] args)
|
void |
multiSelect(TGPoint2D from,
TGPoint2D to)
|
int |
nodeNum()
Deprecated. this method has been replaced by the visibleNodeCount() method. |
void |
paint(java.awt.Graphics g)
|
void |
processGraphMove()
|
void |
removeGraphListener(GraphListener gl)
|
void |
removePaintListener(TGPaintListener pl)
|
void |
repaintAfterMove()
|
void |
resetDamper()
Makes the graph mobile, and slowly slows it down. |
void |
selectFirstNode()
A convenience method that selects the first node of a graph, so that hiding works. |
void |
setBackColor(java.awt.Color color)
|
void |
setDragNode(Node node)
|
void |
setGraphEltSet(GraphEltSet ges)
|
void |
setLensSet(TGLensSet lensSet)
|
void |
setLocale(Node node,
int radius)
|
void |
setLocale(Node node,
int radius,
int maxAddEdgeCount,
int maxExpandEdgeCount,
boolean unidirectional)
|
void |
setMaintainMouseOver(boolean maintain)
|
void |
setMouseOverE(Edge edge)
|
void |
setMouseOverN(Node node)
|
void |
setSelect(Node node)
|
void |
setTGLayout(TGLayout tgl)
|
void |
startDamper()
Start and stop the damper. |
void |
stopDamper()
|
void |
stopMotion()
Gently stops the graph from moving |
void |
update(java.awt.Graphics g)
|
void |
updateDrawPos(Node node)
|
void |
updateDrawPositions()
|
void |
updateGraphSize()
|
void |
updateLocalityFromVisibility()
|
void |
updatePosFromDraw(Node node)
|
int |
visibleEdgeCount()
Return the number of Edges in the Locality. |
int |
visibleNodeCount()
Returns the current node count within the VisibleLocality. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, 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, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static java.awt.Color BACK_COLOR
public TGLayout tgLayout
protected com.touchgraph.graphlayout.TGPanel.BasicMouseMotionListener basicMML
protected Edge mouseOverE
protected Node mouseOverN
protected boolean maintainMouseOver
protected Node select
protected java.awt.Point mousePos
Constructor Detail |
public TGPanel()
Method Detail |
public void setLensSet(TGLensSet lensSet)
public void setTGLayout(TGLayout tgl)
public void setGraphEltSet(GraphEltSet ges)
public TGPanel.AdjustOriginLens getAdjustOriginLens()
public TGPanel.SwitchSelectUI getSwitchSelectUI()
public void setBackColor(java.awt.Color color)
public java.util.Iterator getAllNodes()
public ImmutableGraphEltSet getGES()
public int getNodeCount()
public int nodeNum()
public int visibleNodeCount()
public Node findNode(java.lang.String id)
id
- The ID identifier used as a query.
public java.util.Collection findNodesByLabel(java.lang.String label)
public Node findNodeLabelContaining(java.lang.String substring)
substring
- The Substring used as a query.public Node addNode() throws TGException
TGException
Node
public Node addNode(java.lang.String label) throws TGException
TGException
GraphEltSet
public Node addNode(java.lang.String id, java.lang.String label) throws TGException
TGException
Node
public void addNode(Node node) throws TGException
TGException
public boolean deleteNodeById(java.lang.String id)
id
, returning true if the
deletion occurred, false if a Node matching the ID does not exist (or if the ID
value was null).
id
- The ID identifier used as a query.
public boolean deleteNode(Node node)
public void clearAll()
public Node getSelect()
public Node getMouseOverN()
public void setMouseOverN(Node node)
public java.util.Iterator getAllEdges()
public void deleteEdge(Edge edge)
public void deleteEdge(Node from, Node to)
public int getEdgeCount()
public int edgeNum()
public int visibleEdgeCount()
public Edge findEdge(Node f, Node t)
public void addEdge(Edge e)
public Edge addEdge(Node f, Node t, int tens)
public Edge getMouseOverE()
public void setMouseOverE(Edge edge)
public void fireResetEvent()
public void addGraphListener(GraphListener gl)
public void removeGraphListener(GraphListener gl)
public void addPaintListener(TGPaintListener pl)
public void removePaintListener(TGPaintListener pl)
public void setMaintainMouseOver(boolean maintain)
public void clearSelect()
public void selectFirstNode()
public void setSelect(Node node)
public void multiSelect(TGPoint2D from, TGPoint2D to)
public void updateLocalityFromVisibility() throws TGException
TGException
public void setLocale(Node node, int radius, int maxAddEdgeCount, int maxExpandEdgeCount, boolean unidirectional) throws TGException
TGException
public void fastFinishAnimation()
public void setLocale(Node node, int radius) throws TGException
TGException
public void expandNode(Node node)
public void hideNode(Node hideNode)
public void collapseNode(Node collapseNode)
public void hideEdge(Edge hideEdge)
public void setDragNode(Node node)
public Node getDragNode()
public java.awt.Point getMousePos()
public void startDamper()
public void kstartDamper()
public void stopDamper()
public void kstopDamper()
public void resetDamper()
public void stopMotion()
protected void findMouseOver()
public TGPoint2D getTopLeftDraw()
public TGPoint2D getBottomRightDraw()
public TGPoint2D getCenter()
public TGPoint2D getDrawCenter()
public void updateGraphSize()
public void processGraphMove()
public void repaintAfterMove()
public void updateDrawPos(Node node)
public void updatePosFromDraw(Node node)
public void updateDrawPositions()
public void paint(java.awt.Graphics g)
public void update(java.awt.Graphics g)
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |