You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by daniel alonso <al...@gmail.com> on 2008/06/02 09:34:55 UTC

Moving grid and stuff related to a single component

Hi everybody again. Firstly I would like to give a lot of thanks to all the
people that supports this mailing list, because they give a lot of help.

My present problem is that I'm trying to move properties associated with a
grid from a Page's Pojo to a component, but when the user submit the for, I
get null values.

Best way to understand what I'm telling is with some code ^_^:

Class AddUser

public class AddCelebrity {

............
............
...........

@Persist
private List<User> userList;
private User user;

@Retain
private BeanModel userModel;
@Inject
private BeanModelSource beanModelSource;

.................
................
................

public List<User> getUserList() {
        return userList;
    }

public void setUserList(List<User> userList) {
        this.userList= userList;
}

 void pageLoaded() {
        userModel= beanModelSource.create(User.class, true,
                resources);
        userModel.get("name").sortable(false);

}

public BeanModelSource getBeanModelSource() {
        return beanModelSource;
}

public void setBeanModelSource(BeanModelSource beanModelSource) {
        this.beanModelSource = beanModelSource;
}


}


AddUser.tml


...............
..............

<t:grid align="center" rowsPerPage="5" pagerPosition="top" exclude="id"
reorder="nombre,apellido1,apellido2,dni,fechaNacim,relacion"
                source="userList" row="user" model="userModel">
                <t:parameter name="nameCell">
                    <input t:type="textfield" t:id="name" t:value="user.name
"/>
                </t:parameter>
                <t:parameter name="surnameCell">
                    <input t:type="textfield" t:id="surname"
t:value="user.surname"/>
                </t:parameter>

</t:grid>


...............

..............


END
------


The thing is that I need to move all this stuff to a component, but i'm
always getting null values on submitting the form. Anyone has an idea of
what can i do?

Thanks again for your attention :D

Re: Moving grid and stuff related to a single component

Posted by daniel alonso <al...@gmail.com>.
My solution looks like this:

UserPage.java
------------------------------

public class UserPage{
..........
............

@Persist
    private List<User> users;

............

public List<User> getUsers() {
        if (users== null) {
            users= new ArrayList<User>();
            users.add(new User());
            users.add(new User());
            users.add(new User());
            users.add(new User());
            users.add(new User());

        }
        return beneficiarios;
    }

}


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

UserPage.tml

..........
.........
<t:usersComponent
                users="users" />

..........
........


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


UsersComponent.java

   @Parameter(required = true)
    private List<User> users;
    private User user;
    @Retain
    private BeanModel userModel;
    @Inject
    private ComponentResources resources;
    @Inject
    private BeanModelSource beanModelSource;
    public  List<User> getUsers() {
        return users;
    }

    public void setUsers( List<Beneficiario> users) {
        this.users= users;
    }

    void pageLoaded() {
        userModel= beanModelSource.create(User.class, true,
                resources);

    }

......[getters setters, etc].,....


usersComponent.tml

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

<t:grid align="center" rowsPerPage="5"
                        pagerPosition="top"
                        source="users" row="user"
                        model="userModel">
                        <t:parameter name="nameCell">
                            <input t:type="textfield" t:id="name"
                                t:value="user.name" />
                        </t:parameter>
                        <t:parameter name="surnameCell">
                            <input t:type="textfield" t:id="surname"
                                t:value="user.surname" />
                        </t:parameter>

                    </t:grid>

2008/6/2 nicholas Krul <ni...@gmail.com>:

