Configuring Siebel Open UI > Post-Upgrade Configuration Tasks > Overriding Plug-In Wrappers >

About Presentation Model-Injected APIs in Plug-in Wrappers


This topic includes information about presentation model-injected APIs in plug-in wrappers.

You can use the APIs in this topic to achieve the customized functionality you were using previously in renderers. The code examples for each of the methods in this topic can be used as references about achieving the same or similar customizations in Siebel Innovation Pack 2014.

For more information about plug-in wrappers, examples of configuration and further information about APIs, see Architecture of Siebel Open UI Example of Customizing Siebel Open UI and Siebel Open UI Application Programming Interface.

While the following APIs have been described earlier in this documentation in the context of use within the physical renderer to act as liaisons with the plug-in wrapper, they are also available for use from within the plug-in wrapper:

  • GetEl. Used to get the DOM (jQuery element) that represents the control.
  • GetValue. Used to access the DOM value of the control.
  • SetValue. Used to set the DOM value of the control.
  • SetState. Used to set various DOM states for the control.

In addition to the APIs listed above, the framework injects certain presentation model-level APIs into all plug-in wrappers to ease the layering of calls that a plug-in wrapper is required to complete. This makes programming in customized plug-in wrappers very similar to programming customized physical renderers. These types of APIs are described in the following topics:

Get

This API gets the value of a PM property where the control is deployed.

SetProperty

This API allows the plug-in wrapper set a property on the PM on which this control is operating.They are PM properties that the plug-in wrapper is acting on.

The following example shows how a CustomPW can operate on a PM property, and how another CustomPW can subsequently use the property for other purposes:

CustomPW1.prototype.ShowUI = function (control) {
 // Custom Show Definition
 if (this.Get("ShowControl1") === true) {
  SiebelAppFacade.CustomPW1.superclass.BindEvents.call(this);
 }
 this.SetProperty("ShowControl2", false);
}

CustomPW2.prototype.ShowUI = function (control) {
 // Custom Show Definition
 if (this.Get("ShowControl2") === true) {
  SiebelAppFacade.CustomPW2.superclass.BindEvents.call(this);
 }
}

ExecuteMethod

This API is similar to the ExecuteMethod in the presentation model: it allows the plug-in wrapper to execute a method on the PM on which it is operating.

OnControlEvent

This API runs the event handler call up to the presentation model and subsequently any custom event handlers that may be attached to the event.

The following example shows the usage of APIs in a custom event handler on a custom plug-in wrapper. It depicts a method that is executed on the presentation model, the return value determines if the event should be handled or ignored:

function OnClick(evt) {
 // This is a custom click handler for my control.
 var self = evt.data.ctx,
  shouldHonorClick = self.ExecuteMethod("CustomPMMethod");
 if (shouldHonorClick) {
   self.OnControlEvent("customClickEvent", self.control, self.dataset);
 }
}

Helper

This API is used to obtain helper objects from the plug-in wrapper. Currently only the EventHelper object is present. Any control level custom binding should happen using this helper object.

The following example binds two events on to the control in the customized wrapper, and runs custom handlers defined in the wrapper:

CustomPW.prototype.BindEvents = function (control) {
 var ele = this.GetEl(),
  evHelper = this.Helper("EventHelper");
 evHelper
  .Manage(ele, "click", { ctx: this }, OnClick)
  .Manage(ele.next("span"), "hover", { ctx: this }, OpenAlertBox);
};
function OnClick() {
 // Custom Definition for element click here
}
function OpenAlertBox() {
 // Custom Definition for element next span hover here
}

For a detailed example about using APIs in a customized wrapper, see Configuring the Manifest for the Color Box Example.

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