Request for help with generics-related compiler warnings

2009-11-07 Thread Philip Johnson

Greetings, Wicket Wizards,

I am updating a sample Wicket program from 1.3.6 to 1.4.3 and running into 
a few generics-related issues.   I am hoping you folks can quickly set me 
straight. My code appears to run successfully and passes its JUnit tests, 
despite the warnings I would like to remove.  The purpose of the code is 
to demonstrate simple use of Forms, Lists, and Tables and associated 
testing of these constructs using WicketTester.


First off, although you hopefully will not need to, you can download the 
sample code from here:

http://ics-wicket-examples.googlecode.com/files/wicket-example02-1.0.1106.zip

Unzip, cd into the directory, and type ant, It should download Ivy, then 
download Wicket, Jetty, SLF4J, and JUnit, and finally compile the system, 
generating the following generic-related warnings.   Let me now show you 
what they are:


Problem 1:  please take a look at line 39 of TablePage.java:
http://code.google.com/p/ics-wicket-examples/source/browse/trunk/example02/src/edu/hawaii/wicket/TablePage.java

The problematic line is:
new ListDataProvider(contacts)

and obviously requires a generic argument, but neither of the following 
work:

 new ListDataProviderContact(contacts)  // my preferred guess
 new ListDataProviderListContact(contacts)

The compiler warning is:
   [javac] TablePage.java:39: warning: [unchecked] unchecked call to 
ListDataProvider(java.util.ListT) as a member of the raw type 
org.apache.wicket.markup.repeater.data.ListDataProvider

   [javac] new ListDataProvider(contacts)) {
   [javac] ^
   [javac] TablePage.java:39: warning: [unchecked] unchecked conversion
   [javac] found   : 
org.apache.wicket.markup.repeater.data.ListDataProvider
   [javac] required: 
org.apache.wicket.markup.repeater.data.IDataProviderjava.util.Listedu.hawaii.wicket.TablePage.Contact

   [javac] new ListDataProvider(contacts)) {
   [javac] ^

Problem 2:  on line 49 of the same file, TablePage.java:
http://code.google.com/p/ics-wicket-examples/source/browse/trunk/example02/src/edu/hawaii/wicket/TablePage.java

The line is:
Contact contact = (Contact) item.getModelObject();

Since the preceding line provides a parameterized declaration of  item 
(ItemListContact item), I don't understand why I need to cast here. 
But the code does not compile if I don't.  Then, I get the following 
warning:


   [javac] TablePage.java:49: warning: [unchecked] unchecked cast
   [javac] found   : java.util.Listedu.hawaii.wicket.TablePage.Contact
   [javac] required: edu.hawaii.wicket.TablePage.Contact
   [javac] Contact contact = (Contact) item.getModelObject();
   [javac]
^

Problem 3:  WicketTester and generics.

I clearly don't understand how to test with WicketTester.  Take a look at 
lines 37-39 of TestListPage:

http://code.google.com/p/ics-wicket-examples/source/browse/trunk/example02/src/edu/hawaii/wicket/TestListPage.java

This is a mess, and generates the following warning:
   [javac] TestListPage.java:39: warning: [unchecked] unchecked cast
   [javac] found   : capture#294 of ?
   [javac] required: java.util.Listjava.lang.String
   [javac] ListString metaVars = (ListString) 
varsModel.getObject();


I have a feeling that my whole approach to getting values out of the table 
for testing is wrong, but I don't know what the correct approach is.


If any of you can give me a hand, the first Mai Tai is on me the next time 
you are in Hawaii.


Thanks!
Philip





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



FormTester not working in Cheesr (Wicket In Action) update to 1.4.3

2009-11-07 Thread Philip Johnson

Greetings, Wicketopians,

I am updating the Cheesr application to 1.4.3, and with some help from 
Andrig Miller, have got the actual application working fine.


The problem I am having is with the unit tests that I wrote for the 1.3.6 
version. I use FormTester to fill out the fields on a Checkout page and 
then submit the results.  When running the application interactively, 
submitting the form works correctly and sends you back to an Index page. 
My test code looks like this:


FormTester formTester = tester.newFormTester(form);
formTester.setValue(name, Philip);
formTester.setValue(street, Main Street);
formTester.setValue(zipcode, 96822);
formTester.setValue(city, Anchorage);
formTester.setValue(state-wmc:state, Alaska);
formTester.submit();
tester.assertRenderedPage(Index.class);

But it doesn't work: the last assertion indicates that we're still on the 
Checkout page. This test worked under 1.3.6.   I've played around with 
this for a couple of hours now and am convinced that there's something 
simple going on that I simply can't see.  Can any of you straighten me 
out?


Here's the test class:
http://code.google.com/p/ics-wicket-examples/source/browse/trunk/example04/src/com/cheesr/TestCheckoutPage.java

Here's the Form definition:
http://code.google.com/p/ics-wicket-examples/source/browse/trunk/example04/src/com/cheesr/CheckoutPage.java

Here's the page's HTML:
http://code.google.com/p/ics-wicket-examples/source/browse/trunk/example04/src/com/cheesr/CheckoutPage.html

If you'd like to download the entire application:
http://ics-wicket-examples.googlecode.com/files/wicket-example04-1.0.1107.zip

Thanks so much for any help you can provide,
Philip


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



How to design tables that support 50-100K rows?

2008-04-16 Thread Philip Johnson

Greetings, wicket experts,

I am a newly infatuated wicket developer, and would like to solicit your advice on the 
best way to design a table that can support up to 100,000 rows. Here are my initial 
thoughts:


* Clearly, I don't want to display all of them at once.  I am assuming that I will want 
to use a class like PageableListView so that I can show only 500 or so at a time. Is that 
reasonable, or is there a better approach?


* Clearly, I don't want to have to keep all of the rows in memory.  I am assuming I need 
to use a LoadableDetachable model as a result.  Is that correct?


* Finally, when I am displaying Page 1 containing 500 rows (using something like 
PageableListView), I'd like to only populate my model with rows 1-500 from my backing 
store.  Let's say the user then clicks on Page 3: at that point, I'd like to go retrieve 
rows 1001-1500 from my backing store and populate my model for rows 1001-1500.  How would 
one go about doing this?  Would it be possible to kind of sketch out the approach for me?


If I am totally going down the wrong path, please let me know about that.

Thanks for your help!

Cheers,
Philip Johnson



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]