Re: customize the validation message for Form setMaxSize()

2018-10-16 Thread extraquoo
yes ,i find the key. thanks

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



customize the validation message for Form setMaxSize()

2018-10-03 Thread extraquoo
Hi ,

i am using setMaxSize() to limit the file upload size. 
Looks like the validation message is default to "Upload must be less than  "
Is there any way to customize this validation message ?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: spring controller redirect ModelAndView to a wicket panel class

2018-09-11 Thread extraquoo
thank you for your advice. I will let our architect team investigate such an
integration problem. 

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: spring controller redirect ModelAndView to a wicket panel class

2018-09-10 Thread extraquoo
the purpose is the clients want to reuse an existing wicket html page for
some enhancement in a spring mvc flow of business. 
I am trying three ways "redirect:../[url]" , "redirect:[url]" and "/[url]"
.The first two just kicks me out and return to the application home page
which is coded by wicket. The last one is throwing stack trace of apache
tiles which is used by spring mvc/spring web flow.

you are right, the wicket owns authentication functionality when a user
logins the application. Maybe this is the root cause of kick out. Not sure
if it could pass the entire session of authentication by some additional
code or config file ?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: spring controller redirect ModelAndView to a wicket panel class

2018-09-07 Thread extraquoo
Thanks for your answer.

The panel class has its HTML file and it is mounting in the startup
initialization 

mountBookmarkablePage("/CaseVerificationUpload.html",CaseVerificationUploadsPage.class);

when I am using
return new ModelAndView("redirect:../CaseVerificationUpload.html")
then the application kicks me out to the login page

then I change to 
return new ModelAndView("/CaseVerificationUpload.html")
I get stack trace saying 
org.apache.wicket.WicketRuntimeException: javax.servlet.ServletException: No
Tiles definition found for name 'CaseVerificationUpload.html'

am I missing some configuration ? Can you tell me what is the correct value
to put in the ModelAndView? 

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: spring controller redirect ModelAndView to a wicket panel class

2018-09-07 Thread extraquoo
just correct that the panel class is CaseVerificationUploadsPanel

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



spring controller redirect ModelAndView to a wicket panel class

2018-09-06 Thread extraquoo
Hi 
my project is implemented by two frameworks: spring web flow and wicket.
Now in one of the spring controller, I want to the spring ModelAndView
redirects to an existing wicket panel class.
 
