在用webtop做客户化的时候,如果只有一个repository 客户一般会要求去除左边导航树中的add repository 功能链接。
操作步骤如下:
step1.Create your custom control class as follows . When the control initializes, it will display only the
nodes that are defined in the browsertree component, and it will set the visibility of the dynamic
nodes to false:
package com.mycompany; import java.util.Iterator; import com.documentum.web.common.ArgumentList; import com.documentum.web.form control.TreeNode; public class WebTopBrowserTree extends com.documentum.webtop.control.WebTopBrowserTree { public void onInit(ArgumentList args) { super.onInit(args); Iterator it = getAllNodes(); if (null ! = it) { Object m _Node = null; while (it.hasNext()) { m _Node = it.next(); } if (null ! = m _Node) { ( //get last tree node set it visible false (TreeNode) m _Node).setVisible(false); } } } }
step2.Create your custom comoponent Browsertree class as follows:
package com.mycompany; import com.documentum.web.common.ArgumentList; import com.broadtext.WebTopBrowserTree; public class BrowserTree extends com.documentum.webtop.webcomponent.browsertree.BrowserTree { public BrowserTree() { super(); } public void onInit(ArgumentList args) { //force creation of custom control in component WebTopBrowserTree tree = (WebTopBrowserTree) getControl(TREE_CONTROL, WebTopBrowserTree.class); super.onInit(args); } }
step3.create a tag class to get the new control:
package com.mycompany; public class WebTopBrowserTreeTag extends com.documentum.webtop.control.WebTopBrowserTreeTag { protected Class getControlClass() { return com.mycompany.WebTopBrowserTree.class; } }
step4 Now create a tag library file custom .tld in /WEB-INF/tlds . Copy the content of dmwebtop_1_0 .tld and change only the shortname element for the tag library and the tag class for the browsertree control, as shown:
. . . <shortname>ct< /shortname> <tag> <name>browsertree< /name> <tagclass>com.mycompany.WebTopBrowserTreeTag< /tagclass> . . . < /tag> . . .
step5 Extend the Webtop browsertree component definition in /webtop/config/browsertree_component.xml and use the following definition:
<config version ="1 .0"> <scope> <component id ="browsertree" extends ="browsertree: webtop/config/browsertree_component.xml"> <pages> <start>/custom/browsertree/browsertree.jsp< /start> < /pages> <class>com.mycompany.BrowserTree< /class> < /component> < /scope> < /config>
the last step, copy the Webtop browsertree JSP page /webtop/classic/browsertree .jsp to
/custom /browsertree.jsp Specify your custom tag library:
<%@ taglib uri ="/WEB -INF/tlds/custom.tld" prefix ="ct" %>
Import y our custom control class by importing it in place of the W ebtop control in the import
statement:
<%@ page import ="com.documentum.web.form.Form, com.documentum.web.common.ClientInfo, com.documentum.web.common.ClientInfoService, com.mycompany.BrowserTree" %>
Search for the browsertree tag:
<dmwt:browsertree name ='<% =BrowserTree.TREE _CONTROL%>' . . . />
Replace it with y our custom tag:
<ct:browsertree name ='<% =BrowserTree.TREE _CONTROL%>' . . . />
Stop and restart the app server to pick up your custom classes and verify that the Add Repository
option is not visible: