You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tommy Sadiq Hinrichsen <to...@gmail.com> on 2013/07/04 16:03:38 UTC

Updating forms model causes panel to lose model

Hey

I have a form on a page.

In that form a have a panel.

When i change the forms model with setModel( A Compound PropertyModel)

The panel loose the model due to MarkupContainer line 780.

This is a problem because i want to get the model some time later in the
panel, but because its a compoundpropertymodel in the form, i get the
following error.

Caused by: java.lang.RuntimeException: An error occurred while getting the
model object for Component: [AccountInfoPanel [Component id =
accountInfoPanel, page =
com.trifork.pengeplan.web.app.secure.transactions.AddTransactionPage, path
= 2:entityEdit:accountInfoPanel.AccountInfoPanel, isVisible = true,
isVersioned = true], children = [Component id = ownedAccountType]
[Component id = depositoryType] [RepeatingView [Component id =
accountInfoView]]]
 at org.apache.wicket.Component.getDefaultModelObject(Component.java:1673)
~[wicket-core-1.5.6.jar:1.5.6]
at
org.apache.wicket.markup.html.panel.GenericPanel.getModelObject(GenericPanel.java:59)
~[wicket-core-1.5.6.jar:1.5.6]
 at
com.trifork.pengeplan.web.app.secure.transactions.AddTransactionsPageComponents.panel.AccountInfoPanel.onConfigure(AccountInfoPanel.java:151)
~[classes/:na]
 at org.apache.wicket.Component.configure(Component.java:1093)
~[wicket-core-1.5.6.jar:1.5.6]
at org.apache.wicket.Component.internalBeforeRender(Component.java:984)
~[wicket-core-1.5.6.jar:1.5.6]
 at org.apache.wicket.Component.beforeRender(Component.java:1027)
~[wicket-core-1.5.6.jar:1.5.6]
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1743)
~[wicket-core-1.5.6.jar:1.5.6]
 ... 49 common frames omitted
Caused by: org.apache.wicket.WicketRuntimeException: No get method defined
for class: class com.trifork.pengeplan.domain.CompleteAccountTransaction
expression: accountInfoPanel
 at
org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:499)
~[wicket-core-1.5.6.jar:1.5.6]
at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:341)
~[wicket-core-1.5.6.jar:1.5.6]
 at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
~[wicket-core-1.5.6.jar:1.5.6]
at
org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
~[wicket-core-1.5.6.jar:1.5.6]
 at
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
~[wicket-core-1.5.6.jar:1.5.6]
at org.apache.wicket.Component.getDefaultModelObject(Component.java:1668)
~[wicket-core-1.5.6.jar:1.5.6]
 ... 55 common frames omitted

Could someone please help me?


Med venlig hilsen / Best regards

Tommy Sadiq Hinrichsen

Re: Updating forms model causes panel to lose model

Posted by Paul Bors <pa...@bors.ws>.
Well if its a CPM and you error is:

Caused by: java.lang.RuntimeException: An error occurred while getting the
model object for Component: [AccountInfoPanel [Component id =
accountInfoPanel, page =
com.trifork.pengeplan.web.app.secure.transactions.AddTransactionPage, path
= 2:entityEdit:accountInfoPanel.AccountInfoPanel, isVisible = true,
isVersioned = true], children = [Component id = ownedAccountType]

Your path seems to be:
entityEdit:accountInfoPanel.AccountInfoPanel

I take it entityEdit is your form, then your CPM should have an object with a getAccountInfoPanel.AccountInfoPabel()

In other words if you're using CPM then make sure the POJO that backs it up has fields matching your wicket IDs nested through getters and setters.

However, Wicket's idiom is to nest models. On your panel inside the form for each form field use new PropertyModel("myClassFieldName", getModel())

This should have the PropertyModel use the parent's CPM and look up for the property you really need.

~ Thank you,
   Paul C Bors

On Jul 4, 2013, at 10:03, Tommy Sadiq Hinrichsen <to...@gmail.com> wrote:

> Caused by: java.lang.RuntimeException: An error occurred while getting the
> model object for Component: [AccountInfoPanel [Component id =
> accountInfoPanel, page =
> com.trifork.pengeplan.web.app.secure.transactions.AddTransactionPage, path
> = 2:entityEdit:accountInfoPanel.AccountInfoPanel, isVisible = true,
> isVersioned = true], children = [Component id = ownedAccountType]

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