Grid Layouts in ADF Faces using Trinidad

Posted by frank.nimphius on Oracle Blogs See other posts from Oracle Blogs or by frank.nimphius
Published on Tue, 07 Dec 2010 20:50:32 +0000 Indexed on 2010/12/08 5:46 UTC
Read the original article Hit count: 332

Filed under:

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

.

© Oracle Blogs or respective owner

Related posts about ADFv