TOC PREV NEXT INDEX



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:

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.

Example application page:

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

Note: The component bindings must be visible to the valueChangeListener.

Example application page:

		<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

TOC PREV NEXT INDEX