Re: FormComponentPanel and list edit

2010-08-06 Thread Igor Vaynberg
so make it extend it. the same way formcomponentpanel does but minus
the markup bits.

-igor

On Fri, Aug 6, 2010 at 6:01 AM, Joseph Pachod
 wrote:
> hi
>
>  >
>  > List convertedInput ;
>  >
>  > public void convertInput(){
>  >  List list= new ArrayList()
>  >  // how to compose the list ?
>      listeditor.convertinput();
>     setConvertedInput(listeditor.getconvertedinput());
>
>  -igorlisteditor isn't a FormComponent, so there's no convertinput to call in 
> it. That's the core of the issue in fact.
>
> ++
> joseph
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: FormComponentPanel and list edit

2010-08-06 Thread Joseph Pachod
hi

  >
  > List convertedInput ;
  >
  > public void convertInput(){
  >  List list= new ArrayList()
  >  // how to compose the list ?
  listeditor.convertinput();
 setConvertedInput(listeditor.getconvertedinput());
  
  -igorlisteditor isn't a FormComponent, so there's no convertinput to call in 
it. That's the core of the issue in fact.

++
joseph


Re: FormComponentPanel and list edit

2010-08-04 Thread Igor Vaynberg
On Wed, Aug 4, 2010 at 1:00 AM, Joseph Pachod  wrote:
> Igor Vaynberg wrote:
>>
>> why not? convertinput() will cascade down to all components that need
>> them.
>>
>> -igor
>>
>
> I feel like the issue is not with the components in the list item, but with
> the wrapper around the list item.
>
> For example (pseudo code):
> public class ContactListEdit extends FormComponentPanel>{
>
> (...)
> private ListEditor contactListEdit ;
>
> onBeforeRender(){
>  if(!hasBeenRendered()){
>   contactListEdit = new ListEditor("id",listModel){
>     void onPopulateItem(item){
>        item.add(new TextField("firstname", new
> PropertyModel(item.getModel(), "firstname");
>        item.add(new TextField("lastname", new PropertyModel(item.getModel(),
> "lastname");
>     }
>   }
>   add(contactListEdit);
>  }
> }
>  (..)
>
> List convertedInput ;
>
> public void convertInput(){
>  List list= new ArrayList()
>  // how to compose the list ?
listeditor.convertinput();
   setConvertedInput(listeditor.getconvertedinput());

-igor
> }
> }
>
> The issue is then in convertInput, how to compose the list of contacts ?
>
> thanks again for your help
> ++
> joseph
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: FormComponentPanel and list edit

2010-08-04 Thread Joseph Pachod

Igor Vaynberg wrote:

why not? convertinput() will cascade down to all components that need them.

-igor
  
I feel like the issue is not with the components in the list item, but 
with the wrapper around the list item.


For example (pseudo code):
public class ContactListEdit extends FormComponentPanel>{

(...)
private ListEditor contactListEdit ;

onBeforeRender(){
 if(!hasBeenRendered()){
   contactListEdit = new ListEditor("id",listModel){
 void onPopulateItem(item){
item.add(new TextField("firstname", new 
PropertyModel(item.getModel(), "firstname");
item.add(new TextField("lastname", new 
PropertyModel(item.getModel(), "lastname");

 }
   }
   add(contactListEdit);
 }
}
  (..)

List convertedInput ;

public void convertInput(){
 List list= new ArrayList()
 // how to compose the list ?
 setConvertedInput(list);
}
}

The issue is then in convertInput, how to compose the list of contacts ?

thanks again for your help
++
joseph

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: FormComponentPanel and list edit

2010-08-04 Thread Igor Vaynberg
why not? convertinput() will cascade down to all components that need them.

-igor

On Wed, Aug 4, 2010 at 12:03 AM, Joseph Pachod  wrote:
> Igor Vaynberg wrote:
>>
>> visit all the children, check if they are a FormComponent and call
>> convertinput() followed by getconvertedinput()
>>
>> -igor
>>
>
> hi
>
> thanks igor
>
> we thought of that, but the issue is that we need to handle the
> getconvertedinput
>
> For example, if I've a ContactListEdit, with each item having 2 TextFields
> (on firstname and lastname for example), then just calling getConvertedInput
> would'nt be enough. Each item have some getConvertedInput doing something
> like "return new Contact(firstnameEdit.getConvertedInput(),
> lastnameEdit.getConvertedInput())".
>
> or am I missing something ?
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: FormComponentPanel and list edit

2010-08-04 Thread Joseph Pachod

Igor Vaynberg wrote:

visit all the children, check if they are a FormComponent and call
convertinput() followed by getconvertedinput()

-igor
  

hi

thanks igor

we thought of that, but the issue is that we need to handle the 
getconvertedinput


For example, if I've a ContactListEdit, with each item having 2 
TextFields (on firstname and lastname for example), then just calling 
getConvertedInput would'nt be enough. Each item have some 
getConvertedInput doing something like "return new 
Contact(firstnameEdit.getConvertedInput(), 
lastnameEdit.getConvertedInput())".


or am I missing something ?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: FormComponentPanel and list edit

2010-08-03 Thread Igor Vaynberg
visit all the children, check if they are a FormComponent and call
convertinput() followed by getconvertedinput()

-igor

On Tue, Aug 3, 2010 at 2:42 PM, Joseph Pachod
 wrote:
> hi
> IF
> we're heavily reusing the edit components we do, and as such we wanted them 
> to behave as "good form citizen". On our way, we spotted the 
> FormComponentPanel, which seems to achieve our goal.
>
> Yet, a question has popped up: how to deal with List edit ? Indeed, none of 
> the class extending AbstractRepeater is a form component. As such, there's no 
> getConvertedInput that could be used to compose the result when using a 
> repeater.
>
> Currently, the approach we have taken is to wrap the list edit used 
> (listview/listEditor for example) in a FormComponentPanel and, on 
> convertInput, we first visit all children and call 
> IFormModelUpdateListener.updateModel where possible. And then we use the 
> backing model of the list editor to compose our result.
>
> This doesn't seem 100% right and we already had some issue where some 
> component updateModel was called before convertInput was, resulting in a null 
> convertedInput being used.
>
> In the distant future we plan to implement a list editor being a 
> FormComponent and requesting a FormComponent to populate each row. As such we 
> could iterate over each row formComponent and call getConvertedInput there.
>
> is it appropriate ? Would you recommend some other approach ?
>
> thanks in advance
> ++
> joseph

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



FormComponentPanel and list edit

2010-08-03 Thread Joseph Pachod
hi
IF
we're heavily reusing the edit components we do, and as such we wanted them to 
behave as "good form citizen". On our way, we spotted the FormComponentPanel, 
which seems to achieve our goal.

Yet, a question has popped up: how to deal with List edit ? Indeed, none of the 
class extending AbstractRepeater is a form component. As such, there's no 
getConvertedInput that could be used to compose the result when using a 
repeater.

Currently, the approach we have taken is to wrap the list edit used 
(listview/listEditor for example) in a FormComponentPanel and, on convertInput, 
we first visit all children and call IFormModelUpdateListener.updateModel where 
possible. And then we use the backing model of the list editor to compose our 
result.

This doesn't seem 100% right and we already had some issue where some component 
updateModel was called before convertInput was, resulting in a null 
convertedInput being used.

In the distant future we plan to implement a list editor being a FormComponent 
and requesting a FormComponent to populate each row. As such we could iterate 
over each row formComponent and call getConvertedInput there.

is it appropriate ? Would you recommend some other approach ?

thanks in advance
++
joseph