|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.uka.ipd.sdq.dialogs.SWTResourceManager
public class SWTResourceManager
Utility class for managing OS resources associated with SWT controls such as
colors, fonts, images, etc.
!!! IMPORTANT !!! Application code must explicitly invoke the dispose()
method to release the operating system resources managed by cached objects
when those objects and OS resources are no longer needed (e.g. on
application shutdown)
This class may be freely distributed as part of any application or plugin.
Copyright (c) 2003 - 2005, Instantiations, Inc.
All Rights Reserved
Field Summary | |
---|---|
static int |
BOTTOM_LEFT
Style constant for placing decorator image in bottom left corner of base image. |
static int |
BOTTOM_RIGHT
Style constant for placing decorator image in bottom right corner of base image. |
static int |
TOP_LEFT
Style constant for placing decorator image in top left corner of base image. |
static int |
TOP_RIGHT
Style constant for placing decorator image in top right corner of base image. |
Constructor Summary | |
---|---|
SWTResourceManager()
|
Method Summary | |
---|---|
static Image |
decorateImage(Image baseImage,
Image decorator)
Returns an image composed of a base image decorated by another image |
static Image |
decorateImage(Image baseImage,
Image decorator,
int corner)
Returns an image composed of a base image decorated by another image |
static void |
dispose()
Dispose of cached objects and their underlying OS resources. |
static void |
disposeColors()
Dispose of all the cached colors |
static void |
disposeCursors()
Dispose all of the cached cursors |
static void |
disposeFonts()
Dispose all of the cached fonts |
static void |
disposeImages()
Dispose all of the cached images |
static void |
disposeImages(String section)
Dispose cached images in specified section |
static void |
fixCoolBarSize(CoolBar bar)
Fix the layout of the specified CoolBar |
static Font |
getBoldFont(Font baseFont)
Return a bold version of the give font |
static Color |
getColor(int systemColorID)
Returns the system color matching the specific ID |
static Color |
getColor(int r,
int g,
int b)
Returns a color given its red, green and blue component values |
static Color |
getColor(RGB rgb)
Returns a color given its RGB value |
static Cursor |
getCursor(int id)
Returns the system cursor matching the specific ID |
static Font |
getFont(String name,
int height,
int style)
Returns a font based on its name, height and style |
static Font |
getFont(String name,
int size,
int style,
boolean strikeout,
boolean underline)
Returns a font based on its name, height and style. |
static Image |
getImage(Class<?> clazz,
String path)
Returns an image stored in the file at the specified path relative to the specified class |
protected static Image |
getImage(InputStream is)
Returns an image encoded by the specified input stream |
static Image |
getImage(String path)
Returns an image stored in the file at the specified path |
static Image |
getImage(String section,
String path)
Returns an image stored in the file at the specified path |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TOP_LEFT
public static final int TOP_RIGHT
public static final int BOTTOM_LEFT
public static final int BOTTOM_RIGHT
Constructor Detail |
---|
public SWTResourceManager()
Method Detail |
---|
public static void dispose()
public static Color getColor(int systemColorID)
systemColorID
- int The ID value for the color
public static Color getColor(int r, int g, int b)
r
- int The red component of the colorg
- int The green component of the colorb
- int The blue component of the color
public static Color getColor(RGB rgb)
rgb
- RGB The RGB value of the color
public static void disposeColors()
protected static Image getImage(InputStream is)
is
- InputStream The input stream encoding the image data
public static Image getImage(String path)
path
- String The path to the image file
public static Image getImage(String section, String path)
section
- The section to which belongs specified imagepath
- String The path to the image file
public static Image getImage(Class<?> clazz, String path)
clazz
- Class The class relative to which to find the imagepath
- String The path to the image file
public static Image decorateImage(Image baseImage, Image decorator)
baseImage
- Image The base image that should be decorateddecorator
- Image The image to decorate the base image
public static Image decorateImage(Image baseImage, Image decorator, int corner)
baseImage
- Image The base image that should be decorateddecorator
- Image The image to decorate the base imagecorner
- The corner to place decorator image
public static void disposeImages()
public static void disposeImages(String section)
section
- the section do disposepublic static Font getFont(String name, int height, int style)
name
- String The name of the fontheight
- int The height of the fontstyle
- int The style of the font
public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline)
name
- String The name of the fontsize
- int The size of the fontstyle
- int The style of the fontstrikeout
- boolean The strikeout flag (warning: Windows only)underline
- boolean The underline flag (warning: Windows only)
public static Font getBoldFont(Font baseFont)
baseFont
- Font The font for whoch a bold version is desired
public static void disposeFonts()
public static void fixCoolBarSize(CoolBar bar)
bar
- CoolBar The CoolBar that shgoud be fixedpublic static Cursor getCursor(int id)
id
- int The ID value for the cursor
public static void disposeCursors()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |