Per Newgro wrote:
I don't know exactly from the top of my head, but I think you'd do
this with Javascript.
Ahh ok. I found an example here: http://www.boutell.com/newfaq/creating/windowcenter.html

Where do i have store the java scripts i want to use oftenly? I expected that Page.class would provide it out of the box. Should i add a RFE?

This is what we do:

== JavaScript.java ==

package com.yourcompany.web.wicket.scripts;

public class JavaScript {
    public static final ResourceReference CENTER_WINDOW =
            get("center_window.js");

    public static final ResourceReference FOCUS_FIRST_TEXTBOX =
            get("focus_first_textbox.js");

    // ...

    private JavaScript() { /* prevent construction */ }

    private static ResourceReference get(String path) {
        return new ResourceReference(JavaScript.class, path);
    }
}

== EOF ==

Add your scripts to the same package, with appropriate references.

Then in your page or panels or other components:
add(HeaderContributor.forJavascript(JavaScript.CENTER_WINDOW));


Regards,

Al

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to