com.tensegrity.gui.graphdocument
Interface GraphPanel

All Superinterfaces:
BasicComponent, Evaluable, Observer
All Known Implementing Classes:
SwingGraphPanel, SwtGraphPanel

public interface GraphPanel
extends BasicComponent, Observer

This class represents the drawing-area for graphs in abstract form.

Instances of GraphPanelListener can be registered with a GraphPanel and then will be informed about user interaction events that occurred on the GraphPanel instance.

Version:
$Id: GraphPanel.java,v 1.35 2005/12/16 09:01:21 BurkhardWick Exp $
Author:
Stepan Rutz
See Also:
GraphPanelListener

Field Summary
static int DRAG_TOLERANCE
          The minimum distance to start a dragging action
 
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 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 disableMode(int modemask)
          Disables the given mode(s) on this instance.
 void drop(VisualGraphObject vgo, VisualGraphObject[] vgos, int x, int y)
          Invoked by the DropListener to let the panel handle the dropped VisualGraphObject.
 void enableMode(int modemask)
          Enables the given mode(s) on this instance.
 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.
 GraphApplication getGraphApplication()
          Deprecated. This method is about to disappear, use getApplicationFrame() instead!
 GraphController getGraphController()
          Returns a GraphController.
 RendererConfiguration getRendererConfiguration()
          Returns the current RendererConfiguration for this GraphPanel.
 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.
 boolean isAntialiasing()
          Returns true is anti-aliasing is enabled, otherwise false
 boolean isEditable()
          Returns whether the document is editable or not.
 boolean isModified()
          Returns whether the document needs saving or not.
 void paste()
          Paste the contents of the internal clipboard into the GraphPanel.
 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)
          The method removeModifyListener should remove the passed listener from all the previously added listener lists.
 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 setGraphController(GraphController graphcontroller, VisualGraphView visualgraphview)
          Sets a visualgraph to display along with a controller.
 void setModified()
          Sets the modified state of the document.
 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 visualgraphview)
          Sets the VisualGraph to display in the graphpanel.
 void setZoom(double scaleX, double scaleY)
          sets the zoom factors for the graph view.
 void setZoom(double scaleX, double scaleY, boolean centerzoom)
          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 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 interface com.tensegrity.gui.component.BasicComponent
getHeight, getParentComponent, getWidth, repaint
 
Methods inherited from interface com.tensegrity.gui.Evaluable
applyEvList, installEvList
 

Field Detail

DRAG_TOLERANCE

public static final int DRAG_TOLERANCE
The minimum distance to start a dragging action

See Also:
Constant Field Values
Method Detail

addGraphPanelListener

public void addGraphPanelListener(GraphPanelListener listener)
Adds a GraphPanelListener to this instance.

Parameters:
listener - the listener instance to add.

removeGraphPanelListener

public void removeGraphPanelListener(GraphPanelListener listener)
Removes a GraphPanelListener from this instance.

Parameters:
listener - the listener instance to remove.

update

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

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

isEditable

public boolean isEditable()
Returns whether the document is editable or not.

Returns:
boolean flag that indicates whether editing is enabled or disabled.

enableMode

public void enableMode(int modemask)
Enables the given mode(s) on this instance.

Parameters:
modemask - the mode(s) to enable.

disableMode

public void disableMode(int modemask)
Disables the given mode(s) on this instance.

Parameters:
modemask - the mode(s) to disable.

isModified

public boolean isModified()
Returns whether the document needs saving or not.

Returns:
boolean flag that indicates whether saving is needed or not.

setModified

public void setModified()
Sets the modified state of the document.


setUnmodified

public void setUnmodified()
Clears the modified state of the document.


getGraphApplication

public GraphApplication getGraphApplication()
Deprecated. This method is about to disappear, use getApplicationFrame() instead!

Returns the application reference.

Returns:
a reference to the GraphApplication.

getApplicationFrame

public ApplicationFrame getApplicationFrame()
Returns the application frame reference.

Returns:
a reference to the ApplicationFrame.

getVisualGraphIcon

public java.awt.Image getVisualGraphIcon(int width,
                                         int height)
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.
Returns:
the icon image.

getGraphController

public GraphController getGraphController()
Returns a GraphController.

Returns:
GraphController

setGraphController

