com.tensegrity.gui.swt.graph
Class SwtGraphPanel

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended bycom.tensegrity.gui.swt.graph.SwtGraphPanel
All Implemented Interfaces:
BasicComponent, org.eclipse.swt.graphics.Drawable, Evaluable, java.util.EventListener, GraphPanel, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.MouseTrackListener, Observer, org.eclipse.swt.internal.SWTEventListener

public final class SwtGraphPanel
extends org.eclipse.swt.widgets.Composite
implements GraphPanel, Observer, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.MouseTrackListener

This class represents the drawing-area swt-component for graphs.

It is derived from the SWT Composite and implements the following interfaces:

For information a SwtGraphPanel contains the following components:

These two TENSlider instances are wrappers around the SWT Slider and are used in order to provide advance scrolling facilities to the panel. One could also refer to the documentation of ViewScrollingController for a better understanding of the scrolling functionality provided by the panel. Finally note that the layout of these components is herein encapsulated and hidden to the user (the method Composite.setLayout(Layout) is overridden to do nothing).

As an attempt to extract generic code used by both SwingGraphPanel and SwtGraphPanel, this class delegates some of its implementation to GraphPanelUtility. At a later stage the SwingGraphPanel might make also use of this utility class,

This class is not meant to be extended (it is declared as final), nor serialized.

A SwtGraphPanel holds resources it must release or containers from which it must remove/unregister itself. If a SwtGraphPanel is no longer needed, the application must invoke its dispose() method.

Version:
$Id: SwtGraphPanel.java,v 1.198 2006/05/16 11:46:12 BurkhardWick Exp $
Author:
S�bastien Guyon

Field Summary
 boolean DEBUG_REPAINTMANAGER
          Global flag to disable/enable debugging feature for the RepaintManager.
 InplaceEditor inplaceEditor
          The inplace editor
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Fields inherited from interface com.tensegrity.gui.graphdocument.GraphPanel
DRAG_TOLERANCE
 
Constructor Summary
SwtGraphPanel(ApplicationFrame applicationFrame, org.eclipse.swt.widgets.Composite parentContainer, DragContext dragContext, JPopupMenuSourceWithUpdateUI popupmenusource)
           Generic constructor for the SwtGraphPanel.
SwtGraphPanel(ApplicationFrame applicationFrame, GraphDocument graphdocument, org.eclipse.swt.widgets.Composite parentContainer, DragContext dragContext, JPopupMenuSourceWithUpdateUI popupmenusource)
           Generic constructor for the SwtGraphPanel.
SwtGraphPanel(org.eclipse.swt.widgets.Composite parentContainer)
           This is the simplest constructor of a SwtGraphPanelinstance.
SwtGraphPanel(GraphApplication graphapplication, org.eclipse.swt.widgets.Composite parentContainer, DragContext dragContext, JPopupMenuSourceWithUpdateUI popupmenusource)
           Generic constructor for the SwtGraphPanel.
SwtGraphPanel(GraphApplication graphapplication, GraphDocument graphdocument, org.eclipse.swt.widgets.Composite parentContainer, DragContext dragContext, JPopupMenuSourceWithUpdateUI popupmenusource)
           Generic constructor for the SwtGraphPanel.
 
Method Summary
 void addDragListener(GraphPanelDragListener listener)
          Adds a listener that will react on drag events like start, enter, exit, move and drop.
 void addGraphPanelListener(GraphPanelListener listener)
          Adds a GraphPanelListener to this instance.
 void addModifyListener(ModifiedVisualGraphListener listener)
          The method addModifyListener lets users to keep track on current changes of the represented VisualGraph.
 void applyEvList()
          Tells the component to apply its UIItemEvaluationList.
protected  void cacheBitmapsAndValidate()
          This method performs all caching for the repaint-manager.
 void copy()
          Copy the selection into the internal clipboard.
 void cut()
          Cut the selection into the internal clipboard.
 void deleteSelection()
          Deletes the currently selected objects.
 void disableKeyboardSupport(org.eclipse.swt.widgets.Composite component)
          This method disables the keyboard support for this SwingGraphPanel.
 void disableMode(int modemask)
          Disables the given mode(s) on this instance.
 void dispose()
          This method is used in order to destroy the popupmenusource as well as to dispose swt resources held within this class.
 void drag(VisualGraphObject visualgraphobject, VisualGraphObject[] additional_vgos, BaseComposite dragRepresentation, double scalefactor, int x, int y)
           Invoked by the DropListener during dragging, if the infrastructure is configured to draw during dragging.
 void drag(VisualGraphObject visualgraphobject, VisualGraphObject[] additional_vgos, double scalefactor, int x, int y)
          Invoked by the DropListener during dragging, if the infrastructure is configured to draw during dragging.
 void drop(VisualGraphObject vgo, VisualGraphObject[] additional_vgos, int x, int y)
          Invoked by the DropListener to let the panel handle the dropped VisualGraphObject.
 void enableKeyboardSupport(org.eclipse.swt.widgets.Composite component)
          This method enables the keyboard support for this SwingGraphPanel.
 void enableMode(int modemask)
          Enables the given mode(s) on this instance.
 void enableStrokeZooming(boolean enabled)
          Enables/disables the zooming of the strokes
 void firePostAction()
           Called by mouseDown(MouseEvent) and mouseUp(MouseEvent), this method informs the GraphPanelListener s that an action just occured.
 ApplicationFrame getApplicationFrame()
          Returns the application frame reference.
 AttributableOnSetDelegate getAttributableOnSetDelegate()
          The method getAttributableOnSetDelegate returns the previously set AttributableOnSet instance of this GraphPanel or null,if no such object has been set.
 org.eclipse.swt.widgets.Canvas getCanvas()
          Returns the Canvas.
 VisualNode getDeepestVisualNodeAt(int x, int y)
          This method delegates its implementation to GraphPanelUtility.getDeepestVisualNodeAt(VisualGraphView, int, int)
 VisualNode getDeepestVisualNodeAt(int x, int y, boolean traverseFoldedGroups)
          This method delegates its implementation to GraphPanelUtility.getDeepestVisualNodeAt(VisualGraphView, int, int, boolean)
 GraphApplication getGraphApplication()
          Returns the application reference.
 GraphController getGraphController()
          Returns a GraphController.
 GraphDocument getGraphDocument()
          Returns the enclosing GraphDocument instance.
 java.util.HashSet getGraphPanelListeners()
          Returns the graphPanelListeners
 int getHeight()
          Returns the height of the component in pixels.
 BasicComponent getParentComponent()
          Returns the parent Component of this instance.
 JPopupMenuSourceWithUpdateUI getPopupMenuSource()
          Returns the local JPopupMenuSourceWithUpdateUI instance.
 Coordinate getRecentPopupMenuMouseCoordinate()
          Returns the most recent meaningful mouse-coordinate of this instance.
 RendererConfiguration getRendererConfiguration()
          Returns the RendererConfiguration that is used for drawing contents of this instance.
