Bookshelf Home | Contents | Index | PDF |
Configuring Siebel Open UI > Application Programming Interface > Methods of the Siebel Open UI Application Programming Interface > Presentation Model ClassThis describes the methods that Siebel Open UI uses with the PresentationModel class. It includes the following information:
Siebel Open UI defines the PresentationModel class in the pmodel.js file. The AddComponentCommunication method binds a communication method. It uses the following arguments:
The AddLocalString method adds a text string. It uses the following syntax: AddLocalString(ID, custom_string)
this.AddMethod("AddLocalString", function (my_text, this is my custom text) { This code adds a string named The AddMethod method adds a method to a presentation model. You can use ExecuteMethod to run the method that AddMethod adds from the presentation model or from the physical renderer. If AddMethod attempts to add a new method that the predefined client already contains, then the new method becomes a customization of the predefined method, and this customization runs before or after the predefined method depending on the CancelOperation part of the return value. A method that customizes another method can return to the caller without running the method that it customizes. To do this, you configure Siebel Open UI to set the CancelOperation part of the return value to true. You set this property on the ReturnStructure object that Siebel Open UI sends to each method as an argument. For an example that does this configuration, see Customizing the Presentation Model to Identify the Records to Delete. The AddMethod method returns one of the following values: AddMethod("methodName",methodDef(argument, argument_n){
The following code adds a new ShowSelection method: this.AddMethod("ShowSelection", SelectionChange,{sequence : false, scope : this}); After Siebel Open UI adds the ShowSelection method, you can use the following code to configure Siebel Open UI to call this method. It sends a string value of this.ExecuteMethod("SetActiveControl", null) The following code configures Siebel Open UI to attach a method. It calls this method anytime it calls the InvokeMethod method of the proxy: this.AddMethod("InvokeMethod", function(){ }, {sequence : true}); This code sets the sequence argument to true, which configures Siebel Open UI to call the method that it sends before it calls InvokeMethod. The method that it sends gets all the arguments that InvokeMethod receives. For more information, see InvokeMethod Method for Presentation Models. The following example overrides the predefined presentation model and runs the ProcessDrillDown method: this.AddMethod("ProcessDrillDown", function(){ The following examples also use AddMethod: this.AddMethod("InvokeMethod", function(){console.log("In Invoke Method of PM"), {override: true}); For more information, see Deriving Presentation Models, Physical Renderers and Plug-in Wrappers. The AddProperty method adds a property to a presentation model. Siebel Open UI can access it through the Get method. It returns one of the following values: this.AddProperty("propertyName", propertyValue);
For example, the following code adds the NumOfRows property and assigns a value of 10 to this property: this.AddProperty("NumOfRows", 10); The AddValidator method validates an event. It allows you to write a custom validation for any event. It returns one of the following values: Addvalidator(siebConsts.get("event_name"), function(){custom validation} For example, the following code validates the control focus event: this.AddValidator(siebConsts.get("PHYEVENT_COLUMN_FOCUS"), function(row, ctrl, val){ You can configure Siebel Open UI to use the value that AddValidator returns to determine whether or not to stop running handlers for an event. For more information, see AttachEventHandler Method. For more information about events, see Siebel CRM Events That You Can Use to Customize Siebel Open UI. The AttachEventHandler method attaches an event handler to an event. It uses the following values:
The AttachEventHandler method uses the following syntax: AttachEventHandler(event_name, function_reference);
The AttachNotificationHandler attaches a method that handles the notification that Siebel Open UI calls when the Siebel Server sends a notification to an applet. It does this attachment when the notification occurs. It returns one of the following values:
this.AttachNotificationHandler("notification_name",handler);
Assume a presentation model named pmodel.js includes an OnControlEvent method that runs a custom event handler, and that Siebel Open UI sends an eventConfig object as the last argument in the event handler call. It uses this eventConfig object in the custom presentation model to set a value for SWE_EXTN_CANCEL_ORIG_OP or SWE_EXTN_STOP_PROP_OP. This configuration allows AttachEventHandler to create multiple custom events and to stop an event handler from running. For example, assume your customization configures Siebel Open UI to do the following:
Siebel Open UI runs AttachEventHandler customizations in a LIFO (last in, first out) sequence. In this example, it uses the following sequence:
So, this example stops the custom PHYEVENT_COLUMN_FOCUS event handlers in the derivedpm2.js file and the derivedpm1.js file from running. An event occurs when the user clicks an object or changes the focus. To manage this event, Siebel Open UI does the following work:
The AttachPMBinding method binds a method to an existing method. Siebel Open UI calls the method that it binds when it finishes processing this existing method. The AttachPMBinding method returns one of the following values: this.AttachPMBinding("method_name",function(){SiebelJS.Log("method_to_call");},{when : function(conditional_function){return value;}});
For an example that uses AttachPMBinding, see Customizing the Physical Renderer to Refresh the Carousel. For more information about using the AttachPMBinding method, see Configuring Siebel Open UI to Bind Methods and Life Cycle Flows of User Interface Elements. The AttachPostProxyExecuteBinding method binds a method that resides in a proxy or presentation model to a PostExecute method. Siebel Open UI finishes the PostExecute method, and then calls the method that AttachPostProxyExecuteBinding identifies. It uses the following syntax: this.AttachPostProxyExecuteBinding("method_to_call", function(methodName, inputPS, outputPS){"binder_configuration";return;});
For more information, see Refreshing Custom Events and PostExecute Method. In the following example, the user clicks the New button in an applet, Siebel Open UI runs the NewRecord method, and then the client receives the reply from the Siebel Server. In this situation, you can use the following code to run some logic in the presentation model after Siebel Open UI runs the PostExecute method as part of the element life cycle: this.AttachPostProxyExecuteBinding("NewRecord", function(methodName, inputPS, outputPS){"Do Something for New Record";return;}); The following code runs this same logic in the presentation model for all methods: this.AttachPostProxyExecuteBinding("ALL", function(methodName, inputPS, outputPS){"Do Something for all methods";return;}); For more information, see NewRecord Method. For more examples that use AttachPreProxyExecuteBinding and AttachPostProxyExecuteBinding, see Customizing the Presentation Model to Call the Siebel Server and Delete a Record and Calling Methods. The AttachPreProxyExecuteBinding and AttachPostProxyExecuteBinding methods provide a generic way to do more processing than the AttachNotificationHandler method provides before or after the proxy finishes processing the reply from a method that the client or the Siebel Server calls. A method might cause Siebel Open UI to create a notification from the Siebel Server that does more post-processing than the client proxy requires. This situation can occur with a custom method that you implement on the Siebel Server. For example, with an applet, business service, or some other object type. For more information, see AttachNotificationHandler Method. Siebel Open UI sends a notification only for a typical modification that occurs in the predefined product. For example, a new or deleted record or a modified record set. Siebel Open UI might not be able to identify and process the correct notification. For example, you can configure Siebel Open UI to make one call to the WriteRecord method from the client, but the server business logic might cause this method to run more than one time. Siebel Open UI might receive notifications for any WriteRecord method that occurs for a business component that it binds to the current user interface. These notifications might contain more information than the reply notification requires. For more information, see WriteRecord Method,. The AttachPreProxyExecuteBinding method binds a method that resides in a proxy or presentation model to a PostExecute method. Siebel Open UI calls this method, and then runs PostExecute. The AttachPreProxyExecuteBinding uses the same syntax and arguments that the AttachPostProxyExecuteBinding method uses, except you configure Siebel Open UI to call the AttachPreProxyExecuteBinding method. For more information, see AttachPostProxyExecuteBinding Method. The ExecuteMethod method runs a method. You can use it to run a predefined or custom method that the presentation model contains. It makes sure Siebel Open UI runs all dependency chains for the method that it calls. For more information about dependency chains, see About Dependency Injection. If the method that ExecuteMethod specifies:
this.GetPM().ExecuteMethod("method_name", arguments);
For examples that use InvokeMethod, see Customizing the Presentation Model to Delete Records and Customizing the Presentation Model to Handle Notifications. For more information about using this method, see Life Cycle Flows of User Interface Elements. The Get method returns the value of the property that Siebel Open UI adds through the AddProperty method. If Siebel Open UI sends a method in the propertyValue argument of the AddProperty method, then it calls the Get method, and then sends the return value to the method that calls the Get method. For an example that uses the Get method, see Customizing the Presentation Model to Delete Records. For more information about using this method, see Life Cycle Flows of User Interface Elements. The GetCtrlTemplate method gets the template for a control, and then uses values from this template to create an object. It uses values from this template to set the default values and the format for the property set that this control uses. It returns nothing. It uses the following syntax: GetCtrlTemplate ("control_name", "display_name", consts.get( "control_type" ), column_index);
For example, the following code gets the template for the TestEdit control: GetCtrlTemplate ("TestEdit", "Test Edit", consts.get( "SWE_CTRL_TEXTAREA" ), 1); The Init method allows you to use different methods to customize a presentation model, such as AddMethod, AddNotificationHandler, AttachPMBinding, and so on. It uses the following syntax: For an example that uses Init, see Step 2. You must not configure Siebel Open UI to override any method that resides in a derived presentation model except for the Init method or the Setup method. For more information, see Deriving Presentation Models, Physical Renderers and Plug-in Wrappers. You must configure Siebel Open UI to do the following:
The OnControlEvent method calls an event. It uses the following syntax: OnControlEvent(event_name, event_arguments)
The SetProperty method sets the value of a presentation model property. It returns one of the following values: SetProperty(property_name, property_value)
If the property that the SetProperty method references does not exist, then Siebel Open UI creates this property and sets the value for it according to the SetProperty method. You can also use the AddProperty method to add a property. For examples that use SetProperty, see the following topics:
The Setup method extracts the values that a property set contains. Siebel Open UI calls this Setup method when it processes the initial reply from the Siebel Server. It uses the following syntax:
For example, the following code identifies the childPropset property set: extObject.Setup(childPropset.GetChild(0));
|
Configuring Siebel Open UI | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |