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/27 19:58:34 UTC
PropertyListView does not render the value from the html page to
xml property
Hi I am creating a PropertyListView to dynamically populate rows to collect
data of contact information.
I am able to map the wicket id between html and panel class. However, when I
click save button , the value does not persist in the corresponding object.
The code is below
*main class code:*
final WebMarkupContainer newPhone = new
WebMarkupContainer("newContactPhone");
final YesNoFormBorder s1Border = new YesNoFormBorder("sectionOne",
new PropertyModel<YesNo>(sectionOneModel, "yesorNo"),
new StringResourceModel("forms.mc216.section1", this, mc216Model));
PropertyModel<ContactInformation> sectionOneModel = new
PropertyModel<ContactInformation>(mc216Model, "section1");
final PropertyModel<List<ContactPhone>> contactPhoneList = new
PropertyModel<List<ContactPhone>>(sectionOneModel.getObject(),
"newContactPhone");
if (contactPhoneList.getObject() == null) {
contactPhoneList.setObject(new ArrayList<ContactPhone>());
}
PartialUpdateLimitedListView<ContactPhone> phoneListView = new
PartialUpdateLimitedListView<ContactPhone>(
"section1.newContactPhone", contactPhoneList ,ContactPhone.class){
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<ContactPhone> item ) {
final FormComponent<?>[] allFields = new FormComponent[3];
allFields[0] = new ReferenceTableDropDownChoice("contactPhone.type", new
Model<Long>(), new Model<String>(), DOCUMENT_CATEGORY).setRequired(true);
allFields[1] = new
FormTextField<String>("contactPhone.number").setRequired(true).add(new
PhoneValidator());
allFields[2] = new FormTextField<String>("contactTime");
item.add(allFields);
item.add(getPartialRefreshDeleteButton("delete", item));
item.add(new StyledFeedback("feedback", item));
}
};
s1Border.add(newPhone.setOutputMarkupPlaceholderTag(true));
newPhone.add(phoneListView.setReuseItems(true));
newPhone.add(phoneListView.getPartialRefreshAddButtonByListSize("addNewPhone",
ADD_MORE_LIMIT_TWO));
newPhone.add(phoneListView);
-------------------------------------------------------------
*PartialUpdateLimitedListView.java :*
public abstract class PartialUpdateLimitedListView<T> extends
PropertyListView<T>
{
......
public PartialUpdateLimitedListView(String id,
IModel<? extends List<? extends T>> model) {
super(id, model);
preserveRecord = true;
forceOneRow = true;
}
...............
}
---------------------------------------
property :
*MC216.java*
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MC216", propOrder = {
"section1",
"section2",
"section3",
"section4",
"section5",
"section6",
"section7",
"certification"
})
public class MC216
extends BaseDocumentType
implements Serializable
{
private final static long serialVersionUID = 12343L;
@XmlElement(required = true)
protected ContactInformation section1;
@XmlElement(required = true)
protected HouseholdInformation section2;
@XmlElement(required = true)
protected IncomeInformation section3;
@XmlElement(required = true)
protected HealthInsuranceInformation section4;
@XmlElement(required = true)
protected IncarcerationInformation section5;
@XmlElement(required = true)
protected DeceasedInformation section6;
@XmlElement(required = true)
protected HouseholdChanges section7;
protected MC216 .Certification certification;
...........
*ContactInformation.java*
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "contactInformation", propOrder = {
"caseNumber",
"name",
"currentHomeAddress",
"currentMailingAddress",
"currentContactPhone",
"newHomeAddress",
"newMailingAddress",
"newContactPhone",
"emailAddress"
})
public class ContactInformation
extends QuestionType
implements Serializable
{
private final static long serialVersionUID = 12343L;
@XmlElement(required = true)
protected String caseNumber;
@XmlElement(required = true)
protected String name;
@XmlElement(required = true)
protected AddressType currentHomeAddress;
@XmlElement(required = true)
protected AddressType currentMailingAddress;
@XmlElement(required = true)
protected List<PhoneNumberType> currentContactPhone;
protected AddressType newHomeAddress;
protected AddressType newMailingAddress;
protected List<ContactPhone> newContactPhone;
protected String emailAddress;
-------------------------------------
*ContactPhone.java*
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "contactPhone", propOrder = {
"contactPhone",
"contactTime"
})
public class ContactPhone
implements Serializable
{
private final static long serialVersionUID = 12343L;
@XmlElement(required = true)
protected PhoneNumberType contactPhone;
protected String contactTime;
------------------------------
*
HTML *
*<wicket:message
key="forms.mc216.section1.contactTitle">Contact:</wicket:message>*
<br/>
<wicket:message key="forms.mc216.section1.contactDesc">What number can
we call to contact you ?</wicket:message>
<label wicket:for="contactPhone.type">
<wicket:label for="contactPhone.type"
key="forms.mc216.section1.phonetype">Type:</wicket:label></label>
<label wicket:for="contactPhone.number">
<wicket:label for="contactPhone.number"
key="forms.mc216.section1.phoneNumber">Number:</wicket:label></label>
<label wicket:for="contactTime">
<wicket:label for="contactTime"
key="forms.mc216.section1.contactTime">Best Time to Contact
You:</wicket:label></label>
<div wicket:id="feedback" />
<button type="submit" wicket:id="delete">X</button>
<select wicket:id="contactPhone.type" />
<input type="text" maxlength="10" wicket:id="contactPhone.number"
/>
<input type="text" maxlength="10" wicket:id="contactTime" />
<input type="submit" wicket:id="addNewPhone"
class="ui-button ui-widget ui-state-default ui-corner-all
ui-button-text-only"
value="Add More" />
<http://apache-wicket.1842946.n4.nabble.com/file/n4678335/2017-07-27_12_58_11-PDLVDAPP124.png>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PropertyListView-does-not-render-the-value-from-the-html-page-to-xml-property-tp4678335.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