static AttributeSet getRendererConfigurationLowDetail()
          Returns the AttributeSet that can be used to configure the low-detail rendering settings that used by all instances of SwingGraphPanel during user-interaction.
 ToolTipGenerator getToolTipGenerator()
          Returns the currently used tooltip generator
 int getViewportHeight()
          Computes the sizes of the client area that corresponds to the viewport width in PIXELS.
 int getViewportWidth()
          Computes the sizes of the client area that corresponds to the viewport width in PIXELS.
 VisualGraphView getVisualGraph()
          Gets the visual graph instance that is currently displayed in the graphpanel.
 java.awt.Image getVisualGraphIcon(int width, int height)
          Renders an icon for the VisualGraph.
 java.awt.Image getVisualGraphIcon(int width, int height, boolean visibleRegion)
          Renders an icon for the VisualGraph.
 int getWidth()
          Returns the width of the component in pixels.
 double getZoomX()
          Returns the zoom factor for the VisualGraphView in x direction.
 double getZoomY()
          Returns the zoom factor for the VisualGraphView in y direction.
 void handleDocumentResize()
           This method is called by the #draw(GC, Transform2D, Rectangle) method if it was informed that the graph panel size had changed.
 void installEvList()
          Tells the component to setup its internal state.
 boolean isAntialiasing()
          Returns true is anti-aliasing is enabled, otherwise false
 boolean isAutoScale()
          Gets the auto-scale flag, if true then the drawing area is automatically scaled to fit its gui space.
protected  boolean isDragAccepted()
          Returns true if the the given flavor is supported.
 boolean isDrawDuringDrag()
          Returns the drawDuringDrag flag, if true then composites are drawn during dragging (in drag'n'drop).
