This is really an interesting topic!

I've made some Wicket-Extjs integration tests and I haven't found any
particular issues to make them work smoothly together.

Extjs UI widgets can be created dynamically or can be attach to existing
HTML elements using the element IDs.

Following the latter approach is quite easy integrate Extjs with Wicket.

The simplest way I've tried is using a behavior to 'attach' an Extjs widget
to Wicket component.

For example:

public class ExtDateFieldBehavior extends ExtAbstractBehavior{

    @Override
    String getExtjsClassName() {
        return "Ext.form.DateField";
    }

}

public abstract class ExtAbstractBehavior extends AbstractBehavior {


    /**
     * Used to add all common Extjs required JavaScript and CSS resources
     */
    @Override
    public void bind(Component component) {
        if( component == null ) throw new IllegalArgumentException("Argument
cannot be null");
        component.setOutputMarkupId(true);
        component.add(HeaderContributor.forCss( Extjs.Css.EXT_ALL ));
        component.add(HeaderContributor.forJavaScript( Extjs.Js.EXT_BASE ));
        component.add(HeaderContributor.forJavaScript(
Extjs.Js.EXT_ALL_DEBUG ));
    }


    abstract String getExtjsClassName();

    abstract String getOptions();

    @Override
    public void onRendered( Component component ) {
        /* create a copy of options */
        Config options = new Config( config );
        /* initialization */
        config(component,options);
        /* get the string version */
        String sConfig = Extjs.serialize(options);

        String extjs = "new " + getExtjsClassName() + "(" + getOptions() +
");";
        //TODO log here

        Response r = component.getResponse();
        r.write( JavascriptUtils.SCRIPT_OPEN_TAG );
        r.write( extjs );
        r.write( JavascriptUtils.SCRIPT_CLOSE_TAG );
    }
}


That's all!

Obviously this is just a simple test but it works and can be extended easily
for other widgets.


What I've found not trivial is to pass/define the Extjs widget
property/configuration in a easy/elegant way.

Would be interesting discuss this...

-- Paolo




On Jan 9, 2008 6:25 PM, Jeremy Fergason <[EMAIL PROTECTED]> wrote:

> wicket seems to provide some nice management classes like TextField, that
> do
> things like set the value for you, I don't see how to integrate this with
> a
> javascript solution like ExtJs which does not use an <input type="text"
> ...
> tag.  It could be something very simple and I am just missing it, if so
> please point me in the right direction.
>
> Thanks!
>
> On Jan 9, 2008 10:19 AM, Martijn Dashorst <[EMAIL PROTECTED]>
> wrote:
>
> > What is keeping you from building it?
> >
> > Martijn
> >
> > On Jan 9, 2008 6:15 PM, Reinout van Schouwen <[EMAIL PROTECTED]> wrote:
> > >
> > > Op woensdag 09-01-2008 om 09:07 uur [tijdzone -0700], schreef Jeremy
> > > Fergason:
> > >
> > > > I'm just starting out with wicket and I would like to use a
> > client-side
> > > > javascript library--ExtJs, to enhance the end user experience.
> > >
> > > +1
> > >
> > > At my company we use Ext2 and are very enthousiastic about it.
> > > I want to move us from Struts to Wicket but lack of support for Ext2
> > > would be a roadblock...
> > >
> > > --
> > > Reinout van Schouwen
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> > --
> > Buy Wicket in Action: http://manning.com/dashorst
> > Apache Wicket 1.3.0 is released
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

Reply via email to