Skip navigation links

Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1.7.0)
E10684-08


oracle.adf.view.rich.component.rich.fragment
Class RichDynamicDeclarativeComponent

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by org.apache.myfaces.trinidad.component.UIXComponent
          extended by org.apache.myfaces.trinidad.component.UIXComponentBase
              extended by oracle.adf.view.rich.component.fragment.ContextSwitchingComponent
                  extended by oracle.adf.view.rich.component.fragment.UIXInclude
                      extended by oracle.adf.view.rich.component.fragment.UIXDynamicDeclarativeComponent
                          extended by oracle.adf.view.rich.component.rich.fragment.RichDynamicDeclarativeComponent

All Implemented Interfaces:
javax.faces.component.NamingContainer, javax.faces.component.StateHolder, org.apache.myfaces.trinidad.component.FlattenedComponent

public class RichDynamicDeclarativeComponent
extends UIXDynamicDeclarativeComponent
implements javax.faces.component.NamingContainer

Defines a dynamic declarative component without a need for a specific tag. Dynamic declarative components allow the UI definition of a component to be defined in terms of a composition of other components and then treated as a single component.

You can pass attributes using JSP tag attributes, or by using <f:attribute>. Facets can also be set as normal using <f:facet> tags. The definition can refer to the attributes of the component by using the "var" EL variable and the component itself using the "componentVar" EL variable that are setup on the <af:componentDef> tag. The definition can reference a facet using the <af:facetRef> tag. Each facet can only be referenced once.

If you put a component as a child of a declarative component but fail to put it inside of a facet and fail to reference that facet in the component definition file (via facetRef), that component will not be rendered.

Dynamic declarative components support flattened chlidren. This means that children of the declarative component can be seen by the declarative component parent. So for example, input components at the root level of the declarative component will be correctly rendered if the declarative component resides in a panelFormLayout component.

Dynamic declarative components support being a partial trigger as well as a partial target. The component will trigger partial updates when any of its children broadcast an event. So for example, a value change event in an input text component that is a child of the declarative component will trigger components listening on the declarative components. By using #{attrs.partialTriggers} (assuming var is 'attrs'), child components may partially update when an action triggers the declarative component. One difference from other components is that the declarative component itself is not re-rendered. Therefore, to be able to change the viewId of the declarative component during a partial update, the parent of the declarative component must be updated.

Note about stretching layouts and flowing/scrolling layouts:

With today's web browsers, it is not reliable to have vertically-stretched content inside of areas that also have scroll bars. If you want the outer areas of your page structure to stretch, you need to be careful of how you assemble your component tree.

Rules of thumb:

  1. Never place a scrolling panelGroupLayout inside of another scrolling panelGroupLayout since users do not like nested scroll bars.
  2. Never specify percentage heights in any component's inlineStyle attribute.
  3. Never use the "position" style in any component's inlineStyle attribute.
  4. Unless you are using fixed pixel heights on them, you would never place a panelSplitter or panelStretchLayout inside of any panelGroupLayout regardless of what you have set its layout attribute to.

If you believe that you need to break one of these rules, this is an indication that your page structure is not following the page structure guidelines and you will likely have troubles getting your application to render consistently across various web browsers and computing platforms.

Example:

 <af:declarativeComponent
   id="weather"
   viewid="pagefragments_weatherBox_jsff"
   zip="94065"
   description="Redwood Shores, CA">
   <f:facet name="forecastSummary">
     <af:outputText value="Partly Cloudy"/>
   </f:facet>
   <f:facet name="forecastDetail">
     <af:panelGroupLayout layout="vertical">
       <af:outputText value="72'F"/>
       <af:outputText value="Partly Cloudy"/>
       <af:outputText value="Wind: W at 16 mph"/>
       <af:outputText value="Humidity: 46%"/>
     </af:panelGroupLayout>
   </f:facet>
 </af:declarativeComponent>
 

