N
- The node class for the graphE
- The edge class for the graphpublic abstract class AbstractGraphDisplay<N,E> extends javax.swing.JComponent implements GraphDisplay<N,E>
javax.swing.JComponent.AccessibleJComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
AbstractGraphDisplay() |
Modifier and Type | Method and Description |
---|---|
void |
addHoverListener(HoverListener listener)
Adds a listener which will receive any ItemSelected events.
|
void |
addItemListener(java.awt.event.ItemListener listener)
Adds a listener which will receive any ItemSelected events.
|
protected void |
fireHoverStateChanged(HoverEvent event)
Notifies all listeners that have registered interest for notification on
this event type.
|
protected void |
fireItemStateChanged(java.awt.event.ItemEvent event)
Notifies all listeners that have registered interest for notification on
this event type.
|
abstract E |
getEdgeAt(java.awt.Point point)
Get the edge located at a particular point.
|
Graph<N,E> |
getGraph()
Get the graph assigned to this display
|
abstract N |
getNodeAt(java.awt.Point point)
Returns the node located at the pickPoint.
|
E |
getSelectedEdge()
Gets the current selected edge.
|
N |
getSelectedNode()
Gets the current selected node.
|
java.lang.Object[] |
getSelectedObjects()
Returns the selected items or null if no items are selected.
|
protected boolean |
isEdgeDisplayable(E edge)
Returns whether the edge should be displayed.
|
boolean |
isEdgeSelectable()
Returns whether the edges are selectable
|
protected boolean |
isHighlighted(java.lang.Object obj)
Returns whether the object should be highlighted.
|
protected boolean |
isNodeDisplayable(N node)
Returns whether the node should be displayed.
|
protected void |
processMouseEvent(java.awt.event.MouseEvent event)
Processes any internal mouse events.
|
abstract void |
redrawEdge(E edge)
Redraws an individual edge.
|
abstract void |
redrawNode(N node)
Redraws an individual node
|
void |
removeHoverListener(HoverListener listener)
Removes the ItemListener from the list of listeners receiving the node
or edge selection events
|
void |
removeItemListener(java.awt.event.ItemListener listener)
Removes the ItemListener from the list of listeners receiving the node
or edge selection events
|
void |
selectEdge(E edge)
Programatically sets the currently selected edge
|
void |
selectNode(N node)
Programatically sets the currently selected node
|
void |
setEdgeSelectable(boolean edgeSelect)
Sets whether the edges are selectable.
|
void |
setGraph(Graph<N,E> graph)
Set the graph to be displayed
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, update, updateUI
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, 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, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
updateGraph
public void addHoverListener(HoverListener listener)
listener
- the ItemListener to receive node or edge selectionspublic void addItemListener(java.awt.event.ItemListener listener)
addItemListener
in interface java.awt.ItemSelectable
listener
- the ItemListener to receive node or edge selectionsprotected void fireHoverStateChanged(HoverEvent event)
event
- the ItemEvent object, indicating node/edge selectionprotected void fireItemStateChanged(java.awt.event.ItemEvent event)
event
- the ItemEvent object, indicating node/edge selectionpublic abstract E getEdgeAt(java.awt.Point point)
point
- the point, in pixel coordinatespublic Graph<N,E> getGraph()
getGraph
in interface GraphDisplay<N,E>
public abstract N getNodeAt(java.awt.Point point)
point
- the point in pixel coordinatespublic E getSelectedEdge()
getSelectedEdge
in interface GraphDisplay<N,E>
public N getSelectedNode()
getSelectedNode
in interface GraphDisplay<N,E>
public java.lang.Object[] getSelectedObjects()
getSelectedObjects
in interface java.awt.ItemSelectable
protected boolean isEdgeDisplayable(E edge)
edge
- the edge to checkpublic boolean isEdgeSelectable()
protected boolean isHighlighted(java.lang.Object obj)
obj
- the object to check for highlightingprotected boolean isNodeDisplayable(N node)
node
- the node to checkprotected void processMouseEvent(java.awt.event.MouseEvent event)
processMouseEvent
in class javax.swing.JComponent
event
- the MouseEvent to processpublic abstract void redrawEdge(E edge)
edge
- the node to redrawpublic abstract void redrawNode(N node)
node
- the node to redrawpublic void removeHoverListener(HoverListener listener)
listener
- the ItemListener to removepublic void removeItemListener(java.awt.event.ItemListener listener)
removeItemListener
in interface java.awt.ItemSelectable
listener
- the ItemListener to removepublic void selectEdge(E edge)
selectEdge
in interface GraphDisplay<N,E>
edge
- the currently selected edgepublic void selectNode(N node)
selectNode
in interface GraphDisplay<N,E>
node
- the node to be selectedpublic void setEdgeSelectable(boolean edgeSelect)
edgeSelect
- whether the edges should be selectable