Ajax and OpenSessionInViewFilter problems

2010-02-18 Thread Kogel, Jonck-van-der
Hi All,
As the subject reads, I'm having some problems with Ajax and the
OpenSessionInViewFilter. Here's my basic setup:
 
I've got a page with some address info, such as street/city/zipcode.
Let's call the current value of these fields V1. There is also an ajax
link to open a modal panel that allows the user to look up street/city
info based on the zipcode. When the modal panel opens the info V1 is
passed on to the modal panel as initial value. Let's say here the user
enters new info and a street/city is found, we'll call this info V2. The
user then presses the submit button on the modal panel and indeed V2 is
now shown on the main page. However, when I now click the ajax link to
open the modal panel again, the user get's shown V1 in the modal panel
as initial filling. When finally submitting the page V2 is persisted, so
the information is being retained somewhere.
 
I have debugged the application and I see the setters of my domain
object being called. Also when debugging however I see that the load()
method of the LoadableDetachableModel is being called when I hit the
ajax link, so it seems like a new version of the object is being
retrieved from the database. I thought that's what the
OpenSessionInViewFilter was for, to allow for multiple requests in your
view without Hibernate closing/opening the session each time and
retrieving fresh copies of your objects. Here is some relevant code:
 
OpenSessionInView setup in web.xml:
 
filter
 filter-nameopensessioninview/filter-name
 filter-class
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
 /filter-class
 init-param
  param-namesingleSession/param-name
  param-valuetrue/param-value
 /init-param
/filter
 
Submit link on my modal panel:
 
searchResultsHolder.add(new AjaxSubmitLink(selectMatch) {
 @Override
 protected void onSubmit(AjaxRequestTarget target, Form? form) {
  Address address = addressModel.getObject();
  address.setZipcode(foundZipcode.getZipcode());
  address.setHouseNr(foundZipcode.getHouseNr());
  address.setStreet(foundZipcode.getStreet().getStreetName());
  address.setCity(foundZipcode.getCity().getCityName());
  address.setCountry(Country.NL);
  address.setAddressValidated(true);
  
  for (Component component : updateList) {
   target.addComponent(component);
  }
  modalWindow.close(target);
 }
});
 
The LoadableDetachableModel used (and is being called when I hit the
ajax link):
 
final IModelARF mergedModel = new LoadableDetachableModelARF() {
 @Override
 protected ARF load() {
  return arfService.load(arfId);
 }
};
 
Many thanks for any help!
 
Kind regards, Jonck


RE: Ajax and OpenSessionInViewFilter problems

2010-02-18 Thread Kogel, Jonck-van-der
Hi All,
Follow-up to my own post.

I found the following here:
http://old.nabble.com/Wicket---No-Serializable-objects-Web-application-t
d19351608.html

Quote: However , there is a problem if you use loadabledetachable with
AJAX requests
on your page. Model.detach() is called on every request, which causes
your
object to be retrieved from database on the next Model.getObject() call.
This
means you lose all changes on your bound domain obect on every ajax
request.
I found to solutions to this, and i like neither of them:

a) use DTOs, which means a lot of code duplication.

b) write the current object state  to the database on every detach,
which
means you might store objects in an incomplete state, before the user
explicitly tells the application to store what she or hehas entered.

If anybody has a nicer solution to this, i'd love to hear about it. 

Option b) is definitely a no-go, so it seems I'll have to use DTO's
then. If someone knows of a nicer solution I would also love to hear
about it. For now I guess I'll go the DTO road.

Thanks, Jonck 

-Original Message-
From: Kogel, Jonck-van-der [mailto:jonck-van-der.ko...@bmw.nl] 
Sent: donderdag 18 februari 2010 14:30
To: users@wicket.apache.org
Subject: Ajax and OpenSessionInViewFilter problems

Hi All,
As the subject reads, I'm having some problems with Ajax and the
OpenSessionInViewFilter. Here's my basic setup:
 
I've got a page with some address info, such as street/city/zipcode.
Let's call the current value of these fields V1. There is also an ajax
link to open a modal panel that allows the user to look up street/city
info based on the zipcode. When the modal panel opens the info V1 is
passed on to the modal panel as initial value. Let's say here the user
enters new info and a street/city is found, we'll call this info V2. The
user then presses the submit button on the modal panel and indeed V2 is
now shown on the main page. However, when I now click the ajax link to
open the modal panel again, the user get's shown V1 in the modal panel
as initial filling. When finally submitting the page V2 is persisted, so
the information is being retained somewhere.
 
