public class UIDataCell
extends org.apache.myfaces.trinidad.component.UIXComponentBase
implements javax.faces.component.NamingContainer
Each immediate child of a Pivot Table component must either be a <dvt:headerCell>
or <dvt:dataCell>
component. The Pivot Table should contain at most one headerCell component and at most one dataCell component. These components make it possible to customize the cell content via stamping. For example, each dataCell can contain non-editable content or editable content.
Rather than having a separate child component for each cell in the pivot table, the child component of the dataCell component is repeatedly rendered (stamped) once per data cell. Because of this stamping behavior, only certain types of components are supported as children inside a Data Cell. Supported components include all components with no behavior and most components that implement the EditableValueHolder or ActionSource interfaces.
As the dataCell content is stamped, the data for the current cell is copied into an EL reachable property. The name of this property is defined by the var property on the Pivot Table. Once the Pivot Table has completed rendering, this property is removed (or reverted back to its previous value). In the following example, the data for each cell is placed under the EL property "cellData". Each data cell displays its content by getting further properties from the "cellData" property:
<dvt:pivotTable id="goodPT" var="cellData">
<dvt:dataCell id="dc1">
<af:outputText id="ot1" value="#{cellData.dataValue}" />
</dvt:dataCell>
</dvt:pivotTable>
For customizing data cell content, use DataFormat. DataFormat attribute
returns instances of oracle.dss.adf.view.faces.bi.component.pivotTable.CellFormat
. CellFormat instances
allow specification of the following:
javax.faces.convert.Converter
, which is used to perform number/date/text formatting of a cell raw value
Data Cell content can be specified by using a logical component such as <af:switcher>
.
The following example shows how Data Cell supports alternative cell content using <af:switcher>
based on the stamping property. In other words, the stamping content is customized on a cell by cell basis depending on a variable value ("#{richPivotTableModel.stampFacet}"
). The example also shows custom CSS styling using inlineStyle
and contentStyle
attributes of outputText
and inputText
respectively.
<dvt:pivotTable id="goodPT"
value="#{richPivotTableModel.dataModel}"
var="cellData"
varStatus="cellStatus">
<dvt:dataCell id="dc1">
<af:switcher id="sw1" facetName="#{richPivotTableModel.stampFacet}">
<f:facet name="outputText">
<af:outputText id="ot1" value="#{cellData.dataValue}" inlineStyle="#{cellStatus.cellFormat.textStyle}"/>
</f:facet>
<f:facet name="inputText">
<af:inputText id="ot2" value="#{cellData.dataValue}" contentStyle="#{cellStatus.cellFormat.textStyle}" />
</f:facet>
</af:switcher>
</dvt:dataCell>
</dvt:pivotTable>
The following example uses <af:switcher>
to vary the type of stamped component by measure (i.e. different content for Sales, Weight, etc.). The example also shows different components that can be used as child tag of <dvt:dataCell>
<dvt:pivotTable id="goodPT" var="cellData">
<dvt:dataCell>
<af:switcher id="sw" facetName="#{cellStatus.members.MeasDim.value}" defaultFacet="Other">
<f:facet name="Sales">
<af:inputText id="idinputtext1" value="#{cellData.dataValue}" />
</f:facet>
<f:facet name="Units">
<af:inputText id="idinputtext2" value="#{cellData.dataValue}" >
<af:validateLength maximum="6" minimum="2" />
</af:inputText>
</f:facet>
<f:facet name="Weight">
<af:outputText id="idoutputtext1" value="#{cellData.dataValue}" />
</f:facet>
<f:facet name="Color">
<af:selectOneChoice id="idselectonechoice"
value="#{cellData.dataValue}" label="Color">
<af:selectItem label="red" value="red" shortDesc="shortDesc sample"/>
<af:selectItem label="coffee" value="coffee" shortDesc="Sample shortDesc text"/>
<af:selectItem label="milk" value="milk" shortDesc="Another shortDesc sample"/>
</af:selectOneChoice>
</f:facet>
<f:facet name="Available">
<af:selectBooleanCheckbox id="idselectbooleancheckbox" label="Availability" text="Item Available"
autoSubmit="true" value="#{cellData.dataValue}"/>
</f:facet>
<f:facet name="Supply Date">
<af:inputDate id="idinputdate1" value="#{cellData.dataValue}"
label="Change Date:" simple="true" >
<af:validateDateTimeRange maximum="2020-12-31" minimum="1980-12-31" />
</af:inputDate>
</f:facet>
<f:facet name="Link">
<af:commandLink text="#{cellData.dataValue}" immediate="true" action="guide" id="idcommandlink"/>
</f:facet>
<f:facet name="Size">
<af:inputComboboxListOfValues label="Size" id="idInputComboboxListOfValues"
value="#{cellData.dataValue}" searchDesc="Search Size"
model="#{pivotTableEditBean.listOfValuesModel}"
columns="3" />
</f:facet>
<f:facet name="Other">
<af:outputText id="idoutputtext2" value="#{cellData.dataValue}" />
</f:facet>
</af:switcher>
</dvt:dataCell>
</dvt:pivotTable>
Examples of components that are supported by <dvt:dataCell>
include but are not limited to the following:
<af:switcher>
<af:outputText>
<af:inputText>
<af:selectBooleanCheckbox>
<af:selectOneChoice>
<af:inputDate>
<af:commandLink>
<af:inputComboboxListOfValues>
The dataCell should have only one child component. If multiple children are desired, they should be wrapped in another component. If no layout is desired, <af:group> can be used, which simply renders its children without adding layout, and is consequently lightweight. If layout is desired, a layout component like <af:panelGroupLayout> can be used instead. If multiple children are present without being wrapped, the current behavior is to vertically stack the components, but no guarantees or support are provided for this usage. To achieve vertical stacking, consider <panelGroupLayout layout="vertical">.
The following example shows a way to use stamping
<dvt:pivotTable id="goodPT"
value="#{pivotTableEdit.dataModel}"
var="cellData"
varStatus="cellStatus">
<dvt:dataCell id="dc1">
<af:outputText id="ot1" value="#{cellData.dataValue}" />
</dvt:dataCell>
</dvt:pivotTable>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMPONENT_FAMILY |
static java.lang.String |
COMPONENT_TYPE |
static org.apache.myfaces.trinidad.bean.PropertyKey |
CUSTOMIZATION_ID_KEY
Deprecated.
This attribute is deprecated. The 'id' attribute should be used when applying persistent customizations. This attribute will be removed in the next release.
|
static org.apache.myfaces.trinidad.bean.PropertyKey |
DATA_ATTRIBUTE_KEY
Deprecated.
An
<af:switcher> should be used instead of this attribute. |
static org.apache.myfaces.trinidad.bean.PropertyKey |
INLINE_STYLE_KEY |
static org.apache.myfaces.trinidad.bean.PropertyKey |
STYLE_CLASS_KEY |
static org.apache.myfaces.trinidad.bean.FacesBean.Type |
TYPE |
BINDING_KEY, ID_KEY, RENDERED_KEY, RENDERER_TYPE_KEY, TRANSIENT_KEY
Constructor and Description |
---|
UIDataCell()
Constructs a new
UIDataCell . |
Modifier and Type | Method and Description |
---|---|
protected org.apache.myfaces.trinidad.bean.FacesBean.Type |
getBeanType() |
java.lang.String |
getCustomizationId()
Deprecated.
The
id attribute should be used when applying
persistent customizations. This attribute will be removed in the next release. |
java.lang.String |
getDataAttribute()
Deprecated.
An
<af:switcher> should be used instead of this attribute. |
java.lang.String |
getFamily() |
java.lang.String |
getInlineStyle()
Retrieves the inline style of the data cell.
|
java.lang.String |
getStyleClass()
Retrieves the CSS style class to use for this component.
|
void |
setCustomizationId(java.lang.String customizationId)
Deprecated.
The
id attribute should be used when applying
persistent customizations. This attribute will be removed in the next release. |
void |
setDataAttribute(java.lang.String dataAttribute)
Deprecated.
An
<af:switcher> should be used instead of this attribute. |
void |
setInlineStyle(java.lang.String inlineStyle)
Specifies the inline style of the data cell.
|
void |
setStyleClass(java.lang.String styleClass)
Sets a CSS style class to use for this component.
|
adaptMethodBinding, addAttributeChange, addAttributeChangeListener, addClientBehavior, addComponentChange, addComponentChange, addComponentChangeFilter, addFacesListener, broadcast, broadcastToMethodBinding, broadcastToMethodExpression, clearCachedClientIds, clearInitialState, createFacesBean, decode, decodeChildren, decodeChildrenImpl, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributeChangeListener, getAttributeChangeListeners, getAttributes, getBooleanProperty, getChildCount, getChildren, getClientBehaviors, getClientId, getComponentChangeFilters, getContainerClientId, getDefaultEventName, getFacesBean, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacetNames, getFacets, getFacetsAndChildren, getId, getIntProperty, getLifecycleRenderer, getListenersForEventClass, getParent, getPassThroughAttributes, getProperty, getPropertyKey, getRenderedFacetsAndChildren, getRenderer, getRendererType, getRendersChildren, getValueBinding, getValueExpression, initialStateMarked, invokeOnChildrenComponents, invokeOnComponent, invokeOnNamingContainerComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeAttributeChangeListener, removeComponentChangeFilter, removeFacesListener, restoreState, satisfiesPartialTrigger, saveState, setAttributeChangeListener, setAttributeChangeListener, setBooleanProperty, setId, setIntProperty, setParent, setProperty, setRendered, setRendererType, setTransient, setupFlattenedChildrenContext, setupFlattenedContext, setValueBinding, setValueExpression, subscribeToEvent, tearDownFlattenedChildrenContext, tearDownFlattenedContext, toString, unsubscribeFromEvent, updateChildren, updateChildrenImpl, validateChildren, validateChildrenImpl
addPartialTarget, broadcastInContext, clearCachedClientIds, defaultGetRenderedFacetsAndChildren, encodeFlattenedChild, encodeFlattenedChildren, getLogicalParent, getLogicalParent, getStateHelper, getStateHelper, isVisitable, partialEncodeVisit, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, setPartialTarget, setupChildrenEncodingContext, setupChildrenVisitingContext, setupEncodingContext, setUpEncodingContext, setupVisitingContext, tearDownChildrenEncodingContext, tearDownChildrenVisitingContext, tearDownEncodingContext, tearDownVisitingContext, visitAllChildren, visitChildren, visitChildren, visitTree, visitTree
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getTransientStateHelper, getTransientStateHelper, isCompositeComponent, isInView, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView
public static final org.apache.myfaces.trinidad.bean.FacesBean.Type TYPE
public static final org.apache.myfaces.trinidad.bean.PropertyKey INLINE_STYLE_KEY
public static final org.apache.myfaces.trinidad.bean.PropertyKey STYLE_CLASS_KEY
@Deprecated public static final org.apache.myfaces.trinidad.bean.PropertyKey CUSTOMIZATION_ID_KEY
@Deprecated public static final org.apache.myfaces.trinidad.bean.PropertyKey DATA_ATTRIBUTE_KEY
<af:switcher>
should be used instead of this attribute.public static final java.lang.String COMPONENT_FAMILY
public static final java.lang.String COMPONENT_TYPE
@Deprecated public final java.lang.String getCustomizationId()
id
attribute should be used when applying
persistent customizations. This attribute will be removed in the next release.@Deprecated public final void setCustomizationId(java.lang.String customizationId)
id
attribute should be used when applying
persistent customizations. This attribute will be removed in the next release.customizationId
- the new customization ID@Deprecated public final java.lang.String getDataAttribute()
<af:switcher>
should be used instead of this attribute.UIDataCell
instance.@Deprecated public final void setDataAttribute(java.lang.String dataAttribute)
<af:switcher>
should be used instead of this attribute.UIDataCell
instance.dataAttribute
- the data attributepublic java.lang.String getInlineStyle()
public void setInlineStyle(java.lang.String inlineStyle)
inlineStyle
- the data cell's inline stylepublic java.lang.String getStyleClass()
public void setStyleClass(java.lang.String styleClass)
styleClass
- the data cell's style classpublic java.lang.String getFamily()
getFamily
in class org.apache.myfaces.trinidad.component.UIXComponentBase
protected org.apache.myfaces.trinidad.bean.FacesBean.Type getBeanType()
getBeanType
in class org.apache.myfaces.trinidad.component.UIXComponentBase