org.apache.myfaces.component.html.ext
Class HtmlDataTableHack

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIData
              extended by javax.faces.component.html.HtmlDataTable
                  extended by org.apache.myfaces.component.html.ext.HtmlDataTableHack
All Implemented Interfaces:
javax.faces.component.NamingContainer, javax.faces.component.StateHolder, ExtendedComponentBase
Direct Known Subclasses:
AbstractHtmlDataList, AbstractHtmlDataTable

public abstract class HtmlDataTableHack
extends javax.faces.component.html.HtmlDataTable
implements ExtendedComponentBase

Reimplement all UIData functionality to be able to have (protected) access the internal DataModel.

Version:
$Revision: 1082309 $ $Date: 2011-03-16 16:38:06 -0500 (Wed, 16 Mar 2011) $
Author:
Manfred Geiler (latest modification by $Author: lu4242 $)

Field Summary
 
Fields inherited from class javax.faces.component.html.HtmlDataTable
COMPONENT_FAMILY, COMPONENT_TYPE
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
HtmlDataTableHack()
           
 
Method Summary
protected  void checkUpdateModelError(javax.faces.context.FacesContext context)
          This method is used when a custom processUpdates and processValidators is defined, to check if a update model error forces the render response for our data, because _isValidChilds is a private field and is not available on child components that inherits this component class like t:dataList.
 void clearRowStates()
          Remove all preserved row state for the dataTable
protected  javax.faces.model.DataModel createDataModel()
          Creates a new DataModel around the current value.
 void deleteRowStateForRow(int deletedIndex)
          Remove preserved row state for deleted row and adjust row state to reflect deleted row.
 void encodeBegin(javax.faces.context.FacesContext context)
           
 void encodeEnd(javax.faces.context.FacesContext context)
           
 java.lang.String getClientId(javax.faces.context.FacesContext context)
          Hack since RI does not call getRowIndex()
protected  javax.faces.model.DataModel getDataModel()
           
 java.lang.String getDerivedRowKeyPrefix()
          This attribute is used to append an unique prefix when rowKey is not used, to prevent a key match a existing component id (note two different components can't have the same unique id).
protected  java.lang.String getDerivedSubClientId()
          Return the fragment to be used on the container client id to identify a row.
 int getRowCount()
           
 java.lang.Object getRowData()
           
 int getRowIndex()
           
 java.lang.Object getRowKey()
          Used to assign a value expression that identify in a unique way a row.
protected  boolean hasErrorMessages(javax.faces.context.FacesContext context)
           
 boolean isForceId()
          If true, this component will force the use of the specified id when rendering.
 boolean isForceIdIndex()
          If false, this component will not append a '[n]' suffix (where 'n' is the row index) to components that are contained within a "list." This value will be true by default and the value will be ignored if the value of forceId is false (or not specified.)
 boolean isPreserveRowStates()
          Indicates whether the state for each row should not be discarded before the datatable is rendered again.
 boolean isRowAvailable()
           
 void processUpdates(javax.faces.context.FacesContext context)
           
 void processValidators(javax.faces.context.FacesContext context)
           
protected  void restoreDescendantComponentStates(java.util.Iterator childIterator, java.lang.Object state, boolean restoreChildFacets)
           
protected  void restoreDescendantComponentStates(java.lang.Object state)
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
protected  java.lang.Object saveDescendantComponentStates()
           
protected  java.lang.Object saveDescendantComponentStates(java.util.Iterator childIterator, boolean saveChildFacets)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
protected  void setDataModel(javax.faces.model.DataModel datamodel)
           
 void setDerivedRowKeyPrefix(java.lang.String derivedRowKeyPrefix)
           
 void setForceId(boolean forceId)
           
 void setForceIdIndex(boolean forceIdIndex)
           
 void setPreserveRowStates(boolean preserveRowStates)
           
 void setRowIndex(int rowIndex)
           
 void setRowKey(java.lang.Object rowKey)
           
 void setValue(java.lang.Object value)
           
 void setValueBinding(java.lang.String name, javax.faces.el.ValueBinding binding)
           
 
Methods inherited from class javax.faces.component.html.HtmlDataTable
getBgcolor, getBorder, getCaptionClass, getCaptionStyle, getCellpadding, getCellspacing, getColumnClasses, getDir, getFamily, getFooterClass, getFrame, getHeaderClass, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getRowClasses, getRules, getStyle, getStyleClass, getSummary, getTitle, getWidth, setBgcolor, setBorder, setCaptionClass, setCaptionStyle, setCellpadding, setCellspacing, setColumnClasses, setDir, setFooterClass, setFrame, setHeaderClass, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setRowClasses, setRules, setStyle, setStyleClass, setSummary, setTitle, setWidth
 
Methods inherited from class javax.faces.component.UIData
broadcast, getFirst, getFooter, getHeader, getRows, getValue, getVar, invokeOnComponent, processDecodes, queueEvent, setFirst, setFooter, setHeader, setRows, setValueExpression, setVar
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, decode, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlDataTableHack

public HtmlDataTableHack()
Method Detail

isRowAvailable

public boolean isRowAvailable()
Overrides:
isRowAvailable in class javax.faces.component.UIData

getRowCount

public int getRowCount()
Overrides:
getRowCount in class javax.faces.component.UIData

getRowData

public java.lang.Object getRowData()
Overrides:
getRowData in class javax.faces.component.UIData

getRowIndex

public int getRowIndex()
Overrides:
getRowIndex in class javax.faces.component.UIData

getClientId

public java.lang.String getClientId(javax.faces.context.FacesContext context)
Hack since RI does not call getRowIndex()

Overrides:
getClientId in class javax.faces.component.UIData

processUpdates

public void processUpdates(javax.faces.context.FacesContext context)
Overrides:
processUpdates in class javax.faces.component.UIData
See Also:
UIData.processUpdates(javax.faces.context.FacesContext)

checkUpdateModelError

protected void checkUpdateModelError(javax.faces.context.FacesContext context)
This method is used when a custom processUpdates and processValidators is defined, to check if a update model error forces the render response for our data, because _isValidChilds is a private field and is not available on child components that inherits this component class like t:dataList. (TOMAHAWK-1225)


processValidators

public void processValidators(javax.faces.context.FacesContext context)
Overrides:
processValidators in class javax.faces.component.UIData
See Also:
UIData.processValidators(javax.faces.context.FacesContext)

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context)
                 throws java.io.IOException
