...
The registerImageSet(...)
method requires two arguments. The first argument is the name of the image set which can be considered as the namespace of the images contained in the image set. It is added as prefix seperated by a dot (".") to each image id in order to avoid name clashes between different image sets. The second argument is the relative path to the property file that specifies the image set.
You can access images from registered image sets in the same way like you can do for individually registered images. However, you need to qualify the image ID with image set name as the prefix.
Code Block | ||||
---|---|---|---|---|
| ||||
Image image = MyRCPPlugIn.getImageManager().get("imageSetName.someImageID"); |
The OdysseusRCPPlugIn
class provides different image sets (white
, black
, and default
) each containing a number of illustrating icons for physical operators.
User-defined image sets
Image sets can be provided by a plugin. In this case, all images and the image set property file must be stored inside the bundle and all paths must be relative to the bundle root. However, it is also possible to create user-defined image sets. They can be stored in and loaded from the Odysseus home directory.
User-defined image sets are created in the same way like bundle-based image sets. However, there are a few differences you should consider:
- The property files that define the image sets must be stored in a folder called
icons
located in the Odysseus home directory. - The property file name must be the same as the image set file name with the suffix ".xml".
- All paths inside the property files must be relative to the Odysseus home directory.
- Even though the images may be stored at any location inside the Odysseus home directory, it is strongly recommended to store them in a subdirectory of the
icons
directory which has the same name like the image set name.
All user-defined image sets are loaded at the start of Odysseus Studio and can be accessed via the OdysseusRCPPlugIn
class instance.
Using user-defined image sets for operator graph visualization styles
With user-defined image sets, it is quite simple to apply your own icons in the operator graph visualization:
- Create your user-defined image set as described above
- To map an image to a specific physical oeprator, use the class name (without packages or generics) of the physical operator as the image ID
- You must define a default image in the image set with image ID
DEFAULT
. This image is used as a fallback, if your icon set does not define an image for a specific operator.
- Create you own viewer configuration file as described here.
- Use the
SymbolElement
element of typeoperator
to display the operator image. - Set its
iconSetName
parameter to the name of your image set (don't set theresource
parameter!).
- Use the
You can also use user-defined image sets to override specific images of bundle-based image sets. To do this, you need to create an user-defined image set of the same name and define the image ID of the orginal image as the image ID of the new image.