public void setGraphController(GraphController graphcontroller,
                               VisualGraphView visualgraphview)
Sets a visualgraph to display along with a controller. The previous visualgraph is removed from the panel.

Parameters:
graphcontroller - the controller for the visualgraph
visualgraphview - the visualgraph to be displayed.

getVisualGraph

public VisualGraphView getVisualGraph()
Gets the visual graph instance that is currently displayed in the graphpanel.

Returns:
the visualgraph instance shown in this graphpanel.

setVisualGraph

public void setVisualGraph(VisualGraphView visualgraphview)
Sets the VisualGraph to display in the graphpanel.

Parameters:
visualgraphview - the visualgraph to display in the graphpanel

setZoom

public void setZoom(double scaleX,
                    double scaleY,
                    boolean centerzoom)
sets the zoom factors for the graph view.

Parameters:
scaleX - the zoom factor for the x axis
scaleY - the zoom factor for the y axis
centerzoom - 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.

setZoom

public void setZoom(double scaleX,
                    double scaleY)
sets the zoom factors for the graph view.

Parameters:
scaleX - the zoom factor for the x axis
scaleY - the zoom factor for the y axis

setZoomToFit

public void setZoomToFit()
sets the zoom factors for the graph view so that all visible items fit into the visible region.


getViewportWidth

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

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.

Returns:
the viewport width in pixels.

drop

public void drop(VisualGraphObject vgo,
                 VisualGraphObject[] vgos,
                 int x,
                 int y)
Invoked by the DropListener to let the panel handle the dropped VisualGraphObject.

Parameters:
vgo - users dropped VisualGraphObject.
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.

deleteSelection

public void deleteSelection()
Deletes the currently selected objects. If no object is selected nothing will be deleted.


undo

public void undo()
Undo the last undoable change.


redo

public void redo()
Redo the last undone change.


cut

public void cut()
Cut the selection into the internal clipboard.


copy

public void copy()
Copy the selection into the internal clipboard.


paste

public void paste()
Paste the contents of the internal clipboard into the GraphPanel.


pasteStart

public void pasteStart()
Paste the contents of the internal clipboard into the GraphPanel.


pasteStop

public void pasteStop()
Paste the contents of the internal clipboard into the GraphPanel.


pasteBefore

public void pasteBefore(VisualNode visualnode)
Paste the contents of the internal clipboard into the GraphPanel.

Parameters:
visualnode - the VisualNode to paste before.

pasteBehind

public void pasteBehind(VisualNode visualnode)
Paste the contents of the internal clipboard into the GraphPanel.

Parameters:
visualnode - the VisualNode to paste behind.

setAttributableOnSetDelegate

public 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.

Parameters:
delegate - the delegate object to delegate determineAttributableOnSet calls to.

getAttributableOnSetDelegate

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

Returns:
AttributableOnSetDelegate

setToolTipGenerator

public void setToolTipGenerator(ToolTipGenerator generator)
Sets the tooltip generator to generate the tooltips for this component

Parameters:
generator - The ToolTipGenerator to use.

getToolTipGenerator

public ToolTipGenerator getToolTipGenerator()
Returns the currently used tooltip generator

Returns:
generator The ToolTipGenerator currently in use.

addModifyListener

public void addModifyListener(ModifiedVisualGraphListener listener)
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.

Parameters:
listener - the ModifiedVisualGraphListener to add.

removeModifyListener

public void removeModifyListener(ModifiedVisualGraphListener listener)
The method removeModifyListener should remove the passed listener from all the previously added listener lists. The GraphPanel is responsible for a clean listener handling.

Parameters:
listener - the ModifiedVisualGraphListener to remove.

postSelect

public 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. E.g. SelectAll, etc.


getRendererConfiguration

public RendererConfiguration getRendererConfiguration()
Returns the current RendererConfiguration for this GraphPanel.

Returns:
the current RendererConfiguration

setAntialiasing

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

Parameters:
antialiasing - true for enabling antialiasing otherwise false.

isAntialiasing

public boolean isAntialiasing()
Returns true is anti-aliasing is enabled, otherwise false

Returns:
true is anti-aliasing is enabled, otherwise false

addDragListener

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

Parameters:
listener - The listener for the events

removeDragListener

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

Parameters:
listener - The listener for the events


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