com.touchgraph.graphlayout
public class TGPanel extends Panel
Parts of this code build upon Sun's Graph Layout example. http://java.sun.com/applets/jdk/1.1/demo/GraphLayout/Graph.java
Modifier and Type | Class and Description |
---|---|
protected class |
TGPanel.AdjustOriginLens |
class |
TGPanel.SwitchSelectUI |
Panel.AccessibleAWTPanel
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static Color |
BACK_COLOR |
protected com.touchgraph.graphlayout.TGPanel.BasicMouseMotionListener |
basicMML |
protected boolean |
maintainMouseOver |
protected Edge |
mouseOverE |
protected Node |
mouseOverN |
protected Point |
mousePos |
protected Node |
select |
TGLayout |
tgLayout |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
TGPanel()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
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(String label)
Adds a Node, provided its label.
|
Node |
addNode(String id,
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)
Returns an Iterator over all edges in the complete graph.
|
void |
deleteEdge(Node from,
Node to) |
boolean |
deleteNode(Node node) |
boolean |
deleteNodeById(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(String id)
Return the Node whose ID matches the String id, null if no match is found.
|
Node |
findNodeByURL(String strURL)
Return the Node whose URL matches the String strURL, null if no match is found.
|
Node |
findNodeLabelContaining(String substring)
Return the first Nodes whose label contains the String substring,
null if no match is found.
|
void |
fireResetEvent() |
TGPanel.AdjustOriginLens |
getAdjustOriginLens() |
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() |
Point |
getMousePos() |
int |
getNodeCount()
Returns the current node count.
|
Node |
getSelect() |
TGPanel.SwitchSelectUI |
getSwitchSelectUI() |
TGPoint2D |
getTopLeftDraw() |
void |
hideEdge(Edge hideEdge) |
void |
hideNode(Node hideNode) |
static void |
main(String[] args) |
void |
multiSelect(TGPoint2D from,
TGPoint2D to) |
int |
nodeNum()
Deprecated.
this method has been replaced by the visibleNodeCount() method.
|
void |
paint(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(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(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.
|
addNotify, getAccessibleContext
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static 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 Point mousePos
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(Color color)
public ImmutableGraphEltSet getGES()
public int getNodeCount()
public int nodeNum()
public int visibleNodeCount()
public Node findNode(String id)
id
- The ID identifier used as a query.public Node findNodeByURL(String strURL)
strURL
- The URL identifier used as a query.public Node findNodeLabelContaining(String substring)
substring
- The Substring used as a query.public Node addNode() throws TGException
TGException
Node
public Node addNode(String label) throws TGException
TGException
GraphEltSet
public Node addNode(String id, String label) throws TGException
TGException
Node
public void addNode(Node node) throws TGException
TGException
public boolean deleteNodeById(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 void deleteEdge(Edge edge)
public int getEdgeCount()
public int edgeNum()
public int visibleEdgeCount()
public void addEdge(Edge e)
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 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 Point getMousePos()
public void startDamper()
public void stopDamper()
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 static void main(String[] args)