|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectComponent
Container
JComponent
JGraph
ImprovedJGraph<NodeType,NodeData,EdgeType,EdgeData>
public abstract class ImprovedJGraph<NodeType,NodeData extends INodeData<NodeType>,EdgeType,EdgeData extends IEdgeData<EdgeType>>
Nested Class Summary | |
---|---|
class |
ImprovedJGraph.EdgeSortingComparator
|
Nested classes/interfaces inherited from class JGraph |
---|
JGraph.EmptySelectionModel |
Nested classes/interfaces inherited from class JComponent |
---|
JComponent.AccessibleJComponent |
Field Summary |
---|
Fields inherited from class JGraph |
---|
ANTIALIASED_PROPERTY, CROSS_GRID_MODE, DOT_GRID_MODE, EDITABLE_PROPERTY, GRAPH_LAYOUT_CACHE_PROPERTY, GRAPH_MODEL_PROPERTY, GRID_SIZE_PROPERTY, GRID_VISIBLE_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, LINE_GRID_MODE, MARQUEE_HANDLER_PROPERTY, PORTS_VISIBLE_PROPERTY, SCALE_PROPERTY, SELECTION_MODEL_PROPERTY, VERSION |
Fields inherited from class JComponent |
---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
ImprovedJGraph()
|
Method Summary | ||
---|---|---|
DefaultEdge |
addEdge(EdgeData data,
DefaultGraphCell src,
DefaultGraphCell tgt)
Adds a new edge to the graph (and the underlying model). |
|
DefaultGraphCell |
addNode(String name,
NodeData data)
Adds a new node to the graph (and the underlying model). |
|
static
|
addToMapList(Map<E,List<T>> map,
E key,
T nVal)
Generic method that handles maps from an Object to a list of objects and ads a new entry to the value list with the specified object key. |
|
void |
adjustNodeWidths()
Compute the true widths of the node labels in the graph, change the node widths such that all the labels fit in, and recompute the layout. |
|
void |
clear()
Remove all nodes and edges in the graph. |
|
void |
computeAdjacency()
Go through all the edges of the graph and record the adjacency matrix in the "parents" and "children" maps. |
|
abstract void |
computeLayout()
|
|
int |
computeNodeHeight(DefaultGraphCell node)
Computes the height of the label of a node. |
|
int |
computeNodeWidth(DefaultGraphCell node)
Computes the width of the label of a node. |
|
DefaultGraphCell |
findNodeOrEdgeAt(int x,
int y)
Return the node at the mouse position (x,y). |
|
List<DefaultGraphCell> |
getChildren(DefaultGraphCell node)
|
|
EdgeData |
getEdgeData(DefaultEdge edge)
Get the edge data of an edge cell. |
|
Set<DefaultEdge> |
getEdges()
Get all edges of the graph. |
|
List<DefaultEdge> |
getInEdges(DefaultGraphCell node)
Compute the incoming edges for a node. |
|
String |
getName()
Get the name (= ID) of the graph. |
|
NodeData |
getNodeData(DefaultGraphCell node)
Get the node data of a node cell. |
|
DefaultGraphCell |
getNodeForName(String name)
Look up the node with the specified name. |
|
Set<DefaultGraphCell> |
getNodes()
Get all nodes of the graph. |
|
List<DefaultEdge> |
getOutEdges(DefaultGraphCell node)
Compute the outgoing edges for a node. |
|
List<DefaultGraphCell> |
getParents(DefaultGraphCell node)
|
|
DefaultGraphCell |
getRightSibling(DefaultGraphCell node)
Returns the right sibling of a given node (if there is one). |
|
List<DefaultEdge> |
getSortedEdges()
Return all edges of the graph in a sorted List . |
|
DefaultGraphCell |
getSourceNode(DefaultEdge edge)
Returns the source node of an edge. |
|
DefaultGraphCell |
getTargetNode(DefaultEdge edge)
Returns the target node of and edge. |
|
String |
getToolTipText(MouseEvent e)
Overrides the getToolTipText method of
JComponent . |
|
boolean |
isForest()
Determines whether or not this graph is a forest. |
|
boolean |
isLeaf(DefaultGraphCell node)
|
|
boolean |
isRelativeLeaf(DefaultGraphCell node,
Collection<DefaultGraphCell> subgraph)
|
|
boolean |
isRelativeRoot(DefaultGraphCell node,
Collection<DefaultGraphCell> subgraph)
|
|
boolean |
isRoot(DefaultGraphCell node)
|
|
void |
setName(String name)
Set the name (= ID) of the dominance graph. |
Methods inherited from class JGraph |
---|
addGraphSelectionListener, addSampleData, addSelectionCell, addSelectionCells, cancelEditing, clearSelection, cloneCells, convertValueToString, createBounds, createView, fromScreen, fromScreen, getCellBounds, getCellBounds, getDescendantList, getDescendants, getEditClickCount, getEditingCell, getFirstCellForLocation, getGraphLayoutCache, getGridColor, getGridMode, getGridSize, getHandleColor, getHandleSize, getHighlightColor, getInvokesStopCellEditing, getLockedHandleColor, getMarqueeColor, getMarqueeHandler, getMinimumMove, getModel, getNextCellForLocation, getNextViewAt, getNextViewAt, getPortForLocation, getPortViewAt, getPreferredScrollableViewportSize, getRoots, getRoots, getScale, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectionCell, getSelectionCells, getSelectionCount, getSelectionModel, getTolerance, getUI, getUIClassID, graphDidChange, isAntiAliased, isBendable, isCellEditable, isCellSelected, isCloneable, isConnectable, isDisconnectable, isDisconnectOnMove, isDragEnabled, isDropEnabled, isEditable, isEditing, isGridEnabled, isGridVisible, isMoveable, isMoveBelowZero, isPortsVisible, isSelectionEmpty, isSelectNewCells, isSizeable, main, removeGraphSelectionListener, removeSelectionCell, scrollCellToVisible, scrollPointToVisible, setAntiAliased, setBendable, setCloneable, setConnectable, setDisconnectable, setDisconnectOnMove, setDragEnabled, setDropEnabled, setEditable, setEditClickCount, setGraphLayoutCache, setGridColor, setGridEnabled, setGridMode, setGridSize, setGridVisible, setHandleColor, setHandleSize, setHighlightColor, setInvokesStopCellEditing, setLockedHandleColor, setMarqueeColor, setMarqueeHandler, setMinimumMove, setModel, setMoveable, setMoveBelowZero, setPortsVisible, setScale, setSelectionCell, setSelectionCells, setSelectionModel, setSelectNewCells, setSizeable, setTolerance, setUI, snap, snap, startEditingAtCell, stopEditing, toScreen, toScreen, updateAutoSize, updateUI |
Methods inherited from class JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class Container |
---|
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface Accessible |
---|
getAccessibleContext |
Constructor Detail |
---|
public ImprovedJGraph()
Method Detail |
---|
public void clear()
public DefaultGraphCell addNode(String name, NodeData data)
data
- the data for the new node.
public DefaultEdge addEdge(EdgeData data, DefaultGraphCell src, DefaultGraphCell tgt)
data
- the data for the new edge.src
- the node cell at which the edge should start.tgt
- the node cell at which the edge should end.
public Set<DefaultGraphCell> getNodes()
public Set<DefaultEdge> getEdges()
public int computeNodeWidth(DefaultGraphCell node)
computeTextWidth
, and is subject to the same
caveats.
node
- the node whose width we want to know
computeTextWidth
public int computeNodeHeight(DefaultGraphCell node)
computeTextHeight
, and is subject to the same
caveats.
node
- the node whose height we want to know
computeTextHeight
public void adjustNodeWidths()
public abstract void computeLayout()
public NodeData getNodeData(DefaultGraphCell node)
node
-
public EdgeData getEdgeData(DefaultEdge edge)
edge
-
public DefaultGraphCell getNodeForName(String name)
name
-
public String getToolTipText(MouseEvent e)
getToolTipText
method of
JComponent
.
getToolTipText
in class JGraph
public DefaultGraphCell findNodeOrEdgeAt(int x, int y)
x
- y
-
public boolean isRoot(DefaultGraphCell node)
public boolean isRelativeRoot(DefaultGraphCell node, Collection<DefaultGraphCell> subgraph)
public boolean isLeaf(DefaultGraphCell node)
public boolean isRelativeLeaf(DefaultGraphCell node, Collection<DefaultGraphCell> subgraph)
public void computeAdjacency()
public static <E,T> void addToMapList(Map<E,List<T>> map, E key, T nVal)
E
- the key typeT
- the type of the list elementsmap
- the mapkey
- the key to which list the new value shall be addednVal
- the new valuepublic List<DefaultEdge> getSortedEdges()
List
.
public void setName(String name)
setName
in class Component
name
- new name of the graph.public String getName()
getName
in class Component
public List<DefaultEdge> getInEdges(DefaultGraphCell node)
EdgeSortingComparator
node
- the node whose in-edges we want
public DefaultGraphCell getSourceNode(DefaultEdge edge)
edge
- the edge
public DefaultGraphCell getTargetNode(DefaultEdge edge)
edge
- the edge
public List<DefaultEdge> getOutEdges(DefaultGraphCell node)
EdgeSortingComparator
node
- the node to compute the outgoing edges for
public boolean isForest()
public List<DefaultGraphCell> getChildren(DefaultGraphCell node)
public List<DefaultGraphCell> getParents(DefaultGraphCell node)
public DefaultGraphCell getRightSibling(DefaultGraphCell node)
node
- the node (the left sibling)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |