com.tensegrity.gui.swt.repository
Class VisualGraphObjectSwtIcon

java.lang.Object
  extended bycom.tensegrity.gui.swt.icon.SwtIcon
      extended bycom.tensegrity.gui.swt.repository.VisualGraphObjectSwtIcon
All Implemented Interfaces:
Disposable

public class VisualGraphObjectSwtIcon
extends SwtIcon

A VisualGraphObjectSwtIcon is a SwtIcon which is used to represent any given VisualGraphObject.

Two constructors are available. While one lets the caller define the width and height of the VisualGraphObjectSwtIcon, the other one uses predefined values (DEFAULT_WIDTH and DEFAULT_HEIGHT).

This class internally performs the drawing of its associated VisualGraphObject onto an image which can be accessed by means of the SwtIcon.getIcon() method. For information, the drawing is delegated to the BaseComposite.draw(Renderer, Device, Transform2D) method.

Use the dispose() method once instances of this class are no longer necessary. This ensures that resources internally held are freed.

Version:
$Id: VisualGraphObjectSwtIcon.java,v 1.21 2006/03/02 11:42:01 BurkhardWick Exp $
Author:
S�bastien Guyon

Field Summary
static int DEFAULT_HEIGHT
          constant defining the size of the icon
static int DEFAULT_WIDTH
          constant defining the size of the icon
 
Constructor Summary
VisualGraphObjectSwtIcon(org.eclipse.swt.graphics.Device device, VisualGraphObject vgo, double textscalefactor, CoordinateSystem coordSystem, int width, int height)
           This constructor creates instances of VisualGraphObjectSwtIcon based on the given VisualGraphObject with a width and height respectively of width and height.
VisualGraphObjectSwtIcon(org.eclipse.swt.graphics.Device device, VisualGraphObject vgo, double textscalefactor, CoordinateSystem coordSystem, Raster raster, int width, int height)
           This constructor creates instances of VisualGraphObjectSwtIcon based on the given VisualGraphObject with a width and height respectively of width and height.
VisualGraphObjectSwtIcon(org.eclipse.swt.graphics.Device device, VisualGraphObject vgoIcon, int width, int height)
           
 
Method Summary
 org.eclipse.swt.graphics.Color getBackgroundColor()
           Returns the background color of this VisualGraphObjectSwtIcon.
 Renderer getRenderer()
          Returns the renderer that is used to draw the icon
 void setBackgroundColor(org.eclipse.swt.graphics.Color color)
           Sets the background color for this Icon.
 void setRenderer(Renderer renderer)
          Sets the renderer that should be used to draw the icon
 
Methods inherited from class com.tensegrity.gui.swt.icon.SwtIcon
dispose, getDevice, getHeight, getIcon, getSize, getWidth, setIcon, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
constant defining the size of the icon

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
constant defining the size of the icon

See Also:
Constant Field Values
Constructor Detail

VisualGraphObjectSwtIcon

public VisualGraphObjectSwtIcon(org.eclipse.swt.graphics.Device device,
                                VisualGraphObject vgo,
                                double textscalefactor,
                                CoordinateSystem coordSystem,
                                int width,
                                int height)

This constructor creates instances of VisualGraphObjectSwtIcon based on the given VisualGraphObject with a width and height respectively of width and height.

Parameters:
device - a Device used to create the actual Image that renders the icon
vgo - the VisualGraphObject which this icon represents
textscalefactor - a factor to scale the text (if any)
coordSystem - the underlying CoordinateSystem for this Icon
width - the icon width
height - the icon height

VisualGraphObjectSwtIcon

public VisualGraphObjectSwtIcon(org.eclipse.swt.graphics.Device device,
                                VisualGraphObject vgo,
                                double textscalefactor,
                                CoordinateSystem coordSystem,
                                Raster raster,
                                int width,
                                int height)

This constructor creates instances of VisualGraphObjectSwtIcon based on the given VisualGraphObject with a width and height respectively of width and height.

Parameters:
device - a Device used to create the actual Image that renders the icon
vgo - the VisualGraphObject which this icon represents
textscalefactor - a factor to scale the text (if any)
coordSystem - the underlying CoordinateSystem for this Icon
raster - the Raster used for this Icon
width - the icon width
height - the icon height

VisualGraphObjectSwtIcon

public VisualGraphObjectSwtIcon(org.eclipse.swt.graphics.Device device,
                                VisualGraphObject vgoIcon,
                                int width,
                                int height)
Method Detail

setBackgroundColor

public void setBackgroundColor(org.eclipse.swt.graphics.Color color)

Sets the background color for this Icon.

Parameters:
color - the background color

getBackgroundColor

public org.eclipse.swt.graphics.Color getBackgroundColor()

Returns the background color of this VisualGraphObjectSwtIcon.

Returns:
the background color of this VisualGraphObjectSwtIcon.

getRenderer

public Renderer getRenderer()
Returns the renderer that is used to draw the icon

Returns:
the renderer that is used to draw the icon

setRenderer

public void setRenderer(Renderer renderer)
Sets the renderer that should be used to draw the icon

Parameters:
renderer - the renderer that should be used to draw the icon


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