org.rhq.core.gui.table.component
Class RowSelectorComponent

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by org.rhq.core.gui.table.component.RowSelectorComponent
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder

public class RowSelectorComponent
extends javax.faces.component.UIInput

An HTML component that allows rows in data tables (i.e. h:dataTables or rich:*dataTables) to be selected via either checkboxes (if in multi-select mode) or via radio buttons (if in single-select mode). NOTE: It is preferred to use the disabled attribute of this component instead of the rendered attribute. This will provide consistency to the rendered table such as regardless of what items appear in the table, the check-able column will always be rendered with a consistent width.

Author:
Ian Springer

Nested Class Summary
static class RowSelectorComponent.Mode
           
 
Field Summary
static String COMPONENT_FAMILY
           
static String COMPONENT_TYPE
           
 
Fields inherited from class javax.faces.component.UIInput
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
RowSelectorComponent()
           
 
Method Summary
 Object getBinding(String attr)
           
 String getClientId(javax.faces.context.FacesContext context)
          By default, getClientId() would return something like "myForm:myDataTable:10001:myRowSelector", where "myForm:myDataTable:10001" is the client id of our enclosing data table, and "10001" is the index of the current row.
 String getFamily()
           
 RowSelectorComponent.Mode getMode()
           
 Object getValue()
           
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
 Object saveState(javax.faces.context.FacesContext context)
           
 void setMode(RowSelectorComponent.Mode mode)
           
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, compareValues, decode, getConvertedValue, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, updateModel, validate, validateValue
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression, setValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, setConverter
 

Field Detail

COMPONENT_TYPE

public static final String COMPONENT_TYPE
See Also:
Constant Field Values

COMPONENT_FAMILY

public static final String COMPONENT_FAMILY
See Also:
Constant Field Values
Constructor Detail

RowSelectorComponent

public RowSelectorComponent()
Method Detail

getFamily

public String getFamily()
Overrides:
getFamily in class javax.faces.component.UIInput

getMode

public RowSelectorComponent.Mode getMode()

setMode

public void setMode(RowSelectorComponent.Mode mode)

getValue

public Object getValue()
Specified by:
getValue in interface javax.faces.component.ValueHolder
Overrides:
getValue in class javax.faces.component.UIOutput

getClientId

public String getClientId(javax.faces.context.FacesContext context)
By default, getClientId() would return something like "myForm:myDataTable:10001:myRowSelector", where "myForm:myDataTable:10001" is the client id of our enclosing data table, and "10001" is the index of the current row. For each row, we want ourselves to be rendered as a HTML checkbox with the *same* "name" attribute as the checkboxes for the other rows, so it is easier to obtain the set of checkboxes via JavaScript. Since the client id is used as the checkbox "name" attribute, we need to make sure to return a client id that does not include the rowIndex (e.g. "myForm:myDataTable:myRowSelector". Isn't JSF fun?

Overrides:
getClientId in class javax.faces.component.UIComponentBase
Parameters:
context - the JSF context
Returns:
our client id

saveState

public Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.UIInput

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.UIInput

getBinding

public Object getBinding(String attr)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.