Class GraffitiView
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.graffiti.plugin.view.AbstractView
org.graffiti.plugins.views.defaults.GraffitiView
- All Implemented Interfaces:
Autoscroll,ImageObserver,MenuContainer,Serializable,EventListener,AttributeListener,EdgeListener,GraphListener,NodeListener,TransactionListener,GraphView,View,View2D,Zoomable,ZoomListener
- Direct Known Subclasses:
IPKGraffitiView
public class GraffitiView extends AbstractView implements View2D, GraphView, GraphListener, AttributeListener, NodeListener, EdgeListener, TransactionListener
An implementation of
org.graffiti.plugin.view.View2D, that
displays a graph. Since it also shows changes in the graph it listens for
changes in the graph, attributes, nodes and edges.- See Also:
JPanel,View2D, Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior -
Field Summary
Fields Modifier and Type Field Description booleanisFinishingTransacationcomponents can use this variable to check, if this view is currently finishing a transaction and thus can behave differently as ususal Currently it is used to selectively NOT update dependent components on each nodebooleanthreadedRedrawFields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors Constructor Description GraffitiView() -
Method Summary
Modifier and Type Method Description voidaddMessageListener(MessageListener ml)Adds a message listener to the view.voidaddMouseListener(MouseListener l)voidaddMouseMotionListener(MouseMotionListener l)voidattributeChanged(Attribute attr)Called when a graphics attributes of the Graph represented by this view has changed.voidclose()Closes the current view.voidcompleteRedraw()Instructs the view to do completely refresh its contents.ComponentfindComponentAt(int x, int y)booleangetBlockEdges()ComponentgetComponentAt(int x, int y)ComponentgetComponentOfAnyTypeAt(int x, int y)CoordinateSystemgetCoordinateSystem()GraffitiFrame[]getDetachedFrames()DrawModegetDrawMode()GraphicsgetGraphics()ArrayList<GraphElement>getSortedGraphElements(boolean inverse)StringgetViewName()Returns the viewName.booleanisHidden(GraphElement ge)voidpostAttributeAdded(AttributeEvent e)Called after an attribute has been added.voidpostAttributeChanged(AttributeEvent e)Called after an attribute has been changed.voidpostAttributeRemoved(AttributeEvent e)Called after an attribute has been removed.voidpostDirectedChanged(EdgeEvent e)Called after the edge was set directed or undirected.voidpostEdgeAdded(GraphEvent e)Called after an edge has been added to the graph.voidpostEdgeRemoved(GraphEvent e)Called after an edge has been removed from the graph.voidpostEdgeReversed(EdgeEvent e)Called after the edge has been reversed.voidpostGraphCleared(GraphEvent e)Called after methodclear()has been called on a graph.voidpostNodeAdded(GraphEvent e)Called after an edge has been added to the graph.voidpostNodeRemoved(GraphEvent e)Called after a node has been removed from the graph.voidpostSourceNodeChanged(EdgeEvent e)Called after the source node of an edge has changed.voidpostTargetNodeChanged(EdgeEvent e)Called after the target node of an edge has changed.voidpreSourceNodeChanged(EdgeEvent e)Called before a change of the source node of an edge takes place.voidpreTargetNodeChanged(EdgeEvent e)Called before a change of the target node of an edge takes place.booleanputInScrollPane()booleanredrawActive()voidremove(Component comp)voidremoveMessageListener(MessageListener ml)Removes a message listener from the view.voidremoveMouseListener(MouseListener listener)voidremoveMouseMotionListener(MouseMotionListener l)voidrepaint(GraphElement ge)Repaints the given graph elementvoidrepaintGraphElementComponent(GraphElementComponent gec)voidsetBlockEdges(boolean block)Disable edge component creation.voidsetDrawMode(DrawMode dm)voidsetGraph(Graph g)Sets the graph this view displays.voidsortGraphElements(GraphElement[] ges)voidtransactionFinished(TransactionEvent event, BackgroundTaskStatusProviderSupportingExternalCall status)Called when a transaction has stopped.voidtransactionStarted(TransactionEvent e)Called when a transaction has started.voidzoomChanged(AffineTransform newZoom)Indicates that a zoom value has changed.Methods inherited from class org.graffiti.plugin.view.AbstractView
autoresize, autoscroll, clearGraphElementComponentMap, closing, getAttributeComponentsForElement, getAutoscrollInsets, getComponentElementMap, getComponentForElement, getGraph, getGraphElementComponent, getGraphElementComponentMap, getViewComponent, getViewToolbarComponentBackground, getViewToolbarComponentBottom, getViewToolbarComponentLeft, getViewToolbarComponentRight, getViewToolbarComponentTop, getZoom, postInEdgeAdded, postInEdgeRemoved, postOutEdgeAdded, postOutEdgeRemoved, postUndirectedEdgeAdded, postUndirectedEdgeRemoved, preAttributeAdded, preAttributeChanged, preAttributeRemoved, preDirectedChanged, preEdgeAdded, preEdgeRemoved, preEdgeReversed, preGraphCleared, preInEdgeAdded, preInEdgeRemoved, preNodeAdded, preNodeRemoved, preOutEdgeAdded, preOutEdgeRemoved, preUndirectedEdgeAdded, preUndirectedEdgeRemoved, removeGraphElementComponent, setAttributeComponentManager, worksWithTabMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, updateUIMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, getComponent, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graffiti.event.AttributeListener
preAttributeAdded, preAttributeChanged, preAttributeRemovedMethods inherited from interface java.awt.dnd.Autoscroll
autoscroll, getAutoscrollInsetsMethods inherited from interface org.graffiti.event.EdgeListener
preDirectedChanged, preEdgeReversedMethods inherited from interface org.graffiti.event.GraphListener
preEdgeAdded, preEdgeRemoved, preGraphCleared, preNodeAdded, preNodeRemovedMethods inherited from interface org.graffiti.event.NodeListener
postUndirectedEdgeAdded, postUndirectedEdgeRemoved, preUndirectedEdgeAdded, preUndirectedEdgeRemovedMethods inherited from interface org.graffiti.plugin.view.View
closing, getAttributeComponentsForElement, getComponentElementMap, getComponentForElement, getGraph, getViewComponent, getViewToolbarComponentBackground, getViewToolbarComponentBottom, getViewToolbarComponentLeft, getViewToolbarComponentRight, getViewToolbarComponentTop, setAttributeComponentManager, worksWithTab
-
Field Details
-
threadedRedraw
public boolean threadedRedraw -
isFinishingTransacation
public boolean isFinishingTransacationcomponents can use this variable to check, if this view is currently finishing a transaction and thus can behave differently as ususal Currently it is used to selectively NOT update dependent components on each node
-
-
Constructor Details
-
GraffitiView
public GraffitiView()
-
-
Method Details
-
getComponentAt
- Overrides:
getComponentAtin classContainer
-
getComponentOfAnyTypeAt
-
setGraph
Sets the graph this view displays.- Specified by:
setGraphin interfaceView- Specified by:
setGraphin classAbstractView- Parameters:
g- graph this view should display.
-
setBlockEdges
public void setBlockEdges(boolean block)Disable edge component creation.- Parameters:
block- If true, no edges will be created upon next redraw.
-
getBlockEdges
public boolean getBlockEdges() -
getGraphics
- Overrides:
getGraphicsin classJComponent
-
addMessageListener
Adds a message listener to the view.- Specified by:
addMessageListenerin interfaceView- Overrides:
addMessageListenerin classAbstractView- Parameters:
ml- a message listener- Throws:
IllegalArgumentException- DOCUMENT ME!
-
addMouseListener
- Overrides:
addMouseListenerin classComponent
-
removeMouseListener
- Overrides:
removeMouseListenerin classComponent
-
addMouseMotionListener
- Overrides:
addMouseMotionListenerin classComponent
-
removeMouseMotionListener
- Overrides:
removeMouseMotionListenerin classComponent
-
close
public void close()Closes the current view.- Specified by:
closein interfaceView- Overrides:
closein classAbstractView
-
redrawActive
public boolean redrawActive()- Specified by:
redrawActivein interfaceZoomable- Overrides:
redrawActivein classAbstractView- Returns:
-
completeRedraw
public void completeRedraw()Description copied from interface:ViewInstructs the view to do completely refresh its contents.- Specified by:
completeRedrawin interfaceView
-
getSortedGraphElements
-
sortGraphElements
-
findComponentAt
- Overrides:
findComponentAtin classContainer- See Also:
Container.findComponentAt(int, int)
-
postAttributeAdded
Called after an attribute has been added.- Specified by:
postAttributeAddedin interfaceAttributeListener- Overrides:
postAttributeAddedin classAbstractView- Parameters:
e- the AttributeEvent detailing the changes.
-
postAttributeChanged
Called after an attribute has been changed.- Specified by:
postAttributeChangedin interfaceAttributeListener- Overrides:
postAttributeChangedin classAbstractView- Parameters:
e- the AttributeEvent detailing the changes.
-
postAttributeRemoved
Called after an attribute has been removed.- Specified by:
postAttributeRemovedin interfaceAttributeListener- Overrides:
postAttributeRemovedin classAbstractView- Parameters:
e- the AttributeEvent detailing the changes.
-
postDirectedChanged
Called after the edge was set directed or undirected.- Specified by:
postDirectedChangedin interfaceEdgeListener- Overrides:
postDirectedChangedin classAbstractView- Parameters:
e- the EdgeEvent detailing the changes.
-
postEdgeAdded
Called after an edge has been added to the graph.- Specified by:
postEdgeAddedin interfaceGraphListener- Overrides:
postEdgeAddedin classAbstractView- Parameters:
e- the GraphEvent detailing the changes.
-
postEdgeRemoved
Called after an edge has been removed from the graph.- Specified by:
postEdgeRemovedin interfaceGraphListener- Overrides:
postEdgeRemovedin classAbstractView- Parameters:
e- the GraphEvent detailing the changes.
-
postEdgeReversed
Called after the edge has been reversed.- Specified by:
postEdgeReversedin interfaceEdgeListener- Overrides:
postEdgeReversedin classAbstractView- Parameters:
e- the EdgeEvent detailing the changes.
-
postGraphCleared
Called after methodclear()has been called on a graph. No other events (like remove events) are generated.- Specified by:
postGraphClearedin interfaceGraphListener- Overrides:
postGraphClearedin classAbstractView- Parameters:
e- the GraphEvent detailing the changes.
-
postNodeAdded
Called after an edge has been added to the graph.- Specified by:
postNodeAddedin interfaceGraphListener- Overrides:
postNodeAddedin classAbstractView- Parameters:
e- the GraphEvent detailing the changes.
-
postNodeRemoved
Called after a node has been removed from the graph. All edges incident to this node have already been removed (preEdgeRemoved and postEdgeRemoved have been called).- Specified by:
postNodeRemovedin interfaceGraphListener- Overrides:
postNodeRemovedin classAbstractView- Parameters:
e- the GraphEvent detailing the changes.
-
remove
-
postSourceNodeChanged
Called after the source node of an edge has changed.- Specified by:
postSourceNodeChangedin interfaceEdgeListener- Overrides:
postSourceNodeChangedin classAbstractView- Parameters:
e- the EdgeEvent detailing the changes.
-
postTargetNodeChanged
Called after the target node of an edge has changed.- Specified by:
postTargetNodeChangedin interfaceEdgeListener- Overrides:
postTargetNodeChangedin classAbstractView- Parameters:
e- the EdgeEvent detailing the changes.
-
preSourceNodeChanged
Called before a change of the source node of an edge takes place.- Specified by:
preSourceNodeChangedin interfaceEdgeListener- Overrides:
preSourceNodeChangedin classAbstractView- Parameters:
e- the EdgeEvent detailing the changes.
-
preTargetNodeChanged
Called before a change of the target node of an edge takes place.- Specified by:
preTargetNodeChangedin interfaceEdgeListener- Overrides:
preTargetNodeChangedin classAbstractView- Parameters:
e- the EdgeEvent detailing the changes.
-
removeMessageListener
Removes a message listener from the view.- Specified by:
removeMessageListenerin interfaceView- Overrides:
removeMessageListenerin classAbstractView- Parameters:
ml- a message listener- Throws:
IllegalArgumentException- DOCUMENT ME!
-
transactionFinished
public void transactionFinished(TransactionEvent event, BackgroundTaskStatusProviderSupportingExternalCall status)Called when a transaction has stopped.- Specified by:
transactionFinishedin interfaceTransactionListener- Overrides:
transactionFinishedin classAbstractView- Parameters:
event- the EdgeEvent detailing the changes.
-
transactionStarted
Description copied from class:AbstractViewCalled when a transaction has started.- Specified by:
transactionStartedin interfaceTransactionListener- Overrides:
transactionStartedin classAbstractView- Parameters:
e- the EdgeEvent detailing the changes.- See Also:
TransactionListener.transactionStarted(org.graffiti.event.TransactionEvent)
-
zoomChanged
Description copied from interface:ZoomListenerIndicates that a zoom value has changed.- Specified by:
zoomChangedin interfaceZoomListener- Overrides:
zoomChangedin classAbstractView- See Also:
ZoomListener.zoomChanged(AffineTransform)
-
attributeChanged
Description copied from interface:ViewCalled when a graphics attributes of the Graph represented by this view has changed.- Specified by:
attributeChangedin interfaceView- Parameters:
attr- the attribute that has triggered the event.
-
getViewName
Description copied from class:AbstractViewReturns the viewName.- Specified by:
getViewNamein interfaceView- Overrides:
getViewNamein classAbstractView- Returns:
- String
-
repaint
Description copied from interface:ViewRepaints the given graph element -
repaintGraphElementComponent
-
getDetachedFrames
-
putInScrollPane
public boolean putInScrollPane()- Specified by:
putInScrollPanein interfaceView
-
isHidden
-
getCoordinateSystem
-
setDrawMode
- Parameters:
reduced-
-
getDrawMode
-