This is only accessible for subclasses of MarkupContainer. Not for Behaviours that might want to render _javascript_ based on non-wicket managed CSS id's.

I am currently busy working out a schema for easy Ajax stuff using the scriptaculous library, and when you want to update other parts of a page, then you need the CSS id, not the wicket:id. The CSS id could be generated by Wicket, but that is not working when using CSS or non-generated _javascript_.

So in order to work nicely with severside generated _javascript_ we should open up some way at getting at the CSS id.

I'll make my showcase available soon (I'm waiting on an answer by the Flickr team). Basically I've recreated the Ruby on Rails Flickr demo application using Wicket, the FlickrJ library and scriptaculous (not the wicket-contrib-scriptaculous library). Currently it is too complicated IMHO to create such an application. Mind that I have been struggling mostly with the scriptaculous.js and prototype.js components, not the Wicket side of things. The problem with Wicket starts when you want to create an easy, reusable way of providing the desired functionality.

Martijn

On 12/29/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
On 12/29/05, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> OK, but how to get to the markupstream?

For containers which are currently being rendered:
markupContainer.getMarkupStream()
markupContainer.findMarkupStream()

Note: MarkupContainer.markupStream is a temporary variable only and
only available during the render cycle.

> It is internal for MarkupContainer,
> and there is no way to get at the stream of another component while in
> IBehaviour#onComponentTag(Component component, ComponentTag
> tag).

The component you want the markup stream for has to be rendered
already. That is, you can not get the markup stream of a component
which will be rendered later. Separating the current render phase into
a attachMarkup and render phase is scheduled for wicket V2 as it most
likely requires major changes to wicket core (and will not be
backwards compatible. Chris and Jon discussed it a year ago already)

However, this is how to get a markupStream
MarkupStream markupStream =
findParentWithAssociatedMarkup().getAssociatedMarkupStream();
// Make sure the markup stream is position at the correct element
markupStream.setCurrentIndex(this.markupStreamPosition);


>
>  Should we open up the API to get at the markup attributes in a read-only
> manner?
>

I don't see why.

Juergen

>  Martijn
>
>
>
>
> On 12/28/05, Juergen Donnerstag <[EMAIL PROTECTED] > wrote:
> >
> > On 12/28/05, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> > > All,
> > >
> > >  Is it possible to retrieve the value of an attribute of a markup tag
> which
> > > is used in combination with a component?
> > >
> >
> > CompentTag.getAttributes().get("myAttr")
> >
> > and if tag is not given
> >         // Get the current markup element
> >         final MarkupElement element = markupStream.get();
> >
> >         if (element instanceof ComponentTag)
> >         {
> >                 // Get element as tag
> >                 final ComponentTag tag = (ComponentTag)element;
> >
> > Juergen
> >
> > >  Say I want to get the contents of the 'id' attibute of a tag, but not
> > > overwrite it...
> > >
> > >  This is very useful when working with prototype.js or other _javascript_
> > > libraries that can automatically update markup based on the return
> answer,
> > > and when one doesn't want the 'id' attribute to be generated by wicket
> (CSS,
> > > etc).
> > >
> > >  Martijn
> > >
> > > --
> > > Living a wicket life...
> > >
> > > Martijn Dashorst - http://www.jroller.com/page/dashorst
> > >
> > > Wicket 1.1 is out:
> http://wicket.sourceforge.net/wicket-1.1
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> > for problems?  Stop!  Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> > http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
> > _______________________________________________
> > Wicket-develop mailing list
> > [email protected]
> >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> >
>
>
>
> --
>
> Living a wicket life...
>
> Martijn Dashorst - http://www.jroller.com/page/dashorst
>
> Wicket 1.1 is out: http://wicket.sourceforge.net/wicket-1.1


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop



--
Living a wicket life...

Martijn Dashorst - http://www.jroller.com/page/dashorst

Wicket 1.1 is out: http://wicket.sourceforge.net/wicket-1.1

Reply via email to