> actually, I would...
>
> currently I have to click the property key in order to be able to set it...
> I tried the in-grid approach, but just went around it when it didn't
> work...
>
> Please share.
>
> On Mon, Jun 2, 2008 at 11:47 AM, daniel alonso <al...@gmail.com>
> wrote:
>
> > Sorry again people, I have just solved the problem. If someone would like
> > to
> > know the solution, just ask me ;D
> >
> > 2008/6/2 daniel alonso <al...@gmail.com>:
> >
> > > Hi everybody again. Firstly I would like to give a lot of thanks to all
> > the
> > > people that supports this mailing list, because they give a lot of
> help.
> > >
> > > My present problem is that I'm trying to move properties associated
> with
> > a
> > > grid from a Page's Pojo to a component, but when the user submit the
> for,
> > I
> > > get null values.
> > >
> > > Best way to understand what I'm telling is with some code ^_^:
> > >
> > > Class AddUser
> > >
> > > public class AddCelebrity {
> > >
> > > ............
> > > ............
> > > ...........
> > >
> > > @Persist
> > > private List<User> userList;
> > > private User user;
> > >
> > > @Retain
> > > private BeanModel userModel;
> > > @Inject
> > > private BeanModelSource beanModelSource;
> > >
> > > .................
> > > ................
> > > ................
> > >
> > > public List<User> getUserList() {
> > >         return userList;
> > >     }
> > >
> > > public void setUserList(List<User> userList) {
> > >         this.userList= userList;
> > > }
> > >
> > >  void pageLoaded() {
> > >         userModel= beanModelSource.create(User.class, true,
> > >                 resources);
> > >         userModel.get("name").sortable(false);
> > >
> > > }
> > >
> > > public BeanModelSource getBeanModelSource() {
> > >         return beanModelSource;
> > > }
> > >
> > > public void setBeanModelSource(BeanModelSource beanModelSource) {
> > >         this.beanModelSource = beanModelSource;
> > > }
> > >
> > >
> > > }
> > >
> > >
> > > AddUser.tml
> > >
> > >
> > > ...............
> > > ..............
> > >
> > > <t:grid align="center" rowsPerPage="5" pagerPosition="top" exclude="id"
> > > reorder="nombre,apellido1,apellido2,dni,fechaNacim,relacion"
> > >                 source="userList" row="user" model="userModel">
> > >                 <t:parameter name="nameCell">
> > >                     <input t:type="textfield" t:id="name" t:value="
> > > user.name"/>
> > >                 </t:parameter>
> > >                 <t:parameter name="surnameCell">
> > >                     <input t:type="textfield" t:id="surname"
> > > t:value="user.surname"/>
> > >                 </t:parameter>
> > >
> > > </t:grid>
> > >
> > >
> > > ...............
> > >
> > > ..............
> > >
> > >
> > > END
> > > ------
> > >
> > >
> > > The thing is that I need to move all this stuff to a component, but i'm
> > > always getting null values on submitting the form. Anyone has an idea
> of
> > > what can i do?
> > >
> > > Thanks again for your attention :D
> > >
> > >
> > >
> > >
> >
>

Re: Moving grid and stuff related to a single component

Posted by nicholas Krul <ni...@gmail.com>.
actually, I would...

currently I have to click the property key in order to be able to set it...
I tried the in-grid approach, but just went around it when it didn't work...

Please share.

On Mon, Jun 2, 2008 at 11:47 AM, daniel alonso <al...@gmail.com>
wrote:

> Sorry again people, I have just solved the problem. If someone would like
> to
> know the solution, just ask me ;D
>
> 2008/6/2 daniel alonso <al...@gmail.com>:
>
> > Hi everybody again. Firstly I would like to give a lot of thanks to all
> the
> > people that supports this mailing list, because they give a lot of help.
> >
> > My present problem is that I'm trying to move properties associated with
> a
> > grid from a Page's Pojo to a component, but when the user submit the for,
> I
> > get null values.
> >
> > Best way to understand what I'm telling is with some code ^_^:
> >
> > Class AddUser
> >
> > public class AddCelebrity {
> >
> > ............
> > ............
> > ...........
> >
> > @Persist
> > private List<User> userList;
> > private User user;
> >
> > @Retain
> > private BeanModel userModel;
> > @Inject
> > private BeanModelSource beanModelSource;
> >
> > .................
> > ................
> > ................
> >
> > public List<User> getUserList() {
> >         return userList;
> >     }
> >
> > public void setUserList(List<User> userList) {
> >         this.userList= userList;
> > }
> >
> >  void pageLoaded() {
> >         userModel= beanModelSource.create(User.class, true,
> >                 resources);
> >         userModel.get("name").sortable(false);
> >
> > }
> >
> > public BeanModelSource getBeanModelSource() {
> >         return beanModelSource;
> > }
> >
> > public void setBeanModelSource(BeanModelSource beanModelSource) {
> >         this.beanModelSource = beanModelSource;
> > }
> >
> >
> > }
> >
> >
> > AddUser.tml
> >
> >
> > ...............
> > ..............
> >
> > <t:grid align="center" rowsPerPage="5" pagerPosition="top" exclude="id"
> > reorder="nombre,apellido1,apellido2,dni,fechaNacim,relacion"
> >                 source="userList" row="user" model="userModel">
> >                 <t:parameter name="nameCell">
> >                     <input t:type="textfield" t:id="name" t:value="
> > user.name"/>
> >                 </t:parameter>
> >                 <t:parameter name="surnameCell">
> >                     <input t:type="textfield" t:id="surname"
> > t:value="user.surname"/>
> >                 </t:parameter>
> >
> > </t:grid>
> >
> >
> > ...............
> >
> > ..............
> >
> >
> > END
> > ------
> >
> >
> > The thing is that I need to move all this stuff to a component, but i'm
> > always getting null values on submitting the form. Anyone has an idea of
> > what can i do?
> >
> > Thanks again for your attention :D
> >
> >
> >
> >
>

Re: Moving grid and stuff related to a single component

Posted by daniel alonso <al...@gmail.com>.
Sorry again people, I have just solved the problem. If someone would like to
know the solution, just ask me ;D

2008/6/2 daniel alonso <al...@gmail.com>:

> Hi everybody again. Firstly I would like to give a lot of thanks to all the
> people that supports this mailing list, because they give a lot of help.
>
> My present problem is that I'm trying to move properties associated with a
> grid from a Page's Pojo to a component, but when the user submit the for, I
> get null values.
>
> Best way to understand what I'm telling is with some code ^_^:
>
> Class AddUser
>
> public class AddCelebrity {
>
> ............
> ............
> ...........
>
> @Persist
> private List<User> userList;
> private User user;
>
> @Retain
> private BeanModel userModel;
> @Inject
> private BeanModelSource beanModelSource;
>
> .................
> ................
> ................
>
> public List<User> getUserList() {
>         return userList;
>     }
>
> public void setUserList(List<User> userList) {
>         this.userList= userList;
> }
>
>  void pageLoaded() {
>         userModel= beanModelSource.create(User.class, true,
>                 resources);
>         userModel.get("name").sortable(false);
>
> }
>
> public BeanModelSource getBeanModelSource() {
>         return beanModelSource;
> }
>
> public void setBeanModelSource(BeanModelSource beanModelSource) {
>         this.beanModelSource = beanModelSource;
> }
>
>
> }
>
>
> AddUser.tml
>
>
> ...............
> ..............
>
> <t:grid align="center" rowsPerPage="5" pagerPosition="top" exclude="id"
> reorder="nombre,apellido1,apellido2,dni,fechaNacim,relacion"
>                 source="userList" row="user" model="userModel">
>                 <t:parameter name="nameCell">
>                     <input t:type="textfield" t:id="name" t:value="
> user.name"/>
>                 </t:parameter>
>                 <t:parameter name="surnameCell">
>                     <input t:type="textfield" t:id="surname"
> t:value="user.surname"/>
>                 </t:parameter>
>
> </t:grid>
>
>
> ...............
>
> ..............
>
>
> END
> ------
>
>
> The thing is that I need to move all this stuff to a component, but i'm
> always getting null values on submitting the form. Anyone has an idea of
> what can i do?
>
> Thanks again for your attention :D
>
>
>
>