Overrides:
encodeBegin in class javax.faces.component.UIData
Throws:
java.io.IOException
See Also:
UIData.encodeBegin(javax.faces.context.FacesContext)

setPreserveRowStates

public void setPreserveRowStates(boolean preserveRowStates)

isPreserveRowStates

public boolean isPreserveRowStates()
Indicates whether the state for each row should not be discarded before the datatable is rendered again. Setting this to true might be hepful if an input component inside the datatable has no valuebinding and the value entered in there should be displayed again. This will only work reliable if the datamodel of the datatable did not change either by sorting, removing or adding rows. Default: false


hasErrorMessages

protected boolean hasErrorMessages(javax.faces.context.FacesContext context)

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context)
               throws java.io.IOException
Overrides:
encodeEnd in class javax.faces.component.UIData
Throws:
java.io.IOException
See Also:
UIComponentBase.encodeEnd(javax.faces.context.FacesContext)

setRowIndex

public void setRowIndex(int rowIndex)
Overrides:
setRowIndex in class javax.faces.component.UIData

restoreDescendantComponentStates

protected void restoreDescendantComponentStates(java.lang.Object state)

restoreDescendantComponentStates

protected void restoreDescendantComponentStates(java.util.Iterator childIterator,
                                                java.lang.Object state,
                                                boolean restoreChildFacets)

saveDescendantComponentStates

protected java.lang.Object saveDescendantComponentStates()

saveDescendantComponentStates

protected java.lang.Object saveDescendantComponentStates(java.util.Iterator childIterator,
                                                         boolean saveChildFacets)

setValueBinding

public void setValueBinding(java.lang.String name,
                            javax.faces.el.ValueBinding binding)
Overrides:
setValueBinding in class javax.faces.component.UIComponentBase

setValue

public void setValue(java.lang.Object value)
Overrides:
setValue in class javax.faces.component.UIData
See Also:
UIData.setValue(java.lang.Object)

getDataModel

protected javax.faces.model.DataModel getDataModel()
Overrides:
getDataModel in class javax.faces.component.UIData

setDataModel

protected void setDataModel(javax.faces.model.DataModel datamodel)
Overrides:
setDataModel in class javax.faces.component.UIData

createDataModel

protected javax.faces.model.DataModel createDataModel()
Creates a new DataModel around the current value.


saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.html.HtmlDataTable

restoreState

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

isForceId

public boolean isForceId()
If true, this component will force the use of the specified id when rendering.

Specified by:
isForceId in interface ExtendedComponentBase
Returns:

setForceId

public void setForceId(boolean forceId)
Specified by:
setForceId in interface ExtendedComponentBase

isForceIdIndex

public boolean isForceIdIndex()
If false, this component will not append a '[n]' suffix (where 'n' is the row index) to components that are contained within a "list." This value will be true by default and the value will be ignored if the value of forceId is false (or not specified.)

Returns:

setForceIdIndex

public void setForceIdIndex(boolean forceIdIndex)

clearRowStates

public void clearRowStates()
Remove all preserved row state for the dataTable


deleteRowStateForRow

public void deleteRowStateForRow(int deletedIndex)
Remove preserved row state for deleted row and adjust row state to reflect deleted row.

Parameters:
deletedIndex - index of row to delete

getRowKey

public java.lang.Object getRowKey()
Used to assign a value expression that identify in a unique way a row. This value will be used later instead of rowIndex as a key to be appended to the container client id using getDerivedSubClientId() method.

Returns:

setRowKey

public void setRowKey(java.lang.Object rowKey)

getDerivedRowKeyPrefix

public java.lang.String getDerivedRowKeyPrefix()
This attribute is used to append an unique prefix when rowKey is not used, to prevent a key match a existing component id (note two different components can't have the same unique id).

Returns:

setDerivedRowKeyPrefix

public void setDerivedRowKeyPrefix(java.lang.String derivedRowKeyPrefix)

getDerivedSubClientId

protected java.lang.String getDerivedSubClientId()
Return the fragment to be used on the container client id to identify a row. As a side effect, it will be used to indicate a row component state and a datamodel in nested datatable case.

The returned value must comply with the following rules:

Returns:


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.