| Bookshelf Home | Contents | Index | PDF | ![]() |
|
Configuring Siebel Open UI > Siebel Open UI Application Programming Interface > Classes and Methods of the Siebel Open UI Application Programming Interface > Presentation Model ClassThis topic describes the presentation model class. It includes the following topics:
Siebel Open UI defines the presentation model class in the pmodel.js file. It stores this file in the following folder: vob_src_locale\src\core\locale\base\ssa\swe\siebel Init MethodThe Init method allows you to use different methods to customize a presentation model, such as AddMethod, AddNotificationHandler, AttachPMBinding, and so forth. It uses the following syntax: You must configure Siebel Open UI to use the Init function in the derived presentation model to create customization for this derived presentation model. You must not override any method except the Init or Setup methods in the derived presentation model. You must configure Siebel Open UI to do the following:
For more information, see Notifications That Siebel Open UI Supports. Setup MethodSiebel Open UI calls the Setup method when it processes the initial response from the Siebel Server. It uses the following syntax:
For example, the following code identifies the childPropset property set: extObject.Setup( childPropset.GetChild( 0 )); AddProperty MethodThe AddProperty method adds a property to the Presentational Model. Siebel Open UI can access it through the Get function. 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 ); SetProperty MethodThe SetProperty method sets the value of a property in a presentation model. It returns one of the following values: SetProperty( propName, propDef ) 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. Get MethodThe Get method returns the value of the property that Siebel Open UI adds through the AddProperty method. If Siebel Open UI passes a function in the propertyValue parameter of the AddProperty method, then Siebel Open UI calls this function and passes the return value to the method that calls the Get. AddMethod MethodThe 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 an argument that Siebel Open UI sends when it adds the method. A method that customizes a method can return to the caller without running the predefined method. To do this, you set the CancelOperation property to true. You set this property on the ReturnStructure object that Siebel Open UI sends to each method as an argument. The AddMethod method returns one of the following values: AddMethod( "methodName", methodDef( argument, argument_n){
Example of Adding a New MethodThe following code adds a new ShowSelection method: this.AddMethod( "ShowSelection", SelectionChange, { sequence : false, scope : this } ); After you add the ShowSelection method, you can use the following code to configure Siebel Open UI to call this method. It passes a string value of true to the sequence and a string value of blue to the scope argument: this.ExecuteMethod( "ShowSelection", "true", "blue" ); Example of Using the Sequence ParameterYou can use the AddMethod method to get the feature of delegation interface of the function that is available in the predefined presentation model or that Siebel Open UI adds through the AddMethod method. For example, the following code configures Siebel Open UI to attach a function. It calls this function anytime it calls the InvokeMethod method of the proxy: this.AddMethod( "InvokeMethod", function(){ This code sets the sequence parameter to true, which instructs Siebel Open UI to call the method that it passes before it calls the InvokeMethod method. The function that it passes gets all the parameters that the InvokeMethod method receives. For more information, see InvokeMethod Method. Example of Overriding the Predefined Presentation ModelThe following example overrides the predefined presentation model and runs the ProcessDrillDown method: this.AddMethod( "ProcessDrillDown", function(){ You can use the following code: this.AddMethod( "InvokeMethod", function(){ console.log( "In Invoke Method of PM" ), { override: true }); ExecuteMethod MethodThe ExecuteMethod method runs a method. You must use ExecuteMethod to run any predefined or custom method that the presentation model contains. ExecuteMethod makes sure Siebel Open UI runs all injected dependency chains for the method that it calls. For more information, see About Dependency Injection. If the method that ExecuteMethod specifies:
this.GetPM().ExecuteMethod( "methodName", arguments );
ExampleThe following example configures the predefined presentation model to use the InvokeMethod function. A physical renderer can get the value from the InvokeMethod function. EditPopup and inputPS are arguments of the InvokeMethod method: this.GetPM().ExecuteMethod( "InvokeMethod", "EditPopup", inputPS ); AttachEventHandler MethodThe AttachEventHandler method attaches an event handler for a physical event. It accepts the eventName and corresponding event handler that Siebel Open UI attaches to the Physical Event Arbitration layer. It returns one of the following values: AttachEventHandler( "eventName", eventHandler());
You can use the AttachEventHandler method to override some of the predefined event handling. If you do this, then you must make sure it returns a value of False. Using AttachEventHandler to Refresh Custom EventsSiebel Open UI does not come predefined to refresh a custom event. The example in this topic describes how to modify this behavior. To use AttachEventHandler to refresh custom events
Overriding an Event HandlerThe example in this topic configures Siebel Open UI to override an event handler that the predefined presentation model references.
OnControlEvent MethodThe OnControlEvent method uses the following syntax: OnControlEvent( eventName, eventArgs ) AttachPMBinding MethodThe AttachPMBinding method binds a function to an existing function so that Siebel Open UI calls it when the existing function finishes processing. It returns one of the following values: this.AttachPMBinding(
ExampleThe following example assumes the presentation model includes the FieldChange function. It configures Siebel Open UI to call another function when FieldChange finishes processing: this.AttachPMBinding( "DoSomthing", function(){ SiebelJS.Log( "After DoSomething" ); } ); Conditionally Binding a FunctionThe example in this topic conditionally calls the AttachPMBinding method. To conditionally bind a function
In this example, if Siebel Open UI calls DoSomething, then the presentation model calls the function_name that the
If you do not include the Binding Functions That Reside in the Physical RendererYou can use the AttachPMBinding method to bind a function that resides in a physical renderer and that Siebel Open UI must call when the presentation model finishes processing. In this situation, you add the function reference in the physical renderer and you configure Siebel Open UI to pass the scope in the binderConfig parameter as a scope property. AttachNotificationHandler MethodThe AttachNotificationHandler method attaches a handler to the Presentational Model. It does this attachment when the notification occurs. It returns one of the following values: this.AttachNotificationHandler("notification", function(propSet){
For example, the following code: this.AttachNotificationHandler("g", function(propSet){ For more information, see Notifications That Siebel Open UI Supports. AddComponentCommunication MethodThe AddComponentCommunication method binds a communication method. It uses the following parameters:
AttachPreProxyExecuteBinding MethodThe AttachPreProxyExecuteBinding method binds a function that resides in a proxy or presentation model to a Post Execute method. Siebel Open UI calls this function and then runs the Post Execute. this.AttachPreProxyExecuteBinding( "binderName", function(handler, inputPS, outputPS){"binderConfig";
ExampleIn this example, the user clicks the New button in an applet, Siebel Open UI runs the NewRecord method, runs the CallServer 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 before Siebel Open UI runs the Post Execute method as part of the element life cycle: this.AttachPreProxyExecuteBinding( "NewRecord", function(methodName, inputPS, outputPS){"Do Something for New Record"; The following code runs this same logic in the presentation model for all methods: this.AttachPreProxyExecuteBinding( "ALL", function(methodName, inputPS, outputPS){ Using the AttachPreProxyExecuteBinding and AttachPostProxyExecuteBinding MethodsThe AttachPreProxyExecuteBinding and AttachPostProxyExecuteBinding methods provide a more generic way to do more processing than the AttachNotificationHandler method provides before or after the proxy finishes processing the reply for 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 requires 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, for an applet, business service, or some other object type. 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. A notification that Siebel Open UI sends after a typical Siebel Server operation or a business layer operation finishes is more granular. Siebel Open UI might not be able to identify and process the correct notification. For example, you can configure Siebel Open UI to call one WriteRecord method from the client, but the server business logic might cause this method to run multiple times. 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 informaiton than the response notification that you must configure Siebel Open UI to process. AttachPostProxyExecuteBinding MethodThe AttachPostProxyExecuteBinding method binds a function that resides in a proxy or presentation model to a Post Execute method. Siebel Open UI runs the Post Execute function and then calls the AttachPostProxyExecuteBinding method. this.AttachPostProxyExecuteBinding( "binderName", function(handler, inputPS, outputPS){"binderConfig";
For more information, see Using AttachEventHandler to Refresh Custom Events. ExampleIn this example, the user clicks the Delete button in an applet, Siebel Open UI runs the DeleteRecord method, runs the CallServer 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 Post Execute method as part of the element life cycle: this.AttachPostProxyExecuteBinding( "DeleteRecord", function(methodName, inputPS, outputPS){"Do Something for Delete Record"; The following code runs this same logic in the presentation model for all methods: this.AttachPostProxyExecuteBinding( "ALL", function(methodName, inputPS, outputPS){ |
![]() |
![]() |
| Configuring Siebel Open UI | Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |