Hey Igor,

thanks very much again for your help.

>it is amazing how you can fully understand the wicket philosophy after
>only one day using it :)
LOL yes, I just meant from how I had understood it - which obviously is not
great at the moment. We all start from somewhere! :-)


>this is simply item.add(new
WebMarkupContainer("comment").setOutputMarkupId(true));
>wicket already has facilities for outputting unique markup ids

Ok thanks for that. Is there anyway to 'namespace' this? . My component is
displayed in 2 different areas of the same page (using different model
behind), therefore I need to assign either the component id plus an index to
the markup id to make it unique in the document. (I'd actually cut that out
of the example code I was using here). I suppose I can componentize it?

Does anyone know if there are any architecture diagrams/flows of how things
happenings in Wicket? I read the 'Wicket In Action' book pre-lease which
gave a great introduction for me, however there's only so much can be
covered. I'd like to understand the exact flows and what options there are,
or would you suggest I just get the code and step through it?

Thanks
Wayne


On Wed, Aug 13, 2008 at 7:03 PM, Igor Vaynberg <[EMAIL PROTECTED]>wrote:

> On Wed, Aug 13, 2008 at 9:50 AM, Wayne Pope
> <[EMAIL PROTECTED]> wrote:
> > Ok,
> >
> > so I'm new to this, however things have been progression ok for my first
> day
> > with Wicket.
> > However it seems to me that I must be doing HTML markup manipulation in
> java
> > when the manipulation only concerns the view and not the data behind it.
> > This seems at odds with wicket philosophy.
>
> it is amazing how you can fully understand the wicket philosophy after
> only one day using it :) anyways, what you are doing is not markup
> manipulation, you are outputting a dynamic value attribute which is
> quiet logical to do from code...
>
> >                item.add(new Label("title", new
> > PropertyModel(news,"title")));
>
> proper way to do this is to chain the models:
>
> item.add(new label("title", new propertymodel(item.getmodel(), "title")))
>
> >                item.add(new WebMarkupContainer("comment") {
> >                    protected void onComponentTag(ComponentTag tag) {
> >                    tag.getAttributes().put("id","comment"+index); }
> >                });
>
> this is simply item.add(new
> WebMarkupContainer("comment").setOutputMarkupId(true));
> wicket already has facilities for outputting unique markup ids
>
> >                item.add(new WebMarkupContainer("makecomment") {
> >                    protected void onComponentTag(ComponentTag tag) {
> >
> tag.getAttributes().put("onclick","getElementById('comment"+index+"').style.display='';return
> > false;"); }
> >                });
>
> componentize this:
> class javascriptshowlink extends webmarkupcontainer {
>  private final component target;
>  // constructor left to your imagination
>
>  protected void oncomponenttag(tag) {
>     tag.put("onclick",
> "getelementbyid('"+target.getmarkupid();+"').style.display='';return
> false;");
>     // there is nothing wrong with doing this, it is a dynamic string
> generated via code
>  }
>
> then just item.add(new javascriptshowlink("show", commentContainer);
>
> -igor
>
>
>
> >
> >
> >
> >
> >            }
> >        };
> >
> >        add(items);
> >
> >
> > Ok so that code is just to demonstrate what I mean. The point is I need
> to
> > manipulate the attributes of elements, just so I can setup some
> javascript
> > stuff. Is there no better way of just doing this in the markup or some
> form
> > of wicket:tag that can insert the current list item index?
> >
> > thanks
> > Wayne
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to