Configuring Siebel Open UI > Example of Customizing Siebel Open UI > Process of Customizing the Plug-in Wrapper >
Attaching the Plug-in Wrapper to a Control Conditionally
This task is a step in Process of Customizing the Plug-in Wrapper. This topic describes how to attach the plug-in wrapper you created in Creating the Plug-in Wrapper to a control. Figure 33 illustrates the code you use to attach the plug-in wrapper to a control conditionally. Each number in this figure identifies the corresponding step number in the numbered task list that this book includes immediately after this figure. Figure 33. Attaching the Plug-in Wrapper to a Control
To attach the plug-in wrapper to a control conditionally
- In the colorboxpw.js file, introduce the AttachPW method from the PluginBuilder namespace that attaches the presently defined plug-in wrapper to a given type of control:
SiebelApp.S_App.PluginBuilder.AttachPW(consts.get("SWE_CTRL_COMBOBOX"), SiebelAppFacade.ColorBoxPW, function (control) {
In this customization, the intention is to apply the plug-in wrapper to a dropdown type of control. To achieve this customization the SWE_CTRL_COMBOBOX is used for the dropdown type. All controls are customizable. With this customization, every dropdown encountered by the Siebel Open UI client will use this method.
- Define the condition under which the attachment should occur, and to which specific instance of the control. The return value of the method used in Step 1 decides whether the plug-in wrapper attaches to a particular control. Returning true will mean a positive attachment.
return (control.GetName() === "Probability2");
Use the control object to create this condition. Since the intention is to attach the plug-in wrapper for all repository controls that have a name of Probability2 , true will be returned when the name of the condition matches.
NOTE: Plug-in wrappers are not restricted to any Presentation Model or Physical Renderer. Also, a customization defined on a plug-in wrapper will be applicable throughout the Siebel Open UI client, as long as the condition is satisfied. In this example, any control having a repository name of "Probability2" in any screen or view will be attached to this plug-in wrapper.
- Define conditions for plug-in wrapper attachments. Conditions used can be as complex as necessary, based on the requirements. Use following examples as guidance for defining conditions:
Attach a plug-in wrapper to all TextArea fields in Opportunity List applet: SiebelApp.S_App.PluginBuilder.AttachPW(consts.get("SWE_CTRL_TEXTAREA"), SiebelAppFacade.CustomPW, function (control) { return (control.GetAppplet().GetName() === "Opportunity List Applet"); });
- Attach a plug-in wrapper to all Date Fields in Contact Form applet and Account Form Applet:
SiebelApp.S_App.PluginBuilder.AttachPW(consts.get("SWE_CTRL_DATE_PICK"), SiebelAppFacade.CustomPW, function (control) { var appletName = control.GetAppplet().GetName(); return (appletName === "Contact Form Applet" || appletName === "Account Form Applet"); });
- Attach a plug-in wrapper to a specific Text Box in a specific applet only:
SiebelApp.S_App.PluginBuilder.AttachPW(consts.get("SWE_CTRL_TEXT"), SiebelAppFacade.CustomPW, function (control) { var appletName = control.GetAppplet().GetName(); return (appletName === "Contact Form Applet" && control.GetName() === "Last Name"); });
- Attach a plug-in wrapper to all Dropdowns in a particular application:
SiebelApp.S_App.PluginBuilder.AttachPW(consts.get("SWE_CTRL_COMBOBOX"), SiebelAppFacade.CustomPW, function (control) { return (SiebelApp.S_App.GetName() === "Siebel EPharma") });
- Attach a plug-in wrapper to all check boxes in a view when they are accessed on touch devices:
SiebelApp.S_App.PluginBuilder.AttachPW(consts.get("SWE_CTRL_CHECKBOX"), SiebelAppFacade.CustomPW, function (control) { return (SiebelAppFacade.DecisionManager.IsTouch() && control.GetApplet().GetView().GetName === "Opportunity Detail View") });
|