the code of spring controller is below :
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, 
BindException errors)
throws Exception {
..
if (StringHelper.isValid(startAppEvent)) {
return new
ModelAndView("redirect:../services/continueApplication?_eventId=startApp&_flowExecutionKey="+
flowExecutionKey);
}else if (StringHelper.isValid(cboVerifEvent)){
return new ModelAndView("");// want to redirect to 
wicket panel
}

I also have an existing panel class: ImageUploadsPanel

then how can ModelAndView redirect and pass parameters to call the panel
class?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



how to restrict the feedback message to display only one time for FormComponentPanel

2018-02-07 Thread extraquoo
our app has a phone number field like ###-###- x## on the page

 

We define a phone number class as FormComponentPanel in our app  like below 
public class PhoneFormComponent extends FormComponentPanel
{

private static final long serialVersionUID = 1L;

private TextField areaField;
private TextField threeField;
private TextField fourField;
private TextField extField;
private String area;
private String three;
private String four;
private String ext;

public PhoneFormComponent(String id, IModel phone) {
super(id, phone);
init();

}

private void init() {
if (getModelObject() != null) {
if 
(StringUtils.isNotBlank(getModelObject().getNumber())) {
String phoneNumber = 
getModelObject().getNumber();
area = phoneNumber.substring(0, 3);
three = phoneNumber.substring(4, 7);
four = phoneNumber.substring(8, 12);
}
ext = getModelObject().getExtension();
}
add(areaField = new TextField("area",
new PropertyModel(this, "area")));
areaField.add(new PatternValidator("\\d{3}")).setLabel(
new StringResourceModel("Phone", areaField, 
null));
add(threeField = new TextField("three",
new PropertyModel(this, "three")));
threeField.add(new PatternValidator("\\d{3}")).setLabel(
new StringResourceModel("Phone", threeField, 
null));
add(fourField = new TextField("four",
new PropertyModel(this, "four")));
fourField.add(new PatternValidator("\\d{4}")).setLabel(
new StringResourceModel("Phone", fourField, 
null));
add(extField = new TextField("ext", new 
PropertyModel(
this, "ext")));
extField.add(new PatternValidator("\\d{0,6}")).setLabel(
new StringResourceModel("Extension", extField, 
null));
areaField.add(new INullAcceptingValidator() {

/** Default serial id */
private static final long serialVersionUID = 1L;

@Override
public void validate(IValidatable validatable) {
if 
(StringUtils.isNotBlank(areaField.getConvertedInput()) != StringUtils

.isNotBlank(threeField.getConvertedInput())
&& 
StringUtils.isNotBlank(threeField

.getConvertedInput()) != StringUtils

.isNotBlank(fourField.getConvertedInput())) {
PhoneFormComponent.this.error(new 
ValidationError()

.addMessageKey("Incomplete"));
}
}

});
}

@Override
protected void convertInput() {
// note that earlier versions did override updateModel, which 
looked
// somewhat better, but wasn't useful for when you want to do
// validations with either normal validators or form validators
PhoneNumberType phoneNumber = new PhoneNumberType();
if (StringUtils.isNotBlank(areaField.getConvertedInput())
&& 
StringUtils.isNotBlank(threeField.getConvertedInput())
&& 
StringUtils.isNotBlank(fourField.getConvertedInput())) {
StringBuffer phoneString = new StringBuffer();
phoneString.append(areaField.getConvertedInput());
phoneString.append("-");
phoneString.append(threeField.getConvertedInput());
phoneString.append("-");
phoneString.append(fourField.getConvertedInput());
phoneNumber.setNumber(phoneString.toString());
phoneNumber.setExtension(extField.getConvertedInput());
setConvertedInput(phoneNumber);
} else if (StringUtils.isNotBlank(areaField.getConvertedInput())
|| 
StringUtils.isNotBlank(threeField.getConvertedInput())
|| 
StringUtils.isNotBlank(fourField.getConvertedInput())) {
  

Re: the choices is key instead of value when using DropDownChoice component

2018-01-29 Thread extraquoo
Hi ,just ignore my last reply. 

I should not override localizeDisplayValues to return true so as not to
execute
display = getLocalizer().getString(displayValue, this, displayValue);.

your code is really helpful. Thank you very much indeed.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: the choices is key instead of value when using DropDownChoice component

2018-01-29 Thread extraquoo
yes, it is hard to explain the issue. 
the situation is if I put the key in the choices, then the i18n works fine
for the front page ( when I click the locale change button ,the option got
translated correctly), however ,since the key is in the choices, in pdf, it
prints the verbiage key "forms.cf37.question8.oneTimeOrMonthly" instead of
exact verbiages.

if I put the value in the choices, then the verbiage prints on the pdf is
correct because the value is rendered.
however, the i18n does not work because the value is in the choices and when
executing

"display = getLocalizer().getString(displayValue, this, displayValue);"

Here, displayValue carries the value and getString method will not work
appropriately. which means the verbiage of the options will not change
correspondingly  when I click the button.

I am think is it possible to put the key
"forms.cf37.question8.oneTimeOrMonthly"  in the choices, and then when
selecting the option in the page, render the exact value to the
dropdownchoice object ?


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: the choices is key instead of value when using DropDownChoice component

2018-01-29 Thread extraquoo
thanks for replying. 
Looks like it still put the value in the choices object.
Maybe I am describing the issue incorrectly.

so if put value in the choices object , construct the DropDownChoice and
override localizeDisplayValues
DropDownChoice selector = new DropDownChoice(fieldName,
choices){

private static final long serialVersionUID = 1L;

@Override
protected boolean localizeDisplayValues() {
return true;
}
};

then it wont support i18n when executing below code of AbstractChoice.class

/**
 * Generates and appends html for a single choice into the provided 
buffer
 * 
 * @param buffer
 *Appending string buffer that will have the generated html
appended
 * @param choice
 *Choice object
 * @param index
 *The index of this option
 * @param selected
 *The currently selected string value
 */
@SuppressWarnings("unchecked")
protected void appendOptionHtml(AppendingStringBuffer buffer, E choice, 
int
index,
String selected)
{
T objectValue = (T)renderer.getDisplayValue(choice);
Class objectClass = (Class)(objectValue == null ? null :
objectValue.getClass());

String displayValue = "";
if (objectClass != null && objectClass != String.class)
{
final IConverter converter = getConverter(objectClass);

displayValue = converter.convertToString(objectValue, 
getLocale());
}
else if (objectValue != null)
{
displayValue = objectValue.toString();
}
buffer.append("\n");

String display = displayValue;
if (localizeDisplayValues())
{
*display = getLocalizer().getString(displayValue, this, 
displayValue);*
}
CharSequence escaped = display;
if (getEscapeModelStrings())
{
escaped = escapeOptionHtml(display);
}
buffer.append(escaped);
buffer.append("");
}


the bold line is using getString and here displayValue should be the key not
the value.



--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: the choices is key instead of value when using DropDownChoice component

2018-01-25 Thread extraquoo
Hi, I try to use GetString / StringResourceModel and put the key 
selectionDescription.add(new
StringResourceModel("forms.cf37.question8.oneTime",this,parent).getObject());
or
selectionDescription.add(getString("forms.cf37.question8.oneTime"));

Both of them will return the values from xml
however ,it doesn't support locale change in the pape because  it will
execute the wicket library class AbstractChoice and run below method:

/**
 * Generates and appends html for a single choice into the provided 
buffer
 * 
 * @param buffer
 *Appending string buffer that will have the generated html
appended
 * @param choice
 *Choice object
 * @param index
 *The index of this option
 * @param selected
 *The currently selected string value
 */
@SuppressWarnings("unchecked")
protected void appendOptionHtml(AppendingStringBuffer buffer, E choice, 
int
index,
String selected)
{
T objectValue = (T)renderer.getDisplayValue(choice);
Class objectClass = (Class)(objectValue == null ? null :
objectValue.getClass());

String displayValue = "";
if (objectClass != null && objectClass != String.class)
{
final IConverter converter = getConverter(objectClass);

displayValue = converter.convertToString(objectValue, 
getLocale());
}
else if (objectValue != null)
{
displayValue = objectValue.toString();
}
buffer.append("\n");

String display = displayValue;
if (localizeDisplayValues())
{
display = getLocalizer().getString(displayValue, this, 
displayValue);
}
CharSequence escaped = display;
if (getEscapeModelStrings())
{
escaped = escapeOptionHtml(display);
}
buffer.append(escaped);
buffer.append("");
}

Here, localizeDisplayValues is overrided to return true, so it will run 
display = getLocalizer().getString(displayValue, this, displayValue);
displayValue is the key so in the DropDownChoice options ,it needs to put
the key instead of value to support i18n.  
any advice ?


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



the choices is key instead of value when using DropDownChoice component

2018-01-24 Thread extraquoo
Hi
 I am adding a FormComponent DropDownChoice to display a dropdown list on
the page like below
 

To support the i18n, I  add the key to a list of choices and override the
localizeDisplayValues, the code is below

private FormComponent getQuestion8Select(String fieldName,
IModel parent) {

List selectionDescription = new ArrayList();
selectionDescription.add("forms.cf37.question8.oneTime");

selectionDescription.add("forms.cf37.question8.otherSourcemonthly");
DropDownChoice selector = new 
DropDownChoice(fieldName,
selectionDescription){
private static final long serialVersionUID = 1L;
@Override
protected boolean 
localizeDisplayValues() {
return true;
  }
};

 return selector;
}

the key forms.cf37.question8.oneTime and
forms.cf37.question8.otherSourcemonthly has different values in
corresponding XML files. 
  .xml
One time or ongoing
payment:
One time payment
_es.xml
Pago de solo una vez o
pago mensual:
Pago de solo una vez

When I switch the locale to Spanish, the verbiage changes well on the HTML.
 

However, the choices object carries the key instead of the value in the
backend.

Is there anything I miss to code for the DropDownChoice?  The choices need
to carry the exact values.



--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: wicket switch locale to Spanish but dot is being ignored

2018-01-08 Thread extraquoo
 I add a converter class and it works without impacting the message
resources.
Thank you so much.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: wicket switch locale to Spanish but dot is being ignored

2018-01-05 Thread extraquoo
why using getDateFormat()  for the decimal/currency converter ? can you
explain a little bit detailed?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: wicket switch locale to Spanish but dot is being ignored

2018-01-05 Thread extraquoo
I understand. could you please show me any sample of such this custom
converter?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



wicket switch locale to Spanish but dot is being ignored

2018-01-04 Thread extraquoo
Hi ,

my application supports the locale switch and when I am switching to Spanish
locale, the bigDecimal type textfield cannot be recognized the dot (eg.
555.555 is read as 55 ).

The textfield code is:

final FormBorder q4Border = new FormBorder(
"questionFour",
new StringResourceModel("forms.cf37.question4", 
this, cf37Model));
pageTwoForm.add(q4Border);

q4Border.add(new 
TextField("question4.rentOrMortgageAmt").add(
new DecimalOnlyValidator()));


--
the validator class is :

public class DecimalOnlyValidator extends AbstractValidator{

private static final long serialVersionUID = 1L;

@Override
protected void onValidate(IValidatable validatable) {
BigDecimal income =  validatable.getValue();
if(null!=income){
Boolean matchesVal 
=income.toString().matches("[0-9]+([,.][0-9]{1,2})?");
if(!matchesVal){

super.error(validatable,"BigDecimalValidator.format");
}

}
}
}

The weird thing is the income object in the validator class cannot see the
dot of the amount. The dot is working perfectly for English locale(15.55 is
input in the page and income object is still 15.55), but for Spanish, the
dot is missing ( 15.55 input in the page and income object shows 1555 ). 
the screenshot is below

 

 

Can someone explain it and provide the solution ?


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: How to add image in the panel class

2018-01-04 Thread extraquoo
I am adding the img tag in the i18n xml with key-value by using 

How to add image in the panel class

2018-01-03 Thread extraquoo
I want to add an image icon inline the title of the panel like below
 

the panel HTML is using the tag  to render the panel class

HTML :


..(verbiages) 




then the corresponding class extends the Panel :

public class AmericansWithDisabilitiesPanel extends Panel {
private static final long serialVersionUID = 1L;
public AmericansWithDisabilitiesPanel(String pWicketId) {
super(pWicketId);
}
}


Is there any way to add the image to the panel title?


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: i18n of ButtonElement for YES/NO button text

2017-12-27 Thread extraquoo
Thank you for your answer. I am using StringResourceModel and it works
perfectly for i18n dynamically.


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



i18n of ButtonElement for YES/NO button text

2017-12-18 Thread extraquoo
Hi,

I am facing an i18n for a yes/no radio button listener in a Border class
when doing locale switch.

here is some piece of orginal codes

// Lets other elements register yes/no selections listeners
listeners = new ArrayList();

// The button elements for yes & no are constructed and added 
here
ArrayList> buttonList = new
ArrayList>();
buttonList.add(yes = new ButtonElement(
new Model(YesNo.Y), new 
Model("Yes")));
buttonList.add(yes = new ButtonElement(
new Model(YesNo.N), new 
Model("No")));
yesNoGroup = new ButtonRadioSet("yesNoGroup",
Model.ofList(buttonList), questionAnswer);


in the corresponding html, 







* Question
text*










-
I am trying to use GetString() method to replace the "YES","NO" in model
attribute and create key-value pairs in  the xml files (xxx_es.xml,
xxx_zh.xml) for different languages. However, since it is controller tier,
when I change the locale, it won't touch the class to execute border
initialization. 
I find the tag  works perfectly for i18n. Is there any
similar way in wicket framework that can solve the i18n for 
ButtonRadioSet/ButtonElement in border component?



--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: how to get parent listView item index in the child listview populateItem method

2017-08-07 Thread extraquoo
i am not aware of it. Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-parent-listView-item-index-in-the-child-listview-populateItem-method-tp4678401p4678478.html
Sent from the Users forum 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



how to get parent listView item index in the child listview populateItem method

2017-08-02 Thread extraquoo
Hi , I try to use setOutputMarkupId and setMarkupId to generate the id for
the component radio button 

the hierarchy is 

List incomeDetail has a child List incomeA.

 I use PropertyListView to loop List incomeDetail and in populateItem method

I use another PropertyListView to loop List IncomeA, then in the child
PropertyListView, I want to get the current index of parent list
incomeDetail to construnct an id for the radio button object in IncomeA.

code is like below

final PropertyModel> currentIncomeList = new
PropertyModel>(sectionThreeModel, "incomes");

final PropertyListView incomeExpenseDetail = new
PropertyListView("section3.currentIncome", currentIncomeList,
IncomeDetail.class){

private static final long serialVersionUID = 1L;
int a =1;

@Override
protected void 
populateItem(ListItem item) {
IncomeDetail incomeDetail = 
(IncomeDetail) item.getModelObject();
final PropertyModel> populateIncomeList = new
PropertyModel>(item.getDefaultModelObject(),
"incomeEstimate");

final PropertyListView incomeListView = new
PropertyListView("section3.incomes.populateIncomeDetail", 
populateIncomeList 
,IncomeA.class){


private static final 
long serialVersionUID = 1L;


@Override
protected void 
populateItem(ListItem item ) {
IncomeA income = (IncomeA) item.getModelObject();
..
yesRadio.setOutputMarkupId(true).setMarkupId("corectRadio_Y_"+* i * );
.

here *i *should be the parent listview current index.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-parent-listView-item-index-in-the-child-listview-populateItem-method-tp4678401.html
Sent from the Users forum 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: PropertyListView issue of adding multiple instance to every child list.

2017-08-02 Thread extraquoo
and looks like it will add to the second list in the object every time 


 

the instance in first list is added to the second list mulitple times

the xml is like this 


   
  
 John, Taylor
 5000
 
d

Monthly
 
 


Monthly
 
 2000
  
  
 Mary, Taylor
 3000
 
d

Monthly
 
 


Monthly
 
 
d

Monthly
 
 


Monthly
 
 
d

Monthly
 
 


Monthly
 
 2000
 3000  
  
   
  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PropertyListView-issue-of-adding-multiple-instance-to-every-child-list-tp4678402p4678403.html
Sent from the Users forum 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



PropertyListView issue of adding multiple instance to every child list.

2017-08-02 Thread extraquoo
Hi ,I am creating AjaxFallbackButton to dynamically add new instance to
collect data in PropertyListView.

however ,after it is saved in the xml , the new instance is add to every
child list.

screenshot like this 
this is the table of the PropertyListView  under income 1

 

this is the table of the PropertyListView under income 2

 

after saved, 
both of the PropertyListView has new instance.

 

 

the xml after saving is like below ,here the instance is added twice in each
one.


  
 John, Taylor
 5000
 
d

Monthly
 
 


Monthly
 
 2000
  
  
 Mary, Taylor
 5000
 
d

Monthly
 
 


Monthly
 
 2000
 3000   
  
   

below is the code of the ajaxbutton

public Button getPartialRefreshAddButtonByListSize(String id, final int
size) {
return new AjaxFallbackButton(id, null) {

/** Default serial id */
private static final long serialVersionUID = 1L;

@Override protected void onConfigure () { 
  setVisible (getList().size() < size); 
  super.onConfigure(); 
} 

@Override
protected void onSubmit(AjaxRequestTarget target, 
Form form) {

List targetList = 
PartialUpdateLimitedListView.this
.getModelObject();
targetList.add(createNewItem());

if (target != null) {
setResponsePage(getPage());
}
}
}.setDefaultFormProcessing(false);
}

protected T createNewItem() {
if (type == null) {
throw new UnsupportedOperationException(
"PartialUpdateListView#createNewItem: 
Type is null, and create item
isn't overridden");
} else {
try {
return type.newInstance();
} catch (Exception e) {
throw new RuntimeException(

"PartialUpdateListView#createNewItem: Unable to generate a new
instance of a generic",
e);
}
}
}

does anyone know how to resolve it ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PropertyListView-issue-of-adding-multiple-instance-to-every-child-list-tp4678402.html
Sent from the Users forum 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



how to map list model within another list model by propertyModel

2017-07-29 Thread extraquoo
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 incomes;

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

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

final PropertyModel sectionThreeModel = new
PropertyModel(mc216Model, "section3");   
final WebMarkupContainer populateIncomeInfo = new
WebMarkupContainer("populateIncomeInfo");
final PropertyModel> 
currentIncomeList = new
PropertyModel>(sectionThreeModel, "incomes");

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

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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



PropertyListView does not render the value from the html page to xml property

2017-07-27 Thread extraquoo
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(sectionOneModel, 
"yesorNo"),
new StringResourceModel("forms.mc216.section1", 
this, mc216Model));
PropertyModel sectionOneModel = new
PropertyModel(mc216Model, "section1");
final PropertyModel> contactPhoneList = new
PropertyModel>(sectionOneModel.getObject(),
"newContactPhone");
if (contactPhoneList.getObject() == null) {
contactPhoneList.setObject(new 
ArrayList());
}

  PartialUpdateLimitedListView phoneListView = new
PartialUpdateLimitedListView(
"section1.newContactPhone", contactPhoneList 
,ContactPhone.class){

private static final long serialVersionUID = 1L;

@Override
protected void populateItem(ListItem item 
) {

final FormComponent[] allFields = new 
FormComponent[3];

allFields[0] = new 
ReferenceTableDropDownChoice("contactPhone.type", new
Model(), new Model(), DOCUMENT_CATEGORY).setRequired(true);
allFields[1] = new
FormTextField("contactPhone.number").setRequired(true).add(new
PhoneValidator());
allFields[2] = new 
FormTextField("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 extends
PropertyListView
 {
..
public PartialUpdateLimitedListView(String id,
IModel> 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 currentContactPhone;
protected AddressType newHomeAddress;
protected AddressType newMailingAddress;
protected List newContactPhone;
protected String emailAddress;

-

*ContactPhone.java*



Re: how to implement resource bundle to get text from the xml file

2017-07-26 Thread extraquoo
the current project use the i18n xml like below 

 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-implement-resource-bundle-to-get-text-from-the-xml-file-tp4678278p4678312.html
Sent from the Users forum 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



how to implement resource bundle to get text from the xml file

2017-07-24 Thread extraquoo
Hi , I want to  get the text from the corresponding xml .

how to get the text from a xml resource file and assign to String variable 
"message" ? my code is below 

add(new AbstractBehavior() {

private static final long 
serialVersionUID = 1L;

public void renderHead(IHeaderResponse 
response) {
super.renderHead(response);
if (!modalRendered) {

response.renderOnLoadJavascript("$('#dialog-message-forms').dialog('open');");
*String message="You 
will be able to attach all supporting
documentation after you submit the report";*


response.renderOnLoadJavascript("$('#dialog-message-text').html( '" +
message +  " ');");
modalRendered = true;
}
}
});

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-implement-resource-bundle-to-get-text-from-the-xml-file-tp4678278.html
Sent from the Users forum 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: how to hide the AjaxFallbackButton when the number of Models is larger than a specific integer

2017-07-24 Thread extraquoo
 the onConfigure is working fine now . previous code overrides the
onBeforeRender method and I am not aware of that. for the wicket lifecyle ,
onConfigure is executed before onBeforeRender method.

Thank you for your help.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-hide-the-AjaxFallbackButton-when-the-number-of-Models-is-larger-than-a-specific-integer-tp4678266p4678277.html
Sent from the Users forum 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: how to hide the AjaxFallbackButton when the number of Models is larger than a specific integer

2017-07-24 Thread extraquoo
by the way, the project uses 1.4.1 wicket version~~~

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-hide-the-AjaxFallbackButton-when-the-number-of-Models-is-larger-than-a-specific-integer-tp4678266p4678275.html
Sent from the Users forum 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: how to hide the AjaxFallbackButton when the number of Models is larger than a specific integer

2017-07-24 Thread extraquoo
Hi ,

Thanks for you reply. I remove my method  hideAddButton()  from
phoneListView 

then I create a new ajaxcallbackbutton method to carry your code like below 

public Button getLimitedPartialRefreshAddButton(String id, final int
limited) {
return new AjaxFallbackButton(id, null) {

/** Default serial id */
private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return isEnabledInHierarchy();
}

@Override protected void onConfigure () { 
  super.onConfigure(); 

  setVisible (getList().size() < limited); 
} 

@Override
protected void onSubmit(AjaxRequestTarget target, 
Form form) {

List targetList = 
PartialUpdateListView.this.getModelObject();
targetList.add(createNewItem());

if (target != null) {
setResponsePage(getPage());
}

}
}.setDefaultFormProcessing(false);
}

then add this button in the phoneViewList :

newPhone.add(phoneListView.getLimitedPartialRefreshAddButton("addNewPhone",
ADD_MORE_LIMIT_TWO));

the button is not hidden when I add phone panel twice.

any suggestion ?

 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-hide-the-AjaxFallbackButton-when-the-number-of-Models-is-larger-than-a-specific-integer-tp4678266p4678274.html
Sent from the Users forum 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



how to hide the AjaxFallbackButton when the number of Models is larger than a specific integer

2017-07-21 Thread extraquoo
here i have an AjaxFallbackButton to dynamically add  new models of phone
information
My issue is that I want to hide this button if the models are added three
times ( three phone number panels)

here is my code. 

final PropertyModel> contactPhoneList = new
PropertyModel>(mc216.getSection1(),
"newContactPhone");

 final PartialUpdateListView phoneListView = new
PartialUpdateListView(
"newContactPhone", contactPhoneList 
,ContactPhone.class){

private static final long serialVersionUID = 1L;

@Override
protected void populateItem(ListItem 
item) {

final FormComponent[] allFields = new 
FormComponent[3];

allFields[0] = new 
ReferenceTableDropDownChoice("contactPhone.type", new
Model(), new Model(), DOCUMENT_CATEGORY);
allFields[1] = new
FormTextField("contactPhone.Number").setRequired(true).add(new
PhoneValidator());
allFields[2] = new 
FormTextField("contactTime");
item.add(allFields);


item.add(getPartialRefreshDeleteButton("delete", item));
item.add(new StyledFeedback("feedback", item));


}
@Override
public boolean hideAddButton() {
if(contactPhoneList.getObject().size()  > 2 
)   
{   
//TODO : hide the button
return true;
}
else{
return false;
}
}

};

newPhone.add(phoneListView.setReuseItems(true));


newPhone.add(phoneListView.getPartialRefreshAddButton("addNewPhone"));
newPhone.add(phoneListView);
s1Border.add(newPhone);



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-hide-the-AjaxFallbackButton-when-the-number-of-Models-is-larger-than-a-specific-integer-tp4678266.html
Sent from the Users forum 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: how to hide the AjaxFallbackButton when the number of Models is larger than a specific integer

2017-07-21 Thread extraquoo
here is the screenshot of the page

 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-hide-the-AjaxFallbackButton-when-the-number-of-Models-is-larger-than-a-specific-integer-tp4678266p4678267.html
Sent from the Users forum 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