I have debugged the application and I see the setters of my domain
object being called. Also when debugging however I see that the load()
method of the LoadableDetachableModel is being called when I hit the
ajax link, so it seems like a new version of the object is being
retrieved from the database. I thought that's what the
OpenSessionInViewFilter was for, to allow for multiple requests in your
view without Hibernate closing/opening the session each time and
retrieving fresh copies of your objects. Here is some relevant code:
 
OpenSessionInView setup in web.xml:
 
filter
 filter-nameopensessioninview/filter-name
 filter-class
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
 /filter-class
 init-param
  param-namesingleSession/param-name
  param-valuetrue/param-value
 /init-param
/filter
 
Submit link on my modal panel:
 
searchResultsHolder.add(new AjaxSubmitLink(selectMatch) {  @Override
protected void onSubmit(AjaxRequestTarget target, Form? form) {
  Address address = addressModel.getObject();
  address.setZipcode(foundZipcode.getZipcode());
  address.setHouseNr(foundZipcode.getHouseNr());
  address.setStreet(foundZipcode.getStreet().getStreetName());
  address.setCity(foundZipcode.getCity().getCityName());
  address.setCountry(Country.NL);
  address.setAddressValidated(true);
  
  for (Component component : updateList) {
   target.addComponent(component);
  }
  modalWindow.close(target);
 }
});
 
The LoadableDetachableModel used (and is being called when I hit the
ajax link):
 
final IModelARF mergedModel = new LoadableDetachableModelARF() {
@Override  protected ARF load() {
  return arfService.load(arfId);
 }
};
 
Many thanks for any help!
 
Kind regards, Jonck


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



RE: Autosize modal window

2010-01-07 Thread Kogel, Jonck-van-der
Ok, great, the height is indeed autosizing nicely now. Is there any way to have 
the width autosize as well?

Thanks, Jonck


-Original Message-
From: Ilja Pavkovic [mailto:ilja.pavko...@binaere-bauten.de] 
Sent: donderdag 7 januari 2010 13:51
To: users@wicket.apache.org
Cc: Kogel, Jonck-van-der
Subject: Re: Autosize modal window

Hi,

I forgot the following line: modalWindow.setUseInitialHeight(false);

Best Regards,
Ilja Pavkovic

