Re: [Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-26 Thread Leon Lee

I just tried your code. Like you said, it's really not working. I think this
might be a wicket's shortcoming. Maybe you should avoid using ListView when
you want to validate your form, or try to use Tapestry. I guess Tapestry
does not have this kind of problem.

Regards,
Leon
--
View this message in context: 
http://www.nabble.com/How-to-add-components-nested-in-the-list-view-to-a-IFormValidator--t1834645.html#a5047708
Sent from the Wicket - User forum at Nabble.com.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-26 Thread Igor Vaynberg
heh, why dont you go troll somewhere else-IgorOn 6/26/06, Leon Lee [EMAIL PROTECTED] wrote:
I just tried your code. Like you said, it's really not working. I think thismight be a wicket's shortcoming. Maybe you should avoid using ListView when
you want to validate your form, or try to use Tapestry. I guess Tapestrydoes not have this kind of problem.Regards,Leon--View this message in context: 
http://www.nabble.com/How-to-add-components-nested-in-the-list-view-to-a-IFormValidator--t1834645.html#a5047708Sent from the Wicket - User forum at Nabble.com.Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-26 Thread itsliang

Hi Igor,

You are right. It works very well now. Next time I'll spend more time to
read javadoc. Anyway, thanks a lot!!

Kind regards,
C Chang
-- 
View this message in context: 
http://www.nabble.com/How-to-add-components-nested-in-the-list-view-to-a-IFormValidator--tf1834645.html#a5059465
Sent from the Wicket - User forum at Nabble.com.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-24 Thread itsliang

This is my first time to use wicket. Hence, I don't know whether I did it
right or wrong. Anyway, I have reproduced my case below, the first part is
java code, and the second part is markup file. Any idea is appreciated,
Thanks a lot!!

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import wicket.markup.html.WebPage;
import wicket.markup.html.form.CheckBox;
import wicket.markup.html.form.DropDownChoice;
import wicket.markup.html.form.Form;
import wicket.markup.html.form.FormComponent;
import wicket.markup.html.form.validation.AbstractFormValidator;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.ListView;
import wicket.model.CompoundPropertyModel;
import wicket.model.PropertyModel;

public class TestPage extends WebPage {

private static final ListString DROP_DOWN_LIST = Arrays
.asList(new String[] { Sunday, Monday });

public TestPage() {
super.add(new TestForm(form));
}

private class TestForm extends Form {

public TestForm(String id) {
super(id);
ListInnerModel innerModel = new 
ArrayListInnerModel();
for (int i = 0; i  5; i++) {
innerModel.add(new InnerModel());
}
TestModel testModel = new TestModel();
testModel.setInnerModels(innerModel);
super.setModel(new CompoundPropertyModel(testModel));

ListView lv = new ListView(innerModels) {

protected void populateItem(ListItem item) {
CheckBox checkBox = new 
CheckBox(checked,
new 
PropertyModel(item.getModel(), checked));
item.add(checkBox);
DropDownChoice choice = new 
DropDownChoice(choice,
new 
PropertyModel(item.getModel(), choice),

TestPage.DROP_DOWN_LIST);
item.add(choice);
TestForm.this.add(new 
TestValidator(checkBox, choice));
}

};
super.add(lv);
}

}

private class TestValidator extends AbstractFormValidator {

private final FormComponent[] formComponents;

public TestValidator(FormComponent comp1, FormComponent comp2) {
this.formComponents = new FormComponent[] { comp1, 
comp2 };
}

public FormComponent[] getDependentFormComponents() {
return this.formComponents;
}

public void validate(Form form) {
if ((Boolean) 
this.formComponents[0].getConvertedInput() == true) {
if (!this.formComponents[1].getConvertedInput()
.equals(Sunday)) {
this.formComponents[1].error(ERROR!!);
}
}
}

}

private class TestModel implements Serializable {

private ListInnerModel innerModels;

public ListInnerModel getInnerModels() {
return this.innerModels;
}

public void setInnerModels(ListInnerModel model) {
this.innerModels = model;
}

}

private class InnerModel implements Serializable {

private boolean checked;

private String choice;

public boolean isChecked() {
return checked;
}

public void setChecked(boolean checked) {
this.checked = checked;
}

public String getChoice() {
return choice;
}

public void setChoice(String choice) {
this.choice = choice;
}

}

}

-
?xml version=1.0 encoding=BIG5 ?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:wicket=http://wicket.sourceforge.net;
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 /
titleInsert title here/title
/head
body
form wicket:id=form
table
tbody
tr wicket:id=innerModels
 

[Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-23 Thread itsliang

Hi,

I have a form that uses ListView to generate some form components, but I
don't know how to use a form validator to validate those nested components.
Here is the example:

public class TestForm extends Form {

public TestForm(String arg0) {
ListView lv = new ListView(list) {
protected void populateItem(ListItem item) {
CheckBox checkBox = new CheckBox(check);
item.add(checkBox);
DropDownChoice choice = new 
DropDownChoice(choice);
item.add(choice);
}
};
}

private class TestFormValidator extends AbstractFormValidator {

private final FormComponent[] formComponents;

public TestFormValidator(FormComponent checkBox, FormComponent 
choice) {
this.formComponents = new FormComponents[] {checkBox, 
choice};
}

public FormComponent[] getDependentFormComponents() {
}

public void validate(Form arg0) {
}

}

}

Can anybody tell me how to add both checkBox component and choice component
into TestFormValidator?

Regards,
Chih-liang Chang
--
View this message in context: 
http://www.nabble.com/How-to-add-components-nested-in-the-list-view-to-a-IFormValidator--t1834645.html#a5006956
Sent from the Wicket - User forum at Nabble.com.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-23 Thread Martijn Dashorst
populateItem(...) {
   ...
   TestForm.this.add(new TestFormValidator(checkbox, choice));
}

should do the trick.

Martijn

On 6/23/06, itsliang [EMAIL PROTECTED] wrote:

 Hi,

 I have a form that uses ListView to generate some form components, but I
 don't know how to use a form validator to validate those nested components.
 Here is the example:

 public class TestForm extends Form {

 public TestForm(String arg0) {
 ListView lv = new ListView(list) {
 protected void populateItem(ListItem item) {
 CheckBox checkBox = new CheckBox(check);
 item.add(checkBox);
 DropDownChoice choice = new 
 DropDownChoice(choice);
 item.add(choice);
 }
 };
 }

 private class TestFormValidator extends AbstractFormValidator {

 private final FormComponent[] formComponents;

 public TestFormValidator(FormComponent checkBox, 
 FormComponent choice) {
 this.formComponents = new FormComponents[] {checkBox, 
 choice};
 }

 public FormComponent[] getDependentFormComponents() {
 }

 public void validate(Form arg0) {
 }

 }

 }

 Can anybody tell me how to add both checkBox component and choice component
 into TestFormValidator?

 Regards,
 Chih-liang Chang
 --
 View this message in context: 
 http://www.nabble.com/How-to-add-components-nested-in-the-list-view-to-a-IFormValidator--t1834645.html#a5006956
 Sent from the Wicket - User forum at Nabble.com.


 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-- 
Download Wicket 1.2 now! Write Ajax applications without touching JavaScript!
-- http://wicketframework.org

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-23 Thread itsliang

I tried, however, I got an exception:

WicketMessage: Method onFormSubmitted of interface
wicket.markup.html.form.IFormSubmitListener targeted at component
[MarkupContainer [Component id = form, page = test.TestPage, path =
0:form.TestPage$TestForm, isVisible = true, isVersioned = true]] threw an
exception

Root cause:

java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = check, page = No Page, path =
0:check.CheckBox]]
at wicket.Component.getPage(Component.java:1022)
at wicket.Component.hasErrorMessage(Component.java:1226)
at wicket.markup.html.form.FormComponent.isValid(FormComponent.java:442)
at wicket.markup.html.form.Form.validateFormValidators(Form.java:1021)
at wicket.markup.html.form.Form.validate(Form.java:958)
at wicket.markup.html.form.Form.process(Form.java:868)
at wicket.markup.html.form.Form.onFormSubmitted(Form.java:313)
...

