進階自訂 > Business Logic Customization > Customizing Business Logic > Context Builder Customization Example
Context Builder Customization Example
Enabling the example
To enable the Context Builder customization example:
1. Add the following entry to <Windchill>/declarations.xconf : <ConfigurationRef xlink:href="codebase/com/ptc/windchill/enterprise/contextbuilder/ContextBuilderCustom.xconf"/>
2. Save the change.
3. Exectue the following command: xconfmanager -p
4. Restart the MethodServer.
5. Navigate to the Edit Definition tab, there will be two example Context Builder extension actions.
When the xconfmanager propagates the changes, an actions.xml file will be added to the list of actions.xml files read by the actions framework. The wt.properties property “com.ptc.netmarkets.util.misc.defaultActions” is the property that the actions framework reads to determine the set of available actions. The specific actions xml file that defines the custom action that can be exposed in the CAR Context Builder is <Windchill>/codebase/config/actions/contextbuildercustom-actions.xml.
There are four example actions in the contextbuildercustom-actions.xml file that show how multiple actions can be added to the CAR Context Builder. There are two actions exposed on the Rules tab toolbar and two actions exposed on the right click menu of the top level node of the tree. All entries look similar to this example:
<action name="editIncludeExcludeRulesGWT">
<command class=
"com.ptc.windchill.enterprise.object.alternaterep.client.
action.CustomFilterRuleAction" />
<url=”Windchill/netmarkets/jsp/contexbuildercustom/customFilterRulesPopup.jsp
</action>
The key to hooking into the Context Builder application is to use the com.ptc.windchill.enterprise.object.alternaterep.client.action.CustomFilterRuleAction as the command class. This takes care of appending the CB_CCID and CB_SEEDID query string parameters to the URL used to launch the custom application. It also makes some javascript API’s available to the custom application to take care of updating the checkboxes in the tree when the custom application has finished and is ready to create rules. The url of the action should be set to point to the resource that provides the custom functionality. In the example provided by PTC it points to a customFilterRulesPopup.jsp.
When a Context Builder extension action is selected, a window will be launched and the resource pointed to by the URL will be loaded in it.
這是否有幫助?