protected  boolean isDropAccepted()
          Returns true if the the given flavor is supported.
 boolean isEditable()
          Returns whether the document is editable or not.
 boolean isInplaceEditEnabled()
          Returns a boolean that indicates whether inplace editing of text is enabled for an instance of the SwingGraphPanel or not.
 boolean isModified()
          Returns whether the document needs saving or not.
 boolean isStrokeZoomingEnabled()
          Returns the state of the stroke zooming
 void mouseDoubleClick(org.eclipse.swt.events.MouseEvent event)
          Sent when a mouse button is pressed twice within the (operating system specified) double click period.
 void mouseDown(org.eclipse.swt.events.MouseEvent event)
          Sent when a mouse button is pressed.
 void mouseEnter(org.eclipse.swt.events.MouseEvent arg0)
          Sent when the mouse pointer passes into the area of the screen covered by a control.
 void mouseExit(org.eclipse.swt.events.MouseEvent arg0)
          Sent when the mouse pointer passes out of the area of the screen covered by a control.
 void mouseHover(org.eclipse.swt.events.MouseEvent event)
          Sent when the mouse pointer hovers (that is, stops moving for an (operating system specified) period of time) over a control.
 void mouseMove(org.eclipse.swt.events.MouseEvent event)
          Sent when the mouse moves.
 void mouseUp(org.eclipse.swt.events.MouseEvent event)
          Sent when a mouse button is released.
 void paste()
          Paste the contents of the internal clipboard into the GraphPanel.
 void paste(Coordinate coordinate)
          Paste the contents of the internal clipboard into the GraphPanel at the specified Coordinate.
 void pasteBefore(VisualNode visualnode)
          Paste the contents of the internal clipboard into the GraphPanel.
 void pasteBehind(VisualNode visualnode)
          Paste the contents of the internal clipboard into the GraphPanel.
 void pasteStart()
          Paste the contents of the internal clipboard into the GraphPanel.
 void pasteStop()
          Paste the contents of the internal clipboard into the GraphPanel.
 void postSelect()
          This method should handle all necessary actions to be done whenever you modify the selection of the encapsulated VisualGraphView and its not implicitly propagated to the enclosing GraphPanel.
 void redo()
          Redo the last undone change.
 void removeDragListener(GraphPanelDragListener listener)
          Removed a listener that will react on drag events like start, enter, exit, move and drop.
 void removeGraphPanelListener(GraphPanelListener listener)
          Removes a GraphPanelListener from this instance.
 void removeModifyListener(ModifiedVisualGraphListener listener)
          Removes the modifiy listener that checks for the first initial modification from a VisualGraph.
 void repaint()
          Triggers a repaint on the local Canvas
 void repaint(int arg0, int arg1, int arg2, int arg3, boolean arg4)
           Triggers a repaint on the local Canvas
 void resetDragAndDropState()
          After rejecting a drop or after the cancellation of a drag'n'operation by the client, this method should be invoked to perform clean-up actions internally.
 void setAntialiasing(boolean antialiasing)
          Enables anti-aliasing if the argument is true, otherwise anti-aliasing is disabled.
 void setAttributableOnSetDelegate(AttributableOnSetDelegate delegate)
          The method setAttributableOnSetDelegate sets the delegate object to be used to create, fetch or retrieve the AttributableOnSet from to be displayed when a selection or similar occurs.
 void setAutoScale(boolean autoScale)
          Sets the auto-scale flag, if true then the drawing area is automatically scaled to fit its gui space.
 void setDrawDuringDrag(boolean drawDuringDrag)
          Sets the drawDuringDrag flag, if true then composites are drawn during dragging (in drag'n'drop).
 void setGraphController(GraphController graphcontroller, VisualGraphView vgv)
          Sets a visualgraph to display along with a controller.
 void setInplaceEditEnabled(boolean enableInplaceEdit)
          Sets the inplace edit enabled flag to the value given by enableInplaceEdit.
 void setLayout(org.eclipse.swt.widgets.Layout layout)
          Volontarily do nothing.
 void setLowDetailForInteraction(boolean lowDetailForInteraction)
          Gets the low-detail-during interaction flag, if true then the selected composites are drawn with minimum detail only during interaction.
 void setModified()
          Sets the modified state of the document.
 void setPopupMenuSource(JPopupMenuSourceWithUpdateUI popupmenusource)
          Sets the JPopupMenuSourceWithUpdateUI to use for displaying popup menus.
 void setToolTipGenerator(ToolTipGenerator generator)
          Sets the tooltip generator to generate the tooltips for this component
 void setUnmodified()
          Clears the modified state of the document.
 void setVisualGraph(VisualGraphView vgv)
          Sets the VisualGraph to display in the graphpanel.
 void setVisualGraphBackground(org.eclipse.swt.graphics.Color color)
          Sets the color given by color as the background color as the VisualGraphView.
 void setVisualGraphDisabledBackground(org.eclipse.swt.graphics.Color color)
          Sets the color given by color as the background color as the VisualGraphViewwhen it is not editable.
 void setVisualGraphObjectDragSource(DragContext vgoDragSource)
          Sets the DragContext that this instance should use.
 void setZoom(double scaleX, double scaleY)
          sets the zoom factors for the graph view.
 void setZoom(double scaleX, double scaleY, boolean smartzoom)
          sets the zoom factors for the graph view.
 void setZoomToFit()
          sets the zoom factors for the graph view so that all visible items fit into the visible region.
 void switchLowDetail(boolean isLowDetail)
          internal worker function that toggles low-detail modes
 void undo()
          Undo the last undoable change.
 void update(Observable o, java.lang.Object arg)
          This method is called by the observable that registered this instance as observers.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, computeSize, getChildren, getLayout, getTabList, layout, layout, setFocus, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_REPAINTMANAGER

public boolean DEBUG_REPAINTMANAGER
Global flag to disable/enable debugging feature for the RepaintManager.


inplaceEditor

public InplaceEditor inplaceEditor
The inplace editor

Constructor Detail

SwtGraphPanel

public SwtGraphPanel(org.eclipse.swt.widgets.Composite parentContainer)

This is the simplest constructor of a SwtGraphPanelinstance. The created instance won't have any DragContext, JPopupMenuSourceWithUpdateUI,GraphApplication, nor GraphDocumentassociated to it.

Parameters:
parentContainer - the parent "SWT" container for this Composite

SwtGraphPanel

public SwtGraphPanel(GraphApplication graphapplication,
                     GraphDocument graphdocument,
                     org.eclipse.swt.widgets.Composite parentContainer,
                     DragContext dragContext,
                     JPopupMenuSourceWithUpdateUI popupmenusource)

Generic constructor for the SwtGraphPanel.

Parameters:
graphapplication - reference to the application's main frame.
graphdocument - the graphdocument this panel is embedded in.
parentContainer - the parent "SWT" container for this Composite
dragContext - the drag context that can be used for meaningful drawing during the drag operation.
popupmenusource - the source class for the popupmenu.

SwtGraphPanel

public SwtGraphPanel(ApplicationFrame applicationFrame,
                     GraphDocument graphdocument,
                     org.eclipse.swt.widgets.Composite parentContainer,
                     DragContext dragContext,
                     JPopupMenuSourceWithUpdateUI popupmenusource)

Generic constructor for the SwtGraphPanel.

Parameters:
applicationFrame - reference to the application's main frame.
graphdocument - the graphdocument this panel is embedded in.
parentContainer - the parent "SWT" container for this Composite
dragContext - the drag context that can be used for meaningful drawing during the drag operation.
popupmenusource - the source class for the popupmenu.

