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: 1327684 $ $Date: 2012-04-18 16:07:35 -0500 (Wed, 18 Apr 2012) $
Author:
Manfred Geiler (latest modification by $Author: lu4242 $)

Field Summary
 
Fields inherited from class javax.faces.component.html.HtmlDataTable
COMPONENT_TYPE
 
Fields inherited from class javax.faces.component.UIData
COMPONENT_FAMILY
 
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)
           
 String getClientId(javax.faces.context.FacesContext context)
          Hack since RI does not call getRowIndex()
protected  javax.faces.model.DataModel getDataModel()
           
 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  String getDerivedSubClientId()
          Return the fragment to be used on the container client id to identify a row.
 int getRowCount()
           
 Object getRowData()
           
 int getRowIndex()
           
 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(Iterator childIterator, Object state, boolean restoreChildFacets)
           
protected  void restoreDescendantComponentStates(Object state)
           
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
protected  Object saveDescendantComponentStates()
           
protected  Object saveDescendantComponentStates(Iterator childIterator, boolean saveChildFacets)
           
 Object saveState(javax.faces.context.FacesContext context)
           
protected  void setDataModel(javax.faces.model.DataModel datamodel)
           
 void setDerivedRowKeyPrefix(String derivedRowKeyPrefix)
           
 void setForceId(boolean forceId)
           
 void setForceIdIndex(boolean forceIdIndex)
           
 void setPreserveRowStates(boolean preserveRowStates)
           
 void setRowIndex(int rowIndex)
           
 void setRowKey(Object rowKey)
           
 void setValue(Object value)
           
 void setValueBinding(String name, javax.faces.el.ValueBinding binding)
           
 
Methods inherited from class javax.faces.component.html.HtmlDataTable
getBgcolor, getBorder, getCellpadding, getCellspacing, getColumnClasses, getDir, getFooterClass, getFrame, getHeaderClass, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getRowClasses, getRules, getStyle, getStyleClass, getSummary, getTitle, getWidth, setBgcolor, setBorder, 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, getFamily, getFirst, getFooter, getHeader, getRows, getValue, getVar, processDecodes, queueEvent, setFirst, setFooter, setHeader, setRows, setVar
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, decode, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient
 
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 Object getRowData()
Overrides:
getRowData in class javax.faces.component.UIData

getRowIndex

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

getClientId

public 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 IOException
Overrides:
encodeBegin in class javax.faces.component.html.HtmlDataTable
Throws:
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 IOException
Overrides:
encodeEnd in class javax.faces.component.UIData
Throws:
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(Object state)

restoreDescendantComponentStates

protected void restoreDescendantComponentStates(Iterator childIterator,
                                                Object state,
                                                boolean restoreChildFacets)

saveDescendantComponentStates

protected Object saveDescendantComponentStates()

saveDescendantComponentStates

protected Object saveDescendantComponentStates(Iterator childIterator,
                                               boolean saveChildFacets)

setValueBinding

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

setValue

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

getDataModel

protected javax.faces.model.DataModel getDataModel()

setDataModel

protected void setDataModel(javax.faces.model.DataModel datamodel)

createDataModel

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


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

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.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 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(Object rowKey)

getDerivedRowKeyPrefix

public 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(String derivedRowKeyPrefix)

getDerivedSubClientId

protected 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 © 2012 The Apache Software Foundation. All Rights Reserved.