CAF.Output.Model
The base model class is CAF.Output.Model. Almost all control models are the class or extend this 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 on it, 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 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 toggle() and server-side properties.
For more information about CAF controls, see the
webMethods CAF Tag Library Reference, as described in
Finding Information about CAF Controls.