incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bertrand, Shawn R" <shawn.bertr...@tycoelectronics.com>
Subject Layout components in custom renderers
Date Wed, 21 Feb 2007 19:51:35 GMT
Hi all,

 

I'd like to use the Trinidad layout components (HtmlTableLayout,
HtmlRowLayout, and HtmlCellFormat) in a custom component I've developed,
but I'm not sure how to integrate each component of the table together.
I'm sure I'm missing something basic (like linking them in parent-child
relationships), so thanks for your help in clarifying this.

 

I originally thought calling the encode methods would do the trick, but
output suggested that rows need to be linked to the table, and cells
need to be linked to the rows.  The code I had is below.

 

Thanks,

 

Shawn

 

 

        // Start JSF table layout

        HtmlTableLayout tblLayout = new HtmlTableLayout();

        tblLayout.setBorderWidth(0);

        tblLayout.setCellPadding(3);

        tblLayout.setCellSpacing(3);

        tblLayout.encodeBegin(context);

 

        // Iterate over each row

        HtmlRowLayout rowLayout;

        HtmlCellFormat cellFormat;

        for (LabelFieldComponent comp : comps)

        {

            // Start row

            rowLayout = new HtmlRowLayout();

            rowLayout.encodeBegin(context);

 

            // Start label cell

            cellFormat = new HtmlCellFormat();

            cellFormat.setHalign(comp.getLabel().getHAlign());

 
cellFormat.setHeight(Integer.valueOf(comp.getLabel().getHeight()).toStri
ng());

 
cellFormat.setWidth(Integer.valueOf(comp.getLabel().getWidth()).toString
());

            cellFormat.setValign(comp.getLabel().getVAlign());

            cellFormat.encodeBegin(context);

 

            // Insert label

            writer.write(comp.getLabel().getText());

 

            // End label cell

            cellFormat.encodeEnd(context);

 

            // Start field cell

            cellFormat = new HtmlCellFormat();

            cellFormat.setHalign(comp.getField().getHAlign());

 
cellFormat.setHeight(Integer.valueOf(comp.getField().getHeight()).toStri
ng());

            cellFormat.setValign(comp.getField().getVAlign());

            cellFormat.encodeBegin(context);

 

            // Insert field

            writer.write(comp.getField().getHTML());

 

            // End label cell

            cellFormat.encodeEnd(context);

 

            // End row

            rowLayout = new HtmlRowLayout();

            rowLayout.encodeEnd(context);

        }

 

        // Complete layout

        tblLayout.encodeEnd(context);

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message