Class XYGraphMediaFactory
java.lang.Object
org.eclipse.nebula.visualization.xygraph.util.XYGraphMediaFactory
public final class XYGraphMediaFactory
extends java.lang.Object
A factory, which provides convenience methods for the creation of Images and
Fonts.
All resources created via this factory get automatically disposed, when the
application is stopped.
- Version:
- $Revision$
-
Field Summary
Fields Modifier and Type Field Description static org.eclipse.swt.graphics.RGB
COLOR_BLACK
the color for blackstatic org.eclipse.swt.graphics.RGB
COLOR_BLUE
the color for bluestatic org.eclipse.swt.graphics.RGB
COLOR_CYAN
the color for cyanstatic org.eclipse.swt.graphics.RGB
COLOR_DARK_GRAY
the color for dark graystatic org.eclipse.swt.graphics.RGB
COLOR_GRAY
the color for graystatic org.eclipse.swt.graphics.RGB
COLOR_GREEN
the color for greenstatic org.eclipse.swt.graphics.RGB
COLOR_LIGHT_BLUE
the color for light bluestatic org.eclipse.swt.graphics.RGB
COLOR_ORANGE
the color for orangestatic org.eclipse.swt.graphics.RGB
COLOR_PINK
the color for pinkstatic org.eclipse.swt.graphics.RGB
COLOR_PURPLE
the color for orangestatic org.eclipse.swt.graphics.RGB
COLOR_RED
the color for redstatic org.eclipse.swt.graphics.RGB
COLOR_WHITE
the color for whitestatic org.eclipse.swt.graphics.RGB
COLOR_YELLOW
the color for yellowstatic java.lang.String
CURSOR_GRABBING_ON_AXIS_PATH
static java.lang.String
CURSOR_GRABBING_PATH
static org.eclipse.swt.graphics.FontData
FONT_ARIAL
the font for Arial in height of 9static org.eclipse.swt.graphics.FontData
FONT_TAHOMA
the font for Tahoma in height of 9 -
Method Summary
Modifier and Type Method Description void
disposeResources()
org.eclipse.swt.graphics.Color
getColor(int r, int g, int b)
Create theColor
for the given color information.org.eclipse.swt.graphics.Color
getColor(org.eclipse.swt.graphics.RGB rgb)
Create theColor
for the givenRGB
.org.eclipse.swt.graphics.Cursor
getCursor(java.lang.String cursorImagePath)
org.eclipse.swt.graphics.Font
getDefaultFont(int style)
Return the system's default font.org.eclipse.swt.graphics.Font
getFont(java.lang.String name, int height, int style)
Create theFont
for the given information.org.eclipse.swt.graphics.Font
getFont(org.eclipse.swt.graphics.FontData fontData)
Create theFont
for the givenFontData
and the given style code.org.eclipse.swt.graphics.Font
getFont(org.eclipse.swt.graphics.FontData[] fontData)
Create theFont
for the givenFontData
.org.eclipse.swt.graphics.Font
getFont(org.eclipse.swt.graphics.FontData[] fontData, int style)
Create theFont
for the givenFontData
and the given style code.org.eclipse.swt.graphics.Image
getImage(java.lang.String relativePath)
Load theImage
from the given path in the given plugin.static XYGraphMediaFactory
getInstance()
Return the shared instance of this class.org.eclipse.swt.graphics.Image
getRegisteredImage(java.lang.String key)
void
registerCursor(java.lang.String key, org.eclipse.swt.graphics.Cursor cursor)
Register the cursor so it can be disposed when the plugin stopped.void
registerImage(java.lang.String key, org.eclipse.swt.graphics.Image img)
Register the image to imageRegistry so it can be disposed when Display disposed.
-
Field Details
-
CURSOR_GRABBING_PATH
public static final java.lang.String CURSOR_GRABBING_PATH- See Also:
- Constant Field Values
-
CURSOR_GRABBING_ON_AXIS_PATH
public static final java.lang.String CURSOR_GRABBING_ON_AXIS_PATH- See Also:
- Constant Field Values
-
COLOR_LIGHT_BLUE
public static final org.eclipse.swt.graphics.RGB COLOR_LIGHT_BLUEthe color for light blue -
COLOR_BLUE
public static final org.eclipse.swt.graphics.RGB COLOR_BLUEthe color for blue -
COLOR_WHITE
public static final org.eclipse.swt.graphics.RGB COLOR_WHITEthe color for white -
COLOR_GRAY
public static final org.eclipse.swt.graphics.RGB COLOR_GRAYthe color for gray -
COLOR_DARK_GRAY
public static final org.eclipse.swt.graphics.RGB COLOR_DARK_GRAYthe color for dark gray -
COLOR_BLACK
public static final org.eclipse.swt.graphics.RGB COLOR_BLACKthe color for black -
COLOR_RED
public static final org.eclipse.swt.graphics.RGB COLOR_REDthe color for red -
COLOR_GREEN
public static final org.eclipse.swt.graphics.RGB COLOR_GREENthe color for green -
COLOR_YELLOW
public static final org.eclipse.swt.graphics.RGB COLOR_YELLOWthe color for yellow -
COLOR_PINK
public static final org.eclipse.swt.graphics.RGB COLOR_PINKthe color for pink -
COLOR_CYAN
public static final org.eclipse.swt.graphics.RGB COLOR_CYANthe color for cyan -
COLOR_ORANGE
public static final org.eclipse.swt.graphics.RGB COLOR_ORANGEthe color for orange -
COLOR_PURPLE
public static final org.eclipse.swt.graphics.RGB COLOR_PURPLEthe color for orange -
FONT_ARIAL
public static final org.eclipse.swt.graphics.FontData FONT_ARIALthe font for Arial in height of 9 -
FONT_TAHOMA
public static final org.eclipse.swt.graphics.FontData FONT_TAHOMAthe font for Tahoma in height of 9
-
-
Method Details
-
disposeResources
public void disposeResources() -
getCursor
public org.eclipse.swt.graphics.Cursor getCursor(java.lang.String cursorImagePath) -
getInstance
Return the shared instance of this class.- Returns:
- The shared instance of this class.
-
getColor
public org.eclipse.swt.graphics.Color getColor(int r, int g, int b)Create theColor
for the given color information.- Parameters:
r
- redg
- greenb
- blue- Returns:
- The
Color
for the given color information.
-
getColor
public org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)Create theColor
for the givenRGB
.- Parameters:
rgb
- ARGB
object.- Returns:
- The
Color
for the givenRGB
.
-
getFont
public org.eclipse.swt.graphics.Font getFont(java.lang.String name, int height, int style)Create theFont
for the given information.- Parameters:
name
- The font name.height
- The font height.style
- The font style.- Returns:
- The
Font
for the given information.
-
getFont
public org.eclipse.swt.graphics.Font getFont(org.eclipse.swt.graphics.FontData[] fontData)Create theFont
for the givenFontData
.- Parameters:
fontData
- TheFontData
- Returns:
- The
Font
for the givenFontData
-
getFont
public org.eclipse.swt.graphics.Font getFont(org.eclipse.swt.graphics.FontData[] fontData, int style)Create theFont
for the givenFontData
and the given style code.- Parameters:
fontData
- TheFontData
style
- The style code.- Returns:
- The
Font
for the givenFontData
and the given style code.
-
getFont
public org.eclipse.swt.graphics.Font getFont(org.eclipse.swt.graphics.FontData fontData)Create theFont
for the givenFontData
and the given style code.- Parameters:
fontData
- TheFontData
- Returns:
- The
Font
for the givenFontData
and the given style code.
-
getDefaultFont
public org.eclipse.swt.graphics.Font getDefaultFont(int style)Return the system's default font.- Parameters:
style
- additional styles, e.g. SWT.Bold- Returns:
- The system's default font.
-
registerImage
public void registerImage(java.lang.String key, org.eclipse.swt.graphics.Image img)Register the image to imageRegistry so it can be disposed when Display disposed.- Parameters:
key
-img
-
-
getRegisteredImage
public org.eclipse.swt.graphics.Image getRegisteredImage(java.lang.String key) -
getImage
public org.eclipse.swt.graphics.Image getImage(java.lang.String relativePath)Load theImage
from the given path in the given plugin. Usually, this is the image found via the the given plug-in relative path. But this implementation also supports a hack for testing: If no plugin is running, because for example this is an SWT-only test, the path is used as is, i.e. relative to the current directory.- Parameters:
relativePath
- The image's relative path to the root of the plugin.- Returns:
- The
Image
from the given path in the given plugin.
-
registerCursor
public void registerCursor(java.lang.String key, org.eclipse.swt.graphics.Cursor cursor)Register the cursor so it can be disposed when the plugin stopped.- Parameters:
cursor
-
-