That worked Great! Thx for the help.
I also created a simple Border that uses this Behavior since that is the
pattern I'll be using the most (provided to help others):
It seems there is more than one way to skin this cat. I'm really looking
forward to Wicket in Action. I'm hoping that besides acting as a great
reference, it will be great at explaining the "intent" of the design of the
APIs so that end users can make correct design decisions. Igor's correction
is a perfect example. Why is it better to use "
response.renderOnLoadJavascript()" versus overriding onRendered()?
Anyhoo, I'm enjoying using Wicket. Thanks to all the developers for their
hard work.
public class RoundCornersBorder extends Border {
private static final long serialVersionUID = 1L;
public RoundCornersBorder(String id) {
super(id);
add(new RoundedCorners()); // The behavior outlined previously
}
public RoundCornersBorder(String id, String cssClass) {
this(id);
add(new AttributeModifier("class", true, new Model(cssClass)));
}
}
and the HTML:
<wicket:border>
<div style="padding: 5px">
<wicket:body/>
</div>
</wicket:border>
On 7/1/07, Gerolf Seitz <[EMAIL PROTECTED]> wrote:
thx for the corrections, igor.
i have one question though: what if the panel get's updated via ajax,
wouldn't the whole panel be "redrawn" and thus loosing the
javascript-rendered round corners?
that was actually the reason for putting the javascript code after the
rendering of the component.
please correct any false assumption i have (i also don't have too much
knowledge of the internals of wicket-ajax)
gerolf
On 7/2/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>
> On 7/1/07, Gerolf Seitz <[EMAIL PROTECTED] > wrote:
> [...]
>
> @Override
> > public void renderHead(IHeaderResponse response) {
> > // add the javascript libraries to the header
> > response.renderJavascriptReference(new
> > JavascriptResourceReference(
> > RicoCorner.class, "RICOSCRIPT.js"));
>
>
> response.renderOnLoadJavascript(String.format("Rico.Corner.round('%s');",
> component
> .getMarkupId()));
>
> }
> >
> > @Override
> > public void bind(Component component) {
> > super.bind(component);
> > if (this.component != null)
> > throw new IllegalStateException(
> > "cannot bind behavior to more than one
> > component");
> >
> > this.component = component;
> > this.component.setOutputMarkupId(true);
> > }
>
>
> [removed onrendered]
>
> }
>
>
>
>
> -igor
>
>
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user