Configuring Siebel Open UI > Siebel Open UI Application Programming Interface > Methods of the Siebel Open UI Application Programming Interface >

Presentation Model Class


This 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.

AddComponentCommunication Method

The AddComponentCommunication method binds a communication method. It uses the following arguments:

  • methodName is a string that identifies the communication method that Siebel Open UI binds.
  • targetMethod is a string that identifies the method that Siebel Open UI calls after methodName finishes. It calls this target method in the presentation model context.
  • targetMethodConfig identifies an object that contains configuration properties for targetMethod.
  • targetMethodConfig.scope identifies the object that the AddComponentCommunication method binds. This object must reference the targetMethod.
  • targetMethodConfig.args is a list of arguments that Siebel Open UI sends to targetMethod when the AddComponentCommunication method runs.

AddMethod Method

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:

  • True. Added a method successfully.
  • False. Did not add a method successfully.

It uses the following syntax:

AddMethod("methodName", methodDef(argument, argument_n){
  }, {methodConfig : value});

where:

  • methodName is a string that contains the name of the method that Siebel Open UI adds to the presentation model.
  • methodDef is an argument that allows you to call a method or a method reference.
  • argument and argument_n are arguments that AddMethod sends to the method that methodDef identifies.
  • methodConfig is an argument that you set to one of the following values:
    • sequence. Set to one of the following values:
      • true. Siebel Open UI calls methodName before it calls the method that already exists in the presentation model.
      • false. Siebel Open UI calls methodName after it calls the method that already exists in the presentation model. The default value is false.
    • override. Set to one of the following values:
      • true. Siebel Open UI does not call the method that already exists in the presentation model. Instead, it calls the sent method, when necessary. Note that Siebel Open UI can never override some methods that exist in a predefined presentation model even if you set override to true.
      • false. Siebel Open UI calls the method that already exists in the presentation model.
    • scope. Describes the scope that Siebel Open UI must use when it calls methodDef. The default scope is Presentation Model.
Example of Adding a New Method

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 SetActiveControl to the sequence and a string value of null to the scope argument. To view how Siebel Open UI uses this example, see Step 5:

this.ExecuteMethod("SetActiveControl", null)

Example of Using the Sequence Argument

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.

Example of Overriding the Predefined Presentation Model

The following example overrides the predefined presentation model and runs the ProcessDrillDown method:

this.AddMethod("ProcessDrillDown", function(){
}, {override : true});

Other Examples

The following examples also use AddMethod:

this.AddMethod("InvokeMethod", function(){console.log("In Invoke Method of PM"), {override: true});

this.AddMethod("InvokeControlMethod", DerivedPresentationalModel.prototype.MyInvokeControlMethod, {sequence : true});

AddProperty Method

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:

  • True. Added a property successfully.
  • False. Did not add a property successfully.

It uses the following syntax:

this.AddProperty("propertyName", propertyValue);

where:

  • propertyName is a string that identifies a property. A subsequent call to this method with the same propertyName overwrites the previous value.
  • propertyValue assigns a value to the property.

For example, the following code adds the NumOfRows property and assigns a value of 10 to this property:

this.AddProperty("NumOfRows", 10);
  SiebelJS.Log(this.Get("NumOfRows"));

AttachEventHandler Method

The AttachEventHandler method attaches an event handler for a physical event. It accepts the eventName and the corresponding event handler that Siebel Open UI attaches to this physical event. It returns one of the following values:

  • true. Attached an event handler successfully.
  • false. Did not attach an event handler successfully.

It uses the following syntax:

AttachEventHandler("eventName", eventHandler());

where:

  • eventName is a string that identifies the name of the event that Siebel Open UI must attach to the physical event.
  • eventHandler identifies the method that Siebel Open UI calls.

For an example that uses AttachEventHandler, see Example of the Life Cycle of a User Interface Element.

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. For more information, see Overriding Event Handlers.

For more information about events, see Siebel CRM Events You Can Use to Customize Siebel Open UI.

For more information about using this method, see Life Cycle Flows of User Interface Elements.

AttachNotificationHandler Method

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:

  • True. Attached notification handler successfully.
  • False. Did not attach notification handler successfully.

It uses the following syntax:

this.AttachNotificationHandler("notification_name", handler);

where:

  • notification_name is a string that includes the name or type of a notification. For example, NotifyDeleteRecord or SWE_PROP_BC_NOTI_DELETE_RECORD.
  • handler identifies a notification handler that Siebel Open UI calls when notification processing finishes. For example, HandleDeleteNotification.

For more information about:

AttachPMBinding Method

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:

  • True. The bind succeeded.
  • False. The bind failed.

It uses the following syntax:

this.AttachPMBinding("method_name",function(){SiebelJS.Log("method_to_call");},{when : function(conditional_function){return value;}});

where:

  • method_name is a string that identifies the name of a method.
  • method_to_call identifies the method that Siebel Open UI calls when it finishes processing method_name.
  • conditional_function identifies a function that returns one of the following values:
    • true. Calls the AttachPMBinding method.
    • false. Does not call the AttachPMBinding method.

For an example that uses AttachPMBinding, see Customizing the Physical Renderer to Refresh the Recycle Bin.

For more information about using the AttachPMBinding method, see Configuring Siebel Open UI to Bind Methods and Life Cycle Flows of User Interface Elements.

AttachPostProxyExecuteBinding Method

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;});