Any idea?

Regards,
Chih-liang Chang
--
View this message in context: 
http://www.nabble.com/How-to-add-components-nested-in-the-list-view-to-a-IFormValidator--t1834645.html#a5011402
Sent from the Wicket - User forum at Nabble.com.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How to add components nested in the list view to a IFormValidator?

2006-06-23 Thread Igor Vaynberg
you forgot to add the form to the page?-IgorOn 6/23/06, itsliang [EMAIL PROTECTED] wrote:
I tried, however, I got an exception:WicketMessage: Method onFormSubmitted of interfacewicket.markup.html.form.IFormSubmitListener targeted at component[MarkupContainer [Component id = form, page = test.TestPage
, path =0:form.TestPage$TestForm, isVisible = true, isVersioned = true]] threw anexceptionRoot cause:java.lang.IllegalStateException: No Page found for component[MarkupContainer [Component id = check, page = No Page, path =
0:check.CheckBox]]at wicket.Component.getPage(Component.java:1022)at wicket.Component.hasErrorMessage(Component.java:1226)at wicket.markup.html.form.FormComponent.isValid(FormComponent.java:442)at wicket.markup.html.form.Form.validateFormValidators
(Form.java:1021)at wicket.markup.html.form.Form.validate(Form.java:958)at wicket.markup.html.form.Form.process(Form.java:868)at wicket.markup.html.form.Form.onFormSubmitted(Form.java:313)...Any idea?
Regards,Chih-liang Chang--View this message in context: http://www.nabble.com/How-to-add-components-nested-in-the-list-view-to-a-IFormValidator--t1834645.html#a5011402
Sent from the Wicket - User forum at Nabble.com.Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user