Oracle Fusion Middleware Tag Reference for Oracle ADF Faces
11g Release 2 (11.1.2.0.0)

E17491-02

<af:componentDef>

componentDef component def


Defines a declarative component.

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. First, build up a structure of stretchable components (using panelSplitters and panelStretchLayouts). Second, inside of this structure, create islands of non-stretched content. These islands should be rooted with panelGroupLayouts with layout="scroll". This is an ideal component because it can be stretched and does not stretch its children--which likely don't support being stretched anyway. 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. For specific details of about component stretching, please see the "geometry management" section in the tag documentation of each component. See the demo application for real world layout examples that you can use as a starting point in your application. A good starting point is the "Layout Basics" page listed under the "Framework Features" tab of the demo application.

Example component definition:


<?xml version='1.0' encoding='utf-8'?>
<jsp:root
  xmlns:jsp="http://java.sun.com/JSP/Page"
  xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
  version="2.0">
  <af:componentDef var="attrs" componentVar="adfComponent">
    <af:commandButton
      partialSubmit="true"
      text="#{attrs.text}"
      actionListener="#{adfComponent.handleAction}"/>
  </af:componentDef>
</jsp:root>

Example component usages:


<mytags:simpleDC text="First" actionListener="#{testSimpleDC.actionFired}"/>
</source>

<af:declarativeComponent viewid="simpleDC_jsff" text="First" actionListener="#{testSimpleDC.actionFired}"/>


Example component TLD entries


<tag>
  <description>
  Simple test of declarative components
  </description>
  <name>simpleDC</name>
  <tag-class>oracle.adfdemo.view.test.custom.SimpleDCTag</tag-class>
  <body-content>JSP</body-content>
  <attribute>
    <description>The component identifier.</description>
    <name>id</name>
  </attribute>
  <attribute>
    <description>An expression indicating where to store this component, once created.
    </description>
    <name>binding</name>
    <deferred-value/>
  </attribute>
  <attribute>
    <description>Indicates whether or not this component should be rendered.
    </description>
    <name>rendered</name>
    <deferred-value>
      <type>boolean</type>
    </deferred-value>
  </attribute>
  <attribute>
    <description>Indicates whether or not this component should be state saved.
    </description>
    <name>transient</name>
    <rtexprvalue>false</rtexprvalue>
  </attribute>
  <attribute>
    <description>a string to show
    </description>
    <name>text</name>
    <deferred-value/>
  </attribute>
  <attribute>
    <description>a method reference to an action listener</description>
    <name>actionListener</name>
    <deferred-method>
      <method-signature>void myMethod(javax.faces.event.ActionEvent)</method-signature></deferred-method>
  </attribute>
</tag>


Attributes


 
Name Type Supports EL? Description
var String No The name of the EL variable to use to reference attributes defined on this component's usage.
componentVar String No The name of the EL variable to use to identify the component instance itself.
definition String No The definition of the Declarative Component. Acceptable values are:
  • 'public': indicates that the structure of the Declarative Component will not change and that 'external references to' and 'operations on' the Declarative Component can be made from outside the Declarative Component. Customizations on components that are direct children of a Declarative Component will be persisted by FilteredPersistenceChangeManager via the 'Persistent Change Manager' registered in adf-config.xml. The direct children of the Declarative Component can be referenced in the 'partialTriggers' attribute. The Declarative Component author should clearly document any implementation specific meaning to 'public' definition.
  • 'private': indicates that the structure of the Declarative Component can change and that 'external references to' and 'operations on' the Declarative Component can not be made from outside the Declarative Component. Customizations on components that are direct children of a Declarative Component will not be persisted by FilteredPersistenceChangeManager via the 'Persistent Change Manager' registered in adf-config.xml. The direct children of the Declarative Component can not be referenced in the 'partialTriggers' attribute. The Declarative Component author should clearly document any implementation specific meaning to 'private' definition.