And this is the corresponding pagefragments/weatherBox.jsff:

 <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
           version="2.1">
   <af:componentDef var="attrs">
     <af:xmlContent>
 <component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
   <description>
   This component will show weather forecasts in a box.
   </description>
   <facet>
     <facet-name>forecastSummary</facet-name>
     <description>This child draws out the summary forecast</description>
   </facet>
   <facet>
     <facet-name>forecastDetail</facet-name>
     <description>This child draws out the detailed forecast</description>
   </facet>
   <attribute>
     <attribute-name>zip</attribute-name>
     <description>The Zip code of the area</description>
     <required>true</required>
   </attribute>
   <attribute>
     <attribute-name>description</attribute-name>
     <default-value>Unknown</default-value>
     <description>The city/state of the zip code </description>
   </attribute>
 </component>
     </af:xmlContent>
     <af:panelHeader text="Weather Forecast for Zip:#{attrs.zip}, #{attrs.description}"
       partialTriggers="#{attrs.partialTriggers}">
       <af:facetRef facetname="forecastSummary"/>
       <af:showDetail>
         <af:facetRef facetname="forecastDetail"/>
       </af:showDetail>
     </af:panelHeader>
   </af:componentDef>        
 </jsp:root>
 

Events:

Type Phases Description
org.apache.myfaces.trinidad.event.AttributeChangeEvent Invoke Application
Apply Request Values
Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.

Field Summary
static java.lang.String COMPONENT_FAMILY
           
static java.lang.String COMPONENT_TYPE
           
static org.apache.myfaces.trinidad.bean.PropertyKey CUSTOMIZATION_ID_KEY
          Deprecated. 
static org.apache.myfaces.trinidad.bean.PropertyKey PARTIAL_TRIGGERS_KEY
           
static org.apache.myfaces.trinidad.bean.FacesBean.Type TYPE
           

 

Fields inherited from class oracle.adf.view.rich.component.fragment.UIXDynamicDeclarativeComponent
CLIENT_ATTRIBUTES_KEY, CLIENT_COMPONENT_KEY

 

Fields inherited from class oracle.adf.view.rich.component.fragment.UIXInclude
COMPONENT_VAR_KEY, VAR_KEY, VIEW_ID_KEY

 

Fields inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase
BINDING_KEY, ID_KEY, RENDERED_KEY, RENDERER_TYPE_KEY, TRANSIENT_KEY

 

Fields inherited from class javax.faces.component.UIComponent
bindings

 

Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR

 

Constructor Summary
  RichDynamicDeclarativeComponent()
          Construct an instance of the RichDynamicDeclarativeComponent.
protected RichDynamicDeclarativeComponent(java.lang.String rendererType)
          Construct an instance of the RichDynamicDeclarativeComponent.

 

Method Summary
protected  org.apache.myfaces.trinidad.bean.FacesBean.Type getBeanType()
           
 java.lang.String getCustomizationId()
          Deprecated. This attribute is deprecated. This attribute will be removed in the next release. Use the 'id' attribute instead.
 java.lang.String getFamily()
           
 java.lang.String[] getPartialTriggers()
          Gets the IDs of the components that should trigger a partial update.
 void setCustomizationId(java.lang.String customizationId)
          Deprecated. This attribute is deprecated. This attribute will be removed in the next release. Use the 'id' attribute instead.
protected  void setPartialTarget(javax.faces.context.FacesContext facesContext, org.apache.myfaces.trinidad.context.PartialPageContext partialContext)
          
 void setPartialTriggers(java.lang.String[] partialTriggers)
          Sets the IDs of the components that should trigger a partial update.

 

Methods inherited from class oracle.adf.view.rich.component.fragment.UIXDynamicDeclarativeComponent
getClientAttributes, isClientComponent, setClientAttributes, setClientComponent

 

Methods inherited from class oracle.adf.view.rich.component.fragment.UIXInclude
broadcast, createFacesBean, getAttribute, getComponentVar, getRenderedFacetsAndChildren, getVar, getViewId, invokeOnComponent, queueEvent, setAttribute, setComponentVar, setupVisitingContext, setVar, tearDownVisitingContext

 

Methods inherited from class oracle.adf.view.rich.component.fragment.ContextSwitchingComponent
encodeBegin, encodeEnd, finishComponentEncoding, isFlatteningChildren, processDecodes, processFlattenedChildren, processUpdates, processValidators, restoreContext, setupContext

 

Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase
adaptMethodBinding, addAttributeChange, addAttributeChangeListener, addComponentChange, addComponentChange, addComponentChangeFilter, addFacesListener, broadcastToMethodBinding, broadcastToMethodExpression, decode, decodeChildren, decodeChildrenImpl, encodeChildren, findComponent, getAttributeChangeListener, getAttributeChangeListeners, getAttributes, getBooleanProperty, getChildCount, getChildren, getClientId, getComponentChangeFilters, getContainerClientId, getFacesBean, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacetNames, getFacets, getFacetsAndChildren, getId, getIntProperty, getLifecycleRenderer, getParent, getProperty, getPropertyKey, getRenderer, getRendererType, getRendersChildren, getValueBinding, getValueExpression, invokeOnChildrenComponents, invokeOnNamingContainerComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, removeAttributeChangeListener, removeComponentChangeFilter, removeFacesListener, restoreState, satisfiesPartialTrigger, saveState, setAttributeChangeListener, setAttributeChangeListener, setBooleanProperty, setId, setIntProperty, setParent, setProperty, setRendered, setRendererType, setTransient, setValueBinding, setValueExpression, toString, updateChildren, updateChildrenImpl, validateChildren, validateChildrenImpl

 

Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponent
addPartialTarget, encodeFlattenedChild, encodeFlattenedChildren, getLogicalParent, getLogicalParent, isVisitable, partialEncodeVisit, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, setUpEncodingContext, tearDownEncodingContext, visitTree, visitTree

 

Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

