| |
PDF
|
ICEfaces Online Reference |
Using the ICEfaces Focus Management API
The ICEfaces Focus Management API consists of a single method, requestFocus(). This method is used to communicate a component focus request from the application to the client browser.
The following ICEfaces extended components have implemented the requestFocus method:
- com.icesoft.faces.component.ext.HtmlCommandButton
- com.icesoft.faces.component.ext.HtmlCommandLink
- com.icesoft.faces.component.ext.HtmlInputSecret
- com.icesoft.faces.component.ext.HtmlInputText
- com.icesoft.faces.component.ext.HtmlInputTextarea
- com.icesoft.faces.component.ext.HtmlSelectBooleanCheckbox
- com.icesoft.faces.component.ext.HtmlSelectManyCheckbox
- com.icesoft.faces.component.ext.HtmlSelectManyListbox
- com.icesoft.faces.component.ext.HtmlSelectManyMenu
- com.icesoft.faces.component.ext.HtmlSelectOneListbox
- com.icesoft.faces.component.ext.HtmlSelectOneMenu
- com.icesoft.faces.component.ext.HtmlSelectOneRadio
To use the ICEfaces Focus Management API in your application, you must use component bindings in your applications web pages.
In the following example code snippets, the ice:inputText is bound to an HtmlInputText instance named westText in the application backing bean.
<ice:inputText value="West" binding="#{focusBean.westText}" />Example application backing bean:
import com.icesoft.faces.component.ext.HtmlInputText; private HtmlInputText westText = null; public HtmlInputText getWestText() { return westText; } public void setWestText(HtmlInputText westText) { this.westText = westText; }In the following example code snippets, the requestFocus calls are made in a valueChangeListener which is also implemented in the application's backing bean.
<ice:selectOneRadio value="#{focusBean.selectedText}" styleClass="selectOneMenu" valueChangeListener="#{focusBean.selectedTextChanged}" partialSubmit="true"> <f:selectItem itemValue="#{focusBean.NORTH}" itemLabel="North" /> <f:selectItem itemValue="#{focusBean.WEST}" itemLabel="West" /> <f:selectItem itemValue="#{focusBean.CENTER}" itemLabel="Center" /> <f:selectItem itemValue="#{focusBean.EAST}" itemLabel="East" /> <f:selectItem itemValue="#{focusBean.SOUTH}" itemLabel="South" /> </ice:selectOneRadio>Example application backing bean:
public void selectedTextChanged(ValueChangeEvent event) { selectedText = event.getNewValue().toString(); if (selectedText.equalsIgnoreCase(NORTH)) { this.northText.requestFocus(); } else if (selectedText.equalsIgnoreCase(WEST)){ this.westText.requestFocus(); } else if (selectedText.equalsIgnoreCase(CENTER)) { this.centerText.requestFocus(); } else if (selectedText.equalsIgnoreCase(EAST)){ this.eastText.requestFocus(); } else if (selectedText.equalsIgnoreCase(SOUTH)) { this.southText.requestFocus(); } }
|
Copyright 2005-2006. ICEsoft Technologies, Inc. http://www.icesoft.com |