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.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Fields Modifier and Type Field Description boolean
isFinishingTransacation
components 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 nodeboolean
threadedRedraw
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields 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 void
addMessageListener(MessageListener ml)
Adds a message listener to the view.void
addMouseListener(MouseListener l)
void
addMouseMotionListener(MouseMotionListener l)
void
attributeChanged(Attribute attr)
Called when a graphics attributes of the Graph represented by this view has changed.void
close()
Closes the current view.void
completeRedraw()
Instructs the view to do completely refresh its contents.Component
findComponentAt(int x, int y)
boolean
getBlockEdges()
Component
getComponentAt(int x, int y)
Component
getComponentOfAnyTypeAt(int x, int y)
CoordinateSystem
getCoordinateSystem()
GraffitiFrame[]
getDetachedFrames()
DrawMode
getDrawMode()
Graphics
getGraphics()
ArrayList<GraphElement>
getSortedGraphElements(boolean inverse)
String
getViewName()
Returns the viewName.boolean
isHidden(GraphElement ge)
void
postAttributeAdded(AttributeEvent e)
Called after an attribute has been added.void
postAttributeChanged(AttributeEvent e)
Called after an attribute has been changed.void
postAttributeRemoved(AttributeEvent e)
Called after an attribute has been removed.void
postDirectedChanged(EdgeEvent e)
Called after the edge was set directed or undirected.void
postEdgeAdded(GraphEvent e)
Called after an edge has been added to the graph.void
postEdgeRemoved(GraphEvent e)
Called after an edge has been removed from the graph.void
postEdgeReversed(EdgeEvent e)
Called after the edge has been reversed.void
postGraphCleared(GraphEvent e)
Called after methodclear()
has been called on a graph.void
postNodeAdded(GraphEvent e)
Called after an edge has been added to the graph.void
postNodeRemoved(GraphEvent e)
Called after a node has been removed from the graph.void
postSourceNodeChanged(EdgeEvent e)
Called after the source node of an edge has changed.void
postTargetNodeChanged(EdgeEvent e)
Called after the target node of an edge has changed.void
preSourceNodeChanged(EdgeEvent e)
Called before a change of the source node of an edge takes place.void
preTargetNodeChanged(EdgeEvent e)
Called before a change of the target node of an edge takes place.boolean
putInScrollPane()
boolean
redrawActive()
void
remove(Component comp)
void
removeMessageListener(MessageListener ml)
Removes a message listener from the view.void
removeMouseListener(MouseListener listener)
void
removeMouseMotionListener(MouseMotionListener l)
void
repaint(GraphElement ge)
Repaints the given graph elementvoid
repaintGraphElementComponent(GraphElementComponent gec)
void
setBlockEdges(boolean block)
Disable edge component creation.void
setDrawMode(DrawMode dm)
void
setGraph(Graph g)
Sets the graph this view displays.void
sortGraphElements(GraphElement[] ges)
void
transactionFinished(TransactionEvent event, BackgroundTaskStatusProviderSupportingExternalCall status)
Called when a transaction has stopped.void
transactionStarted(TransactionEvent e)
Called when a transaction has started.void
zoomChanged(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, worksWithTab
Methods 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, updateUI
Methods 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, validate
Methods 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, transferFocusUpCycle
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.graffiti.event.AttributeListener
preAttributeAdded, preAttributeChanged, preAttributeRemoved
Methods inherited from interface java.awt.dnd.Autoscroll
autoscroll, getAutoscrollInsets
Methods inherited from interface org.graffiti.event.EdgeListener
preDirectedChanged, preEdgeReversed
Methods inherited from interface org.graffiti.event.GraphListener
preEdgeAdded, preEdgeRemoved, preGraphCleared, preNodeAdded, preNodeRemoved
Methods inherited from interface org.graffiti.event.NodeListener
postUndirectedEdgeAdded, postUndirectedEdgeRemoved, preUndirectedEdgeAdded, preUndirectedEdgeRemoved
Methods 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:
getComponentAt
in classContainer
-
getComponentOfAnyTypeAt
-
setGraph
Sets the graph this view displays.- Specified by:
setGraph
in interfaceView
- Specified by:
setGraph
in 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:
getGraphics
in classJComponent
-
addMessageListener
Adds a message listener to the view.- Specified by:
addMessageListener
in interfaceView
- Overrides:
addMessageListener
in classAbstractView
- Parameters:
ml
- a message listener- Throws:
IllegalArgumentException
- DOCUMENT ME!
-
addMouseListener
- Overrides:
addMouseListener
in classComponent
-
removeMouseListener
- Overrides:
removeMouseListener
in classComponent
-
addMouseMotionListener
- Overrides:
addMouseMotionListener
in classComponent
-
removeMouseMotionListener
- Overrides:
removeMouseMotionListener
in classComponent
-
close
public void close()Closes the current view.- Specified by:
close
in interfaceView
- Overrides:
close
in classAbstractView
-
redrawActive
public boolean redrawActive()- Specified by:
redrawActive
in interfaceZoomable
- Overrides:
redrawActive
in classAbstractView
- Returns:
-
completeRedraw
public void completeRedraw()Description copied from interface:View
Instructs the view to do completely refresh its contents.- Specified by:
completeRedraw
in interfaceView
-
getSortedGraphElements
-
sortGraphElements
-
findComponentAt
- Overrides:
findComponentAt
in classContainer
- See Also:
Container.findComponentAt(int, int)
-
postAttributeAdded
Called after an attribute has been added.- Specified by:
postAttributeAdded
in interfaceAttributeListener
- Overrides:
postAttributeAdded
in classAbstractView
- Parameters:
e
- the AttributeEvent detailing the changes.
-
postAttributeChanged
Called after an attribute has been changed.- Specified by:
postAttributeChanged
in interfaceAttributeListener
- Overrides:
postAttributeChanged
in classAbstractView
- Parameters:
e
- the AttributeEvent detailing the changes.
-
postAttributeRemoved
Called after an attribute has been removed.- Specified by:
postAttributeRemoved
in interfaceAttributeListener
- Overrides:
postAttributeRemoved
in classAbstractView
- Parameters:
e
- the AttributeEvent detailing the changes.
-
postDirectedChanged
Called after the edge was set directed or undirected.- Specified by:
postDirectedChanged
in interfaceEdgeListener
- Overrides:
postDirectedChanged
in classAbstractView
- Parameters:
e
- the EdgeEvent detailing the changes.
-
postEdgeAdded
Called after an edge has been added to the graph.- Specified by:
postEdgeAdded
in interfaceGraphListener
- Overrides:
postEdgeAdded
in classAbstractView
- Parameters:
e
- the GraphEvent detailing the changes.
-
postEdgeRemoved
Called after an edge has been removed from the graph.- Specified by:
postEdgeRemoved
in interfaceGraphListener
- Overrides:
postEdgeRemoved
in classAbstractView
- Parameters:
e
- the GraphEvent detailing the changes.
-
postEdgeReversed
Called after the edge has been reversed.- Specified by:
postEdgeReversed
in interfaceEdgeListener
- Overrides:
postEdgeReversed
in 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:
postGraphCleared
in interfaceGraphListener
- Overrides:
postGraphCleared
in classAbstractView
- Parameters:
e
- the GraphEvent detailing the changes.
-
postNodeAdded
Called after an edge has been added to the graph.- Specified by:
postNodeAdded
in interfaceGraphListener
- Overrides:
postNodeAdded
in 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:
postNodeRemoved
in interfaceGraphListener
- Overrides:
postNodeRemoved
in classAbstractView
- Parameters:
e
- the GraphEvent detailing the changes.
-
remove
-
postSourceNodeChanged
Called after the source node of an edge has changed.- Specified by:
postSourceNodeChanged
in interfaceEdgeListener
- Overrides:
postSourceNodeChanged
in classAbstractView
- Parameters:
e
- the EdgeEvent detailing the changes.
-
postTargetNodeChanged
Called after the target node of an edge has changed.- Specified by:
postTargetNodeChanged
in interfaceEdgeListener
- Overrides:
postTargetNodeChanged
in classAbstractView
- Parameters:
e
- the EdgeEvent detailing the changes.
-
preSourceNodeChanged
Called before a change of the source node of an edge takes place.- Specified by:
preSourceNodeChanged
in interfaceEdgeListener
- Overrides:
preSourceNodeChanged
in classAbstractView
- Parameters:
e
- the EdgeEvent detailing the changes.
-
preTargetNodeChanged
Called before a change of the target node of an edge takes place.- Specified by:
preTargetNodeChanged
in interfaceEdgeListener
- Overrides:
preTargetNodeChanged
in classAbstractView
- Parameters:
e
- the EdgeEvent detailing the changes.
-
removeMessageListener
Removes a message listener from the view.- Specified by:
removeMessageListener
in interfaceView
- Overrides:
removeMessageListener
in 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:
transactionFinished
in interfaceTransactionListener
- Overrides:
transactionFinished
in classAbstractView
- Parameters:
event
- the EdgeEvent detailing the changes.
-
transactionStarted
Description copied from class:AbstractView
Called when a transaction has started.- Specified by:
transactionStarted
in interfaceTransactionListener
- Overrides:
transactionStarted
in classAbstractView
- Parameters:
e
- the EdgeEvent detailing the changes.- See Also:
TransactionListener.transactionStarted(org.graffiti.event.TransactionEvent)
-
zoomChanged
Description copied from interface:ZoomListener
Indicates that a zoom value has changed.- Specified by:
zoomChanged
in interfaceZoomListener
- Overrides:
zoomChanged
in classAbstractView
- See Also:
ZoomListener.zoomChanged(AffineTransform)
-
attributeChanged
Description copied from interface:View
Called when a graphics attributes of the Graph represented by this view has changed.- Specified by:
attributeChanged
in interfaceView
- Parameters:
attr
- the attribute that has triggered the event.
-
getViewName
Description copied from class:AbstractView
Returns the viewName.- Specified by:
getViewName
in interfaceView
- Overrides:
getViewName
in classAbstractView
- Returns:
- String
-
repaint
Description copied from interface:View
Repaints the given graph element -
repaintGraphElementComponent
-
getDetachedFrames
-
putInScrollPane
public boolean putInScrollPane()- Specified by:
putInScrollPane
in interfaceView
-
isHidden
-
getCoordinateSystem
-
setDrawMode
- Parameters:
reduced
-
-
getDrawMode
-