_javascript_Id = (String)tag.getAttributes().get("id");
if (Strings.isEmpty(_javascript_Id))
{
_javascript_Id = getJavascriptId();
tag.put("id", _javascript_Id);
}
I have to have the id because i need that id for 'fake' submits (Choices onSelection change events and so on)
The current way does have one draw back. If the request for the _javascript_id/css id of the form will be before
the form is renderd (only happening when a submit button is places outside form and above it) then a default
id is generated and the css id that a form has is overridden.
But if we have the preparse of things (so much like a fake rendering phase) then this shouldn't be nessesary anymore.
johan
On 12/29/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
On 12/29/05, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> 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.
non-wicket tags are not available to Wicket at all. They are hidden in
RawMarkup. They are only accessible during markup parsing.
>
> 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_.
The only solution I see to get the id is to make the tag a wicket tag
and assign a WebMarkupContainer. During the render phase the tag is
available and hence the tag's attributes as well. You can assign the
attribute a Wicket component variable and later, when needed, the
component can be retrieved and the variable (id) be used for whatever.
But the tag has be before the tag which makes use of the id.
Only Wicket V2 will separate attachMarkup and render in two separate
phases and only than you'll be able to get any (Wicket) components
attributes.
Juergen
>
> 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
-------------------------------------------------------
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
