You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by extraquoo <ex...@gmail.com> on 2017/07/28 23:40:30 UTC

how to map list model within another list model by propertyModel

Hi , I have a xml class MC216 which has below object
 @XmlElement(required = true)
    protected IncomeInformation section3;
and 
IncomeInformation class have below list object
 protected List<IncomeDetail> incomes;

and this IncomeDetail class has below list object
 protected List<IncomeA> incomeEstimate;

Then, how to map the incomeEstimate by using PropertyModel. 
My code is below

final PropertyModel<IncomeInformation> sectionThreeModel = new
PropertyModel<IncomeInformation>(mc216Model, "section3");		
			final WebMarkupContainer populateIncomeInfo = new
WebMarkupContainer("populateIncomeInfo");
			final PropertyModel<List&lt;IncomeDetail>> currentIncomeList = new
PropertyModel<List&lt;IncomeDetail>>(sectionThreeModel, "incomes");
			
			final PropertyModel<List&lt;IncomeA>> populateIncomeList = new
PropertyModel<List&lt;IncomeA>>(currentIncomeList, "incomeEstimate");
			if (populateIncomeList.getObject() == null) {
				populateIncomeList.setObject(new ArrayList<IncomeA>());
			}

Here the currentIncomeList  can be mapped correctly  while
populateIncomeList can't. It throws exception 
when calling getObject().

*[ERROR] org.apache.wicket.RequestCycle |
RequestCycle.logRuntimeException(1531) | The expression 'incomeEstimate' is
neither an index nor is it a method or field for the list class
java.util.ArrayList
org.apache.wicket.WicketRuntimeException: The expression 'incomeEstimate' is
neither an index nor is it a method or field for the list class
java.util.ArrayList*


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-map-list-model-within-another-list-model-by-propertyModel-tp4678350.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: how to map list model within another list model by propertyModel

Posted by Maxim Solodovnik <so...@gmail.com>.
I believe it is not possible
You have to create listview, each item will have model of IncomeDetail.
Then you can map IncomeA

WBR, Maxim
(from mobile, sorry for the typos)


On Jul 29, 2017 13:57, "extraquoo" <ex...@gmail.com> wrote:

Hi , I have a xml class MC216 which has below object
 @XmlElement(required = true)
    protected IncomeInformation section3;
and
IncomeInformation class have below list object
 protected List<IncomeDetail> incomes;

and this IncomeDetail class has below list object
 protected List<IncomeA> incomeEstimate;

Then, how to map the incomeEstimate by using PropertyModel.
My code is below

final PropertyModel<IncomeInformation> sectionThreeModel = new
PropertyModel<IncomeInformation>(mc216Model, "section3");
                        final WebMarkupContainer populateIncomeInfo = new
WebMarkupContainer("populateIncomeInfo");
                        final PropertyModel<List&lt;IncomeDetail>>
currentIncomeList = new
PropertyModel<List&lt;IncomeDetail>>(sectionThreeModel, "incomes");

                        final PropertyModel<List&lt;IncomeA>>
populateIncomeList = new
PropertyModel<List&lt;IncomeA>>(currentIncomeList, "incomeEstimate");
                        if (populateIncomeList.getObject() == null) {
                                populateIncomeList.setObject(new
ArrayList<IncomeA>());
                        }

Here the currentIncomeList  can be mapped correctly  while
populateIncomeList can't. It throws exception
when calling getObject().

*[ERROR] org.apache.wicket.RequestCycle |
RequestCycle.logRuntimeException(1531) | The expression 'incomeEstimate' is
neither an index nor is it a method or field for the list class
java.util.ArrayList
org.apache.wicket.WicketRuntimeException: The expression 'incomeEstimate' is
neither an index nor is it a method or field for the list class
java.util.ArrayList*


--
View this message in context: http://apache-wicket.1842946.
n4.nabble.com/how-to-map-list-model-within-another-list-
model-by-propertyModel-tp4678350.html
Sent from the Users forum mailing list archive at Nabble.com.

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