| Samples > Rule Team Server Authoring Extensions > How to Customize the Rule Team Server User Interface |
How to Customize the Rule Team Server User Interface |
PREVIOUS NEXT |
This sample shows how to customize the Rule Team Server user interface to provide convenient access to key features for different users, depending on their profile, and a personalized look & feel. These changes will make it possible to:
Key features in this sample include:
ManagerBean class (entry point for extending the graphical user interface)
To install this sample through the Samples Console:
teamserver > servercustomui sample.
repack command to compile and repackage the application into a new deployable EAR.
deploy command to deploy the new EAR.
This sample can only be opened and run in the Samples Console.
Because this sample shows examples of customizing, you should already be familiar with Rule Team Server. If you are not, follow the Rule Team Server Tour by clicking the link at the bottom of the Home page once you have signed in.
To see the customized Home page and direct access link:
loanvalidation-rules project.
This sample also shows a custom tab displayed to all users, as well as a new button in the toolbar.
To see the new tab and toolbar:
The Home tab has been customized and made different according to the user group.
To see the Home tab and added tab for Administrators:
http://localhost:8080/teamserver.
loanvalidation-rules to make it the current project.
Two choices are proposed by default for the global look&feel (skin) of Rule Team Server: Classic or Mozilla. In this sample, a custom skin has been added.
To see the custom look&feel:
This sample is located in <InstallDir>/teamserver/samples/servercustomui.
The sample is based on the Sun JSF framework. A typical JavaServer Faces application includes one or more backing beans (JavaBean components associated with UI components used in a page). A backing bean defines UI component properties, each of which is bound to either a component's value or a component instance. A backing bean also defines methods that perform functions associated with a component. In this sample, the beans feed the model that will be displayed and handle navigation.
The JSP files are in the /WebContent directory:
WebContent/custom - Contains files redefined from Rule Team Server:
home.jsp - The new Home page. It describes the middle part of the page without the top banner or footer.
tabs.jsp - Describes the list of tabs.
tableToolbar.jsp - Describes the toolbar provided above the table in the Explore tab, used to interact with the elements listed in the table.
WebContent/custom/extensions - Contains the new page definitions. Each new page has two description files:
<extension>page.jsp - The page itself, named bompage.jsp in this sample. It contains the teamserver:page tag that defines the page, giving the location of another JSP file as its content.
<extension>contents.jsp - The contents of the page, named bomcontents.jsp in this sample. It describes the page without the top banner or footer.
The beans are declared in WebContent/WEB-INF/extended-faces-config.xml.
MyTableToolbarBean.java - The backing bean extends the Rule Team Server bean TableToolbarBean and redefines the edit action.
ProjectsBean.java - The backing bean for the list of projects displayed in the Home page:
getProjects() - Returns the project list. The projects in the list are instances of ProjectHandle. They are directly used in the home.jsp page.
getHasProjects() - Recomputes the list, calling the Rule Team Server API in the computeProjects() internal method. It returns true if there is at least one project.
RulesBean.java - The backing bean for the list of rules displayed in the Home page:
getRules() - Returns the rule list. The rules in the list are instances of RuleHandle. They are directly used in the home.jsp page.
getHasRules() - Recomputes the list, calling the Rule Team Server API in the computeRules internal method. It returns true if there is at least one rule.
getNumberOfDaysBefore() - Returns a list of items to be displayed in a JSF list box to choose the number of days for which rules are considered recent.
getNumberOfRules() - Returns a list of items to be displayed in a JSF list box to choose a number of rules.
setNumberOfDaysBefore(String str) - Sets the Rule Team Server user parameters for the number of days.
setNumberOfRules(String str) - Sets the Rule Team Server user parameters for the number of rules to be displayed.
QuickEditBean.java - The backing bean that manages the custom quick editing. It uses the Rule Editor web component:
printRuleEditor(HttpSession session) - Displays a rule in the Rule Editor. The rule is locked before being edited.
save() - Saves the contents of the editor and unlocks the rule. It returns a JSF navigation string that brings you back to the Explore tab.
cancel() - Unlocks the rule. It returns a JSF navigation string that brings you back to Explore tab.
BOMTreeBacker.java - The backing bean for the tree that displays the BOM classes, fields, methods, and their details. It is used in servercustomui/WebContent/custom/extensions/bomcontents.jsp:
getTreeData() - Called to feed the treeview model. See the value attribute of the t:tree2 tag in servercustomui/WebContent/custom/extensions/bomcontents.jsp.
updateFormData(ActionEvent event) - Called to feed the detail information of the selected field or method. See the actionListener attribute of the h:commandLink tag with the id memberlink in servercustomui/WebContent/custom/extensions/bomcontents.jsp.
CategoriesBacker.java - The backing bean for the list displaying the verbalization templates. It is used in servercustomui/WebContent/custom/extensions/categorycontents.jsp:
getCategories() - Used to fill the list box. See the value attribute of the f:selectItems tag with id categorySelectItems in servercustomui/WebContent/custom/extensions/categorycontents.jsp.
getList() - Used to fill the list. See the value attribute of the t:dataTable tag with id data in servercustomui/WebContent/custom/extensions/categorycontents.jsp.
setCategory(String category) - Used to set the current category. See the value attribute of the h:selectOneMenu tag with id selectCategorie in servercustomui/WebContent/custom/extensions/categorycontents.jsp.
MoveBeanBacker.java - The backing bean for moving rules from package to package. It is used in servercustomui/WebContent/custom/tableToolbar.jsp:
setMoveaction(String moveaction) - Used to set the current action. This action will be triggered when the user clicks the Move button. See the value attribute of the h:selectOneMenu tag with id selectAction in servercustomui/WebContent/custom/tableToolbar.jsp
move() - Used to execute the move action. See the action attribute of the h:commandLink tag with id movecommand in servercustomui/WebContent/custom/tableToolbar.jsp.
getMoveactions() - Used to fill the list box next to the Move button. See the value attribute of the f:selectItems tag with id selectActions in servercustomui/WebContent/custom/tableToolbar.jsp.
Filter.java - A class helper defining and filtering BOM classes that are candidates to be displayed.
RuleHandle.java and ProjectHandle.java - Classes to handle the information displayed on the page about the projects and the rules.
WebUtil.java - A utility class to redefine the editing command.
The highlights of this sample are described in the following sections.
The Move button is added to the toolbar by adding a teamserver:button tag in servercustomui/WebContent/custom/tableToolbar.jsp. This file describes all the toolbar buttons. When the user clicks on the button, the MoveBeanBacker.move method is called.
Note that MoveBeanBacker is a bean with a session scope, which means that there is one instance per user session. This way, the list box choice persists during the user session since it is kept as an attribute of the bean.
The file servercustomui/WebContent/custom/tabs.jsp describes all the tabs. Each tab is described using the teamserver:tab tag. Descriptions of the tags are available in jrules-teamserver-web-JBOSS40.war/WEB-INF/teamserver.tld.
In the file servercustomui/WebContent/custom/tabs.jsp, you will notice the rendered attribute for the BOM tab. Here we used the Manager backing bean to check whether the current user is an administrator or not. The tab is displayed only if the Manager.administrator field value is true.
The teamserver:page tag is used to define the location of the contents of a JSP file describing a new page without the top banner and the footer since these are added by Rule Team Server. The content is included in a JSF tag. All HTML tags, such as table, div, and so on, should be surrounded by <f:verbatim> </f:verbatim> to be correctly interpreted. For example, WebContent/custom/extensions/bompage.jsp gives the location in teamserver:page and WebContent/custom/extensions/bomcontents.jsp describes the contents of the page.
The Home page is redefined simply by adding, in the /custom directory, a file home.jsp describing the page contents. The top banner and the footer are added by Rule Team Server. In this sample, the new page is made of two panel groups with different rendering: the projects part is shown only when the user belongs to the Admin group and the rules part is shown when the user does not belong to the Admin group.
The edit action is redefined by extending the TableToolbar bean. This extension is declared to be the managed bean class of TableToolbarBean in WebContent/WEB-INF/extended-faces-config.xml. The constructor of this class redefines the command associated with the edit method (see src/ilog/rules/rts/samples/util/WebUtil.java). This command returns the navigation string quickeditpage described in WebContent/WEB-INF/extended-faces-config.xml:
<navigation-case> <from-outcome>quickeditpage</from-outcome> <to-view-id>/custom/extensions/quickeditpage.jsp</to-view-id> </navigation-case>
The quickeditpage is a custom page defined using the teamserver:page tag. Its content is described in WebContent/custom/extensions/quickeditcontents.jsp. It calls QuickEditBean to display, save, or cancel the Rule Editor web component. You can find more information about this component in the How to Use Web Components for Rule Editing sample.
Permanent links give direct access to projects or rules. They are used as the URL associated with the project or with the rule on the custom Home page. See the IlrPermanentLinkHelper API for more information.
A new customskin directory is added in the web/skins/ directory. This directory contains the files that define the new customskin skin. The css subdirectory contains the CSS style sheet, and the images subdirectory contains the images used by the skin.
The skin is declared in WebContent/WEB-INF/extended-faces-config.xml. The customskin is configured in the customSkins property of the SkinBean bean. This customized skin has been set as default for the following user types:
The action attribute of the teamserver:tab tag in servercustomui/WebContent/custom/tabs.jsp is a navigation string on the page describing the tab. It is defined in WebContent/WEB-INF/extended-faces-config.xml. For instance, the BOM page is described with an action string bompage. This navigation string is described in the navigation rule part of extended-faces-config.xml as:
<navigation-case> <from-outcome>bompage</from-outcome> <to-view-id>/custom/extensions/bompage.jsp</to-view-id> </navigation-case>
So a click on the BOM tab navigates to the /custom/extensions/bompage.jsp page.
To rebuild this sample:
build command to compile the code.
repack command to repackage the Rule Team Server EAR.
deploy command to put the modified EAR in the deploy directory of the JBoss directory included in the ILOG JRules distribution.
To return to the original Rule Team Server EAR:
<InstallDir>/teamserver/applicationservers/jboss40/jrules-teamserver-JBOSS40.ear to <InstallDir>/shared/tools/jboss/server/jrulessamples/deploy.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |