X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv
    December 7, 2010

Grid Layouts in ADF Faces using Trinidad

Frank Nimphius
Master Principal Product Manager

ADF Faces does provide a data table component but none to
define grid layouts. Grids are common in web design and developers often
try HTML table markup wrapped in an f:verbatim tag or directly added the page to build a desired layout. Usually these attempts fail, showing unpredictable results,

However, ADF Faces does not provide a table layout
component, but Apache MyFaces Trinidad does. The Trinidad trh:tableLayout component
is a thin wrapper around the HTML table element and contains a series of row
layout elements, trh:rowLayout. Each trh:rowLayout component may contain one or
many trh:cellLayout components to format cells content.

<trh:tableLayout id="tl1"
halign="left">

  <trh:rowLayout id="rl1"
valign="top" halign="left">

    <trh:cellFormat id="cf1"
width="100" header="true">

       <af:outputLabel value="Label
1" id="ol1"/>

    </trh:cellFormat>

    <trh:cellFormat id="cf2"
header="true"

                              width="300">

       <af:outputLabel value="Label 2"
id="outputLabel1"/>

       </trh:cellFormat>

     </trh:rowLayout>

     <trh:rowLayout
id="rowLayout1" valign="top" halign="left">

       <trh:cellFormat
id="cellFormat1" width="100" header="false">

          <af:outputLabel
value="Label 3" id="outputLabel2"/>

       </trh:cellFormat>

    </trh:rowLayout>

       ...

</trh:tableLayout>

To add the Trinidad tag library to your ADF Faces
projects ...

  • Open
    the Component Palette and right mouse click into it
  • Choose
    "Edit Tag Libraries" and select the Trinidad components. Move them to
    the "Selected Libraries" section and Ok the dialog.
  • The
    first time you drag a Trinidad component to a page, the web.xml file is updated
    with the required filters

Note: The
Trinidad tags don't participate in the ADF Faces RC geometry management. However,
they are JSF components that are part of the JSF request lifecycle.

ADF Faces RC components work well with Trinidad layout
components that don't use PPR. The PPR implementation of Trinidad is different
from the one in ADF Faces. However, when you mix ADF Faces components with
Trinidad components, avoid Trinidad components that have integrated PPR behavior.
Only use passive Trinidad components.

See:

http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/trh_tableLayout.html

http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/trh_rowLayout.html

http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/trh_cellFormat.html

.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.