Re: Model question ?

2009-08-16 Thread Martijn Dashorst
Just don't pass the model to another page (also don't do this for
anon-inner classes, or nested classes that carry a this pointer to the
page)

Martijn

On Sun, Aug 16, 2009 at 4:04 AM, Warren Bellwarr...@clarksnutrition.com wrote:
 Is there any issues you need to be concerned with when using the page
 itself as the model object?

 Warren

 -Original Message-
 From: jWeekend [mailto:jweekend_for...@cabouge.com]
 Sent: Friday, August 14, 2009 5:43 PM
 To: users@wicket.apache.org
 Subject: RE: Model question ?


 Warren,

 If you don't mind your wicket:ids becoming rather misleading and
 arguably slightly harder to follow (magical) Java, you can even do ...

 public class HomePage extends WebPage {
    private ListVendor vendors = Arrays.asList(new Vendor(v1),
            new Vendor(v2));
    private Vendor vendor = new Vendor(default vendor);
    public HomePage(final PageParameters parameters) {
        setDefaultModel(new CompoundPropertyModelHomePage(this));
        FormVoid form = new FormVoid(form);
        add(form);
        form.add(new ListChoiceVendor(vendor, vendors));
        FormVendor editForm = new FormVendor(vendorEditForm);
        add(editForm);
        editForm.add(new TextFieldString(vendor.name));
    }
    private class Vendor {
        private String name;
        Vendor(String name) {this.name = name;}
       �...@override public String toString() {return name;}
    }
 }

 I haven't worked out how to properly paste html into nabble, so drop me
 a line at the jWeekend site if you want the template code to go with
 this, or a QuickStart.

 Any comments on the type-parameters used above anybody?!

 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development
 http://jWeekend.com


 Warren Bell-3 wrote:

 In your second example the Vendor in the vendorModel becomes the
 selected Vendor from the ListChoice and that Vendor name property
 becomes the value of the TextField?

 -Original Message-
 From: jWeekend [mailto:jweekend_for...@cabouge.com]
 Sent: Friday, August 14, 2009 3:47 PM
 To: users@wicket.apache.org
 Subject: Re: Model question ?


 Warren,

 ... and if you prefer using a CPM for your vendorEditForms:

 public class HomePage extends WebPage {
     private ListVendor vendors = Arrays.asList(new Vendor(v1),
                                                                  new
 Vendor(v2));
     private Vendor vendor = new Vendor(default vendor);
     public HomePage(final PageParameters parameters) {
         IModel vendorModel = new PropertyModelVendor(this,
 vendor);
         FormVoid form = new FormVoid(form);
         add(form);
         // use your existing LDM instead of this hard-wired
         // List of vendors but
         // make sure you merge your edits properly!
         form.add(new ListChoiceVendor(vendors,
                                          vendorModel, vendors));
         // using a PropertyModel per field
         FormVoid editForm1 = new FormVoid(vendorEditForm1);
         add(editForm1);
         editForm1.add(new TextFieldVendor(name,
                 new PropertyModelVendor(this, vendor.name)));
         // using a CompoundPropertyModel
         FormVendor editForm2 = new FormVendor(vendorEditForm2,
                 new CompoundPropertyModelVendor(vendorModel));
         add(editForm2);
         editForm2.add(new TextFieldVendor(name));
     }

     private class Vendor implements Serializable{
         private String name;
         protected Vendor(String name) {this.name = name;}
         public String toString(){return name;}
         // safer to have accessors  mutators
     }
     // safer to have accessors  mutators }

 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development
 http://jWeekend.com



 Warren Bell-3 wrote:

 How should I set up my model for the following situation. I have a
 form with a ListChoice and a TextField. The TextField needs to access

 a property of the object selected of the ListChoice. I have it all
 working using a ValueMap, but that seems like overkill to use a
 ValueMap for one object. Here is how I have it:

 super(new CompoundPropertyModelValueMap(new ValueMap()));

 ListChoiceVendor vendorListChoice = new
 ListChoiceVendor(vendor,

 new LoadableDetachableModelListVendor(){...}, new
 IChoiceRendererVendor(){...});

 TextFieldString accountNumberField = new
 TextFieldString(vendor.accountNumber);

 I thought I could do something like this:

 super(new CompoundPropertyModelVendor(new Vendor()));

 The ListChoice is the same as above and the TextField like this:

 TextFieldString accountNumberField = new
 TextFieldString(accountNumber);

 The problem with this is that the ListChoice is trying to set a
 property on the model named vendor when I realy want the selected
 ListChoice vendor object be the model object and have the TextField
 access the accountNumber property of the ListChoice vendor.

 How should I set up my model to deal with this type

RE: Model question ?

2009-08-15 Thread Warren Bell
Is there any issues you need to be concerned with when using the page
itself as the model object?

Warren 

-Original Message-
From: jWeekend [mailto:jweekend_for...@cabouge.com] 
Sent: Friday, August 14, 2009 5:43 PM
To: users@wicket.apache.org
Subject: RE: Model question ?


Warren,

If you don't mind your wicket:ids becoming rather misleading and
arguably slightly harder to follow (magical) Java, you can even do ...

public class HomePage extends WebPage {
private ListVendor vendors = Arrays.asList(new Vendor(v1), 
new Vendor(v2));
private Vendor vendor = new Vendor(default vendor);
public HomePage(final PageParameters parameters) {
setDefaultModel(new CompoundPropertyModelHomePage(this));
FormVoid form = new FormVoid(form); 
add(form); 
form.add(new ListChoiceVendor(vendor, vendors)); 
FormVendor editForm = new FormVendor(vendorEditForm);
add(editForm);
editForm.add(new TextFieldString(vendor.name));
}
private class Vendor {
private String name;
Vendor(String name) {this.name = name;}
@Override public String toString() {return name;}
}
}

I haven't worked out how to properly paste html into nabble, so drop me
a line at the jWeekend site if you want the template code to go with
this, or a QuickStart. 

Any comments on the type-parameters used above anybody?!

Regards - Cemal
jWeekend
OO  Java Technologies, Wicket Training and Development
http://jWeekend.com


Warren Bell-3 wrote:
 
 In your second example the Vendor in the vendorModel becomes the 
 selected Vendor from the ListChoice and that Vendor name property 
 becomes the value of the TextField?
 
 -Original Message-
 From: jWeekend [mailto:jweekend_for...@cabouge.com]
 Sent: Friday, August 14, 2009 3:47 PM
 To: users@wicket.apache.org
 Subject: Re: Model question ?
 
 
 Warren,
 
 ... and if you prefer using a CPM for your vendorEditForms:
 
 public class HomePage extends WebPage {
 private ListVendor vendors = Arrays.asList(new Vendor(v1), 
  new 
 Vendor(v2));
 private Vendor vendor = new Vendor(default vendor);
 public HomePage(final PageParameters parameters) {
 IModel vendorModel = new PropertyModelVendor(this,
vendor);
 FormVoid form = new FormVoid(form);
 add(form);
 // use your existing LDM instead of this hard-wired 
 // List of vendors but 
 // make sure you merge your edits properly!
 form.add(new ListChoiceVendor(vendors, 
  vendorModel, vendors));
 // using a PropertyModel per field
 FormVoid editForm1 = new FormVoid(vendorEditForm1);
 add(editForm1);
 editForm1.add(new TextFieldVendor(name, 
 new PropertyModelVendor(this, vendor.name)));   
 // using a CompoundPropertyModel   
 FormVendor editForm2 = new FormVendor(vendorEditForm2, 
 new CompoundPropertyModelVendor(vendorModel));
 add(editForm2);
 editForm2.add(new TextFieldVendor(name)); 
 }
 
 private class Vendor implements Serializable{
 private String name;
 protected Vendor(String name) {this.name = name;}
 public String toString(){return name;}
 // safer to have accessors  mutators
 }
 // safer to have accessors  mutators }
 
 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development 
 http://jWeekend.com
 
 
 
 Warren Bell-3 wrote:
 
 How should I set up my model for the following situation. I have a 
 form with a ListChoice and a TextField. The TextField needs to access

 a property of the object selected of the ListChoice. I have it all 
 working using a ValueMap, but that seems like overkill to use a 
 ValueMap for one object. Here is how I have it:
  
 super(new CompoundPropertyModelValueMap(new ValueMap()));
 
 ListChoiceVendor vendorListChoice = new 
 ListChoiceVendor(vendor,
 
 new LoadableDetachableModelListVendor(){...}, new 
 IChoiceRendererVendor(){...});
 
 TextFieldString accountNumberField = new 
 TextFieldString(vendor.accountNumber);
 
 I thought I could do something like this:
 
 super(new CompoundPropertyModelVendor(new Vendor()));
 
 The ListChoice is the same as above and the TextField like this:
 
 TextFieldString accountNumberField = new 
 TextFieldString(accountNumber);
 
 The problem with this is that the ListChoice is trying to set a 
 property on the model named vendor when I realy want the selected 
 ListChoice vendor object be the model object and have the TextField 
 access the accountNumber property of the ListChoice vendor.
 
 How should I set up my model to deal with this type of situation or 
 is
 
 a ValueMap the best way?
 
 Thanks,
 
 Warren
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr

Re: Model question ?

2009-08-15 Thread Eelco Hillenius
 Is there any issues you need to be concerned with when using the page
 itself as the model object?

I don't think so.

Eelco

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



Re: Model question ?

2009-08-14 Thread jWeekend

Warren,

... and if you prefer using a CPM for your vendorEditForms:

public class HomePage extends WebPage {
private ListVendor vendors = Arrays.asList(new Vendor(v1), 
 new
Vendor(v2));
private Vendor vendor = new Vendor(default vendor);
public HomePage(final PageParameters parameters) {
IModel vendorModel = new PropertyModelVendor(this, vendor);
FormVoid form = new FormVoid(form);
add(form);
// use your existing LDM instead of this hard-wired 
// List of vendors but 
// make sure you merge your edits properly!
form.add(new ListChoiceVendor(vendors, 
 vendorModel, vendors));
// using a PropertyModel per field
FormVoid editForm1 = new FormVoid(vendorEditForm1);
add(editForm1);
editForm1.add(new TextFieldVendor(name, 
new PropertyModelVendor(this, vendor.name)));   
// using a CompoundPropertyModel   
FormVendor editForm2 = new FormVendor(vendorEditForm2, 
new CompoundPropertyModelVendor(vendorModel));
add(editForm2);
editForm2.add(new TextFieldVendor(name)); 
}

private class Vendor implements Serializable{
private String name;
protected Vendor(String name) {this.name = name;}
public String toString(){return name;}
// safer to have accessors  mutators
}
// safer to have accessors  mutators
}

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com



Warren Bell-3 wrote:
 
 How should I set up my model for the following situation. I have a form
 with a ListChoice and a TextField. The TextField needs to access a
 property of the object selected of the ListChoice. I have it all working
 using a ValueMap, but that seems like overkill to use a ValueMap for one
 object. Here is how I have it:
  
 super(new CompoundPropertyModelValueMap(new ValueMap()));
 
 ListChoiceVendor vendorListChoice = new ListChoiceVendor(vendor,
 new LoadableDetachableModelListVendor(){...}, new
 IChoiceRendererVendor(){...});
 
 TextFieldString accountNumberField = new
 TextFieldString(vendor.accountNumber);
 
 I thought I could do something like this:
 
 super(new CompoundPropertyModelVendor(new Vendor()));
 
 The ListChoice is the same as above and the TextField like this:
 
 TextFieldString accountNumberField = new
 TextFieldString(accountNumber);
 
 The problem with this is that the ListChoice is trying to set a property
 on the model named vendor when I realy want the selected ListChoice
 vendor object be the model object and have the TextField access the
 accountNumber property of the ListChoice vendor.
 
 How should I set up my model to deal with this type of situation or is a
 ValueMap the best way?
 
 Thanks,
 
 Warren
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Model-question---tp24978225p24979787.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: Model question ?

2009-08-14 Thread Warren Bell
In your second example the Vendor in the vendorModel becomes the
selected Vendor from the ListChoice and that Vendor name property
becomes the value of the TextField? 

-Original Message-
From: jWeekend [mailto:jweekend_for...@cabouge.com] 
Sent: Friday, August 14, 2009 3:47 PM
To: users@wicket.apache.org
Subject: Re: Model question ?


Warren,

... and if you prefer using a CPM for your vendorEditForms:

public class HomePage extends WebPage {
private ListVendor vendors = Arrays.asList(new Vendor(v1), 
 new
Vendor(v2));
private Vendor vendor = new Vendor(default vendor);
public HomePage(final PageParameters parameters) {
IModel vendorModel = new PropertyModelVendor(this, vendor);
FormVoid form = new FormVoid(form);
add(form);
// use your existing LDM instead of this hard-wired 
// List of vendors but 
// make sure you merge your edits properly!
form.add(new ListChoiceVendor(vendors, 
 vendorModel, vendors));
// using a PropertyModel per field
FormVoid editForm1 = new FormVoid(vendorEditForm1);
add(editForm1);
editForm1.add(new TextFieldVendor(name, 
new PropertyModelVendor(this, vendor.name)));   
// using a CompoundPropertyModel   
FormVendor editForm2 = new FormVendor(vendorEditForm2, 
new CompoundPropertyModelVendor(vendorModel));
add(editForm2);
editForm2.add(new TextFieldVendor(name)); 
}

private class Vendor implements Serializable{
private String name;
protected Vendor(String name) {this.name = name;}
public String toString(){return name;}
// safer to have accessors  mutators
}
// safer to have accessors  mutators }

Regards - Cemal
jWeekend
OO  Java Technologies, Wicket Training and Development
http://jWeekend.com



Warren Bell-3 wrote:
 
 How should I set up my model for the following situation. I have a 
 form with a ListChoice and a TextField. The TextField needs to access 
 a property of the object selected of the ListChoice. I have it all 
 working using a ValueMap, but that seems like overkill to use a 
 ValueMap for one object. Here is how I have it:
  
 super(new CompoundPropertyModelValueMap(new ValueMap()));
 
 ListChoiceVendor vendorListChoice = new ListChoiceVendor(vendor,

 new LoadableDetachableModelListVendor(){...}, new 
 IChoiceRendererVendor(){...});
 
 TextFieldString accountNumberField = new 
 TextFieldString(vendor.accountNumber);
 
 I thought I could do something like this:
 
 super(new CompoundPropertyModelVendor(new Vendor()));
 
 The ListChoice is the same as above and the TextField like this:
 
 TextFieldString accountNumberField = new 
 TextFieldString(accountNumber);
 
 The problem with this is that the ListChoice is trying to set a 
 property on the model named vendor when I realy want the selected 
 ListChoice vendor object be the model object and have the TextField 
 access the accountNumber property of the ListChoice vendor.
 
 How should I set up my model to deal with this type of situation or is

 a ValueMap the best way?
 
 Thanks,
 
 Warren
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

--
View this message in context:
http://www.nabble.com/Model-question---tp24978225p24979787.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
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: Model question ?

2009-08-14 Thread jWeekend

Warren,

Exactly - and in a very Wicket way! 

Just drop the code into your IDE and run it - if there are no typos (other
than the type parameter to the TextFields - the compiler can't help you
here!) it just works.

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com




Warren Bell-3 wrote:
 
 In your second example the Vendor in the vendorModel becomes the
 selected Vendor from the ListChoice and that Vendor name property
 becomes the value of the TextField? 
 
 -Original Message-
 From: jWeekend [mailto:jweekend_for...@cabouge.com] 
 Sent: Friday, August 14, 2009 3:47 PM
 To: users@wicket.apache.org
 Subject: Re: Model question ?
 
 
 Warren,
 
 ... and if you prefer using a CPM for your vendorEditForms:
 
 public class HomePage extends WebPage {
 private ListVendor vendors = Arrays.asList(new Vendor(v1), 
  new
 Vendor(v2));
 private Vendor vendor = new Vendor(default vendor);
 public HomePage(final PageParameters parameters) {
 IModel vendorModel = new PropertyModelVendor(this, vendor);
 FormVoid form = new FormVoid(form);
 add(form);
 // use your existing LDM instead of this hard-wired 
 // List of vendors but 
 // make sure you merge your edits properly!
 form.add(new ListChoiceVendor(vendors, 
  vendorModel, vendors));
 // using a PropertyModel per field
 FormVoid editForm1 = new FormVoid(vendorEditForm1);
 add(editForm1);
 editForm1.add(new TextFieldVendor(name, 
 new PropertyModelVendor(this, vendor.name)));   
 // using a CompoundPropertyModel   
 FormVendor editForm2 = new FormVendor(vendorEditForm2, 
 new CompoundPropertyModelVendor(vendorModel));
 add(editForm2);
 editForm2.add(new TextFieldVendor(name)); 
 }
 
 private class Vendor implements Serializable{
 private String name;
 protected Vendor(String name) {this.name = name;}
 public String toString(){return name;}
 // safer to have accessors  mutators
 }
 // safer to have accessors  mutators }
 
 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development
 http://jWeekend.com
 
 
 
 Warren Bell-3 wrote:
 
 How should I set up my model for the following situation. I have a 
 form with a ListChoice and a TextField. The TextField needs to access 
 a property of the object selected of the ListChoice. I have it all 
 working using a ValueMap, but that seems like overkill to use a 
 ValueMap for one object. Here is how I have it:
  
 super(new CompoundPropertyModelValueMap(new ValueMap()));
 
 ListChoiceVendor vendorListChoice = new ListChoiceVendor(vendor,
 
 new LoadableDetachableModelListVendor(){...}, new 
 IChoiceRendererVendor(){...});
 
 TextFieldString accountNumberField = new 
 TextFieldString(vendor.accountNumber);
 
 I thought I could do something like this:
 
 super(new CompoundPropertyModelVendor(new Vendor()));
 
 The ListChoice is the same as above and the TextField like this:
 
 TextFieldString accountNumberField = new 
 TextFieldString(accountNumber);
 
 The problem with this is that the ListChoice is trying to set a 
 property on the model named vendor when I realy want the selected 
 ListChoice vendor object be the model object and have the TextField 
 access the accountNumber property of the ListChoice vendor.
 
 How should I set up my model to deal with this type of situation or is
 
 a ValueMap the best way?
 
 Thanks,
 
 Warren
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 --
 View this message in context:
 http://www.nabble.com/Model-question---tp24978225p24979787.html
 Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
 -
 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
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Model-question---tp24978225p24980016.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: Model question ?

2009-08-14 Thread jWeekend

Warren,

If you don't mind your wicket:ids becoming rather misleading and arguably
slightly harder to follow (magical) Java, you can even do ...

public class HomePage extends WebPage {
private ListVendor vendors = Arrays.asList(new Vendor(v1), 
new Vendor(v2));
private Vendor vendor = new Vendor(default vendor);
public HomePage(final PageParameters parameters) {
setDefaultModel(new CompoundPropertyModelHomePage(this));
FormVoid form = new FormVoid(form); 
add(form); 
form.add(new ListChoiceVendor(vendor, vendors)); 
FormVendor editForm = new FormVendor(vendorEditForm);
add(editForm);
editForm.add(new TextFieldString(vendor.name));
}
private class Vendor {
private String name;
Vendor(String name) {this.name = name;}
@Override public String toString() {return name;}
}
}

I haven't worked out how to properly paste html into nabble, so drop me a
line at the jWeekend site if you want the template code to go with this, or
a QuickStart. 

Any comments on the type-parameters used above anybody?!

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


Warren Bell-3 wrote:
 
 In your second example the Vendor in the vendorModel becomes the
 selected Vendor from the ListChoice and that Vendor name property
 becomes the value of the TextField? 
 
 -Original Message-
 From: jWeekend [mailto:jweekend_for...@cabouge.com] 
 Sent: Friday, August 14, 2009 3:47 PM
 To: users@wicket.apache.org
 Subject: Re: Model question ?
 
 
 Warren,
 
 ... and if you prefer using a CPM for your vendorEditForms:
 
 public class HomePage extends WebPage {
 private ListVendor vendors = Arrays.asList(new Vendor(v1), 
  new
 Vendor(v2));
 private Vendor vendor = new Vendor(default vendor);
 public HomePage(final PageParameters parameters) {
 IModel vendorModel = new PropertyModelVendor(this, vendor);
 FormVoid form = new FormVoid(form);
 add(form);
 // use your existing LDM instead of this hard-wired 
 // List of vendors but 
 // make sure you merge your edits properly!
 form.add(new ListChoiceVendor(vendors, 
  vendorModel, vendors));
 // using a PropertyModel per field
 FormVoid editForm1 = new FormVoid(vendorEditForm1);
 add(editForm1);
 editForm1.add(new TextFieldVendor(name, 
 new PropertyModelVendor(this, vendor.name)));   
 // using a CompoundPropertyModel   
 FormVendor editForm2 = new FormVendor(vendorEditForm2, 
 new CompoundPropertyModelVendor(vendorModel));
 add(editForm2);
 editForm2.add(new TextFieldVendor(name)); 
 }
 
 private class Vendor implements Serializable{
 private String name;
 protected Vendor(String name) {this.name = name;}
 public String toString(){return name;}
 // safer to have accessors  mutators
 }
 // safer to have accessors  mutators }
 
 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development
 http://jWeekend.com
 
 
 
 Warren Bell-3 wrote:
 
 How should I set up my model for the following situation. I have a 
 form with a ListChoice and a TextField. The TextField needs to access 
 a property of the object selected of the ListChoice. I have it all 
 working using a ValueMap, but that seems like overkill to use a 
 ValueMap for one object. Here is how I have it:
  
 super(new CompoundPropertyModelValueMap(new ValueMap()));
 
 ListChoiceVendor vendorListChoice = new ListChoiceVendor(vendor,
 
 new LoadableDetachableModelListVendor(){...}, new 
 IChoiceRendererVendor(){...});
 
 TextFieldString accountNumberField = new 
 TextFieldString(vendor.accountNumber);
 
 I thought I could do something like this:
 
 super(new CompoundPropertyModelVendor(new Vendor()));
 
 The ListChoice is the same as above and the TextField like this:
 
 TextFieldString accountNumberField = new 
 TextFieldString(accountNumber);
 
 The problem with this is that the ListChoice is trying to set a 
 property on the model named vendor when I realy want the selected 
 ListChoice vendor object be the model object and have the TextField 
 access the accountNumber property of the ListChoice vendor.
 
 How should I set up my model to deal with this type of situation or is
 
 a ValueMap the best way?
 
 Thanks,
 
 Warren
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 --
 View this message in context:
 http://www.nabble.com/Model-question---tp24978225p24979787.html
 Sent from the Wicket - User mailing list archive at Nabble.com

Re: Model Question

2009-07-07 Thread Linda van der Pal
Is there a Calendar object under the covers somewhere? Cause it looks 
like a conversion error, seeing how the months start counting from zero 
in the Calendar object.


Regards,
Linda

jpalmer1...@mchsi.com wrote:
I have the following code to allow the user to select the date that a 
report is to be generated for. For some reason, though, whatever date 
is selected from the textfield, the previous date is being used. For 
example, if the user inputs 07/06/2009 into the dateTextField, 
07/05/2009 is being used. I'm assuming this is because I'm using the 
wrong model, so any assistance would be greatly appreciated.


public class AccountingDashboardPage extends EzdecBaseWebPage {
private Date date;

public AccountingDashboardPage(Date date) {
if (date == null) {
this.date = new Date();
}

Form form = new Form(accountingDashboardForm, new 
PropertyModel(this, date)) {

@Override
protected void onSubmit() {
Date d = (Date)getModelObject();
setResponsePage(new AccountingDashboardPage(d));
}
};

add(form);

EzdecDateTextField reportDate = new 
EzdecDateTextField(stampDate, form.getModel());
reportDate.setModelValue(new String[]{new 
SimpleDateFormat(MM/dd/).format(date).toString()});

form.add(reportDate);

   

}

}




No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.375 / Virus Database: 270.13.5/2220 - Release Date: 07/05/09 17:54:00


  



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



Re: Model question

2007-09-11 Thread Martijn Dashorst
Nothing directly. The only thing you should do is propagate the
'detach' method to your nested eventModel. The chaining model is
merely interesting for consumers of your model, so they can get to the
embedded model using a specified API.

From chapter 5 Understanding Models of Wicket in Action (the custom
models part where the quote comes from may become an appendix though):

To summarize, when you want to chain models, be sure to propagate the
detach call to the chained models. This way the whole chain will be
detached. If your custom model is part of a public API, your clients
will most likely thank you when you implement the IChainingModel
interface, providing them access to the inner model.

The IWrapModel is used for marking models that have been wrapped using
IComponentAssignedModel or IComponentInheritedModel.

Martijn

On 9/11/07, Leszek Gawron [EMAIL PROTECTED] wrote:
 Assuming eventModel is loadable detachable model sould I implement some
 marker interfaces in the following model?

  private static class SystemWarningEventImagePathModel extends 
  AbstractReadOnlyModel {
private IModel  eventModel;
 
public SystemWarningEventImagePathModel( IModel eventModel ) {
this.eventModel = eventModel;
}
 
@Override
public Object getObject() {
SystemWarningEvent event = (SystemWarningEvent) 
  eventModel.getObject();
return event.isReadFlag() ? img/mobile/event_read.png : 
  img/mobile/event_new.png;
}
  }


 There are a number to take into account: IWrapModel, IChainingModel.
 Please advise.

 --
 Leszek Gawron

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




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

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