[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Grid Control (FIXGRID) - Does it offer dynamic arrangement of columns/controls?  XML
Forum Index -> Development
Author Message
dietz

Active
[Avatar]

Joined: 28/11/2007 18:15:48
Messages: 9
Offline

The layout of the grid heavily depends on the configuration of the system in our application.

Is there a way, to not statically define the grid in the JSP page, but to completely configure the layout at runtime, at server side?
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

FIXGRID sounds "fix" but indeed is not. The "fix" in the name refers to the fix column sizing of the content that is managed in a grid.

As with other components the server side JSF component tree is either built hardcoded via JSP or is completely or in parts dynamically created. Enterprise Client components have a so called "componentbinding" attribute, which passes the component to a property of a managed bean.

Example: this is the layout definition
Code:
 <f:view>
 <h:form>
 <f:subview id="workplace_demoflextableg_2">
 <t:rowtitlebar id="g_2" text="Flexible table" />
 <t:rowheader id="g_3" />
 <t:rowbodypane id="g_4" >
   <t:row id="g_5" componentbinding="#{wp.demoFlexTable.rowComponent}" />
 </t:rowbodypane>
 <t:rowstatusbar id="g_6" />
 <t:modalpopup id="g_7" opened="false" >
   <t:rowinclude id="g_8" page="please specify" />
 </t:modalpopup>
 </f:subview>
 </h:form>
 </f:view>
 


The critical part is the row definition, which defines the componentbinding. This means somthing like: "Bean, you get the instance of the component, d o with it, what you like to do..."

The bean now arranges controls into the row, the control this time being a grid:

Code:
     public void setRowComponent(ROWComponent rowComponent)
     {
         if (m_rowComponent == rowComponent) return;
         m_rowComponent = rowComponent;
         // create fix grid
         FIXGRIDComponentTag fgTag = new FIXGRIDComponentTag();
         fgTag.setId("FG");
         fgTag.setObjectbinding("#{wp.demoFlexTable.rows}");
         fgTag.setSbvisibleamount("25");
         fgTag.setHeight("100%");
         fgTag.setWidth("100%");
         BaseComponent fg = fgTag.createBaseComponent();
         m_rowComponent.getChildren().add(fg);
         // create columns
         for (int j=0; j<50; j++)
         {
             GRIDCOLComponentTag gcTag = new GRIDCOLComponentTag();
             gcTag.setId("FGC"+j);
             gcTag.setText("COL"+j);
             gcTag.setWidth("100");
             BaseComponent gc = gcTag.createBaseComponent();
             fg.getChildren().add(gc);
             // create field below column
             FIELDComponentTag fiTag = new FIELDComponentTag();
             fiTag.setId("FIE"+j);
             fiTag.setText(".{values.COL"+j+"}");
             BaseComponent fi = fiTag.createBaseComponent();
             gc.getChildren().add(fi);
         }
     } 
 


In this case a grid is created, holding 50 columns and having FIELD components as tags.

...hope this helps!

Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team