where:

  • method_to_call is a string that identifies the method that Siebel Open UI calls.
  • binder_configuration is a string that identifies code that Siebel Open UI runs after the applet proxy sends a reply.

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 for Applets.

Using the AttachPreProxyExecuteBinding and AttachPostProxyExecuteBinding 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.

AttachPreProxyExecuteBinding 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.

ExecuteMethod 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:

  • Exists. It returns a value from the method that it specifies.
  • Does not exist. It returns the following string:

    undefined

It uses the following syntax:

this.GetPM().ExecuteMethod("method_name", arguments);

where:

  • method_name is a string that identifies the name of the method that ExecuteMethod runs. You must use the AddMethod method to add the method that method_name specifies before you run ExecuteMethod. If the method that method_name specifies:
    • Exists. Siebel Open UI calls the method that method_name specifies, sends the arguments, gets the return value, and then sends this return value to the object that called the ExecuteMethod method.
    • Does not exist. The ExecuteMethod method does nothing.
  • arguments includes a list of one or more arguments where a comma separates each argument. ExecuteMethod sends these arguments to the method that method_name specifies. It sends these arguments in the same order that you list them in this argument list.

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.

Get Method

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.

Init Method

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:

Init()

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.

You must configure Siebel Open UI to do the following:

  • Call the Init method in the predefined presentation model before it calls the Init method in the derived presentation model.
  • Call the Setup method in the predefined presentation model before it calls the Setup method in the derived presentation model. For more information, see Setup Method for Presentation Models.

For more information about deriving values, see About Using This Book.

OnControlEvent Method

The OnControlEvent method calls an event. It uses the following syntax:

OnControlEvent(event_name, event_arguments)

where:

  • event_name identifies the name of an event. You must use event_name to send a physical event.

For more information about:

SetProperty Method

The SetProperty method sets the value of a presentation model property. It returns one of the following values:

  • True. Set the property value successfully.
  • False. Did not set the property value successfully.

It uses the following syntax:

SetProperty(property_name, property_value)

where:

  • property_name specifies the name of the property that SetProperty sets.
  • property_value specifies the value that SetProperty sets for property_name.

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:

Setup Method for Presentation Models

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:

Setup(property_set)

where:

  • property_set identifies the property set that Siebel Open UI uses with the corresponding proxy object. It contains the property set information for the proxy and any custom property set information that Siebel Open UI added through the presentation model that resides on the Siebel Server. If Siebel Open UI must parse a custom property set, then this work must occur in the Setup method for the derived presentation model.

For example, the following code identifies the childPropset property set:

extObject.Setup(childPropset.GetChild(0));

For more information about:

Configuring Siebel Open UI Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.