public class ExtendedTGPanel
extends com.touchgraph.graphlayout.TGPanel
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 |
ExtendedTGPanel.AdjustOriginLens |
class |
ExtendedTGPanel.SwitchSelectUI |
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static Color |
BACK_COLOR |
protected net.ontopia.topicmaps.viz.ExtendedTGPanel.BasicMouseMotionListener |
basicMML |
Image |
image |
protected boolean |
maintainMouseOver |
protected com.touchgraph.graphlayout.Edge |
mouseOverE |
protected com.touchgraph.graphlayout.Node |
mouseOverN |
protected Point |
mousePos |
protected com.touchgraph.graphlayout.Node |
select |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ExtendedTGPanel(String imageSource)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdge(com.touchgraph.graphlayout.Edge e) |
com.touchgraph.graphlayout.Edge |
addEdge(com.touchgraph.graphlayout.Node f,
com.touchgraph.graphlayout.Node t,
int tens) |
void |
addGraphListener(com.touchgraph.graphlayout.GraphListener gl) |
com.touchgraph.graphlayout.Node |
addNode()
Adds a Node, with its ID and label being the current node count plus 1.
|
void |
addNode(com.touchgraph.graphlayout.Node node)
Add the Node node to the visibleLocality, checking for ID
uniqueness.
|
com.touchgraph.graphlayout.Node |
addNode(String label)
Adds a Node, provided its label.
|
com.touchgraph.graphlayout.Node |
addNode(String id,
String label)
Adds a Node, provided its ID and label.
|
void |
addPaintListener(com.touchgraph.graphlayout.TGPaintListener pl) |
void |
clearAll() |
void |
clearSelect() |
void |
collapseNode(com.touchgraph.graphlayout.Node collapseNode) |
void |
deleteEdge(com.touchgraph.graphlayout.Edge edge) |
void |
deleteEdge(com.touchgraph.graphlayout.Node from,
com.touchgraph.graphlayout.Node to) |
boolean |
deleteNode(com.touchgraph.graphlayout.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(com.touchgraph.graphlayout.Node node) |
void |
fastFinishAnimation() |
com.touchgraph.graphlayout.Edge |
findEdge(com.touchgraph.graphlayout.Node f,
com.touchgraph.graphlayout.Node t) |
protected void |
findMouseOver() |
com.touchgraph.graphlayout.Node |
findNode(String id)
Return the Node whose ID matches the String id, null if no
match is found.
|
com.touchgraph.graphlayout.Node |
findNodeLabelContaining(String substring)
Return the first Nodes whose label contains the String substring,
null if no match is found.
|
Collection |
findNodesByLabel(String label)
Return a Collection of all Nodes whose label matches the String
label, null if no match is found.
|
void |
fireResetEvent() |
com.touchgraph.graphlayout.TGPanel.AdjustOriginLens |
getAdjustOriginLens() |
Iterator |
getAllEdges()
Returns an Iterator over all edges in the complete graph.
|
Iterator |
getAllNodes()
Returns an Iterator over all nodes in the complete graph.
|
com.touchgraph.graphlayout.TGPoint2D |
getBottomRightDraw() |
com.touchgraph.graphlayout.TGPoint2D |
getCenter() |
com.touchgraph.graphlayout.Node |
getDragNode() |
com.touchgraph.graphlayout.TGPoint2D |
getDrawCenter() |
int |
getEdgeCount()
Returns the current edge count in the complete graph.
|
com.touchgraph.graphlayout.graphelements.ImmutableGraphEltSet |
getGES()
Return the current visible locality.
|
Image |
getImage(String imageSource) |
com.touchgraph.graphlayout.Edge |
getMouseOverE() |
com.touchgraph.graphlayout.Node |
getMouseOverN() |
Point |
getMousePos() |
int |
getNodeCount()
Returns the current node count.
|
com.touchgraph.graphlayout.Node |
getSelect() |
com.touchgraph.graphlayout.TGPanel.SwitchSelectUI |
getSwitchSelectUI() |
com.touchgraph.graphlayout.TGPoint2D |
getTopLeftDraw() |
void |
hideEdge(com.touchgraph.graphlayout.Edge hideEdge) |
void |
hideNode(com.touchgraph.graphlayout.Node hideNode) |
static void |
main(String[] args) |
void |
multiSelect(com.touchgraph.graphlayout.TGPoint2D from,
com.touchgraph.graphlayout.TGPoint2D to) |
int |
nodeNum()
Deprecated.
this method has been replaced by the
visibleNodeCount() method.
|
void |
paint(Graphics g) |
void |
processGraphMove() |
void |
removeGraphListener(com.touchgraph.graphlayout.GraphListener gl) |
void |
removePaintListener(com.touchgraph.graphlayout.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(com.touchgraph.graphlayout.Node node) |
void |
setGraphEltSet(com.touchgraph.graphlayout.graphelements.GraphEltSet ges) |
void |
setLensSet(com.touchgraph.graphlayout.TGLensSet lensSet) |
void |
setLocale(com.touchgraph.graphlayout.Node node,
int radius) |
void |
setLocale(com.touchgraph.graphlayout.Node node,
int radius,
int maxAddEdgeCount,
int maxExpandEdgeCount,
boolean unidirectional) |
void |
setMaintainMouseOver(boolean maintain) |
void |
setMouseOverE(com.touchgraph.graphlayout.Edge edge) |
void |
setMouseOverN(com.touchgraph.graphlayout.Node node) |
void |
setSelect(com.touchgraph.graphlayout.Node node) |
void |
setTGLayout(com.touchgraph.graphlayout.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(com.touchgraph.graphlayout.Node node) |
void |
updateDrawPositions() |
void |
updateGraphSize() |
void |
updateLocalityFromVisibility() |
void |
updatePosFromDraw(com.touchgraph.graphlayout.Node node) |
int |
visibleEdgeCount()
Return the number of Edges in the Locality.
|
int |
visibleNodeCount()
Returns the current node count within the VisibleLocality.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static Color BACK_COLOR
protected net.ontopia.topicmaps.viz.ExtendedTGPanel.BasicMouseMotionListener basicMML
protected com.touchgraph.graphlayout.Edge mouseOverE
protected com.touchgraph.graphlayout.Node mouseOverN
protected boolean maintainMouseOver
protected com.touchgraph.graphlayout.Node select
protected Point mousePos
public Image image
public ExtendedTGPanel(String imageSource)
public void setLensSet(com.touchgraph.graphlayout.TGLensSet lensSet)
setLensSet
in class com.touchgraph.graphlayout.TGPanel
public void setTGLayout(com.touchgraph.graphlayout.TGLayout tgl)
setTGLayout
in class com.touchgraph.graphlayout.TGPanel
public void setGraphEltSet(com.touchgraph.graphlayout.graphelements.GraphEltSet ges)
setGraphEltSet
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.TGPanel.AdjustOriginLens getAdjustOriginLens()
getAdjustOriginLens
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.TGPanel.SwitchSelectUI getSwitchSelectUI()
getSwitchSelectUI
in class com.touchgraph.graphlayout.TGPanel
public void setBackColor(Color color)
setBackColor
in class com.touchgraph.graphlayout.TGPanel
public Iterator getAllNodes()
getAllNodes
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.graphelements.ImmutableGraphEltSet getGES()
getGES
in class com.touchgraph.graphlayout.TGPanel
public int getNodeCount()
getNodeCount
in class com.touchgraph.graphlayout.TGPanel
public int nodeNum()
nodeNum
in class com.touchgraph.graphlayout.TGPanel
public int visibleNodeCount()
visibleNodeCount
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Node findNode(String id)
findNode
in class com.touchgraph.graphlayout.TGPanel
id
- The ID identifier used as a query.public Collection findNodesByLabel(String label)
findNodesByLabel
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Node findNodeLabelContaining(String substring)
findNodeLabelContaining
in class com.touchgraph.graphlayout.TGPanel
substring
- The Substring used as a query.public com.touchgraph.graphlayout.Node addNode() throws com.touchgraph.graphlayout.TGException
addNode
in class com.touchgraph.graphlayout.TGPanel
com.touchgraph.graphlayout.TGException
Node
public com.touchgraph.graphlayout.Node addNode(String label) throws com.touchgraph.graphlayout.TGException
addNode
in class com.touchgraph.graphlayout.TGPanel
com.touchgraph.graphlayout.TGException
GraphEltSet
public com.touchgraph.graphlayout.Node addNode(String id, String label) throws com.touchgraph.graphlayout.TGException
addNode
in class com.touchgraph.graphlayout.TGPanel
com.touchgraph.graphlayout.TGException
Node
public void addNode(com.touchgraph.graphlayout.Node node) throws com.touchgraph.graphlayout.TGException
addNode
in class com.touchgraph.graphlayout.TGPanel
com.touchgraph.graphlayout.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).deleteNodeById
in class com.touchgraph.graphlayout.TGPanel
id
- The ID identifier used as a query.public boolean deleteNode(com.touchgraph.graphlayout.Node node)
deleteNode
in class com.touchgraph.graphlayout.TGPanel
public void clearAll()
clearAll
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Node getSelect()
getSelect
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Node getMouseOverN()
getMouseOverN
in class com.touchgraph.graphlayout.TGPanel
public void setMouseOverN(com.touchgraph.graphlayout.Node node)
setMouseOverN
in class com.touchgraph.graphlayout.TGPanel
public Iterator getAllEdges()
getAllEdges
in class com.touchgraph.graphlayout.TGPanel
public void deleteEdge(com.touchgraph.graphlayout.Edge edge)
deleteEdge
in class com.touchgraph.graphlayout.TGPanel
public void deleteEdge(com.touchgraph.graphlayout.Node from, com.touchgraph.graphlayout.Node to)
deleteEdge
in class com.touchgraph.graphlayout.TGPanel
public int getEdgeCount()
getEdgeCount
in class com.touchgraph.graphlayout.TGPanel
public int edgeNum()
edgeNum
in class com.touchgraph.graphlayout.TGPanel
public int visibleEdgeCount()
visibleEdgeCount
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Edge findEdge(com.touchgraph.graphlayout.Node f, com.touchgraph.graphlayout.Node t)
findEdge
in class com.touchgraph.graphlayout.TGPanel
public void addEdge(com.touchgraph.graphlayout.Edge e)
addEdge
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Edge addEdge(com.touchgraph.graphlayout.Node f, com.touchgraph.graphlayout.Node t, int tens)
addEdge
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Edge getMouseOverE()
getMouseOverE
in class com.touchgraph.graphlayout.TGPanel
public void setMouseOverE(com.touchgraph.graphlayout.Edge edge)
setMouseOverE
in class com.touchgraph.graphlayout.TGPanel
public void fireResetEvent()
fireResetEvent
in class com.touchgraph.graphlayout.TGPanel
public void addGraphListener(com.touchgraph.graphlayout.GraphListener gl)
addGraphListener
in class com.touchgraph.graphlayout.TGPanel
public void removeGraphListener(com.touchgraph.graphlayout.GraphListener gl)
removeGraphListener
in class com.touchgraph.graphlayout.TGPanel
public void addPaintListener(com.touchgraph.graphlayout.TGPaintListener pl)
addPaintListener
in class com.touchgraph.graphlayout.TGPanel
public void removePaintListener(com.touchgraph.graphlayout.TGPaintListener pl)
removePaintListener
in class com.touchgraph.graphlayout.TGPanel
public void setMaintainMouseOver(boolean maintain)
setMaintainMouseOver
in class com.touchgraph.graphlayout.TGPanel
public void clearSelect()
clearSelect
in class com.touchgraph.graphlayout.TGPanel
public void selectFirstNode()
selectFirstNode
in class com.touchgraph.graphlayout.TGPanel
public void setSelect(com.touchgraph.graphlayout.Node node)
setSelect
in class com.touchgraph.graphlayout.TGPanel
public void multiSelect(com.touchgraph.graphlayout.TGPoint2D from, com.touchgraph.graphlayout.TGPoint2D to)
multiSelect
in class com.touchgraph.graphlayout.TGPanel
public void updateLocalityFromVisibility() throws com.touchgraph.graphlayout.TGException
updateLocalityFromVisibility
in class com.touchgraph.graphlayout.TGPanel
com.touchgraph.graphlayout.TGException
public void setLocale(com.touchgraph.graphlayout.Node node, int radius, int maxAddEdgeCount, int maxExpandEdgeCount, boolean unidirectional) throws com.touchgraph.graphlayout.TGException
setLocale
in class com.touchgraph.graphlayout.TGPanel
com.touchgraph.graphlayout.TGException
public void fastFinishAnimation()
fastFinishAnimation
in class com.touchgraph.graphlayout.TGPanel
public void setLocale(com.touchgraph.graphlayout.Node node, int radius) throws com.touchgraph.graphlayout.TGException
setLocale
in class com.touchgraph.graphlayout.TGPanel
com.touchgraph.graphlayout.TGException
public void expandNode(com.touchgraph.graphlayout.Node node)
expandNode
in class com.touchgraph.graphlayout.TGPanel
public void hideNode(com.touchgraph.graphlayout.Node hideNode)
hideNode
in class com.touchgraph.graphlayout.TGPanel
public void collapseNode(com.touchgraph.graphlayout.Node collapseNode)
collapseNode
in class com.touchgraph.graphlayout.TGPanel
public void hideEdge(com.touchgraph.graphlayout.Edge hideEdge)
hideEdge
in class com.touchgraph.graphlayout.TGPanel
public void setDragNode(com.touchgraph.graphlayout.Node node)
setDragNode
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.Node getDragNode()
getDragNode
in class com.touchgraph.graphlayout.TGPanel
public Point getMousePos()
getMousePos
in class com.touchgraph.graphlayout.TGPanel
public void startDamper()
startDamper
in class com.touchgraph.graphlayout.TGPanel
public void stopDamper()
stopDamper
in class com.touchgraph.graphlayout.TGPanel
public void resetDamper()
resetDamper
in class com.touchgraph.graphlayout.TGPanel
public void stopMotion()
stopMotion
in class com.touchgraph.graphlayout.TGPanel
protected void findMouseOver()
findMouseOver
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.TGPoint2D getTopLeftDraw()
getTopLeftDraw
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.TGPoint2D getBottomRightDraw()
getBottomRightDraw
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.TGPoint2D getCenter()
getCenter
in class com.touchgraph.graphlayout.TGPanel
public com.touchgraph.graphlayout.TGPoint2D getDrawCenter()
getDrawCenter
in class com.touchgraph.graphlayout.TGPanel
public void updateGraphSize()
updateGraphSize
in class com.touchgraph.graphlayout.TGPanel
public void processGraphMove()
processGraphMove
in class com.touchgraph.graphlayout.TGPanel
public void repaintAfterMove()
repaintAfterMove
in class com.touchgraph.graphlayout.TGPanel
public void updateDrawPos(com.touchgraph.graphlayout.Node node)
updateDrawPos
in class com.touchgraph.graphlayout.TGPanel
public void updatePosFromDraw(com.touchgraph.graphlayout.Node node)
updatePosFromDraw
in class com.touchgraph.graphlayout.TGPanel
public void updateDrawPositions()
updateDrawPositions
in class com.touchgraph.graphlayout.TGPanel
public void paint(Graphics g)
paint
in class com.touchgraph.graphlayout.TGPanel
public void update(Graphics g)
update
in class com.touchgraph.graphlayout.TGPanel
public static void main(String[] args)