MyTreeViewPlugin example

9 messages Options
Embed this post
Permalink
emmykate

MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
Hi everybody!

I found WickeXt project fantastic.
I want to use for integrate a jQuery plugin to an existing wicket app. That's why I'm trying to follow the MyTreeViewPlugin example, but it isn't working...
I followed the steps in the quickstart tutorial and the MyTreeViewPlugin example, but I don't know why my output it's simply a ul/li tags.
I'm in a hurry with my project, anyone can help me?

Thanks in advance,
  Kate.
Lionel Armanet

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
Hi Kate,

Could you please put some code, it would help us to understand your problem.
Anyway, here are some clues to debug your problem:
  1/ Have you firebugged your page to see if your .js is loaded (and not results in a 404 error)
  2/ Does your wicket application extends WickextWebApplication or uses the Wickext listener ? You need on of this condition to be true to have your plugin working.

Lionel

On Tue, Dec 2, 2008 at 6:56 PM, emmykate (via Nabble) <[hidden email]> wrote:
Hi everybody!

I found WickeXt project fantastic.
I want to use for integrate a jQuery plugin to an existing wicket app. That's why I'm trying to follow the MyTreeViewPlugin example, but it isn't working...
I followed the steps in the quickstart tutorial and the MyTreeViewPlugin example, but I don't know why my output it's simply a ul/li tags.
I'm in a hurry with my project, anyone can help me?

Thanks in advance,
  Kate.



--
__________________________________

"SJBCJM! (Si Java Bien, C'est Java Mine)"

Lionel armanet
MSN : [hidden email]
emmykate

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
Hi Lionel!

Thanks for your answer.
I'm not getting an 404 error, but the jquery.treeview.js is not load too.
By the way, I'm new in jquery and thought that your project can help me. Where should I put jquery.js ?  I mean, how can organize my project? How do you do this?
I'm not using Wickext listener, how can I do this and let my WicketApplication extends a secure page?

Thanks again,
  Kate.
emmykate

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
Hi Lionel!

Now my example is working.
In my real app, WicketApplication extends SwarmWebApplication. How can I use WickeXt in this scenario? You told about WickeXt listeners, how did you mean?

Thanks in advance,
  Kate.
Lionel Armanet

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
Hi,

In facts, the WickextWebApplication class is just there to do a quick integration. If you look at the source code of this class, it just adds a listener to the web application. This listener manages WickeXt components' life cycle, such as auto JS import, theming of UI components etc.

If you want to use WickeXt with a WebApplication without using inheritance, just do the following thing:

1/ override the init method in your Wicket application
2/ in this init method, add the WickeXt listener (its class is WickextPluginInstantiationListener).

If you want more information, see there an example (the WickextWebApplication itselfs): http://code.google.com/p/wickext/source/browse/branches/0.9/src/main/java/org/objetdirect/wickext/utils/WickextWebApplication.java

Let me know if it worked for you, and thank you using WickeXt !

Lionel

martin-g

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
Hi,

El mar, 02-12-2008 a las 15:19 -0800, Lionel Armanet (via Nabble)
escribió:

> Hi,
>
> In facts, the WickextWebApplication class is just there to do a quick
> integration. If you look at the source code of this class, it just
> adds a listener to the web application. This listener manages WickeXt
> components' life cycle, such as auto JS import, theming of UI
> components etc.
>
> If you want to use WickeXt with a WebApplication without using
> inheritance, just do the following thing:
>
> 1/ override the init method in your Wicket application
> 2/ in this init method, add the WickeXt listener (its class is
> WickextPluginInstantiationListener).
>
@Lionel: I think this could happen automatically by using
o.a.wicket.IInitializer.

Just add wicket.properties at .../main/resources/ folder with content:
initializer=org.objetdirect.wickext.WickextInitializer

This initializer will register the listener but I don't see how it could
manipulate the theming ...

> If you want more information, see there an example (the
> WickextWebApplication itselfs):
> http://code.google.com/p/wickext/source/browse/branches/0.9/src/main/java/org/objetdirect/wickext/utils/WickextWebApplication.java
>
> Let me know if it worked for you, and thank you using WickeXt !
>
> Lionel
>
>
>
>
> ______________________________________________________________________
> View message @
> http://n2.nabble.com/MyTreeViewPlugin-example-tp1604959p1606557.html 
> To start a new topic under WickeXt - User forum, email ml-node
> +[hidden email]
> To unsubscribe from WickeXt - User forum, click here.
>

emmykate

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
In reply to this post by Lionel Armanet

Lionel, it works!
Thanks a lot.

Kate
Lionel Armanet

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
@martin-g

Ok, I'll take a look at that for the 1.0 version. Thanks !

On Wed, Dec 3, 2008 at 4:44 PM, emmykate (via Nabble) <[hidden email]> wrote:

Lionel, it works!
Thanks a lot.

Kate



Adrian Cadena

Re: MyTreeViewPlugin example

Reply Threaded More More options
Print post
Permalink
In reply to this post by Lionel Armanet
Hello Lionel ,

Im having this:

java.lang.IllegalArgumentException: Argument pageClass must be an instance of org.apache.wicket.Page
Im pasting my JAVA CODE BELOW:

I dont know whats wrong with this please give me a hand im currently using wicket and would love to see more examples of wickext if you ha ve a simple zip please let me know. bye and thanks

/*
 * ajax.java
 *
 * Created on February 6, 2009, 5:15 PM
 */
 
/*package ajax;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebPage;
import org.objetdirect.wickext.ui.dialog.Window;
import org.objetdirect.wickext.core.commons.WickextPluginInstantiationListener;

public class ajax extends WebPage {

    private static final long serialVersionUID = 1L;

    public ajax(final PageParameters parameters) {
        Window window = new Window("modal");
        add(window);
        window.add(new Label("message", "If you see this message wicket is properly configured and running"));
        window.setAutoOpen(true);
    }
}*/
package ajax;

import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.IHeaderContributor;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.WebMarkupContainer;

import org.apache.wicket.markup.html.resources.JavascriptResourceReference;
import org.objetdirect.wickext.core.commons.WickextPlugin;
import org.objetdirect.wickext.core.javascript.JsQuery;
import org.objetdirect.wickext.core.javascript.JsStatement;


public class ajax extends WebMarkupContainer implements WickextPlugin {

    public ajax(String id) {
        super(id);
        add(new ajax("treeview-example"));
    }


public IHeaderContributor getHeaderContribution() {
        return new IHeaderContributor() {
                private static final long serialVersionUID = 3385265870102253503L;

                public void renderHead(IHeaderResponse response) {
          response
                .renderJavascriptReference(new JavascriptResourceReference(
                                                        ajax.class,
                                                        "jquery.treeview.js"));
          response.renderCSSReference(new ResourceReference(
                                                        ajax.class,
                                                        "jquery.treeview.css"));

        }

    };


}


    public JsStatement statement() {
        // TODO
    return new JsQuery(this).$().chain("treeview");

    }


}


·#######################

html code

#####


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html xmnls:wicket>
  <head>
    <title></title>
  </head>
  <body>
<ul wicket:id="treeview-example">
  <li>
  Item 1
  <ul>
  <li>Foo 1</li>
  <li>Foo 2</li>
  <li>Foo 3</li>
  </ul>
  </li>
  <li>Item 2</li>
 </ul>


  </body>
</html>