Re: DataView the easy way?
Thanks a lot, it works :) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579384.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: DataView the easy way?
try with item.add(new Label("title", expedition.get(0).toString())); On Tue, Jun 7, 2011 at 1:07 PM, Zeldor wrote: > I almost have it... I have my ArrayList of lists, so I guess my code should > look smth like that: > > > ArrayList<ArrayList<Long>> colonisations = > MySession.loggedInUser.colonisations; > add(new DataView("expeditionsView", new > ListDataProvider(colonisations)) > { > @Override > protected void populateItem(final Item item) > { > ArrayList expedition = (ArrayList)item.getModelObject(); > // "item" represents the current "row-component" > item.add(new Label("title", expedition.get(0))); > item.add(new Label("price", expedition.get(1))); > } > }); > > I must be doing some fundamental mistake here, as it can't work. It throws > "cannot find symbol: symbol constructor Label" at both item.add lines > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579270.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 > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DataView the easy way?
I almost have it... I have my ArrayList of lists, so I guess my code should look smth like that: ArrayList<ArrayList<Long>> colonisations = MySession.loggedInUser.colonisations; add(new DataView("expeditionsView", new ListDataProvider(colonisations)) { @Override protected void populateItem(final Item item) { ArrayList expedition = (ArrayList)item.getModelObject(); // "item" represents the current "row-component" item.add(new Label("title", expedition.get(0))); item.add(new Label("price", expedition.get(1))); } }); I must be doing some fundamental mistake here, as it can't work. It throws "cannot find symbol: symbol constructor Label" at both item.add lines -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579270.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: DataView the easy way?
Hi Zeldor, the populateItem-method is used to populate the rows of your table. Basically, you can add the "cells" of your rows there. DataView will loop through the elements of your collection automatically, and for every element in the collection call the populateItem-method with the current element passed as a parameter. So by slightly modifying the SimplePage that Martin suggested to match your case you should get something like this: List colonisations = ...; // initialized somewhere else add( new DataView( "expeditionsView", new ListDataProvider(colonisations) ) { @Override protected void populateItem(final Item item) { Expedition expedition = item.getModelObject(); // "item" represents the current "row-component" item.add(new Label("title", expedition.getTitle()); item.add(new Label("price", expedition.getPrice()) } } ); As you can see, you're just populating your table-rows' cells with the components you need. Instead of Labels you could also add Buttons or whatever you like. greetz, achim Am 07.06.2011 12:10, schrieb Zeldor: Ok, I changed it to ArrayList<ArrayList<Long>>, but I still don't get how to use populateItem... Even testing just that add(new DataView("expedition", MySession.loggedInUser.colonisations) { }); Results in: internal error; cannot instantiate org. apache.wicket.markup.repeater.data.DateView. at org.apache.wicket.markup.repeater.data.DAtaView to () -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579173.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DataView the easy way?
Ok, I changed it to ArrayList<ArrayList<Long>>, but I still don't get how to use populateItem... Even testing just that add(new DataView("expedition", MySession.loggedInUser.colonisations) { }); Results in: internal error; cannot instantiate org. apache.wicket.markup.repeater.data.DateView. at org.apache.wicket.markup.repeater.data.DAtaView to () -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579173.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: DataView the easy way?
Do I need to do anything special? Will it automatically go through all rows of my Map? When my map is HashMap<Integer,ArrayList> then Expedition will be my ArrayList or whole row, together with int id? I could probably use just a list of ArrayLists if it'd be easier... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579147.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: DataView the easy way?
populateItem() gives you one Expedition at a time. You decide how to render it. On Tue, Jun 7, 2011 at 11:42 AM, Zeldor wrote: > Right :) > > > So I want to start with something like: > > add(new DataView("expedition", > MySession.loggedInUser.colonisations) { > }); > > I am confused how to implement populateItem though... > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579124.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 > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DataView the easy way?
Right :) So I want to start with something like: add(new DataView("expedition", MySession.loggedInUser.colonisations) { }); I am confused how to implement populateItem though... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3579124.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: DataView the easy way?
There are 15+ pages because there are examples for several components in this folder. Just take a look at SimplePage.java and it should become clear how to do it. On Tue, Jun 7, 2011 at 8:53 AM, Zeldor wrote: > Hi, > > I am trying to make my first DataView and I found an example that does what > I want. It's quite confusing though - it takes like 15 pages and classes to > do it and I cannot decipher it. > http://wicketstuff.org/wicket14/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.SimplePage > http://wicketstuff.org/wicket14/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.SimplePage > > So, any ideas how to do it fast, just on one page? I have a HashTable with > ArrayLists [HashTable<Integer, ArrayList<Long>>] that I want to > display. Of course I don't know how many rows I will have, that's why I want > DataView. I want to display 3 first data from the ArrayList in the map and I > want to be able to select rows [so I can delete them by int id]. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3578760.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 > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
DataView the easy way?
Hi, I am trying to make my first DataView and I found an example that does what I want. It's quite confusing though - it takes like 15 pages and classes to do it and I cannot decipher it. http://wicketstuff.org/wicket14/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.SimplePage http://wicketstuff.org/wicket14/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.SimplePage So, any ideas how to do it fast, just on one page? I have a HashTable with ArrayLists [HashTable<Integer, ArrayList<Long>>] that I want to display. Of course I don't know how many rows I will have, that's why I want DataView. I want to display 3 first data from the ArrayList in the map and I want to be able to select rows [so I can delete them by int id]. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataView-the-easy-way-tp3578760p3578760.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