On 5/22/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
im taking a stab in the dark here, but
if you call setColumns(>1) then the chances are you are going to have an
empty cell that needs to be populated and your populateEmptyItem method is
not reproducing the hierarchy properly.
You beat me to my last reply...this is probably *exactly* what's
happening. However, I'm implementing that method...is it just not
working correctly?
as i said, if you can mock enough of this in wicket-quickstart i can help
you more. if not then you have to walk the code and see what goes wrong.
I have been...the method fires. Do all the controls that exist in
populateItem also need to exist in populateEmptyItem?? Would
"missing" controls explain the screwed-up hierarchy?
the best way to use the gridview imho is to make each cell a panel or a
fragment so that in markup you only have <td wicket:id="cells"><span
wicket:id="cell-panel"/></td> that way in populateEmptyItem you can just add
an empty panel and be done.
so instead of <td wicket:id="cells"><a wicket:id="link"><span
wicket:id="label"></span></a></td>
you have
<td wicket:id="cells"><span wicket:id="item"></span></td>
...
<wicket:fragment wicket:id="item-frag"><a wicket:id="link"><span
wicket:id="label"></span></a></wicket:fragment>
<wicket:fragment
wicket:id="empty-item-frag"></wicket:fragment>
makes things nice and easy
ouch...a panel for each cell?
-Igor
On 5/22/06, VGJ <[EMAIL PROTECTED]> wrote:
>
>
> Another lead, and perhaps the source of the problem:
>
> If I have setRows() set on the control...it doesn't render how I want but
the hierarchy exception goes away. If I set setColumns() on the
control...ka-boom.
>
> Obviously the control is messing itself up on account of my messed up
HTML?
>
>
> On Mon, 2006-05-22 at 15:52 -0700, Igor Vaynberg wrote:
>
>
> where is the populateEmptyItem you are supposed to implement for the
gridview? this method populate left over cells and is probably what is
causing the hierarchy mismatch.
>
> also here is how to implement detachable idataprovider:
>
> class mydataprovider implemetns IDataProvider, IDetachable {
> private transient List list;
>
> public void detach() { list=null; }
>
> public iterator iterateor(int first, int last) {
> return getlist().listiterator(first);
> }
>
> public int size() {
> return getlist().size();
> }
>
> private List getlist() {
> if (list==null) {
> list=...load list here
> }
> return list;
> }
> }
>
> -Igor
>
>
>
>
> On 5/22/06, Vincent Jenks < [EMAIL PROTECTED]> wrote:
>
> Yeah, that's what I figured given the example, however that's where my
> problem lies. The items I'm adding in populateItem in the GridView
> can't be found, I'm getting the hierarchy problem exception.
>
> Here's what I'm doing in the page as an overview:
>
> 1. List Product Categories (ListView)
> 2. for each Category, retrieve and display Products (GridView)
> 3. Display 3-column table w/ Product details ("cols" in GridView)
>
> Here's the code:
>
> //add ListView object to page w/ data
> add(new ListView("categoryView", categoryModel)
> {
> protected void
populateItem(ListItem item)
> {
> //get catagory item
> final ProductCategory
category = (ProductCategory)item.getModelObject();
>
> //add category label
> item.add(new
Label("category", category.getName()));
>
> //STILL DON'T UNDERSTAND
HOW TO PASS THIS INTO GRIDVIEW
> IModel productModel = new
LoadableDetachableModel()
> {
> protected Object
load()
> {
> return
ProductProxy.getProducts (category);
> }
> };
>
> IDataProvider provider =
new
> ProductDataProvider(ProductProxy.getProducts(category)); //HARDCODED,
> NOT DETACHED! SEE DETACHED MODEL ABOVE!
> GridView productView =
new GridView("productView", provider)
> {
> protected void
populateItem(Item item)
> {
> //get
product item
> final
Product product = (Product)item.getModelObject();
>
> //create
thumbnail link w/ event
> Link
thumbnailLink = new Link("thumbnailLink")
> {
>
public void onClick()
> {
>
setResponsePage(new ProductDetail(product));
> }
> };
>
> //add
attribute modifier
>
thumbnailLink.add(wmc);
>
> //add
thumbnail link
>
item.add(thumbnailLink);
> .....
>
> You'll notice I've got a detached model in there...right now it's not
> being used since I haven't figured out how to send detached data from
> this page into the IDataProvider derived class (another issue, not to
> get off track, sorry!)
>
> Here's my HTML, I'm sure it's fantastically wrong but I need to see it
> rendered to decide if it looks right:
>
> ...............
>
> <tr
wicket:id="categoryView">
>
<td>
>
<span wicket:id="category"
class="titleSmall">category</span>
>
<hr width="100%" size="1" />
>
<br />
>
<table width="200" align="left"
wicket:id="productView">
>
<tr>
>
<td wicket:id="cols">
>
<table
width="200" align="left">
>
<tr>
>
<td>
>
<a href="#" wicket:id="thumbnailLink">
>
<img src="#" wicket:id="thumnailImg"
width="200"
> height="134" border="0" />
>
</a>
>
</td>
>
</tr>
>
> ................
>
> Here's the exception I'm getting, it's not finding the thumbnailLink
> control above:
>
> WicketMessage: Unable to find component with id 'thumbnailLink' in
> [MarkupContainer [Component id = 4, page =
> com.myapp.ui.ProductCatalog, path =
> 2:categoryView:0:productView:1:cols:4.Item, isVisible =
true,
> isVersioned = true]]. This means that you declared
> wicket:id=thumbnailLink in your markup, but that you either did not
> add the component to your page at all, or that the hierarchy does not
> match.[markup =
> file:/C:/Program%20Files/jboss-
4.0.4.GA/server/default/tmp/deploy/tmp37375MyAppEAR.ear-contents/MyApp-exp.war/WEB-INF/classes/com/myapp/ui/ProductCatalog.html,
> index = 29, current = '<a href="#" wicket:id="thumbnailLink">' (line
> 61, column 15)]
>
> I must just be missing something obvious....I thought I set it up
> correctly per the wicket-examples GridViewPage example.
>
> On 5/22/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > cols objects are generated by the gridview, whatever components you add
to
> > the gridview in populate have to go inside the cols
> >
> > -Igor
> >
> >
> > On 5/22/06, VGJ <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > The code in examples looks screwy to me too, since it defines
> > wicket:id="rows" for the GridView control and wicket:id="cols" as the
> > columns...yet in the class there is no mention of "cols" anywhere. Is
this
> > some built-in object?
> > >
> > > I'm obviously getting an exception because I've setup "rows" and
"cols"
> > but there is no "cols" - every widget I've nested inside of "cols" is
> > causing my hierarchy to be incorrect.
> > >
> > >
> > > On Mon, 2006-05-22 at 10:02 -0700, Igor Vaynberg wrote:
> > >
> > >
> > >
> > >
> > > On 5/22/06, VGJ < [EMAIL PROTECTED]> wrote:
> > >
> > > Ok, this makes more sense than the example in wicket-examples.
However,
> > what if the List I'm passing in is actually wrapped in a
> > LoadableDetachableModel?
> > >
> > > that should be ok because dataview will check if the idataprovider
impl
> > you passed in also implements IDetachable and call detach on it at the
end
> > of request.
> > >
> > > so class MyDataProvider extends ListDataProvider implements
IDetachable
> > {....}
> > >
> > >
> > >
> > >
> > >
> > > Congrats on the baby, by the way!!
> > >
> > > thank you :)
> > >
> > > -Igor
> > >
> > >
> > >
> >
> >
>
>
> -------------------------------------------------------
> 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?cmdlnk&kid0709&bid&3057&dat1642
> _______________________________________________
> Wicket-user mailing list
> Wicket-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=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user