SwtGraphPanel

public SwtGraphPanel(GraphApplication graphapplication,
                     org.eclipse.swt.widgets.Composite parentContainer,
                     DragContext dragContext,
                     JPopupMenuSourceWithUpdateUI popupmenusource)

Generic constructor for the SwtGraphPanel. To be used if the instance is not embedded into a GraphDocument.

Parameters:
graphapplication - reference to the application's main frame.
parentContainer - the parent "SWT" container for this Composite
dragContext - the drag context that can be used for meaningful drawing during the drag operation.
popupmenusource - the source class for the popupmenu.

SwtGraphPanel

public SwtGraphPanel(ApplicationFrame applicationFrame,
                     org.eclipse.swt.widgets.Composite parentContainer,
                     DragContext dragContext,
                     JPopupMenuSourceWithUpdateUI popupmenusource)

Generic constructor for the SwtGraphPanel. To be used if the instance is not embedded into a GraphDocument.

Parameters:
applicationFrame - reference to the application's main frame.
parentContainer - the parent "SWT" container for this Composite
dragContext - the drag context that can be used for meaningful drawing during the drag operation.
popupmenusource - the source class for the popupmenu.
Method Detail

setVisualGraphBackground

public void setVisualGraphBackground(org.eclipse.swt.graphics.Color color)
Sets the color given by color as the background color as the VisualGraphView.

Parameters:
color - the new background color for the VisualGraphView.

setVisualGraphDisabledBackground

public void setVisualGraphDisabledBackground(org.eclipse.swt.graphics.Color color)
Sets the color given by color as the background color as the VisualGraphViewwhen it is not editable.

Parameters:
color - the new background color for the VisualGraphView.

addGraphPanelListener

public void addGraphPanelListener(GraphPanelListener listener)
Description copied from interface: GraphPanel
Adds a GraphPanelListener to this instance.

Specified by:
addGraphPanelListener in interface GraphPanel
Parameters:
listener - the listener instance to add.

removeGraphPanelListener

public void removeGraphPanelListener(GraphPanelListener listener)
Description copied from interface: GraphPanel
Removes a GraphPanelListener from this instance.

Specified by:
removeGraphPanelListener in interface GraphPanel
Parameters:
listener - the listener instance to remove.

getGraphPanelListeners

public final java.util.HashSet getGraphPanelListeners()
Returns the graphPanelListeners

Returns:
the graphPanelListeners.

deleteSelection

public void deleteSelection()
Description copied from interface: GraphPanel
Deletes the currently selected objects. If no object is selected nothing will be deleted.

Specified by:
deleteSelection in interface GraphPanel

update

public void update(Observable o,
                   java.lang.Object arg)
Description copied from interface: GraphPanel
This method is called by the observable that registered this instance as observers.

Specified by:
update in interface GraphPanel
Parameters:
o - observable that invoked this method
arg - additional arguments from the observable.

getParentComponent

public BasicComponent getParentComponent()
Description copied from interface: BasicComponent
Returns the parent Component of this instance.

Specified by:
getParentComponent in interface BasicComponent
Returns:
the parent component or null if no parent exists.

getWidth

public int getWidth()
Description copied from interface: BasicComponent
Returns the width of the component in pixels.

Specified by:
getWidth in interface BasicComponent
Returns:
the width of the component in pixels.

getHeight

public int getHeight()
Description copied from interface: BasicComponent
Returns the height of the component in pixels.

Specified by:
getHeight in interface BasicComponent
Returns:
the height of the component in pixels.

repaint

public void repaint()
Triggers a repaint on the local Canvas

Specified by:
repaint in interface BasicComponent

repaint

public void repaint(int arg0,
                    int arg1,
                    int arg2,
                    int arg3,
                    boolean arg4)

Triggers a repaint on the local Canvas

Parameters:
arg0 - the x coordinate of the area to draw
arg1 - the y coordinate of the area to draw
arg2 - the width of the area to draw
arg3 - the height of the area to draw
arg4 - true if children should redraw, and false otherwise

isEditable

public boolean isEditable()
Description copied from interface: GraphPanel
Returns whether the document is editable or not.

Specified by:
isEditable in interface GraphPanel
Returns:
boolean flag that indicates whether editing is enabled or disabled.

enableMode

public final void enableMode(int modemask)
Description copied from interface: GraphPanel
Enables the given mode(s) on this instance.

Specified by:
enableMode in interface GraphPanel
Parameters:
modemask - the mode(s) to enable.

disableMode

public final void disableMode(int modemask)
Description copied from interface: GraphPanel
Disables the given mode(s) on this instance.

Specified by:
disableMode in interface GraphPanel
Parameters:
modemask - the mode(s) to disable.

isModified

public final boolean isModified()
Description copied from interface: GraphPanel
Returns whether the document needs saving or not.

Specified by:
isModified in interface GraphPanel
Returns:
boolean flag that indicates whether saving is needed or not.

setUnmodified

public final void setUnmodified()
Description copied from interface: GraphPanel
Clears the modified state of the document.

Specified by:
setUnmodified in interface GraphPanel

getGraphApplication

public GraphApplication getGraphApplication()
Description copied from interface: GraphPanel
Returns the application reference.

Specified by:
getGraphApplication in interface GraphPanel
Returns:
a reference to the GraphApplication.

getApplicationFrame

public ApplicationFrame getApplicationFrame()
Description copied from interface: GraphPanel
Returns the application frame reference.