TYPE

public static final org.apache.myfaces.trinidad.bean.FacesBean.Type TYPE

CUSTOMIZATION_ID_KEY

@Deprecated
public static final org.apache.myfaces.trinidad.bean.PropertyKey CUSTOMIZATION_ID_KEY
Deprecated. 

PARTIAL_TRIGGERS_KEY

public static final org.apache.myfaces.trinidad.bean.PropertyKey PARTIAL_TRIGGERS_KEY

COMPONENT_FAMILY

public static final java.lang.String COMPONENT_FAMILY
See Also:
Constant Field Values

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
See Also:
Constant Field Values

Constructor Detail

RichDynamicDeclarativeComponent

public RichDynamicDeclarativeComponent()
Construct an instance of the RichDynamicDeclarativeComponent.

RichDynamicDeclarativeComponent

protected RichDynamicDeclarativeComponent(java.lang.String rendererType)
Construct an instance of the RichDynamicDeclarativeComponent.

Method Detail

setPartialTarget

protected void setPartialTarget(javax.faces.context.FacesContext facesContext,
                                org.apache.myfaces.trinidad.context.PartialPageContext partialContext)
Overrides:
setPartialTarget in class org.apache.myfaces.trinidad.component.UIXComponent

getCustomizationId

@Deprecated
public final java.lang.String getCustomizationId()
Deprecated. This attribute is deprecated. This attribute will be removed in the next release. Use the 'id' attribute instead.
Gets This attribute is deprecated. The 'id' attribute should be used when applying persistent customizations. This attribute will be removed in the next release.
Returns:
the new customizationId value

setCustomizationId

@Deprecated
public final void setCustomizationId(java.lang.String customizationId)
Deprecated. This attribute is deprecated. This attribute will be removed in the next release. Use the 'id' attribute instead.
Sets This attribute is deprecated. The 'id' attribute should be used when applying persistent customizations. This attribute will be removed in the next release.
Parameters:
customizationId - the new customizationId value

getPartialTriggers

public final java.lang.String[] getPartialTriggers()
Gets the IDs of the components that should trigger a partial update. This component will listen on the trigger components. If one of the trigger components receives an event that will cause it to update in some way, this component will request to be updated too. Identifiers are relative to the source component (this component), and must account for NamingContainers. If your component is already inside of a naming container, you can use a single colon to start the search from the root of the page, or multiple colons to move up through the NamingContainers - "::" will pop out of the component's naming container (or itself if the component is a naming container) and begin the search from there, ":::" will pop out of two naming containers (including itself if the component is a naming container) and begin the search from there, etc.
Returns:
the new partialTriggers value

setPartialTriggers

public final void setPartialTriggers(java.lang.String[] partialTriggers)
Sets the IDs of the components that should trigger a partial update. This component will listen on the trigger components. If one of the trigger components receives an event that will cause it to update in some way, this component will request to be updated too. Identifiers are relative to the source component (this component), and must account for NamingContainers. If your component is already inside of a naming container, you can use a single colon to start the search from the root of the page, or multiple colons to move up through the NamingContainers - "::" will pop out of the component's naming container (or itself if the component is a naming container) and begin the search from there, ":::" will pop out of two naming containers (including itself if the component is a naming container) and begin the search from there, etc.
Parameters:
partialTriggers - the new partialTriggers value

getFamily

public java.lang.String getFamily()
Overrides:
getFamily in class UIXDynamicDeclarativeComponent

getBeanType

protected org.apache.myfaces.trinidad.bean.FacesBean.Type getBeanType()
Overrides:
getBeanType in class UIXDynamicDeclarativeComponent

Skip navigation links

Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1.7.0)
E10684-08


Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.