com.tensegrity.graphics.device
Class SWTDevice

java.lang.Object
  extended bycom.tensegrity.graphics.device.AbstractDevice
      extended bycom.tensegrity.graphics.device.AWTDevice
          extended bycom.tensegrity.graphics.device.SWTDevice
All Implemented Interfaces:
Device

public final class SWTDevice
extends AWTDevice
implements Device

This is a TEMPORARY version of the SWT-based implementation of Device. At this stage of development (and in order to provide an Eclipse Plug-in with the maximum available functionality), this class extends class AWTDevice.

The setSWTDeviceFile(String) method has also been temporarily added in order to provide the ability to switch easily between the AWT-dependent version of the SWTDevice and the non-AWT-dependent one, for which the development is currently in progress.

This implementation has been inspired by the sample code provided by Andy Smith and Christophe Avare in the Eclipse Newsgroups.

Version:
$Id: SWTDevice.java,v 1.42 2005/05/10 14:08:39 KevinCVS Exp $
Author:
S�bastien Guyon

Field Summary
 
Fields inherited from class com.tensegrity.graphics.device.AWTDevice
fontCache, gfx, gfx2D, USE_FONT_CACHING, USE_TEXTURE_BITMAP_CACHING
 
Fields inherited from class com.tensegrity.graphics.device.AbstractDevice
fontFormat, fontFormatData, paintFormat, paintFormatData, strokeFormat, strokeFormatData, visibleFont, visiblePaint, visibleStroke
 
Fields inherited from interface com.tensegrity.graphics.device.Device
DRAW_FILL, DRAW_OUTLINE
 
Method Summary
 void dispose()
          This method retrieves the SWT image (see #getSWTImage(int, int, int, int)) and draws it onto the on-screen GC.
static Device getDevice(org.eclipse.swt.graphics.Device swtdevice, org.eclipse.swt.graphics.GC gc, int x, int y, int width, int height)
           This method creates, initializes and returns a new instance of this class.
static void setSWTDeviceFile(java.lang.String SWTDeviceFile)
           Important: This method will be removed once the non-AWT dependent version of the SWTDevice will be fully implemented.
 
Methods inherited from class com.tensegrity.graphics.device.AWTDevice
clearClip, clearRect, clipRect, createAWTPaint, createAWTPaint, createAWTStroke, createAWTStroke, createAWTStroke, drawArc, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, getClipBounds, getClipBounds, getDevice, getDeviceStatistics, getGraphics, getTransform, hitClip, initiate, isAntialiasing, isInhibitLT2RBFlip, isInhibitYFlip, isPrinting, lookupAWTFont, lookupAWTFont, setAntialiasing, setClip, setClipBounds, setFontFormat, setFontFormatData, setInhibitLT2RBFlip, setInhibitYFlip, setIsPrinting, setPaintFormat, setPaintFormatData, setPaintMode, setStrokeFormat, setStrokeFormatData, setTransform, setXORMode, translate
 
Methods inherited from class com.tensegrity.graphics.device.AbstractDevice
getFontFormat, getPaintFormat, getStrokeFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tensegrity.graphics.device.Device
clearClip, clearRect, clipRect, drawArc, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, getClipBounds, getClipBounds, getFontFormat, getPaintFormat, getStrokeFormat, getTransform, hitClip, initiate, isAntialiasing, isInhibitLT2RBFlip, isInhibitYFlip, isPrinting, setAntialiasing, setClip, setClipBounds, setFontFormat, setFontFormatData, setInhibitLT2RBFlip, setInhibitYFlip, setIsPrinting, setPaintFormat, setPaintFormatData, setPaintMode, setStrokeFormat, setStrokeFormatData, setTransform, setXORMode, translate
 

Method Detail

setSWTDeviceFile

public static final void setSWTDeviceFile(java.lang.String SWTDeviceFile)

Important: This method will be removed once the non-AWT dependent version of the SWTDevice will be fully implemented. The passed SWTDeviceFile should be "com.tensegrity.graphics.device.SWTDeviceNonAWTDependent" or "com.tensegrity.graphics.device.SWTDevice", the latter being the default value.

Parameters:
SWTDeviceFile - the servicefile to use.

getDevice

public static Device getDevice(org.eclipse.swt.graphics.Device swtdevice,
                               org.eclipse.swt.graphics.GC gc,
                               int x,
                               int y,
                               int width,
                               int height)

This method creates, initializes and returns a new instance of this class. Please note that the SWTDeviceB#initiate() method is called in order to simplify clients code. Also note that the dispose() method will not dispose the passed parameters and it is the caller's responsability to ensure that the resources it allocated are disposed.

Parameters:
swtdevice - the "SWT" Device associated to the returned SWTDevice.
gc - the graphical context for the returned SWTDevice
x - the on screen X position of the drawing area
y - the on screen Y position of the drawing area
width - the on screen width of the drawing area
height - the on screen height of the drawing area
Returns:
an initialized SWTDevice instance

dispose

public void dispose()
This method retrieves the SWT image (see #getSWTImage(int, int, int, int)) and draws it onto the on-screen GC. Finally it releases all resources which were kept in this instance.

Specified by:
dispose in interface Device
Overrides:
dispose in class AWTDevice
See Also:
Device.dispose()


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