You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Carpels Pascal <Pa...@sycron-it.com> on 2004/08/20 13:59:06 UTC

Datagrid Linking

Thanx, it is working.
I used another Class, than the page class,  to get my columns. That was the reason of failure.

Anther related question :
The results displayed in my table are comming from a list containing VO objects.
The boolean is a field inside my object.
How can I link the <property-specification name="someProperty" type="java.lang.Boolean"/> to the property of my VO object ? Is there to catch an event ? Currently, when I go to another page inside my table and go back, all the checks are lost.


Thx,
Pascal.
-----Original Message-----
From: Sebastian Zaffarano [mailto:szaffarano@afip.gov.ar] 
Sent: donderdag 19 augustus 2004 15:21
To: Tapestry users
Subject: RE: Datagrid

in the .page you must declare the property to bind to the check
component:

.java
> 
>     	   List cols = new ArrayList();
>     	   ITableColumnModel columnModel;
>     	   AbstractTableColumn column;
>     	   IComponent comp = null;
> 
>     	   column = new SimpleTableColumn("Title");
>     	   column.setValueRendererSource(new BlockTableRendererSource(new ComponentAddress
>     	   		(comp.getComponent("checkBlock")))); // MISTAKE! here you must put the checkbox's block's name, in this example is "check" (<span jwcid="check@Block">)
>     	   cols.add(column);
>       
>     	   
>     	   // add more table columns to the 'cols' lists
>     	   column = new ExpressionTableColumn("Product", "idtProduct");
>     	   column = new ExpressionTableColumn("Name", "txtDescr");
>     	   column = new ExpressionTableColumn("StockAuto", 
> "flgStockAuto");
> 
>     	   return new SimpleTableColumnModel(cols);   
> 
> .html
> 
> <span class="DefaultTable" jwcid="tableProductInfo">
> 	
>  <span jwcid="check@Block"> 
>  	<input jwcid="@Checkbox" type="check" selected="ognl:someProperty"/>
>   </span>
>   
> </span>
> 
> .page
>  <page-specification class= "ui.web.common.ProductInfo">   
>      <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>        
>      <property-specification name="someProperty" type="java.lang.Boolean"/> <!-- property for the check -->
>      <component id="tableProductInfo" type="contrib:Table">
>          <binding name="columns" expression='productInfoCols'/>
>          <binding name="source" expression='productInfo'/>
>          <binding name="rowsClass" expression="beans.evenOdd.next"/>     
>      </component>                      
>  </page-specification>


sebastian


