de.tu_berlin.cs.tfs.muvitorkit.ui.utils
Class IconUtilTemplate
java.lang.Object
de.tu_berlin.cs.tfs.muvitorkit.ui.utils.IconUtilTemplate
public class IconUtilTemplate
- extends Object
This class is a template, showing how a static IconUtil class can be built.
The purpose of this class is to manage the icons in some image folder in an
uniform way and cache them in the plugin's ImageRegistry
. Do not
create or access Images for the icon files on other places!
Because of its static methods it is not intended to be subclassed but to
be copied and modified directly.
The methods to use in your plugin are
These will take care of the correct creating of the descriptors and images
and caching them in the plugin's image registry.
How to point to some image files:
The main idea is that you specify a folder in your plugin (like in this
template defaultImagePath
= "icons/"
) and put all your PNG image
files in it.
All the public methods mentioned above call the private method
getFileName(int, int, int)
to build a file name for the given type,
attribute and size (preferably constants of this class like
GRAPH_LAYOUT
). Your task is to extend
getFileName(int, int, int)
with switch-case blocks such that it
builds the filename of the icon you put in your image folder for some type of
icon you need.
Naming proposition:
An universal pattern for naming the icon files would be "NAMEXX.png" or
"NAMEATTXX.png" like the examples "graphlayout16.png" and
"graphlayout24.png". This way, you can build the filename by simply
concatenating a name string for the type constant with some attribute string
and the size integer like in this template.
- Rating

Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GRAPH_LAYOUT
public static final int GRAPH_LAYOUT
- See Also:
- Constant Field Values
GRID
public static final int GRID
- See Also:
- Constant Field Values
RULER
public static final int RULER
- See Also:
- Constant Field Values
TRIM
public static final int TRIM
- See Also:
- Constant Field Values
getIcon
public static final Image getIcon(int type,
int size)
- Parameters:
type
- an integer describing the type of icon to be returnedsize
- the size of the icon to returned
- Returns:
- a
Image
for the given type and with the given size - See Also:
getIcon(int, int, int)
,
getFileName(int, int, int)
getIcon
public static final Image getIcon(int type,
int attribute,
int size)
- Parameters:
type
- an integer describing the type of icon to be returnedattribute
- an integer describing a further distinguishing attribute of
the icon to be returnedsize
- the size of the icon to be returned
- Returns:
- a
Image
for the given type, special attribute, and size - See Also:
getFileName(int, int, int)
getDescriptor
public static final ImageDescriptor getDescriptor(int type,
int size)
- Parameters:
type
- an integer describing the type of image descriptor to be
returnedsize
- the size of the image descriptor to be returned
- Returns:
- a
ImageDescriptor
for the given type and size - See Also:
getDescriptor(int, int, int)
,
getFileName(int, int, int)
getDescriptor
public static final ImageDescriptor getDescriptor(int type,
int attribute,
int size)
- Parameters:
type
- an integer describing the type of image descriptor to be
returnedattribute
- an integer describing a further distinguishing attribute of
the image descriptor to be returnedsize
- the size of the image descriptor to be returned
- Returns:
- a
ImageDescriptor
for the given type and a special
attribute with the given size - See Also:
getFileName(int, int, int)