org.ceryle.graph.tm
Class TMPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.touchgraph.graphlayout.TGPanel
org.ceryle.graph.GraphPanel
org.ceryle.graph.tm.TMPanel
- All Implemented Interfaces:
- FocusListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
public class TMPanel
- extends GraphPanel
TMPanel extends GraphPanel,
providing additional Topic Map-related features used in the Ceryle application.
- Version:
- 1.21 $Id: TMPanel.java,v 3.2 2007-06-15 12:09:26 altheim Exp $
- Author:
- Murray Altheim
- See Also:
- Serialized Form
|
Field Summary |
static int |
GS_empty
Bitwise graph state identifiers. |
static int |
GS_mult_assoc
Bitwise graph state identifiers. |
static int |
GS_mult_scope
Bitwise graph state identifiers. |
static int |
GS_mult_topic
Bitwise graph state identifiers. |
static int |
GS_no_sel
Bitwise graph state identifiers. |
static int |
GS_sel_assoc
Bitwise graph state identifiers. |
static int |
GS_sel_mixed
Bitwise graph state identifiers. |
static int |
GS_sel_scope
Bitwise graph state identifiers. |
static int |
GS_sel_topic
Bitwise graph state identifiers. |
static int |
GS_two_topic
Bitwise graph state identifiers. |
static int |
GS_unknown
Bitwise graph state identifiers. |
| Fields inherited from class org.ceryle.graph.GraphPanel |
autoCenter, BIT_hgrid, BIT_vgrid, COLOR_BACKGROUND, COLOR_EMPTY_GRAPH, COLOR_TEXT_FOREGROUND, connected, fasterDraw, hilighted, m_bgimage, m_bgimageURL, m_gridMode, m_selmgr, magneticMouse, mh, mouseIsDragging, outlined, previouslySelectedNodes, provisionalNode, scrolling, skew, STROKE_DOTTED, tgsp |
| Fields inherited from class com.touchgraph.graphlayout.TGPanel |
BACK_COLOR, basicMML, bottomRightDraw, completeEltSet, dragNode, fixedIsPinned, graphListeners, handCursor, localityUtils, maintainMouseOver, mouseOverE, mouseOverN, mousePos, moveCursor, offgraphics, offscreen, offscreensize, paintListeners, select, TG_THREADGROUP_ID, tgLayout, threadgroup, topLeftDraw, visibleLocality |
|
Constructor Summary |
TMPanel()
Default constructor for a TMPanel. |
TMPanel(TGScrollPane tgScrollPane)
Constructor for a TMPanel with a TGScrollPane tgScrollPane. |
|
Method Summary |
protected boolean |
acceptDroppedString(String s,
Point p)
Receive a drag and dropped String, returning true if accepted at
the given Point. |
protected void |
activateMMListener(boolean activate)
Activates or deactivate the superclass' ExtendedMouseMotionListener. |
ANode |
getANodeForAssociation(Association assoc)
Returns the ANode corresponding to the provided Association assoc,
or null if it cannot be obtained (for any reason). |
TMNode |
getFirstTMNode()
A convenience method that returns the first TMNode of a graph. |
TNode |
getFirstTNode()
A convenience method that returns the first TNode of a graph. |
int |
getGraphState()
Returns the state of the graph as a bitwise int. |
TNode |
getTNodeForTopic(Topic topic)
Returns the TNode corresponding to the provided Topic topic,
or null if it cannot be obtained (for any reason). |
Set |
getTNodes()
Return the Set of all TNodes in the graph, an empty Set if none
are available. |
StackSet |
getTNodesForTopics(StackSet topics)
Returns a StackSet of TNodes provided with a StackSet of
Topics topics, or an empty StackSet if none are available. |
Topic |
getTopicForTNode(TNode tnode)
Returns the Topic corresponding to the provided TNode tnode,
or null if it cannot be obtained (for any reason). |
TopicMap |
getTopicMap()
If a TopicMap has been explicitly set via setTopicMap(TopicMap),
it will be returned. |
Set |
getTopics()
Return the Set of all Topics corresponding to visualized TNodes
in the graph, an empty Set if none are available. |
boolean |
inVernier(MouseEvent e,
Node node)
Returns true if the current mouse position is within the Vernier of
a TNode's time line. |
void |
keyNavigate(int key)
Responds to cursor key movements by navigating through the graph. |
void |
multiSelect(Point2D.Double from,
Point2D.Double to,
MouseEvent e)
Overrides TouchGraph's method, storing the selected nodes
via the SelectionManager. |
void |
setGraphFixed(boolean fixed)
When true, sets the visible and on-screen nodes fixed; when false,
unfixes them. |
void |
setSelected(GraphNode node)
Selects the Node node. |
void |
setTopicMap(TopicMap topicmap)
Sets the TopicMap to be returned via setTopicMap(TopicMap). |
protected void |
tmChanged()
This method is called on any change to the TopicMap. |
| Methods inherited from class org.ceryle.graph.GraphPanel |
addEnMasse, addSelectionListener, addToSelection, beginMultiSelect, blitText, centerNode, clearHilights, clearOutlined, clearSelect, clearSelection, endMultiSelect, fastScrollToCenter, findMouseOver, focusGained, focusLost, followNode, getAngleDBetweenNodes, getAngleRBetweenNodes, getAutoCenteringFrequency, getBackgroundImage, getBackgroundImageURL, getFirstGraphNode, getForegroundText, getGridCellSize, getLocalityUtils, getMessageFadeTime, getMultiSelected, getNodesByClass, getSelect, getSelected, getSelectedComposition, getSelectedCount, getSelectionManager, getSharedEdge, getTGScrollPane, handleMouseEvent, handleMouseMotionEvent, isAutoCentering, isMouseDragging, isSelected, nodeCountByClass, paintBackground, paintForeground, paintGrid, removeEdgesOfType, removeFromSelection, selectAll, selectFirstNode, setAutoCentering, setAutoCenteringFrequency, setForegroundText, setHilighted, setMagneticMouse, setMessageFadeTime, setMouseIsDragging, setOutlined, setSelect, setTGScrollPane, updateLocality |
| Methods inherited from class com.touchgraph.graphlayout.TGPanel |
addEdge, addEdge, addGraphListener, addNode, addNode, addNode, addNode, addNode, addPaintListener, clearAll, collapseNode, convertDrawToReal, convertDrawToReal, convertDrawToReal, convertRealToDraw, convertRealToDraw, convertRealToDraw, deleteEdge, deleteEdge, deleteNode, deleteNodeById, edgeNum, expandNode, fastFinishAnimation, findEdge, findNode, findNodeLabelContaining, findNodesByLabel, findNodesByLabel, fireMovedEvent, fireResetEvent, getAdjustOriginLens, getAllEdges, getAllNodes, getAllNodesAsSet, getBottomRightDraw, getCenter, getDragNode, getDrawCenter, getEdgeCount, getGES, getMouseOverE, getMouseOverN, getMousePos, getNodeCount, getOffscreenImage, getOffscreenImageSize, getSwitchSelectUI, getThreadGroup, getTopLeftDraw, hideEdge, hideNode, isShiftingLocality, main, multiSelect, myBrighter, nodeNum, paint, processGraphMove, redraw, removeGraphListener, removePaintListener, repaintAfterMove, resetDamper, setBackColor, setDragNode, setGraphEltSet, setLensSet, setLocale, setLocale, setMaintainMouseOver, setMouseOverE, setMouseOverN, setMousePos, setTGLayout, sleepTGThread, startDamper, stopDamper, stopMotion, update, updateDrawPos, updateDrawPositions, updateGraphSize, updateLocalityFromVisibility, updatePosFromDraw, visibleEdgeCount, visibleNodeCount |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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 |
| Methods inherited from class java.awt.Container |
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, 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, 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, hide, 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, transferFocusUpCycle |
GS_unknown
public static final int GS_unknown
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_empty
public static final int GS_empty
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_no_sel
public static final int GS_no_sel
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_sel_mixed
public static final int GS_sel_mixed
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_sel_topic
public static final int GS_sel_topic
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_two_topic
public static final int GS_two_topic
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_mult_topic
public static final int GS_mult_topic
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_sel_assoc
public static final int GS_sel_assoc
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_mult_assoc
public static final int GS_mult_assoc
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_sel_scope
public static final int GS_sel_scope
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
GS_mult_scope
public static final int GS_mult_scope
- Bitwise graph state identifiers. (See code for descriptions.)
- See Also:
- Constant Field Values
TMPanel
public TMPanel()
- Default constructor for a TMPanel.
This leaves the parent TGScrollPane null and disables
focusability and any key-based event listeners.
TMPanel
public TMPanel(TGScrollPane tgScrollPane)
- Constructor for a TMPanel with a TGScrollPane tgScrollPane.
activateMMListener
protected void activateMMListener(boolean activate)
- Activates or deactivate the superclass' ExtendedMouseMotionListener.
- Overrides:
activateMMListener in class GraphPanel
setSelected
public void setSelected(GraphNode node)
- Selects the Node node.
See
GraphPanel.setSelected(GraphNode),
but returns the Node subclass GraphNode.
- Overrides:
setSelected in class GraphPanel
multiSelect
public void multiSelect(Point2D.Double from,
Point2D.Double to,
MouseEvent e)
- Overrides TouchGraph's method, storing the selected nodes
via the SelectionManager. This method is normally activated if
the Shift key is down during a drag. If the control key is also
down, all node types are selected. The default (when the
control key is not down) is only to hilight TNodes.
- Overrides:
multiSelect in class GraphPanel
getGraphState
public int getGraphState()
- Returns the state of the graph as a bitwise int.
acceptDroppedString
protected boolean acceptDroppedString(String s,
Point p)
- Receive a drag and dropped String, returning true if accepted at
the given Point. This returns true when dropped on TNodes or the
background only. The message is passed to the TMLayoutPanel.
- Overrides:
acceptDroppedString in class GraphPanel
tmChanged
protected void tmChanged()
- This method is called on any change to the TopicMap.
setTopicMap
public void setTopicMap(TopicMap topicmap)
- Sets the TopicMap to be returned via
setTopicMap(TopicMap).
This should not be abused.
getTopicMap
public TopicMap getTopicMap()
- If a TopicMap has been explicitly set via
setTopicMap(TopicMap),
it will be returned. Otherwise, returns the TopicMap parent of the first
TMNode in the graph, or null if it cannot be obtained (for any reason).
It should be noted that there may be more than one TopicMap open in the graph.
getFirstTMNode
public TMNode getFirstTMNode()
- A convenience method that returns the first TMNode of a graph.
If for some strange reason the first node is not a TMNode, null is returned.
setGraphFixed
public void setGraphFixed(boolean fixed)
- When true, sets the visible and on-screen nodes fixed; when false,
unfixes them. This is used to temporarily fix in place nodes during
drag and drop operations.
This keeps track of which were fixed previous to the call, so each
call with a parameter of true should be followed by a call
with false to reset the graph to its prior state.
getTNodes
public Set getTNodes()
- Return the Set of all TNodes in the graph, an empty Set if none
are available.
getTopics
public Set getTopics()
- Return the Set of all Topics corresponding to visualized TNodes
in the graph, an empty Set if none are available. Non-visualized
Topics or those within invisible nodes are not included.
getFirstTNode
public TNode getFirstTNode()
- A convenience method that returns the first TNode of a graph.
If there is no TNode, null is returned.
getTopicForTNode
public Topic getTopicForTNode(TNode tnode)
- Returns the Topic corresponding to the provided TNode tnode,
or null if it cannot be obtained (for any reason).
getTNodeForTopic
public TNode getTNodeForTopic(Topic topic)
- Returns the TNode corresponding to the provided Topic topic,
or null if it cannot be obtained (for any reason). This first tries
a direct ID match. If that fails, it iterates through all the TNodes
checking each's stored Topic.
getANodeForAssociation
public ANode getANodeForAssociation(Association assoc)
- Returns the ANode corresponding to the provided Association assoc,
or null if it cannot be obtained (for any reason). This uses the ID if
available, otherwise attempts to match the bound TopicMapObject by iterating
through the entire graph.
getTNodesForTopics
public StackSet getTNodesForTopics(StackSet topics)
- Returns a StackSet of TNodes provided with a StackSet of
Topics topics, or an empty StackSet if none are available.
inVernier
public boolean inVernier(MouseEvent e,
Node node)
- Returns true if the current mouse position is within the Vernier of
a TNode's time line. If the Node is not a TNode, it isn't displaying
a time line, or the point is not within, returns false.
keyNavigate
public void keyNavigate(int key)
- Responds to cursor key movements by navigating through the graph.
This uses the KeyEvent.VK_RIGHT (the right cursor key) for
clockwise movement, the KeyEvent.VK_LEFT (the left cursor
key) for counter-clockwise movement. The VK_ENTER key
selects the outlined Node, unless there is no outlined node (in which
case it centers the currently selected node).
This traversal is done according entirely as regards edge direction,
not via the semantics of the associations.
- Overrides:
keyNavigate in class GraphPanel
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.