Re: Editing a collection

2008-01-29 Thread Szemere Szemere
I'm going through something similar right now. Looking at the docs:

http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentstextfield

it seems that your:

value=user.loginUser

determines the field that gets updated when the form is submitted. So as
you've got 6x fields that point to the same field in your form, that's what
gets updated (take a peek at 'user' to confirm this).

I think you need to override the 'value' setting to point to your different
objects.


Re: Editing a collection

2008-01-29 Thread Michael Courcy
You mean that using value=user.loginUser tapestry alway update the 
same thing.

Thus if I change the method

User {
void setLoginUser(String loginUser){
  this.loginUser = loginUser;
  System.out.println(loginUser);
}

It should at least output the value I input in my textField ...
And that's right, it actually what's going on the input are correctly 
output


But When I outout the user itself in the page

public void setUser(User user) {
   this.user = user;
   System.out.println(user);
   }

the old value is kept

actually setUser is call before setLoginUser ...

Ok thanks I've to work on that.


Szemere Szemere a écrit :

I'm going through something similar right now. Looking at the docs:

http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentstextfield

it seems that your:

value=user.loginUser

determines the field that gets updated when the form is submitted. So as
you've got 6x fields that point to the same field in your form, that's what
gets updated (take a peek at 'user' to confirm this).

I think you need to override the 'value' setting to point to your different
objects.

  



--
Michael Courcy
http://courcy.blogspot.com
http://courcy-en.blogspot.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Editing a collection

2008-01-29 Thread Francois Armand

Michael Courcy wrote:
You mean that using value=user.loginUser tapestry alway update the 
same thing.

Thus if I change the method

User {
void setLoginUser(String loginUser){
  this.loginUser = loginUser;
  System.out.println(loginUser);
}

It should at least output the value I input in my textField ...
And that's right, it actually what's going on the input are correctly 
output


But When I outout the user itself in the page

public void setUser(User user) {
   this.user = user;
   System.out.println(user);
   }

the old value is kept

actually setUser is call before setLoginUser ...

Ok thanks I've to work on that.


If you want, I built a ListEditor to handle this kind of things. It's 
part of my project, http://interldap.org
What you may looking for is here : 
http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-common/trunk/src/main/java/org/interldap/wui/t5lib/components/ListEditor.java?view=markuprev=672

And here there is an example of use case (it really lacks a lot of doc) :
http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-common/trunk/src/main/resources/org/interldap/wui/t5lib/components/eschema/EditAttribute.tml?view=markuprev=568

That build a list of input fields, with a [delete] button next to them, 
and [add new value] button at the end of the list.
Each button emits an events so that enclosing component can add or 
delete matching value from list.
When you click on a button, updated values are set in the list at the 
right place.


It may be use to construct simpler list editor.

Hope it may help !

--
Francois Armand
Etudes  Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
---
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/

Open Source identities management and federation


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Editing a collection

2008-01-29 Thread Michael Courcy

Hi François

Thanks a lot, but actually my goal was more on understanding the loop 
inside the form and how the model is updated in such situation.


I keep your link though, I'll have a look on it.


Michael.

Francois Armand a écrit :

Michael Courcy wrote:
You mean that using value=user.loginUser tapestry alway update the 
same thing.

Thus if I change the method

User {
void setLoginUser(String loginUser){
  this.loginUser = loginUser;
  System.out.println(loginUser);
}

It should at least output the value I input in my textField ...
And that's right, it actually what's going on the input are correctly 
output


But When I outout the user itself in the page

public void setUser(User user) {
   this.user = user;
   System.out.println(user);
   }

the old value is kept

actually setUser is call before setLoginUser ...

Ok thanks I've to work on that.


If you want, I built a ListEditor to handle this kind of things. 
It's part of my project, http://interldap.org
What you may looking for is here : 
http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-common/trunk/src/main/java/org/interldap/wui/t5lib/components/ListEditor.java?view=markuprev=672 


And here there is an example of use case (it really lacks a lot of doc) :
http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-common/trunk/src/main/resources/org/interldap/wui/t5lib/components/eschema/EditAttribute.tml?view=markuprev=568 



That build a list of input fields, with a [delete] button next to 
them, and [add new value] button at the end of the list.
Each button emits an events so that enclosing component can add or 
delete matching value from list.
When you click on a button, updated values are set in the list at the 
right place.


It may be use to construct simpler list editor.

Hope it may help !




--
Michael Courcy
http://courcy.blogspot.com
http://courcy-en.blogspot.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Editing a collection

2008-01-28 Thread Michael Courcy

Hi,

I make some nice night experience about editing a list in a form.

Here is my  template
===
 t:form
   t:loop source=users value=user
   t:textfield value=user.loginUser t:validate=required/br/
   /t:loop
   t:submit /
 /t:form

and here is my page
===
public class ListBean {
  
   private ListUser users = new ArrayListUser(0);

   private User user;
  
   @PageLoaded

   public void initUsers(){
   users.add(new User(mic1,pass1));
   users.add(new User(mic2,pass2));
   users.add(new User(mic3,pass3));
   users.add(new User(mic4,pass4));
   users.add(new User(mic5,pass5));
   users.add(new User(mic6,pass6));
   }
  
   public void onValidate(){

   System.out.println(users);
   }

   public ListUser getUsers() {
   return users;
   }

   public void setUsers(ListUser users) {
   this.users = users;
   }

   public User getUser() {
   return user;
   }

   public void setUser(User user) {
   this.user = user;
   }

}

I bump into really strange things ...

1) onValidate is called six time !! Probably as much as users.size() I 
guess, is that expected ?


2) Debugging and logging show me that the list of users is never updated 
whatever the input in the textfields


Is all that normal or did I miss a key concept


--
Michael Courcy
http://courcy.blogspot.com
http://courcy-en.blogspot.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]