Creating your own Conditional Formatting customised icons (for developers)

Icon sets are used in conditional formatting to display different icons based on the data returned in a report. Yellowfin ships with a few icon sets, but it is also possible to create your own.

To create a custom icon set, you will need to create a java class that extends the class com.hof.mi.interfaces.IconSet. This class is in the i4-mi.jar library, in the Yellowfin/appserver/webapps/ROOT/WEB-INF/lib/ directory. The java source for this class is attached to this post.

To extend this class you should create a jar file consisting of your custom class, the image files for your icons, and a service provider file.

The requirements to create the subclass are:

1. Initialise the subclass. The constructor should call addIconResource() to register all the icons.

2. Implement the getIconSetCode() method. This must return a unique code for the IconSet.

3. Implement the getDescription() method. This returns the display name for the icon set that will be shown to users.

Once you have created the class you can package it into a jar file along with the service provider file and the images. The service provider file is a text file that contains the full class name of your icon set. It must be named com.hof.mi.interfaces.IconSet and it must be in the META-INF/services/ directory in the jar file.

Attached to this post is an example icon set (emoticons.jar) which consists of these files:

com/example/EmoticonIconSet.class
META-INF/services/com.hof.mi.interfaces.IconSet
resources/happy.png
resources/sad.png

The source for the EmoticonIconSet class is also attached.

To use the icon set, copy the jar file into your Yellowfin/appserver/webapps/ROOT/WEB-INF/lib/ directory and restart Yellowfin. You can now choose the new icon set from the conditional formatting menu.

Is this article helpful?
1 0 0