Enterprise console GUI customization sample details
You use the Decision Center Enterprise console to run this sample.
Running this sample
This sample shows examples of customizing and requires knowledge of Decision Center.
To view the customized Home page and direct access link:
Sign in to the Decision Center Enterprise console (http://localhost:<PORT>/teamserver) with the following username and password:
Username: rtsUser1
Password: rtsUser1
In the Home page, select the loanvalidation-rules project.
The customized Home page displays the list of the latest modified rules to all users except the Administrator, who sees the list of projects instead.
Click the Explore tab.
Click the folder.
In the table, select the check box for the checkAge rule.
Click Edit in the toolbar above the table.
You access the Rule Editor directly, and the other steps for rule editing are no longer available.
Change the value of maxAge to 130.
Click Save.
Click the Home tab.
Notice that the list displays your saved rule.
Click the checkAge link.
Notice that you see the rule details directly.
This sample shows a custom tab that is available to all users, as well as a new button in the toolbar.
To view the new tab and toolbar:
Click the Category tab.
The tab displays all verbalization templates as a list sorted by category and shows the class name, the member, and the template. You can filter the list by selecting a specific category in the Category list box.
Click the Explore tab.
Notice the custom drop-down list and Move button in the toolbar. You use the Move button to move folders up or down a level, or to the previous or next sibling folder.
Click the folder.
In the table, select the checkAge rule.
In the selection list, choose Up, and then click Move.
Click the validation folder.
Notice how the checkAge rule is now in the validation folder.
In the table, select the checkAge rule again.
In the selection list, choose Down and click Move.
The rule is now back in the borrower folder.
Sign out by clicking Sign Out in the upper corner.
The Home tab is customized based on the user group.
To view the Home tab and added tab for Administrators:
Sign in to the Enterprise console as Administrator: http://localhost:<PORT>/teamserver.
Username: rtsAdmin
Password: rtsAdmin
The Home page displays the list of projects. The current project has an arrow next to it. When you click a project name, it becomes the current project.
Click loanvalidation-rules to make it the current project.
You have now two more tabs: Category, which is available to all users, and BOM, which is available to administrators only.
Click the BOM tab and expand the tree view until you get to .
Four sub-items are displayed:
fields: Contains loan.Borrower fields
methods: Containsloan.Borrower methods
Bankruptcy: Contains inner class of loan.Borrower
SSN: Contains inner class of loan.Borrower
Expand the fields tree item and click the age field.
The details of the field are shown next to it.
The Enterprise console displays three choices for the global look and feel (skin), Classic, Gray, or Blue. In this sample, a customized skin is added.
To view the custom look and feel:
Click Options in the top banner.
Open the Select a theme list box.
Notice that a custom skin is now available.
Select skin.customskin if it was not the default selection.
Click OK.
The top banner and footer background color change to black.
Click Sign Out in the upper corner.
Rebuilding this sample
To rebuild this sample:
In the Samples Commands view, navigate to .
Double-click build to compile the code.
Double-click repack to repackage the Decision Center application.
Double-click deploy.
Click the Restore Server button in the samples console to return the sample server to its initial state.
How this sample works
You can customize the Enterprise console as follows:
Add the Move button to the toolbar: You add a teamserver:button tag in servercustomui/WebContent/custom/tableToolbar.jsp.
This file describes all the toolbar buttons. When you click the Move button, you call the MoveBeanBacker.move method.
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 because it is kept as an attribute of the bean.
Add a tab in the Enterprise console: You use the file servercustomui/WebContent/custom/tabs.jsp, which describes all the tabs. You use the teamserver:tab tag to describe each tab.
Descriptions of the tags are available in teamserver.war/WEB-INF/teamserver.tld
Handle access permissions to a tab in the Enterprise console: You use the file servercustomui/WebContent/custom/tabs.jsp, which contains a rendered attribute for the BOM tab.
Here the Manager backing bean checks whether the current user is an administrator or not. The tab displays only if the Manager.administrator field value is true.
Define a new page in the Enterprise console: You use the teamserver:page tag to define the location of the contents of a JSP file describing a new page without the top banner and the footer as these are added by the Enterprise console. 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.
Include the content in a JSF tag and surround all HTML tags, such as table, and div by <f:verbatim> </f:verbatim> so that they are interpreted correctly.
Redefine the Home page in the Enterprise console: You add a file home.jsp that describes the page contents to the /custom directory.
The Enterprise console adds the top banner and the footer. In this sample, the new page has two panel groups with different rendering: the projects part shows when the user belongs to the Admin group only and the rules part shows when the user does not belong to the Admin group.
Redefine the edit action in the Enterprise console: You extend the TableToolbar bean.
This extension is declared as 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 teamserver:page tag defines the quickeditpage custom page. The description for the content of the custom page is in WebContent/custom/extensions/quickeditcontents.jsp. The custom page calls QuickEditBean to display, save, or cancel the Rule Editor web component. You can find more information about this component in the Sample: Web authoring application sample.
Change the Enterprise console skin: You add a new customskin directory to the WebContent/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 the skin uses. You add the skin to the customSkins managed property in WebContent/WEB-INF/skin-faces-config.xml.
Note:The sample first extracts the skin-faces-config.xml file from teamserver.war to add the custom skin and keep the existing one.
Use permanent links: You can use permanent links for direct access to projects or rules. Permanent links are the URL associated with the project or with the rule on the custom Home page. See the IlrPermanentLinkHelper API for more information.
Handle navigation of customized tab pages: The action attribute of the teamserver:tab tag in servercustomui/WebContent/custom/tabs.jsp is a navigation string on the page describing the tab. The definition of the attribute is in WebContent/WEB-INF/extended-faces-config.xml. The .xml file describes the BOM page with an action string bompage. The definition of the navigation string is 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.
Source files
This sample is located in <InstallDir>/teamserver/samples/servercustomui.
The sample uses the Sun JSF framework. A typical JavaServer Faces application includes one or more backing beans (JavaBeans 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 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 displays and handles navigation.
The JSP files are in the /WebContent directory:
WebContent/custom contains files redefined from Decision Center
WebContent/custom/extensions contains the new page definitions
The beans are declared in WebContent/WEB-INF/extended-faces-config.xml using the files in <InstallDir>/teamserver/samples/servercustomui/src/ilog/rules/rts/samples
bean/MyTableToolbarBean.java: The backing bean extends the Decision Center bean TableToolbarBean and redefines the edit action.
bean/ProjectsBean.java: The backing bean for the list of projects displayed in the Home page:
getProjects()
The method returns the project list. The projects in the list are instances of ProjectHandle. They are used directly in the home.jsp page.
-
getHasProjects()
The method recomputes the list, calling the Decision Center API in the computeProjects() internal method. It returns true if there is at least one project.
bean/RulesBean.java: The backing bean for the list of rules the Home page displays:
getRules()
The method returns the rule list. The rules in the list are instances of RuleHandle. They are directly used in the home.jsp page.
-
getHasRules()
The method recomputes the list, calling the Decision Center API in the computeRules internal method. It returns true if there is at least one rule.
-
getNumberOfDaysBefore()The method returns a list of items to display in a JSF list box to choose the number of days for which rules are considered recent.
-
getNumberOfRules()
The method returns a list of items to display in a JSF list box to choose a number of rules.
setNumberOfDaysBefore(String str)
The method sets the user parameters for the number of days.
setNumberOfRules(String str)
The method sets the user parameters for the number of rules.
bean/QuickEditBean.java: The backing bean that manages the custom quick editing. It uses the Rule Editor web component:
printRuleEditor(IlxWPort port)
The method displays a rule in the Rule Editor. The rule is locked before being edited.
save()
The method 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()
The method unlocks the rule. It returns a JSF navigation string that takes you back to the Explore tab.
bean/BOMTreeBacker.java: The backing bean for the tree that displays the BOM classes, fields, methods, and their details. It is used in the servercustomui/WebContent/custom/extensions/bomcontents.jsp page with the tag teamserver:treeview.
bean/CategoriesBacker.java: The backing bean for the list displaying the verbalization templates. It is used in servercustomui/WebContent/custom/extensions/categorycontents.jsp:
-
getCategories()
The method that fills the list box. See the value attribute of the f:selectItems tag with ID categorySelectItems in servercustomui/WebContent/custom/extensions/categorycontents.jsp.
getList()
The method that fills the list. See the value attribute of the t:dataTable tag with ID data in servercustomui/WebContent/custom/extensions/categorycontents.jsp.
setCategory(String category)
The method that sets the current category. See the value attribute of the h:selectOneMenu tag with ID selectCategory in servercustomui/WebContent/custom/extensions/categorycontents.jsp.
-
bean/MoveBeanBacker.java: The backing bean for moving rules from folder to folder. It is used in servercustomui/WebContent/custom/tableToolbar.jsp:
setMoveaction(String moveaction)
The method that sets the current action. You trigger this action when you click the Move button. See the value attribute of the h:selectOneMenu tag with ID selectAction in servercustomui/WebContent/custom/tableToolbar.jsp.
move()
The method that executes the move action. See the action attribute of the h:commandLink tag with ID movecommand in servercustomui/WebContent/custom/tableToolbar.jsp.
getMoveactions()
The method that fills 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.
util/Filter.java: A class helper that defines and filters BOM classes that are candidates for display.
util/RuleHandle.java and util/ProjectHandle.java: The classes that handle the information displayed on the page about the projects and the rules.
util/WebUtil.java: A utility class that redefines the editing command.
You can also view and modify the sample source files in Rule Designer. To import the sample into your workspace, click the Import projects link in the Samples and Tutorials view.