com.tensegrity.gui.swt.graph
Class GraphPanelUtility

java.lang.Object
  extended bycom.tensegrity.gui.swt.graph.GraphPanelUtility

public final class GraphPanelUtility
extends java.lang.Object

This class intends to gather utility methods that could be used by both the SwingGraphPanel and the SwtGraphPanel. Definitely are good candidates: #initLayoutService(VisualGraphView) getDeepestVisualNodeAt(VisualGraphView, int, int) initRendererConfigurationLowDetail() #computeViewfactorX(VisualGraphView) #computeViewfactorY(VisualGraphView)

Version:
$Id: GraphPanelUtility.java,v 1.22 2005/04/04 07:27:48 MichaelKegel Exp $
Author:
Sebastien Guyon

Constructor Summary
protected GraphPanelUtility()
           This class is not intended to be instanciated.
 
Method Summary
protected static int[] clientToView(VisualGraphView vgv, int x, int y, int viewportwidth, int viewportheight)
           Returns the values of x and y in vgv's coordinate system.
static boolean confirmImageSize(UIManager uiManager)
          NOT IMPLEMENTED - Returns simply true for the moment Display a confirmation dialog that prompts the user whether the computed image size for raster export is accepted or not.
static VisualNode getDeepestVisualNodeAt(VisualGraphView visualgraphview, int x, int y)
          Returns the deepest VisualNode at the coordinate given by x and y that can be found in the hierarchy.
static VisualNode getDeepestVisualNodeAt(VisualGraphView visualgraphview, int x, int y, boolean traverseFoldedGroups)
          Returns the deepest VisualNode at the coordinate given x,y that can be found in the hierarchy.
static org.eclipse.swt.graphics.Image getVisualGraphImage(VisualGraphView visualgraphview)
          Renders a picture for the VisualGraph.
static int getVisualGraphImageRequiredSize(VisualGraphView visualgraphview)
          Returns the number of pixels that are required for a full unscaled export of the current VisualGraphView.
static int getVisualGraphImageThreshold()
          Returns the number of pixels that represent the maximum number of pixels for a full unscaled export of the current VisualGraphView.
protected static AttributeSet initRendererConfigurationLowDetail()
          Returns the attributeset that determines the rendering-settings during user-interaction.
protected static void positionCompositeLine(CompositeLine compositeline, int x, int y)
          Internal helper method, positions the start point of a line at the coordiantes (x,y).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphPanelUtility

protected GraphPanelUtility()

This class is not intended to be instanciated.

Method Detail

clientToView

protected static final int[] clientToView(VisualGraphView vgv,
                                          int x,
                                          int y,
                                          int viewportwidth,
                                          int viewportheight)

Returns the values of x and y in vgv's coordinate system.

Parameters:
vgv - the VisualGraphView
x - represents a position on the X-axis
y - represents a position on the X-axis
viewportwidth - the view ports width of vgv
viewportheight - the view ports height of vgv
Returns:
an array of int of size 2, where int[0] represents the X-position and int[1] the Y position of x and y in the vgv coordinate system.

positionCompositeLine

protected static final void positionCompositeLine(CompositeLine compositeline,
                                                  int x,
                                                  int y)
Internal helper method, positions the start point of a line at the coordiantes (x,y). The line's will be positioned relative to that point. This method is used by drag and drop handling.

Parameters:
compositeline - the compositeline to position
x - the x coordinate of the line's starting point.
y - the y coordinate of the line's starting point.

getDeepestVisualNodeAt

public static final VisualNode getDeepestVisualNodeAt(VisualGraphView visualgraphview,
                                                      int x,
                                                      int y)
Returns the deepest VisualNode at the coordinate given by x and y that can be found in the hierarchy. If no VisualNode is found at the coordinate null is returned. By default VisualNode s contained inside folded groups are ignored. Please use #getDeepestVisualNodeAt(int, int, boolean) with the last parameter set to true in order to traverse folded groups during the search.
Notice that the coordinate is given in device coordinates.

Parameters:
visualgraphview - the VisualGraphView to search on.
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 static final VisualNode getDeepestVisualNodeAt(VisualGraphView visualgraphview,
                                                      int x,
                                                      int y,
                                                      boolean traverseFoldedGroups)
Returns the deepest VisualNode at the coordinate given x,y that can be found in the hierarchy. If no VisualNode is found at the coordinate null is returned.
If the parameter traverseFoldedGroups is set to false, the first folded CompositeGroup found at the given coordinate is considered as the deepest VisualNode for this coordinate and is therefore returned by this method. Notice that the coordinate is given in device coordinates.

Parameters:
visualgraphview - the VisualGraphView to search on.
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

initRendererConfigurationLowDetail

protected static final AttributeSet initRendererConfigurationLowDetail()
Returns the attributeset that determines the rendering-settings during user-interaction.

Returns:
the attributeset that determines the rendering-settings during user-interaction.

getVisualGraphImageRequiredSize

public static int getVisualGraphImageRequiredSize(VisualGraphView visualgraphview)
Returns the number of pixels that are required for a full unscaled export of the current VisualGraphView.

Parameters:
visualgraphview - the VisualGraphView
Returns:
the required number of pixels for export.

getVisualGraphImage

public static final org.eclipse.swt.graphics.Image getVisualGraphImage(VisualGraphView visualgraphview)
Renders a picture for the VisualGraph. The current display contents are rendered into a standard RGB image (true-color) of the specified 1:1 zoomed width and height and returned as an image.

Parameters:
visualgraphview - the current VisualGraphView
Returns:
an image representing the currently assigned VisualGraphViewor null which is returned if no VisualGraphViewis currently active.

getVisualGraphImageThreshold

public static int getVisualGraphImageThreshold()
Returns the number of pixels that represent the maximum number of pixels for a full unscaled export of the current VisualGraphView.

Returns:
the maximum number of pixels for export.

confirmImageSize

public static final boolean confirmImageSize(UIManager uiManager)
NOT IMPLEMENTED - Returns simply true for the moment Display a confirmation dialog that prompts the user whether the computed image size for raster export is accepted or not.

Parameters:
uiManager - the UIManager to use for the displayed texts.
Returns:
true if and only if the user confirmed.


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