Specified by:
getApplicationFrame in interface GraphPanel
Returns:
a reference to the ApplicationFrame.

getVisualGraphIcon

public final java.awt.Image getVisualGraphIcon(int width,
                                               int height)
Description copied from interface: GraphPanel
Renders an icon for the VisualGraph. The current display contents are rendered into a standard RGB image (true-color) of the specified width and height and returned as an image. Use this method to generate a thumbnail image of the current GraphPanel display area.

Specified by:
getVisualGraphIcon in interface GraphPanel
Parameters:
width - the desired image width.
height - the desired image height.
Returns:
the icon image.

getVisualGraphIcon

public final java.awt.Image getVisualGraphIcon(int width,
                                               int height,
                                               boolean visibleRegion)
Renders an icon for the VisualGraph. The current display contents are rendered into a standard RGB image (true-color) of the specified width and height and returned as an image. Use this method to generate a thumbnail image of the current graphpanel display area.

Parameters:
width - the desired image width.
height - the desired image height.
visibleRegion - whether to compute the icon for the visible region or for the entire graph.
Returns:
the image icon.

getGraphController

public GraphController getGraphController()
Description copied from interface: GraphPanel
Returns a GraphController.

Specified by:
getGraphController in interface GraphPanel
Returns:
GraphController

setGraphController

public void setGraphController(GraphController graphcontroller,
                               VisualGraphView vgv)
Description copied from interface: GraphPanel
Sets a visualgraph to display along with a controller. The previous visualgraph is removed from the panel.

Specified by:
setGraphController in interface GraphPanel
Parameters:
graphcontroller - the controller for the visualgraph
vgv - the visualgraph to be displayed.

getVisualGraph

public VisualGraphView getVisualGraph()
Description copied from interface: GraphPanel
Gets the visual graph instance that is currently displayed in the graphpanel.

Specified by:
getVisualGraph in interface GraphPanel
Returns:
the visualgraph instance shown in this graphpanel.

setVisualGraph

public void setVisualGraph(VisualGraphView vgv)
Description copied from interface: GraphPanel
Sets the VisualGraph to display in the graphpanel.

Specified by:
setVisualGraph in interface GraphPanel
Parameters:
vgv - the visualgraph to display in the graphpanel

getViewportWidth

public int getViewportWidth()
Computes the sizes of the client area that corresponds to the viewport width in PIXELS.

Specified by:
getViewportWidth in interface GraphPanel
Returns:
the viewport width in pixels.

getViewportHeight

public int getViewportHeight()
Computes the sizes of the client area that corresponds to the viewport width in PIXELS.

Specified by:
getViewportHeight in interface GraphPanel
Returns:
the viewport width in pixels.

applyEvList

public void applyEvList()
Description copied from interface: Evaluable
Tells the component to apply its UIItemEvaluationList.

Specified by:
applyEvList in interface Evaluable

installEvList

public void installEvList()
Description copied from interface: Evaluable
Tells the component to setup its internal state.

Specified by:
installEvList in interface Evaluable

undo

public void undo()
Description copied from interface: GraphPanel
Undo the last undoable change.

Specified by:
undo in interface GraphPanel

redo

public void redo()
Description copied from interface: GraphPanel
Redo the last undone change.

Specified by:
redo in interface GraphPanel

cut

public void cut()
Description copied from interface: GraphPanel
Cut the selection into the internal clipboard.

Specified by:
cut in interface GraphPanel

setAttributableOnSetDelegate

public void setAttributableOnSetDelegate(AttributableOnSetDelegate delegate)
Description copied from interface: GraphPanel
The method setAttributableOnSetDelegate sets the delegate object to be used to create, fetch or retrieve the AttributableOnSet from to be displayed when a selection or similar occurs.

Specified by:
setAttributableOnSetDelegate in interface GraphPanel
Parameters:
delegate - the delegate object to delegate determineAttributableOnSet calls to.

getAttributableOnSetDelegate

public AttributableOnSetDelegate getAttributableOnSetDelegate()
Description copied from interface: GraphPanel
The method getAttributableOnSetDelegate returns the previously set AttributableOnSet instance of this GraphPanel or null,if no such object has been set.

Specified by:
getAttributableOnSetDelegate in interface GraphPanel
Returns:
AttributableOnSetDelegate

copy

public void copy()
Description copied from interface: GraphPanel
Copy the selection into the internal clipboard.

Specified by:
copy in interface GraphPanel

paste

public void paste()
Description copied from interface: GraphPanel
Paste the contents of the internal clipboard into the GraphPanel.

Specified by:
paste in interface GraphPanel

pasteStart

public void pasteStart()
Description copied from interface: GraphPanel
Paste the contents of the internal clipboard into the GraphPanel.

Specified by:
pasteStart in interface GraphPanel

pasteStop

public void pasteStop()
Description copied from interface: GraphPanel
Paste the contents of the internal clipboard into the GraphPanel.

Specified by:
pasteStop in interface GraphPanel

pasteBefore

public void pasteBefore(VisualNode visualnode)
Description copied from interface: GraphPanel
Paste the contents of the internal clipboard into the GraphPanel.

Specified by:
pasteBefore in interface GraphPanel
Parameters:
visualnode - the VisualNode to paste before.

pasteBehind

public void pasteBehind(VisualNode visualnode)
Description copied from interface: GraphPanel
Paste the contents of the internal clipboard into the GraphPanel.

Specified by:
pasteBehind in interface GraphPanel
Parameters:
visualnode - the VisualNode to paste behind.

