Designer 10.7 | webMethods CAF and OpenUI Development | Understanding the Client-side Model | CAF.Output.Model
 
CAF.Output.Model
The base model class is CAF.Output.Model. Almost all control models are instances of the class or extend the class, including all UIOutput controls such as Text, and all UIPanel controls such as BlockPanel.
You can examine and modify the value of a CAF.Output.Model using the getValue() and setValue(value) methods. This is usually just the control element's innerHTML property. If the control is a javax.faces.component.ValueHolder, the value corresponds to the control's value property. For example, the value of an Image control is the image's URL. The following script example shows how to dynamically set the Image control with a control identifier of ID to display a company logo.
CAF.model(id).setValue("http://www.mycompany.com/logos/Logo_50wht.gif");
You can use the following methods to examine and modify the disabled, focused, and visible states of a CAF.Output.Model:
*isDisabled() and setDisabled()
*isFocused() and setFocused()
*isVisible() and setVisible()
Setting the disabled and focused states of an UIOutput or UIPanel control does not affect the control itself, but can affect descendant controls. The show(), hide(), and toggle() methods also modify the control's visibility.
You can refresh the contents of any control from the server using an asynchronous request that calls the model's refresh() method. For example, to refresh a panel, myPanelId, when the user double-clicks the panel, add a Script Block control to the page, and in its value property use the Prototype library's Event.observe method to register the double-click event handler, and call the refresh() method in that handler's body. The following snippet shows an example of this approach.
Event.observe('#{activePageBean.clientIds['myPanelId']}', 'dblclick',
function(event) {
CAF.model('#{activePageBean.clientIds['myPanelId']}').refresh();
});
You can configure the behavior of the toggle() server-side property.
For more information about CAF controls, see webMethods CAF Tag Library Reference.
Related Topics