ClassCastException in ListMultipleChoice

2009-09-22 Thread Sadhna Ahuja
Hello,

 

I have a ListMultipleChoice component in my form and I get the following
exception when I select an option and submit the form:

 

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast
to java.util.Collection

  at
org.apache.wicket.markup.html.form.ListMultipleChoice.updateModel(ListMu
ltipleChoice.java:325)

  at
org.apache.wicket.markup.html.form.Form$20.validate(Form.java:1837)

  at
org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(
Form.java:165)

  at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPost
OrderHelper(FormComponent.java:421)

  at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPost
OrderHelper(FormComponent.java:408)

  at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPost
Order(FormComponent.java:385)

  at
org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(For
m.java:1060)

  at
org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModel
s(Form.java:1829)

  at
org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.j
ava:1796)

  at org.apache.wicket.markup.html.form.Form.process(Form.java:865)

  at
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:807)

  ... 53 more

 

Could someone please point out if I'm missing something? Here's the
relevant pieces of my code:

--

ListMultipleChoice searchPymntApplCd = new
ListMultipleChoice(

searchPymntApplCd,

new AbstractReadOnlyModel() {

public Object getObject() {

return getPaymentApplOptions(paymentAppls);
//This returns ArrayListPaymentApplOption

}},

new IChoiceRenderer() {

public Object getDisplayValue(Object object) {

PaymentApplOption option =
(PaymentApplOption) object;

return option.getPymntApplDesc();

}

public String getIdValue(Object object, int
index) {

if
(PaymentApplOption.class.isInstance(object)) {

PaymentApplOption option =
(PaymentApplOption) object;

return option.getPymntApplCd();

}

return null;

}

}).setMaxRows(5);

searchPymntApplCd.setRequired(false);

searchPymntApplCd.setType(Collection.class);

add(searchPymntApplCd);

 

---

public class PaymentApplOption implements Serializable {

 

private String pymntApplCd;

private String pymntApplDesc;

...

}

 

Thanks.

 

 

 



Multiple choice checkboxes

2009-09-22 Thread Sadhna Ahuja
Is there a way to have multiple choice checkboxes? From what I read on
the forums, I could only have a ListMultipleChoice.

 

But I need to have multiple choice checkboxes. Any examples on how I
could achieve that?

 

Thanks.

 

 

 

 



ClassCastException in ListMultipleChoice

2009-09-21 Thread Sadhna Ahuja
Hello,

 

I have a ListMultipleChoice component in my form and I get the following
exception when I select an option and submit the form:

 

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast
to java.util.Collection

  at
org.apache.wicket.markup.html.form.ListMultipleChoice.updateModel(ListMu
ltipleChoice.java:325)

  at
org.apache.wicket.markup.html.form.Form$20.validate(Form.java:1837)

  at
org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(
Form.java:165)

  at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPost
OrderHelper(FormComponent.java:421)

  at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPost
OrderHelper(FormComponent.java:408)

  at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPost
Order(FormComponent.java:385)

  at
org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(For
m.java:1060)

  at
org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModel
s(Form.java:1829)

  at
org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.j
ava:1796)

  at org.apache.wicket.markup.html.form.Form.process(Form.java:865)

  at
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:807)

  ... 53 more

 

Could someone please point out if I'm missing something? Here's the
relevant pieces of my code:

--

ListMultipleChoice searchPymntApplCd = new
ListMultipleChoice(

searchPymntApplCd,

new AbstractReadOnlyModel() {

public Object getObject() {

return getPaymentApplOptions(paymentAppls);
//This returns ArrayListPaymentApplOption

}},

new IChoiceRenderer() {

public Object getDisplayValue(Object object) {

PaymentApplOption option =
(PaymentApplOption) object;

return option.getPymntApplDesc();

}

public String getIdValue(Object object, int
index) {

if
(PaymentApplOption.class.isInstance(object)) {

PaymentApplOption option =
(PaymentApplOption) object;

return option.getPymntApplCd();

}

return null;

}

}).setMaxRows(5);

searchPymntApplCd.setRequired(false);

searchPymntApplCd.setType(Collection.class);

add(searchPymntApplCd);

 

---

public class PaymentApplOption implements Serializable {

 

private String pymntApplCd;

private String pymntApplDesc;

...

}

 

Thanks.

 

 

 



Multiple choice checkboxes

2009-09-21 Thread Sadhna Ahuja
Is there a way to have multiple choice checkboxes? From what I read on
the forums, I could only have a ListMultipleChoice.

 

But I need to have multiple choice checkboxes. Any examples on how I
could achieve that?

 

Thanks.

 

 

 

 



Displaying column totals for a DefaultDataTable

2009-09-11 Thread Sadhna Ahuja
Hello,

 

I have a DefaultDataTable with several amount colums. I need to display
a Totals row at the bottom of the table to show the column totals.

 

I have searched the forum, and only found suggestions to use
addBottomToolbar.

 

However, I don't know how to do this? Looking at Wicket's HeaderToolbar,
I see that I would need to pass the DataTable and the
SortableDataProvider to my TotalsToolbar.

 

But, how would the toolbar get the data to display?

 

What would the html markup for this toolbar be like?

 

Would greatly appreciate if someone could please provide some sample
code.

 

Thanks in advance.

 

 

 

 



how to format DateField

2009-08-27 Thread Sadhna Ahuja
Hi,

 

I am using a DateField and in my css I am trying to make the font size
smaller for this component.

 

I notice that the DatePicker calendar font has become smaller, but the
DateTextField does not get that style.

 

How should I make the DateTextField get the same style?

 

Here's the relevant pieces from my code.

 

HTML:

-

wicket:extend

form wicket:id=depositSummarySearchForm

fieldset

table

tr

tdspan wicket:id=dtTm class=gwformdate
tabindex=1 //td

/tr

tr

tdinput type=submit value=Search
name=submitSearch tabindex=3/td

/tr

/table

/fieldset

/form

 

CSS:



span.gwformdate {

color: Black;

font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;

font-size: x-small;

font-weight: 500;

}

 

Thanks,

Sadhna.