paste

public void paste(Coordinate coordinate)
Paste the contents of the internal clipboard into the GraphPanel at the specified Coordinate.

Parameters:
coordinate - the position where to paste.

postSelect

public void postSelect()
Description copied from interface: GraphPanel
This method should handle all necessary actions to be done whenever you modify the selection of the encapsulated VisualGraphView and its not implicitly propagated to the enclosing GraphPanel. E.g. SelectAll, etc.

Specified by:
postSelect in interface GraphPanel

isAutoScale

public final boolean isAutoScale()
Gets the auto-scale flag, if true then the drawing area is automatically scaled to fit its gui space.

Returns:
true if autoscale mode is enabled.

setAutoScale

public final void setAutoScale(boolean autoScale)
Sets the auto-scale flag, if true then the drawing area is automatically scaled to fit its gui space.

Parameters:
autoScale - true if autoscale mode is enabled.

setModified

public final void setModified()
Description copied from interface: GraphPanel
Sets the modified state of the document.

Specified by:
setModified in interface GraphPanel

removeModifyListener

public void removeModifyListener(ModifiedVisualGraphListener listener)
Removes the modifiy listener that checks for the first initial modification from a VisualGraph.

Specified by:
removeModifyListener in interface GraphPanel
Parameters:
listener - the ModifiedVisualGraphListenerto remove.

addModifyListener

public void addModifyListener(ModifiedVisualGraphListener listener)
Description copied from interface: GraphPanel
The method addModifyListener lets users to keep track on current changes of the represented VisualGraph. Basically any GraphPanel implementation might redirect the passed listener instance to the various addListener of the contained VisualGraphView.

Specified by:
addModifyListener in interface GraphPanel
Parameters:
listener - the ModifiedVisualGraphListener to add.

handleDocumentResize

public final void handleDocumentResize()

This method is called by the #draw(GC, Transform2D, Rectangle) method if it was informed that the graph panel size had changed. It initializes the coordinate system if required and sets the local VisualGraphView's bounding box.

See Also:
#initCoordinateSystem(VisualGraphView, int, int)

getZoomX

public final double getZoomX()
Returns the zoom factor for the VisualGraphView in x direction.

Returns:
double the zoom factor in x direction

getZoomY

public final double getZoomY()
Returns the zoom factor for the VisualGraphView in y direction.

Returns:
double the zoom factor in y direction

setZoom

public final void setZoom(double scaleX,
                          double scaleY)
Description copied from interface: GraphPanel
sets the zoom factors for the graph view.

Specified by:
setZoom in interface GraphPanel
Parameters:
scaleX - the zoom factor for the x axis
scaleY - the zoom factor for the y axis

setZoomToFit

public final void setZoomToFit()
Description copied from interface: GraphPanel
sets the zoom factors for the graph view so that all visible items fit into the visible region.

Specified by:
setZoomToFit in interface GraphPanel

setZoom

public final void setZoom(double scaleX,
                          double scaleY,
                          boolean smartzoom)
Description copied from interface: GraphPanel
sets the zoom factors for the graph view.

Specified by:
setZoom in interface GraphPanel
Parameters:
scaleX - the zoom factor for the x axis
scaleY - the zoom factor for the y axis
smartzoom - if true then zooming is done around the center of the currently visible region or if a selection exists, then the zooming is around the center of the current selection.

mouseEnter

public void mouseEnter(org.eclipse.swt.events.MouseEvent arg0)
Sent when the mouse pointer passes into the area of the screen covered by a control.

Specified by:
mouseEnter in interface org.eclipse.swt.events.MouseTrackListener
Parameters:
arg0 - an event containing information about the mouse enter
See Also:
MouseTrackListener.mouseEnter(org.eclipse.swt.events.MouseEvent)

mouseExit

public void mouseExit(org.eclipse.swt.events.MouseEvent arg0)
Sent when the mouse pointer passes out of the area of the screen covered by a control.

Specified by:
mouseExit in interface org.eclipse.swt.events.MouseTrackListener
Parameters:
arg0 - an event containing information about the mouse exit
See Also:
MouseTrackListener.mouseExit(org.eclipse.swt.events.MouseEvent)

mouseHover

public void mouseHover(org.eclipse.swt.events.MouseEvent event)
Sent when the mouse pointer hovers (that is, stops moving for an (operating system specified) period of time) over a control.

Specified by:
mouseHover in interface org.eclipse.swt.events.MouseTrackListener
Parameters:
event - an event containing information about the hover
See Also:
MouseTrackListener.mouseHover(org.eclipse.swt.events.MouseEvent)

mouseDoubleClick

public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent event)
Sent when a mouse button is pressed twice within the (operating system specified) double click period.

Specified by:
mouseDoubleClick in interface org.eclipse.swt.events.MouseListener
Parameters:
event - an event containing information about the mouse double click
See Also:
MouseListener.mouseDoubleClick(org.eclipse.swt.events.MouseEvent)

mouseDown

public void mouseDown(org.eclipse.swt.events.MouseEvent event)
Sent when a mouse button is pressed.

Specified by:
mouseDown in interface org.eclipse.swt.events.MouseListener
Parameters:
event - an event containing information about the mouse button press
See Also:
MouseListener.mouseDown(org.eclipse.swt.events.MouseEvent)

mouseUp

public void mouseUp(org.eclipse.swt.events.MouseEvent event)
Sent when a mouse button is released.

