Re: [Wicket-user] Wizard StaticContentStep and CompoundPropertyModel

2006-11-10 Thread Erik van Oosten

If you want to use a CompoundPropertyModel you can do something like the 
following in the constructor of the component:

setModel(new CompoundPropertyModel(...));  // where ... is either your 
POJO or another model
add(new Label("userModel.userName"));

Leave the html unchanged.
Because you did not set a model on the label, the label will search in 
its parent(s) for a CompoundPropertyModel.

Regards,
 Erik.


>> -Ursprüngliche Nachricht-
>> Von: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] Im Auftrag 
>> von [EMAIL PROTECTED]
>> Gesendet: Freitag, 10. November 2006 11:13
>> An: wicket-user@lists.sourceforge.net
>> Betreff: [Wicket-user] Wizard StaticContentStep and 
>> CompoundPropertyModel
>>
>> Hello all !
>>
>> I would like to add a CompoundPropertyModel as wizard static 
>> page. I have done so far:
>>
>> public class StepX extends StaticContentStep {
>>  
>>  /**
>>   * Constructor.
>>   * 
>>   * @param userModel
>>   */
>>  public StepX(UserModel userModel)
>>  {
>>  super(true);
>>  
>>  IModel model = new Model(userModel);
>>  setTitleModel(new ResourceModel("confirmation.title"));
>>  setSummaryModel(new 
>> StringResourceModel("confirmation.summary", this, model));
>>  
>>  setContentModel(new CompoundPropertyModel(userModel));
>>  
>>  }
>> }
>>
>> My UserModel look like this:
>>
>> public class UserModel implements Serializable {
>>
>> private String userName;
>>
>>  public final String getUserName() {
>>  return this.userName;
>>  }
>>
>>  public final void setUserName(String userName) {
>>  this.userName = userName;
>>  }
>>
>> }
>>
>>
>> How can I simply output the username property collected in a 
>> previous step? I tried the following code:
>>
>>  
>>  
>>  
>>  
>>  > wicket:id="userModel.userName">[userName]
>>  
>>  
>>  
>>  
>>
>>
>> ... but wicket gives me the following error message:
>>
>> unable to find component with id 'userModel.userName'. This 
>> means that you declared wicket:id=userModel.userName in your 
>> markup, but that you either did not add the component to your 
>> page at all, or that the hierarchy does not match. 
>>
>> Has anyone a solution for this? 
>>
>> Thank you very much,
>>
>> Maciej
>>
>> --
>> ---
>> Using Tomcat but need to do more? Need to support web 
>> services, security?
>> Get stuff done quickly with pre-integrated technology to make 
>> your job easier Download IBM WebSphere Application Server 
>> v.1.0.1 based on Apache Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&;
>> 
> dat=121642
>   
>> ___
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>> 
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>   

-- 
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Wizard StaticContentStep and CompoundPropertyModel

2006-11-10 Thread Korbinian Bachl
You need to create a Label in the constructor of the given part that passes
the information to it.

e.g:
add(new Label("userModel.userName", userModel.getUserName));

BTW: you can change the Labelname to whatever you want as its not associated
with the content behind it.
e.g:
add(new Label("username", userModel.getUserName));
[userName]

please also note that youre current solution is not (!) for use with more
than 1 user since you need to use a session for that or make sure you repass
the user-model each time, wich is not a good solution either...  


Regards

Korbinian

> -Ursprüngliche Nachricht-
> Von: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Im Auftrag 
> von [EMAIL PROTECTED]
> Gesendet: Freitag, 10. November 2006 11:13
> An: wicket-user@lists.sourceforge.net
> Betreff: [Wicket-user] Wizard StaticContentStep and 
> CompoundPropertyModel
> 
> Hello all !
> 
> I would like to add a CompoundPropertyModel as wizard static 
> page. I have done so far:
> 
> public class StepX extends StaticContentStep {
>   
>   /**
>* Constructor.
>* 
>* @param userModel
>*/
>   public StepX(UserModel userModel)
>   {
>   super(true);
>   
>   IModel model = new Model(userModel);
>   setTitleModel(new ResourceModel("confirmation.title"));
>   setSummaryModel(new 
> StringResourceModel("confirmation.summary", this, model));
>   
>   setContentModel(new CompoundPropertyModel(userModel));
>   
>   }
> }
> 
> My UserModel look like this:
> 
> public class UserModel implements Serializable {
> 
> private String userName;
> 
>   public final String getUserName() {
>   return this.userName;
>   }
> 
>   public final void setUserName(String userName) {
>   this.userName = userName;
>   }
> 
> }
> 
> 
> How can I simply output the username property collected in a 
> previous step? I tried the following code:
> 
>   
>   
>   
>   
>wicket:id="userModel.userName">[userName]
>   
>   
>   
>   
> 
> 
> ... but wicket gives me the following error message:
> 
> unable to find component with id 'userModel.userName'. This 
> means that you declared wicket:id=userModel.userName in your 
> markup, but that you either did not add the component to your 
> page at all, or that the hierarchy does not match. 
> 
> Has anyone a solution for this? 
> 
> Thank you very much,
> 
> Maciej
> 
> --
> ---
> Using Tomcat but need to do more? Need to support web 
> services, security?
> Get stuff done quickly with pre-integrated technology to make 
> your job easier Download IBM WebSphere Application Server 
> v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&;
dat=121642
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user