N
- The allowed Node superclassE
- The allowed Edge superclasspublic class NeptusGraph<N extends NeptusNodeElement,E extends NeptusEdgeElement>
extends javax.swing.JComponent
implements javax.swing.event.UndoableEditListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
java.awt.geom.Point2D |
dragDifference |
protected java.util.LinkedHashMap<java.lang.String,E> |
edges |
protected GraphElementFactory<N,E> |
factory |
protected int |
graphHeight |
protected int |
graphWidth |
protected java.awt.geom.Point2D |
lastMousePoint |
protected java.util.LinkedHashMap<java.lang.String,N> |
nodes |
protected java.util.Vector<NeptusGraphElement<?>> |
selection |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
NeptusGraph() |
NeptusGraph(GraphElementFactory<N,E> factoryInstance)
Creates a new NeptusGraph
|
Modifier and Type | Method and Description |
---|---|
E |
addEdge(E edge)
Adds an edge to the graph
|
E |
addEdge(java.lang.String src,
java.lang.String tgt)
Creates an Edge between the given nodes
|
void |
addGraphSelectionListener(GraphSelectionListener listener) |
N |
addNode()
Adds a node at a random position using the GraphElementFactory
|
void |
addNode(N node)
Adds a node to this graph
|
void |
addPostRenderPainter(GraphPainter painter) |
void |
addPreRenderPainter(GraphPainter painter) |
NeptusEdgeElement<?>[] |
allEdges() |
NeptusNodeElement<?>[] |
allNodes() |
void |
autoLayout() |
void |
clear() |
protected void |
editSelectionProperties() |
NeptusEdgeElement[] |
getAllEdges() |
NeptusNodeElement[] |
getAllNodes() |
javax.swing.AbstractAction[] |
getClickActions(java.awt.event.MouseEvent evt) |
java.awt.geom.AffineTransform |
getCurrentTransform() |
E |
getEdge(java.lang.String id)
Returns an existing edge
|
GraphElementFactory<N,E> |
getFactory() |
protected N |
getFirstNodeUnder(java.awt.geom.Point2D point) |
N |
getNode(java.lang.String id)
Returns an existing node
|
NeptusEdgeElement<?>[] |
getSelectedEdges(boolean includeReferredElements) |
NeptusNodeElement[] |
getSelectedNodes() |
javax.swing.undo.UndoManager |
getUndoManager() |
javax.swing.undo.UndoableEditSupport |
getUndoSupport() |
boolean |
isCyclingAllowed() |
boolean |
isEditable() |
boolean |
isFinalStateRequired() |
boolean |
isInitialStateRequired() |
boolean |
isLoopingAllowed() |
boolean |
isNonDeterminismAllowed() |
boolean |
isOnlyOneInitialStateAllowed() |
static void |
main(java.lang.String[] args) |
void |
mouseClicked(java.awt.event.MouseEvent arg0) |
void |
mouseDragged(java.awt.event.MouseEvent arg0) |
void |
mouseEntered(java.awt.event.MouseEvent arg0) |
void |
mouseExited(java.awt.event.MouseEvent arg0) |
void |
mouseMoved(java.awt.event.MouseEvent arg0) |
void |
mousePressed(java.awt.event.MouseEvent arg0) |
void |
mouseReleased(java.awt.event.MouseEvent arg0) |
void |
paint(java.awt.Graphics arg0) |
void |
removeEdge(java.lang.String id)
Removes an existing edge
|
void |
removeGraphSelectionListener(GraphSelectionListener listener) |
java.util.Vector<NeptusEdgeElement> |
removeNode(java.lang.String id)
Removes a node from this graph
|
void |
removePostRenderPainter(GraphPainter painter) |
void |
removePreRenderPainter(GraphPainter painter) |
void |
setCyclingAllowed(boolean cyclingAllowed) |
void |
setEditable(boolean editable) |
void |
setFactory(GraphElementFactory<N,E> factory) |
void |
setFinalStateRequired(boolean finalStateRequired) |
void |
setInitialStateRequired(boolean initialStateRequired) |
void |
setLoopingAllowed(boolean loopingAllowed) |
void |
setNonDeterminismAllowed(boolean nonDeterminismAllowed) |
void |
setOnlyOneInitialStateAllowed(boolean onlyOneInitialStateAllowed) |
void |
undoableEditHappened(javax.swing.event.UndoableEditEvent e) |
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, 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, 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
protected java.util.LinkedHashMap<java.lang.String,N extends NeptusNodeElement> nodes
protected java.util.LinkedHashMap<java.lang.String,E extends NeptusEdgeElement> edges
protected java.util.Vector<NeptusGraphElement<?>> selection
protected GraphElementFactory<N extends NeptusNodeElement,E extends NeptusEdgeElement> factory
protected int graphWidth
protected int graphHeight
protected java.awt.geom.Point2D lastMousePoint
public java.awt.geom.Point2D dragDifference
public NeptusGraph()
public NeptusGraph(GraphElementFactory<N,E> factoryInstance)
factoryInstance
- The GraphElementFactory that is used to create new nodes and edges
when requested by the userpublic void clear()
public N getNode(java.lang.String id)
id
- The id of the node to returnpublic E getEdge(java.lang.String id)
id
- The id of the edge to returnpublic NeptusEdgeElement<?>[] allEdges()
public NeptusNodeElement<?>[] allNodes()
public void addNode(N node)
node
- The node to be added (its position should already be set)public N addNode()
public E addEdge(java.lang.String src, java.lang.String tgt)
src
- The source node's idtgt
- The target node's idpublic void paint(java.awt.Graphics arg0)
paint
in class javax.swing.JComponent
protected void editSelectionProperties()
public javax.swing.AbstractAction[] getClickActions(java.awt.event.MouseEvent evt)
public void mouseClicked(java.awt.event.MouseEvent arg0)
mouseClicked
in interface java.awt.event.MouseListener
public NeptusEdgeElement<?>[] getSelectedEdges(boolean includeReferredElements)
public NeptusNodeElement[] getSelectedNodes()
public java.util.Vector<NeptusEdgeElement> removeNode(java.lang.String id)
id
- The id of the node to be removedpublic void removeEdge(java.lang.String id)
id
- The id of the edge to be removedpublic void mouseDragged(java.awt.event.MouseEvent arg0)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseEntered(java.awt.event.MouseEvent arg0)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent arg0)
mouseExited
in interface java.awt.event.MouseListener
public void mouseMoved(java.awt.event.MouseEvent arg0)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mousePressed(java.awt.event.MouseEvent arg0)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent arg0)
mouseReleased
in interface java.awt.event.MouseListener
protected N getFirstNodeUnder(java.awt.geom.Point2D point)
public java.awt.geom.AffineTransform getCurrentTransform()
public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
undoableEditHappened
in interface javax.swing.event.UndoableEditListener
public boolean isLoopingAllowed()
public void setLoopingAllowed(boolean loopingAllowed)
public boolean isNonDeterminismAllowed()
public void setNonDeterminismAllowed(boolean nonDeterminismAllowed)
public boolean isOnlyOneInitialStateAllowed()
public void setOnlyOneInitialStateAllowed(boolean onlyOneInitialStateAllowed)
public boolean isCyclingAllowed()
public void setCyclingAllowed(boolean cyclingAllowed)
public boolean isFinalStateRequired()
public void setFinalStateRequired(boolean finalStateRequired)
public boolean isInitialStateRequired()
public void setInitialStateRequired(boolean initialStateRequired)
public void addGraphSelectionListener(GraphSelectionListener listener)
public void removeGraphSelectionListener(GraphSelectionListener listener)
public NeptusNodeElement[] getAllNodes()
public NeptusEdgeElement[] getAllEdges()
public static void main(java.lang.String[] args)
public javax.swing.undo.UndoManager getUndoManager()
public javax.swing.undo.UndoableEditSupport getUndoSupport()
public GraphElementFactory<N,E> getFactory()
public void setFactory(GraphElementFactory<N,E> factory)
public void autoLayout()
public void setEditable(boolean editable)
public boolean isEditable()
public void addPreRenderPainter(GraphPainter painter)
public void addPostRenderPainter(GraphPainter painter)
public void removePreRenderPainter(GraphPainter painter)
public void removePostRenderPainter(GraphPainter painter)
Copyright © 2004-2014 FEUP-LSTS and Neptus developers. All Rights Reserved.