Specified by:
mouseUp in interface org.eclipse.swt.events.MouseListener
Parameters:
event - an event containing information about the mouse button release
See Also:
MouseListener.mouseUp(org.eclipse.swt.events.MouseEvent)

mouseMove

public void mouseMove(org.eclipse.swt.events.MouseEvent event)
Sent when the mouse moves.

Specified by:
mouseMove in interface org.eclipse.swt.events.MouseMoveListener
Parameters:
event - an event containing information about the mouse move
See Also:
MouseMoveListener.mouseMove(org.eclipse.swt.events.MouseEvent)

isDrawDuringDrag

public final boolean isDrawDuringDrag()
Returns the drawDuringDrag flag, if true then composites are drawn during dragging (in drag'n'drop).

Returns:
true if composites are drawn during dragging.

setDrawDuringDrag

public final void setDrawDuringDrag(boolean drawDuringDrag)
Sets the drawDuringDrag flag, if true then composites are drawn during dragging (in drag'n'drop).

Parameters:
drawDuringDrag - true if composites are drawn during dragging.

drag

public final void drag(VisualGraphObject visualgraphobject,
                       VisualGraphObject[] additional_vgos,
                       double scalefactor,
                       int x,
                       int y)
Invoked by the DropListener during dragging, if the infrastructure is configured to draw during dragging. No drag representation is used in this case.

Parameters:
visualgraphobject - the visual object.
additional_vgos - visual graph objects appearing to be dragged along with the representation of visualgraphobject
scalefactor - the scale factor.
x - the x component of the mouse position.
y - the y component of the mouse position.

drag

public final void drag(VisualGraphObject visualgraphobject,
                       VisualGraphObject[] additional_vgos,
                       BaseComposite dragRepresentation,
                       double scalefactor,
                       int x,
                       int y)

Invoked by the DropListener during dragging, if the infrastructure is configured to draw during dragging.

Parameters:
visualgraphobject - the VisualGraphObject being dragged
additional_vgos - visual graph objects appearing to be dragged along with dragRepresentation
dragRepresentation - the representation of the VisualGraphObject being dragged
scalefactor - the current scale factor
x - the x component of the mouse position.
y - the y component of the mouse position.

drop

public final void drop(VisualGraphObject vgo,
                       VisualGraphObject[] additional_vgos,
                       int x,
                       int y)
Description copied from interface: GraphPanel
Invoked by the DropListener to let the panel handle the dropped VisualGraphObject.

Specified by:
drop in interface GraphPanel
Parameters:
vgo - users dropped VisualGraphObject.
additional_vgos - The objects that have been dropped
x - the x coordinate of the point where the drop occurred.
y - the y coordinate of the point where the drop occurred.

firePostAction

public final void firePostAction()

Called by mouseDown(MouseEvent) and mouseUp(MouseEvent), this method informs the GraphPanelListener s that an action just occured.


getCanvas

public final org.eclipse.swt.widgets.Canvas getCanvas()
Returns the Canvas.

Returns:
Returns the canvas.

cacheBitmapsAndValidate

protected final void cacheBitmapsAndValidate()
This method performs all caching for the repaint-manager. It determines what is put into the background repaintbuffer. Also allocation/reuse of exisint buffers is implemented here.


resetDragAndDropState

public final void resetDragAndDropState()
After rejecting a drop or after the cancellation of a drag'n'operation by the client, this method should be invoked to perform clean-up actions internally.


switchLowDetail

public final void switchLowDetail(boolean isLowDetail)
internal worker function that toggles low-detail modes

Parameters:
isLowDetail - true to enable low detail, otherwise false.

getRendererConfigurationLowDetail

public static final AttributeSet getRendererConfigurationLowDetail()
Returns the AttributeSet that can be used to configure the low-detail rendering settings that used by all instances of SwingGraphPanel during user-interaction.

Returns:
the AttributeSet for user-interaction rendering configuration.
See Also:
RendererConfiguration

getDeepestVisualNodeAt

public final VisualNode getDeepestVisualNodeAt(int x,
                                               int y)
This method delegates its implementation to GraphPanelUtility.getDeepestVisualNodeAt(VisualGraphView, int, int)

Parameters:
x - the x component of the coordinate to check for
y - the y component of the coordinate to check for
Returns:
VisualNode the deepest VisualNode found or null

getDeepestVisualNodeAt

public final VisualNode getDeepestVisualNodeAt(int x,
                                               int y,
                                               boolean traverseFoldedGroups)
This method delegates its implementation to GraphPanelUtility.getDeepestVisualNodeAt(VisualGraphView, int, int, boolean)

Parameters:
x - the x component of the coordinate to check for
y - the y component of the coordinate to check for
traverseFoldedGroups - set to false if VisualNode s inside a folded CompositeGroup should be ignored.
Returns:
VisualNode the deepest VisualNode found or null

getToolTipGenerator

public ToolTipGenerator getToolTipGenerator()
Description copied from interface: GraphPanel
Returns the currently used tooltip generator

Specified by:
getToolTipGenerator in interface GraphPanel
Returns:
generator The ToolTipGenerator currently in use.

setToolTipGenerator

public void setToolTipGenerator(ToolTipGenerator generator)
Description copied from interface: GraphPanel
Sets the tooltip generator to generate the tooltips for this component

Specified by:
setToolTipGenerator in interface GraphPanel
Parameters:
generator - The ToolTipGenerator to use.

dispose