El jue, 19-08-2004 a las 09:58, Carpels Pascal escribió:
>  
> I still getting errors, so I remove the checkbox.
> 
> .java
> 
>     	   List cols = new ArrayList();
>     	   ITableColumnModel columnModel;
>     	   AbstractTableColumn column;
>     	   IComponent comp = null;
> 
>     	/*   column = new SimpleTableColumn("Title");
>     	   column.setValueRendererSource(new BlockTableRendererSource(new ComponentAddress
>     	   		(comp.getComponent("checkBlock"))));
>     	   cols.add(column);
>       */
>     	   
>     	   // add more table columns to the 'cols' lists
>     	   column = new ExpressionTableColumn("Product", "idtProduct");
>     	   column = new ExpressionTableColumn("Name", "txtDescr");
>     	   column = new ExpressionTableColumn("StockAuto", 
> "flgStockAuto");
> 
>     	   return new SimpleTableColumnModel(cols);   
> 
> .html
> 
> <span class="DefaultTable" jwcid="tableProductInfo">
> 	<!--
>  <span jwcid="check@Block"> 
>  	<input jwcid="@Checkbox" type="check" selected="ognl:someProperty"/>
>   </span>
>   -->
> </span>
> 
> .page
>  <page-specification class= "ui.web.common.ProductInfo">   
>      <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>        
>      
>      <component id="tableProductInfo" type="contrib:Table">
>          <binding name="columns" expression='productInfoCols'/>
>          <binding name="source" expression='productInfo'/>
>          <binding name="rowsClass" expression="beans.evenOdd.next"/>     
>      </component>                      
>  </page-specification>
> 
> No more errors now, but I only see my pagenumbers, my table is not shown ?
> 
> 
> Pascal.
> 
> -----Original Message-----
> From: Sebastian Zaffarano [mailto:szaffarano@afip.gov.ar]
> Sent: donderdag 19 augustus 2004 14:40
> To: Tapestry users
> Subject: RE: Datagrid
> 
> yes, you must bind the "selected" parameter to the Checkbox component:
> 
> >   <span jwcid="check@Block"> <input jwcid="@Checkbox" type="check"
> selected="ognl:someProperty"/>
> 
> where "someProperty" is a property specification in the .page (or .java's page), like this:
> 
>   <property-specification name="someProperty" 
> type="java.lang.Boolean"/>
> 
> Sebastian
> 
> 
> El jue, 19-08-2004 a las 09:09, Carpels Pascal escribió:
> > I have implemented this, but I get the following error :
> > 
> > Required parameter selected of component ProductInfo/$Checkbox is not bound ?
> > 
> > I think there is probably something wrong with my html or page ?
> > 
> > That is my .html
> > 
> > <span jwcid="@Border" subtitle="products">
> > <br>   
> > <p class="TitleForTable">Product info</p> <span class="DefaultTable" 
> > jwcid="tableProductInfo">
> >    <span jwcid="check@Block"> <input jwcid="@Checkbox" 
> > type="check"/> </span> </span>
> > <hr>                
> > </span>   
> > 
> > That is my .page
> > 
> > <page-specification class= "ui.web.common.ProductInfo">   
> >     <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>        
> >     
> >     <component id="tableProductInfo" type="contrib:Table">
> >         <binding name="columns" expression='productInfoCols'/>
> >         <binding name="source" expression='productInfo'/>
> >         <binding name="rowsClass" expression="beans.evenOdd.next"/>     
> >     </component>                      
> > </page-specification>
> > 
> > That is my .java
> > 
> >     public ITableColumnModel getProductInfoCols() throws Exception {   	
> >     	   List cols = new ArrayList();
> >     	   ITableColumnModel columnModel;
> >     	   AbstractTableColumn column;
> >     	   IComponent comp = null;
> > 
> >     	   column = new SimpleTableColumn("Title");
> >     	   column.setValueRendererSource(new BlockTableRendererSource(new ComponentAddress
> >     	   		(comp.getComponent("checkBlock"))));
> >     	   cols.add(column);
> >     	   
> >     	   // add more table columns to the 'cols' lists
> > 
> >     	   return new SimpleTableColumnModel(cols);    	    
> >     }
> > 
> > 
> > Pascal.
> > 
> > 
> > -----Original Message-----
> > From: Sebastian Zaffarano [mailto:szaffarano@afip.gov.ar]
> > Sent: donderdag 19 augustus 2004 14:00
> > To: Tapestry users
> > Subject: RE: Datagrid
> > 
> > you must use the class ExpressionTableColumn:
> > 
> > public ITableColumnModel getColumnsModel() {
> >    List cols = new ArrayList();
> >    ITableColumnModel columnModel;
> >    AbstractTableColumn column;
> > 
> >    column = new SimpleTableColumn("itle");
> >    column.setValueRendererSource(new BlockTableRendererSource(
> >    new ComponentAddress(getComponent("checkBlock"))));
> >    cols.add(column);
> > 
> >    // add more table columns to the 'cols' lists
> >    column = new ExpressionTableColumn("Title", "txtTitle");
> >    cols.add (column);
> > 
> >    // .......
> >    
> > 
> >    return new SimpleTableColumnModel(cols);
> > 
> > }
> > 
> > Sebastian
> > 
> > 
> > 
> > El jue, 19-08-2004 a las 04:23, Carpels Pascal escribió:
> > > Thx, for the quick response.
> > > 
> > > Before I also made use of columnsX (in the .java getColumnsX), but I used a String instead of the ITableColumModel.
> > > I used something like this : Title:txtTitle, Name:txtName , so my label were linked to a Java name. 
> > > How can you do the binding to the Java names with the ITableColumnModel ? And the getComponent in the example, in which class is this method contained ?
> > > 
> > > Pascal.
> > > 
> > > 
> > > -----Original Message-----
> > > From: Sebastian Zaffarano [mailto:szaffarano@afip.gov.ar]
> > > Sent: woensdag 18 augustus 2004 17:11
> > > To: Tapestry users
> > > Subject: RE: Datagrid
> > > 
> > > > Do you have a more complete example (page,jwc,html,java) of this ? 
> > > > (I am still very new to Tapestry)
> > > 
> > > <!-- in the .page -->
> > > <component id="table" type="contrib:Table">
> > >    <binding name="source" expression="source"/>
> > >    <binding name="columns" expression="columnsModel"/>
> > >    <binding name="row" expression="currentTableRow"/>
> > >    <static-binding name="pagesClass" value="pages-css"/>
> > >    <static-binding name="columnsClass" value="columns-css"/>
> > >    <static-binding name="rowsClass" value="rows-css"/>
> > >    <static-binding name="valuesClass" value="values-css"/> 
> > > </component>
> > > 
> > > <!-- in the .java's page file -->
> > > 
> > > public ITableColumnModel getColumnsModel() {
> > >    List cols = new ArrayList();
> > >    ITableColumnModel columnModel;
> > >    AbstractTableColumn column;
> > > 
> > >    column = new SimpleTableColumn("itle");
> > >    column.setValueRendererSource(new BlockTableRendererSource(
> > >    new ComponentAddress(getComponent("checkBlock"))));
> > >    cols.add(column);
> > > 
> > >    // add more table columns to the 'cols' lists
> > > 
> > >    return new SimpleTableColumnModel(cols); }
> > > 
> > > <!-- in the .html file -->
> > > 
> > > <span jwcid="check@Block">
> > >    <input jwcid="@Checkbox" type="check"/> </span>
> > > 
> > > 
> > > Sebastian
> > > 
> > > El mié, 18-08-2004 a las 11:36, Carpels Pascal escribió:
> > > > Do you mean to inherit from SimpleTableColumn class ?
> > > > Is there no other way, to do it ?
> > > > Do you have a more complete example (page,jwc,html,java) of this ? 
> > > > (I am still very new to Tapestry)
> > > > 
> > > > Best regards,
> > > > Pascal.
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Sebastian Zaffarano [mailto:szaffarano@afip.gov.ar]
> > > > Sent: woensdag 18 augustus 2004 16:07
> > > > To: Tapestry users
> > > > Subject: Re: Datagrid
> > > > 
> > > > for put a checkbox (or any tap component) inside a table field, you must use the SimpleTableColumn class:
> > > > 
> > > >         column = new SimpleTableColumn("TITLE");
> > > >         column.setValueRendererSource(new BlockTableRendererSource(
> > > >                 new
> > > > ComponentAddress(getComponent("BLOCK_NAME"))));
> > > > 
> > > > where "BLOCK_NAME" is a tapestry block where you put the component(s) you want to render in the table column, bye example:
> > > > 
> > > >     <span jwcid="check@Block">
> > > > 	<input jwcid="@Checkbox" type="check"/>
> > > >     </span>
> > > > 
> > > > then, when you declare the contrib:Table component, you must add 
> > > > "column" to the TableColumnModel
> > > > 
> > > > regards
> > > > Sebastian
> > > > 
> > > > El mié, 18-08-2004 a las 10:34, Carpels Pascal escribió:
> > > > > Hi all,
> > > > >  
> > > > > In our web application we use the contrib:table a lot and with success.
> > > > > But currently we need something like a grid (a datagrid like 
> > > > > in
> > > > > .Net) , in which we can put a checkbox component (see below)
> > > > >  
> > > > > --------------------------------------------------------------
> > > > > --
> > > > > --
> > > > > --
> > > > > --
> > > > > --
> > > > > --------------------
> > > > > |  Prod.ID  | Prod.Name | IsInStock  | Automatic sent an Order
> > > > > | |
> > > > > --------------------------------------------------------------
> > > > > --
> > > > > --
> > > > > --
> > > > > --
> > > > > --
> > > > > -------------------|
> > > > > |     1        | product 1   |  checkbox | checkbox
> > > > > |          
> > > > > |-------------------------------------------------------------
> > > > > |--
> > > > > |--
> > > > > |--
> > > > > |--
> > > > > |--
> > > > > -------------------|
> > > > > |     2        | product 2   |  checkbox | checkbox
> > > > > |
> > > > > |-------------------------------------------------------------
> > > > > |--
> > > > > |--
> > > > > |--
> > > > > |--
> > > > > |--
> > > > > ---------------------
> > > > > |              |                  |                 |
> > > > > |
> > > > >  
> > > > > ----------------
> > > > > | Update   |
> > > > > ----------------
> > > > >  
> > > > > The grid should be linked with a recordset, and once the user 
> > > > > choose to update we must update the products.
> > > > >  
> > > > > Does such a component already exists ? 
> > > > > If no, can I become the same result with the contrib:table component ?
> > > > > Any example would be welcome(:-
> > > > >  
> > > > > Best regards,
> > > > > Pascal.
> > > > 
> > > > 
> > > > ----------------------------------------------------------------
> > > > --
> > > > --
> > > > - To unsubscribe, e-mail: 
> > > > tapestry-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: 
> > > > tapestry-user-help@jakarta.apache.org
> > > > 
> > > > 
> > > > 
> > > > ----------------------------------------------------------------
> > > > --
> > > > --
> > > > - To unsubscribe, e-mail: 
> > > > tapestry-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: 
> > > > tapestry-user-help@jakarta.apache.org
> > > 
> > > 
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: 
> > > tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> > > tapestry-user-help@jakarta.apache.org
> > > 
> > > 
> > > 
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: 
> > > tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> > > tapestry-user-help@jakarta.apache.org
> > 
> > 
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: 
> > tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> > tapestry-user-help@jakarta.apache.org
> > 
> > 
> > 
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: 
> > tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> > tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org