Procedure — Creating a New BreadCrumbDelegate Class
Creating the BreadCrumbDelegate Class
Bread crumb delegate classes should implement the BreadCrumbDelegate interface. This interface has two methods: canHandle() and getGenerator().
The canHandle() method is called by the BreadCrumbDelegateFactory to determine if the delegate’s inner AbstractBreadCrumbGenerator class (see below) is capable of producing breadcrumbs for a given page. The canHandle() method is passed the page URL, the context object from the URL, if any, and the container object from the URL, if any. It should return true or false.
The BreadCrumbController calls the getGenerator() method of the delegate chosen by the factory to get a new instance of its inner AbstractBreadCrumbGenerator class.
* 
Since the factory creates only one static instance of each delegate, the delegate class itself should not use class instance variables or be stateful in any way.
Creating the AbstractBreadCrumbGenerator Inner Class
Your delegate class should have an inner class that is a subclass of AbstractBreadCrumbGenerator. The getCrumbs() method of the inner class will be called by the BreadCrumbController to generate the JSONArray of crumbs. A new instance of the inner generator class will be created each time it is called so generator classes may be stateful.
The constructor of the generator class will be passed the URL of the page, the context object for the page, if given on the URL, and the container for the page, if given on the URL. The constructor should call the init() method of the superclass.
The JSON objects returned in the array by the getCrumbs() method should have the following format:
{text: 'display text', url: 'http://my/url'}
For example:
[{"text":"Products","url":"app/#ptc1/comp/netmarkets.product.list"},{"text":"Product1","url":"http://<someServer>/Windchill/app/#ptc1/tcomp/infoPage?oid=OR%3Awt.pdmlink.PDMLinkProduct%3A105250&u8=1"}]
See Sample Code for example classes.
Было ли это полезно?