Adding Action Icons to Associative Structure Browsers
The tables in Associative Structure Browsers can be customized in the following ways:
By adding new status columns. For more information see Attribute Customizing.
By adding action icons
Adding Action Icons
To create an icon that will launch a separate, customized action, use the following procedure:
1. Create a class that implements LogicSeparatedDataUtility, and overrides thegetPlainDataValuemethod to add the icon component to the table component. For example, using a sub-class named CustomStatusDataUtility:
@Override
public Object getPlainDataValue(String component_id, Object datum, ModelContext mc) throws WTException {
JSONObject icon_object = new JSONObject();
try {
WTProperties serverProperties = null;
serverProperties = WTProperties.getServerProperties();
String serverBaseURL = serverProperties.getProperty("wt.server.codebase");
icon_object.put("type", "icon");
icon_object.put("iconPath", serverBaseURL + "/netmarkets/images/<icon_file>");
icon_object.put("tooltip", getLabel(component_id, mc));
icon_object.put("target", "_top");
NmObject obj = getNmObject(mc);
String oid = obj.getOid().toString();
icon_object.put("link", "app/#ptc1/tcomp/infoPage?oid=" + oid);
} catch (Exception e) {
throw new WTException(e);
}
return icon_object.toJSONString();
2. Configure the CustomStatusDataUtility sub-class to implement the getColumnIdmethod and return a unique identifier. In this example: customStatusAction789:
@Override
protected String getColumnId() {
return "customStatusAction789";
}
3. In the Type and Attribute Management Utility create a Calculated attribute. For example, customStatusAction789. Add this entry to <Windchill>\codebase\LogicalAttributes.xml:
<class name="wt.part.WTPart">
...
<Property>
<LogicalForm>customStatusAction789</LogicalForm>
<ExternalForm>NPA|customStatusAction789</ExternalForm>
</Property>
</class>
4. Enable your newly created calculated attribute by adding it to <Windchill>\codebase\com\ptc\core\htmlcomp\createtableview\AvailableAttributes.xml:
<Class name="wt.part.WTPart">
...
<Attribute id="customStatusAction789"/>
</Class>
Est-ce que cela a été utile ?