Hi All,
I am trying to display the WTPart Icon as per certain criteria, for example,
OOTB WTPart Icon will display if the Lifecyle state of that object is in In-Work, but when it get changed to released state, i want to change the display icon as well, now i want to show green color icon for that released object.
Kindly share your thoughts.
Regards,
Vivek
You need to create a class which extends WTPartIconDelegate. Then you can override the method getStandardIconSelector.
I used to extend this class since an End-Item icon is not shown for custom icons.
@Override public IconSelector getStandardIconSelector() throws WTException, IllegalAccessException, InvocationTargetException { IconSelector iconSelector =null; WTObject wtObject = super.getObject(false); if(wtObject instanceof WTPart) { WTPart wtPart = (WTPart) wtObject; ... return iconSelector }
xconf entry:
<Service context="default" name="wt.fc.IconDelegate" targetFile="codebase/service.properties"> <Option requestor="wt.part.WTPart" serviceClass="com.xxx.XXXPartIconDelegate" cardinality="duplicate"/> </Service>
When you don't want to change the icon then you also could create a graphical attribute, e.g. a traffic light. Your are able to configure it and don't need to customize it.
Hi Vivek,
I can't give you the code, because it was developed by our consultants, but I can describe how we reach the result.
In our system, icons change not only based on state but even for the different types of WTpart.
Our customization search for different icons having name based on Types and State.
So if we add a new type or a new state, the only thing I have to do is to create an icon with the right name and the system automatically find the new icon.
If the system doesn't find an icon (because you wrote a wrong name or didn't create it) it use the default one.