public void dispose()
This method is used in order to destroy the popupmenusource as well as to dispose swt resources held within this class.

See Also:
Widget.dispose()

isDragAccepted

protected boolean isDragAccepted()
Returns true if the the given flavor is supported. This DropListener only accepts FlowTransferable.compositeFlavor.

Returns:
true if the flavor is supported, otherwise false

isDropAccepted

protected boolean isDropAccepted()
Returns true if the the given flavor is supported. This DropListener only accepts FlowTransferable.compositeFlavor.

Returns:
true if the flavor is supported, otherwise false-

setPopupMenuSource

public final void setPopupMenuSource(JPopupMenuSourceWithUpdateUI popupmenusource)
Sets the JPopupMenuSourceWithUpdateUI to use for displaying popup menus.

A popupmenusource is a source for a popupmenu and can be asked to recreate the popupmenu on demand. This is needed for ui-switches during runtime, since popupmenus do not get updated if an ui-switch occurs.

Setting a new popupmenusource will invoke the destroy() method on a previously set popupmenusource.

Parameters:
popupmenusource - the popupmenu source for the graphpanel.

getPopupMenuSource

public JPopupMenuSourceWithUpdateUI getPopupMenuSource()
Returns the local JPopupMenuSourceWithUpdateUI instance.

Returns:
the local JPopupMenuSourceWithUpdateUI instance.

enableKeyboardSupport

public void enableKeyboardSupport(org.eclipse.swt.widgets.Composite component)
This method enables the keyboard support for this SwingGraphPanel. This is done by adding a key listener on the specified Component. Calling this method more than once will not have any effect.

Parameters:
component - the Component to use for adding a keyboard listener.

disableKeyboardSupport

public void disableKeyboardSupport(org.eclipse.swt.widgets.Composite component)
This method disables the keyboard support for this SwingGraphPanel. This is done by removing a key listener from the specified Component. Invoking this method many times will not have any effect.

Parameters:
component - the Component to use for adding a keyboard listener.

setLayout

public void setLayout(org.eclipse.swt.widgets.Layout layout)
Volontarily do nothing. The Layout is internally managed in #performGraphContainerInitialization()

Parameters:
layout - the receiver's new layout or null
See Also:
Composite.setLayout(org.eclipse.swt.widgets.Layout)

getRecentPopupMenuMouseCoordinate

public final Coordinate getRecentPopupMenuMouseCoordinate()
Returns the most recent meaningful mouse-coordinate of this instance.

Returns:
the most recent meaningful mouse-coordinate of this instance.

getGraphDocument

public GraphDocument getGraphDocument()
Returns the enclosing GraphDocument instance.

Returns:
the enclosing GraphDocument instance

enableStrokeZooming

public final void enableStrokeZooming(boolean enabled)
Enables/disables the zooming of the strokes

Parameters:
enabled - true, to enable the zooming

isStrokeZoomingEnabled

public boolean isStrokeZoomingEnabled()
Returns the state of the stroke zooming

Returns:
true, if the zooming of strokes is enabled

setAntialiasing

public final void setAntialiasing(boolean antialiasing)
Enables anti-aliasing if the argument is true, otherwise anti-aliasing is disabled.

Specified by:
setAntialiasing in interface GraphPanel
Parameters:
antialiasing - true for enabling antialiasing otherwise false.

getRendererConfiguration

public final RendererConfiguration getRendererConfiguration()
Returns the RendererConfiguration that is used for drawing contents of this instance.

Specified by:
getRendererConfiguration in interface GraphPanel
Returns:
the RendererConfiguration that is used for drawing contents of this instance.

isAntialiasing

public boolean isAntialiasing()
Description copied from interface: GraphPanel
Returns true is anti-aliasing is enabled, otherwise false

Specified by:
isAntialiasing in interface GraphPanel
Returns:
true is anti-aliasing is enabled, otherwise false

addDragListener

public void addDragListener(GraphPanelDragListener listener)
Description copied from interface: GraphPanel
Adds a listener that will react on drag events like start, enter, exit, move and drop.

Specified by:
addDragListener in interface GraphPanel
Parameters:
listener - The listener for the events

removeDragListener

public void removeDragListener(GraphPanelDragListener listener)
Description copied from interface: GraphPanel
Removed a listener that will react on drag events like start, enter, exit, move and drop.

Specified by:
removeDragListener in interface GraphPanel
Parameters:
listener - The listener for the events

setLowDetailForInteraction

public final void setLowDetailForInteraction(boolean lowDetailForInteraction)
Gets the low-detail-during interaction flag, if true then the selected composites are drawn with minimum detail only during interaction. This improves performance and may improve usability for certain scenarios.

Parameters:
lowDetailForInteraction - flag that indicates whether to use low-detail drawing mode for selected composites.

setVisualGraphObjectDragSource

public void setVisualGraphObjectDragSource(DragContext vgoDragSource)
Sets the DragContext that this instance should use.

Parameters:
vgoDragSource - the DragContext that this instance should use.

isInplaceEditEnabled

public boolean isInplaceEditEnabled()
Returns a boolean that indicates whether inplace editing of text is enabled for an instance of the SwingGraphPanel or not.

Returns:
boolean a flag that indicates whether inplace editing is enabled or not

setInplaceEditEnabled

public void setInplaceEditEnabled(boolean enableInplaceEdit)
Sets the inplace edit enabled flag to the value given by enableInplaceEdit.

Parameters:
enableInplaceEdit - the new value for the inplace edit enabled flag


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.