You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Philippe Steinmetz <st...@ISI.EDU> on 2007/09/20 22:19:02 UTC

[T5] Grid component

Is there a way to add extra parameters to a grid component without having to
modify the source class/bean itself? I am displaying a list of objects that
I want to add a column for Edit and Delete links for each item. These links
should not be part of the data structure since they are part of a framework
that exists outside of tapestry itself. Should I be using a different
component?

 

Jean-Philippe Steinmetz

-----------------------------------

Webmaster / Developer

Information Sciences Institute

University of Southern California

steinmet@isi.edu

310.448.8471

 


Re: [T5] Grid component

Posted by Nick Westgate <ni...@key-planning.co.jp>.
There's already a JIRA for this.

"Programly Add Columns/Cells for Grid Component"
http://issues.apache.org/jira/browse/TAPESTRY-1416

But that was added in April, and this month Howard added and fixed:
"Support removal and reordering of BeanModel properties inside Grid
and BeanEditForm components"
http://issues.apache.org/jira/browse/TAPESTRY-1742

... where he commented:
"I don't think there's a reasonable way to accomplish adding new
(synthetic?) properties using parameters."

Anyway, add to the first JIRA if you disagree.

Cheers,
Nick.


Jean-Philippe Steinmetz wrote:
> Thanks for your reply. Hmmm... I tried this and nothing shows up. Am I
> missing something? Seems like an awful lot of work to add one column.
> 
> Jean-Philippe
> 
>> -----Original Message-----
>> From: Robin Helgelin [mailto:lobbin@gmail.com]
>> Sent: Thursday, September 20, 2007 1:40 PM
>> To: Tapestry users
>> Subject: Re: [T5] Grid component
>>
>> On 9/20/07, Robin Helgelin <lo...@gmail.com> wrote:
>>>         userModel.add("action", new
>>> ActionPC()).label("Actions").sortable(false);
>> Oops.
>>
>> class ActionPC implements PropertyConduit {
>>     public Object get(Object arg0) {return "";}
>>     public Class getPropertyType() {return String.class;}
>>     public void set(Object arg0, Object arg1) {}
>>     public <T extends Annotation> T getAnnotation(Class<T> arg0) {return
>> null;}
>> }
>>
>>
>> --
>>         regards,
>>         Robin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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


RE: [T5] Grid component

Posted by Jean-Philippe Steinmetz <st...@ISI.EDU>.
Thanks for your reply. Hmmm... I tried this and nothing shows up. Am I
missing something? Seems like an awful lot of work to add one column.

Jean-Philippe

> -----Original Message-----
> From: Robin Helgelin [mailto:lobbin@gmail.com]
> Sent: Thursday, September 20, 2007 1:40 PM
> To: Tapestry users
> Subject: Re: [T5] Grid component
> 
> On 9/20/07, Robin Helgelin <lo...@gmail.com> wrote:
> >         userModel.add("action", new
> > ActionPC()).label("Actions").sortable(false);
> 
> Oops.
> 
> class ActionPC implements PropertyConduit {
>     public Object get(Object arg0) {return "";}
>     public Class getPropertyType() {return String.class;}
>     public void set(Object arg0, Object arg1) {}
>     public <T extends Annotation> T getAnnotation(Class<T> arg0) {return
> null;}
> }
> 
> 
> --
>         regards,
>         Robin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: [T5] Grid component

Posted by Robin Helgelin <lo...@gmail.com>.
On 9/20/07, Robin Helgelin <lo...@gmail.com> wrote:
>         userModel.add("action", new
> ActionPC()).label("Actions").sortable(false);

Oops.

class ActionPC implements PropertyConduit {
    public Object get(Object arg0) {return "";}
    public Class getPropertyType() {return String.class;}
    public void set(Object arg0, Object arg1) {}
    public <T extends Annotation> T getAnnotation(Class<T> arg0) {return null;}
}


-- 
        regards,
        Robin

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


Re: [T5] Grid component

Posted by Robin Helgelin <lo...@gmail.com>.
On 9/20/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
> Is there a way to add extra parameters to a grid component without having to
> modify the source class/bean itself? I am displaying a list of objects that
> I want to add a column for Edit and Delete links for each item. These links
> should not be part of the data structure since they are part of a framework
> that exists outside of tapestry itself. Should I be using a different
> component?

I did this yesterday based on comments on this mailing list.

Page.java
    @Inject
    private BeanModelSource bms;

    @Inject
    private ComponentResources resources;

    private BeanModel userModel;

    @SetupRender
    void setup() {
        // Create model
        userModel = bms.create(UserDetails.class, false, resources);

        // Add new fields
        userModel.add("action", new
ActionPC()).label("Actions").sortable(false);

        // Setup column order
        userModel.get("action").order(10);
    }

Page.html
	<t:grid model="userModel" source="users" row="user">
		<t:parameter name="actionCell">
			<a t:type="pagelink" page="admin/users/edit" context="user.user_id">edit</a>
		</t:parameter>
	</t:grid>


-- 
        regards,
        Robin

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