Am Donnerstag, 7. Januar 2010 12:40:25 schrieb Kogel, Jonck-van-der:
 Hi Ilja,
 Ok, that's good, I'm not using PageCreator. But how do I then make the  
 ModalWindow autosize? Perhaps I'm missing something in the JavaDocs 
 but I  can't find it anywhere.
 
 Thanks, Jonck
 
 -Original Message-
 From: Ilja Pavkovic [mailto:ilja.pavko...@binaere-bauten.de]
 Sent: woensdag 6 januari 2010 17:23
 To: users@wicket.apache.org
 Subject: Re: Autosize modal window
 
 Hi,
 
 according to the inline documentation of ModalWindow you can only 
 autosize  if you add components and don't use  ModalWindow.PageCreator
 
 something like
 
 ModalWindow modalWindow = new ModalWindow(); modalWindow.add(new  
 MyPanel(modalWindow.getComponentId());
 
 
 
 Best Regards,
   Ilja Pavkovic
 
 Am Mittwoch, 6. Januar 2010 17:12:05 schrieb Kogel, Jonck-van-der:
  Hi,
  Is it possible to have a modal window auto-size depending on its 
  contents? I've been fiddling with header contributions and such but 
  can't get it to work.
 
  Thanks!
 
  Jonck
 
 --
 binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
 
+49 · 171 · 9342 465
 
 Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
 Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost 
 Becker
 
 -
 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
 

--
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker



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



RE: DropDownChoice and selected value...

2010-01-07 Thread Kogel, Jonck-van-der
Hi,
I also had this problem once. It turned out to have to do with my list
of choices becoming stale. I solved this by putting the choices in a
LoadableDetachableModel.
 
ie:
 
IModelListYourObject yourObjectsModel = new
LoadableDetachableModelListYourObject() {
 @Override
 protected ListYourObject load() {
  return yourObjectService.findAll();
 }
 
};
 
add(new YourDropDownChoiceYourObject(foo,
  new PropertyModelYourObject(yourModel, bar),
  yourObjectsModel));
 



From: Facundo Miquel [mailto:facu...@easytech.com.ar] 
Sent: donderdag 7 januari 2010 15:18
To: users@wicket.apache.org
Subject: DropDownChoice and selected value...


Hello all.. 

First of all, I know that this has been discussed here, I searched the
archives but could not find an answer, or at least understand one, so
please If someone can help me I would greatly appreciate it...


I have a small problem with Drop Down Choices and the selected value
when editing an existing record... and I wanted to validate that I'm
doing things the correct way.. and if so.. if there is a known issue

the scenario is as follows...

I created an extended class (just to simplify my work) to generate DDC
from a multivalues tables (aka, a table where one holds different types
of things.. countries, cities, status codes, etc..).

The rest of the mail will be in RED for readability...

In my tables I'm required to store the code and not the value so
basically I created the following class..(these are fractions.. I'm
attaching the actual clasess..)

public class mvDropDownChoice extends DropDownChoice {
...
static List mvValues = null;
@SuppressWarnings(serial)
public mvDropDownChoice(String id, String mvCode, IModel model) {
super(id, new PropertyModel(model,
id),sysMultivaluesProvider.getMVList(mvCode),new IChoiceRenderer() {
public String getDisplayValue(Object object) {
SysMultivalues mv = (SysMultivalues) object;
return mv.getMvMeaning();   
}
public String getIdValue(Object object, int index) {
if (index == -1)
return null;
return ((SysMultivalues)mvValues.get(index)).getMvCode(); 
}
});
mvValues = sysMultivaluesProvider.getMVList(mvCode);
}
...
..


now I call this in the following way..
---

import net.databinder.valid.hib.ValidDataForm;

@AuthorizeInstantiation(Roles.USER)
public class updateUserProfile extends Panel{

private static final long serialVersionUID = 2834437668800017171L;
EditForm form;
...
public updateUserProfile(String id, String userId) {
super(id);
final Integer userIdInt = Integer.parseInt(userId);
add(form = new EditForm(userProfileForm,
Long.parseLong(userId.trim(;




}




protected class EditForm extends ValidDataForm {
@SuppressWarnings({ serial, unchecked })
public EditForm(String id, Long userId) {
super(id, SecUsers.class,userId);
add(new TextField(userName).setRequired(true));
.
add(new mvDropDownChoice(userProfile.country,COUNTRY,
this.getModel()));
.

and this generates the following HTML output
--
select name=userProfile.country class=select
wicket:id=userProfile.country
option selected=selected value=Choose One/option

option value=ARGArgentina/option
option value=UYUruguay/option
/select

---


Wich is correct, O have the code.. as the value. the description as the
user readable choice.. the CODE is persisted to the database (AKA in a
select country from sec_users the country is returned ARG | UY and not
Argentina | Uruguay which is what I need..) but my problem as stated
before is that I can't get the choice to come up with the correct
selected value (Argentina / Uruguay) and it always comes out with
Choose One.. 




TIA






RE: DropDownChoice losing selection after ajax update

2010-01-06 Thread Kogel, Jonck-van-der
Martin thank you!! It was indeed the form in the ModalWindow causing the error. 
I thought that nested forms was not an issue with Wicket but I guess it is? 
Anyway, replacing the form on the ModalWindow with the one you suggested works 
like a charm. Thanks again! 

-Original Message-
From: Martin Makundi [mailto:martin.maku...@koodaripalvelut.com] 
Sent: woensdag 6 januari 2010 14:11
To: users@wicket.apache.org
Subject: Re: DropDownChoice losing selection after ajax update

There can be many reasons... maybe you show more of the html and java pages? 
Here is some previous discussion about such situations:
http://mail-archives.apache.org/mod_mbox/wicket-users/200904.mbox/%3c23274595.p...@talk.nabble.com%3e

2010/1/6 Kogel, Jonck-van-der jonck-van-der.ko...@bmw.nl:
 Hi,

 I have a simple DropDownChoice that holds male/female option. The 
 selected value is retrieved from the database fine. Now I have a modal 
 panel and when it closes it refreshes a certain portion of my screen 
 using ajax. However, when the ajax refresh comes back the selected 
 value gets lost. When I look in the ajax debug screen I see the list 
 of options coming back and the selected value is empty. This happens 
 even when I don't do anything with the value of the dropdown in the 
 modal panel, but simply refresh the dropdown. Any ideas? Here is some code:

 The dropdown: (the list of options is an enum, mergedModel is a
 LoadableDetatchableModel)

 DropDownChoiceSex sex = new DropDownChoiceSex(sex,
  new PropertyModelSex(mergedModel, user.sex),
  Utility.arrayToList(new Sex[]{Sex.MALE, Sex.FEMALE})); 
 sex.setOutputMarkupId(true); add(sex);

 What happens when I close the modal panel: (the contentPanel gets 
 passed a reference to the modalPanel and the objects that need 
 refreshing)

 form.add(new AjaxSubmitLink(save) {
 �...@override
  protected void onSubmit(AjaxRequestTarget target, Form? form) {
  for (Component comp : updateList) {
   target.addComponent(comp);
  }
  modalWindow.close(target);
  }
 });

 The ajax response:

 ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
 id=sex11 ![CDATA[select name=tabs:tabUser:sex id=sex11 
 option selected=selected value=Kies er een/option option 
 value=0Man/option option value=1Vrouw/option /select]]



 Thanks for any help!

 Kind regards, Jonck



-
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



RadioGroup with radio objects with same values

2010-01-06 Thread Kogel, Jonck-van-der
Hi,
I have a radiogroup that is built up dynamically, so I don't know ahead
of time what the choices are going to be. Now I noticed that if I have 3
radio buttons in a RadioGroup and let's say they all have the same value
(are all empty for example), the selected radio button will be the last
one in the group. Let me give an example:
 
RadioGroup
* value1 = foo
* value2 = foo
* value3 = foo
 
So all 3 radio choices have the value foo. The persisted value is also
foo, so all are valid so to speak and therefore the one that gets
selected is the 3d one. However, I would like it to be the first. Could
someone point me in the right direction how I should go about overriding
this behavior so it takes the first value it encounters instead of the
last?
 
Thanks, Jonck


Autosize modal window

2010-01-06 Thread Kogel, Jonck-van-der
Hi,
Is it possible to have a modal window auto-size depending on its
contents? I've been fiddling with header contributions and such but
can't get it to work.
 
Thanks!
 
Jonck


RE: Multi-user environment problem

2009-12-24 Thread Kogel, Jonck-van-der
Actually it's in the specs that the button is not visible when not
applicable. So I can't use your proposed solution. However, I solved it
as follows:

add(new Button(edit) {
private static final long serialVersionUID =
5348615260629883659L;
private Boolean localVisibleFlag;

@Override
public void onSubmit() {
String username =
((AppAuthenticatedWebSession)getSession()).getUsername();
ARF arf = arfModel.getObject();

if (arf.getEditor() == null) {
arf.setEditor(username);
arfService.save(arf);
}
localVisibleFlag = null;
}

@Override
public boolean isVisible() {
if (localVisibleFlag == null) {
String editor =
arfModel.getObject().getEditor();
if (editor == null) {
localVisibleFlag = true;
return true;
}
localVisibleFlag = false;
return false;
} else {
return localVisibleFlag;
}
}
});

Works like a charm.

Cheers, Jonck

-Original Message-
From: Jeremy Thomerson [mailto:jer...@wickettraining.com] 
Sent: woensdag 23 december 2009 17:14
To: users@wicket.apache.org
Subject: Re: Multi-user environment problem

Override isEnabled instead.  That way it is visible, even after being
clicked when the other person clicked it first.  You may have to add
some logic in the onClick that says oops - already in use.

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Dec 23, 2009 at 9:46 AM, Kogel, Jonck-van-der 
jonck-van-der.ko...@bmw.nl wrote:

 Hi,
 I'm having a problem with a multi-user environment. I have a form, 
 which has an edit button. When a user presses the edit button, I write

 to the database that this current user is editing the form. So when 
 another user comes along and wants to edit it, he gets the message 
 that the form cannot be edited because it's locked by another user. 
 This works fine when user A loads the form, presses the edit button 
 and after that user B comes along. However, if the process is: user A 
 comes along and loads the form, user B loads the same form, then user 
 A presses the edit button and after that user B presses it. Then I get

 an unexpected runtimeexception and the message:
 WicketMessage: Submit Button topBar:edit (path=arfForm:topBar:edit) is

 not visible

 Now this obviously has to do with the way I'm determining whether or 
 not this button should be visible. What I did is extend the Button 
 class and override the isVisible method. Here I check whether there is

 no editor, if so, the button should be visible so the current user can

 become the editor. However, since in this situation, user B became the

 editor while this user had already loaded the form, the button is no 
 longer valid for user A but he already has it on his screen. I thought

 to check this in the onSubmit method and retrieve the persisted object

 and check if nothing had changed in the meantime, but apparently 
 Wicket checks whether this button should have been visible in the 
 first place. And since I use LoadableDetachableModel as the underlying

 model (arfModel) the updated object is retrieved and Wicket detects 
 that the isVisible method returns false and throws an error that I'm 
 trying to call the onSubmit method.

 Does anyone know of an elegant solution for this problem? Please see 
 below for my implementation of the edit button.

 Thanks, Jonck

 add(new Button(edit) {
  @Override
  public void onSubmit() {
  String username =
 ((AppAuthenticatedWebSession)getSession()).getUsername();
  ARF currentArf = arfModel.getObject();

  ARF persistedArf = arfService.load(currentArf.getId());

  if (persistedArf.getEditor() == null ||
 persistedArf.getEditor().equals(username)) {
   currentArf.setEditor(username);
   arfService.save(currentArf);
  }
  }

  @Override
  public boolean isVisible() {
  String editor = arfModel.getObject().getEditor();  if (editor == 
 null) {
   return true;
  }
  return false;
  }
 });



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



Multi-user environment problem

2009-12-23 Thread Kogel, Jonck-van-der
Hi,
I'm having a problem with a multi-user environment. I have a form, which
has an edit button. When a user presses the edit button, I write to the
database that this current user is editing the form. So when another
user comes along and wants to edit it, he gets the message that the form
cannot be edited because it's locked by another user. This works fine
when user A loads the form, presses the edit button and after that user
B comes along. However, if the process is: user A comes along and loads
the form, user B loads the same form, then user A presses the edit
button and after that user B presses it. Then I get an unexpected
runtimeexception and the message:
WicketMessage: Submit Button topBar:edit (path=arfForm:topBar:edit) is
not visible
 
Now this obviously has to do with the way I'm determining whether or not
this button should be visible. What I did is extend the Button class and
override the isVisible method. Here I check whether there is no editor,
if so, the button should be visible so the current user can become the
editor. However, since in this situation, user B became the editor while
this user had already loaded the form, the button is no longer valid for
user A but he already has it on his screen. I thought to check this in
the onSubmit method and retrieve the persisted object and check if
nothing had changed in the meantime, but apparently Wicket checks
whether this button should have been visible in the first place. And
since I use LoadableDetachableModel as the underlying model (arfModel)
the updated object is retrieved and Wicket detects that the isVisible
method returns false and throws an error that I'm trying to call the
onSubmit method.
 
Does anyone know of an elegant solution for this problem? Please see
below for my implementation of the edit button.
 
Thanks, Jonck
 
add(new Button(edit) {
 @Override
 public void onSubmit() {
  String username =
((AppAuthenticatedWebSession)getSession()).getUsername();
  ARF currentArf = arfModel.getObject();
  
  ARF persistedArf = arfService.load(currentArf.getId());
  
  if (persistedArf.getEditor() == null ||
persistedArf.getEditor().equals(username)) {
   currentArf.setEditor(username);
   arfService.save(currentArf);
  }
 }
 
 @Override
 public boolean isVisible() {
  String editor = arfModel.getObject().getEditor();
  if (editor == null) {
   return true;
  }
  return false;
 }
});


PropertyModel question

2009-12-15 Thread Kogel, Jonck-van-der
Hi,
I ran into some strange behavior with PropertyModels vs. regular
models. I set up a very simple example that demonstrates what works on
the one hand and what I would expect to work as well but does not. What
I'm doing is very basic: I'm population a list and when a user clicks on
an item in the link the details of that object are shown using ajax. The
following code works fine:
 
public class HomePage extends WebPage {
 @SpringBean
 private OrfDataService orfDataService;
 
 private OrfData selected = new OrfData();
 
 public HomePage(final PageParameters parameters) {
  // code block to be replaced  
  ModelString testModel = new ModelString() {
  public String getObject() {
   return selected.getProdNo();
  }
 };
  final Label testLabel = new Label(testLabel, testModel);
  // end of code block to be replaced
 
 testLabel.setOutputMarkupId(true);
add(testLabel);
 
  add(new ListViewOrfData(orfDataList, orfDataService.getOrfData())
{
 
   public void populateItem(final ListItemOrfData listItem) {
// add all the listItem labels etc..

listItem.add(new AjaxLinkOrfData(selectLink) {
 @Override
 public void onClick(AjaxRequestTarget target) { 
  selected = getModelObject();
  
  target.addComponent(testLabel);
 }
 
});
   }
  });
}

 public void setOrfDataService(OrfDataService orfDataService) {
  this.orfDataService = orfDataService;
 }
}

However, naturally I want to do the above using PropertyModel. But if I
replace the commented code block above with the following line:
final Label testLabel = new Label(testLabel, new
PropertyModelString(selected, prodNo));

The label no longer gets updated.
 
Any idea what I'm doing wrong here?
 
Thanks, Jonck
P.S. I know the usage of the orfDataService is not really all that great
here, it's just as an example


Passing models to panels - Couldn't resolve model type of Model

2009-11-20 Thread Kogel, Jonck-van-der
Hi,
I'm have a question about my application design and whether I should
pass a model to a panel or an id and create a new
LoadableDetachableModel in the panel. Here is a basic layout of my app:
 
I have taken out the non-relevant parts for brevity.
 
My domain model is basically as follows:
Base class is ARF. It has an owner, a keeper and a user. The owner,
keeper and user all have a correspondence address and a visiting
address.
 
The layout of my application reflects this. The main screen has 3 tabs,
one for owner, one for user and one for keeper. These tabs are panels. I
also defined one addressPanel to display all the addresses.
 
So when I am building my view, it is as follows:
 
On my page I create a LoadableDetachableModel as follows:
 
IModelARF arfModel = new LoadableDetachableModelARF() {
 @Override
 protected ARF load() {
  return arfService.load(arfId);
 }
}; 
 
I pass this model on to my tabs panel:
 
public class ArfPageTabsPanel extends Panel {
 public ArfPageTabsPanel(String id, IModelARF arfModel) {
  super(id);
  add(new TabOwner(tabOwner, arfModel));
  add(new TabKeeper(tabKeeper, arfModel));
  add(new TabUser(tabUser, arfModel));
 }
}
 
The TabOwner class is as follows:
 
public class TabOwner extends Panel {
 public TabOwner(String id, IModelARF arfModel) {
  super(id);
  
  add(new AddressPanel(correspondenceAddress, Correspondentie-adres,
new PropertyModelAddress(arfModel, owner.correspondenceAddress)));
  add(new AddressPanel(visitingAddress, Bezoekadres, new
PropertyModelAddress(arfModel, owner.visitingAddress)));
 }
}
 
the TabKeeper and TabUser classes are much the same as the TabOwner
class (probably I could do some code reuse here, I'll do that when
everything is working and I understand it all).
 
And then the AddressPanel is as follows:
 
public class AddressPanel extends Panel {
 public AddressPanel(String id, String addressHeader, IModelAddress
addressModel) {
  super(id);
  add(new Label(addressHeader, addressHeader));
  add(new TextFieldString(street, new
PropertyModelString(addressModel, street)));
  add(new TextFieldString(houseNr, new
PropertyModelString(addressModel, houseNr)));
  add(new TextFieldString(houseNrExt, new
PropertyModelString(addressModel, houseNrExt)));
  add(new TextFieldString(zipcode, new
PropertyModelString(addressModel, zipcode)));
  add(new TextFieldString(city, new
PropertyModelString(addressModel, city)));
 }
}
 
 
So I am nesting all my models here, since the underlying arfModel is a
LoadableDetachableModel and I don't want to get my panels and the main
view out of sync. The problem is however that sometimes there is no
owner/keeper/user and hence also no addresses for that relation. When I
do load an ARF that has a null keeper for example, my console is flooded
with the following message:
 
2009-11-20 17:42:02,274 WARN [AbstractTextComponent] Couldn't resolve
model type of
Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Mod
el:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:
classname=[com.bmw.preparer2.view.ArfPage$1]:attached=true:tempModelObje
ct=[com.bmw.preparer2.domain@d737e3]]:expression=[user.visitingAddre
ss]]:expression=[city] for [MarkupContainer [Component id = city]],
please set the type yourself.

 

I am assuming that this has to do with that I am nesting my models and
that one of them is null. So in the AddressPanel I am creating a
PropertyModel where the passed on model is potentially null.

So my question is, how do I handle such a situation? Please advise.

Thanks very much, Jonck van der Kogel