Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
migrate Widgets from other AJAX-frameworks to GWT
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
error007  
View profile  
 More options Aug 23 2006, 4:16 pm
From: "error007" <david.pren...@gmail.com>
Date: Wed, 23 Aug 2006 13:16:38 -0700
Local: Wed, Aug 23 2006 4:16 pm
Subject: migrate Widgets from other AJAX-frameworks to GWT
Hi,

Developing with GWT is really a nice, and even have the heart to say
the most comfortable, way to develop AJAX-apps. A bit dissappointing
are the standard-widgets which GWT provides compared to other
Frameworks like DOJO. And now my question: is it possible to mix these
two frameworks in a simple way? For example DOJO's Fisheye is really
nice, what would be the best way to migrate this Widget to GWT? Is
there any tutorial or webblog handling this topic?

best regards,
david


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vivian Li  
View profile  
 More options Aug 24 2006, 1:02 am
From: "Vivian Li" <v...@google.com>
Date: Wed, 23 Aug 2006 22:02:02 -0700
Local: Thurs, Aug 24 2006 1:02 am
Subject: Re: migrate Widgets from other AJAX-frameworks to GWT

Hi david,
   I have implemented a Dojo datePicker widget in one of my projects using
the following technique. You may try extending it to support other Dojo
widgets to see if it works.

  Edit the part that says "com.yourpackage.client.DojoWidget" to be
whichever package you place these classes into.

/**
  * The base class of all GWT DojoWidgets
  */
public abstract class DojoWidget extends Widget {
    private JavaScriptObject wid=null;

    /**
     * dojoType is equivalent to the dojoType attribute used on HTML
elements. e.g. 'datePicker'
     */
    public DojoWidget(String dojoType)
    {
        setElement(DOM.createDiv());
        wid=addDojoWidget(getElement(), dojoType, this);

    }

    /**
     * Implement this in subclasses to be notified when an event on the
underlying DojoWidget occurs
     */
    public abstract void onDojoEvent(JavaScriptObject dojoWidget);

    /**
     *  Create the Dojo widget and put it into our DIV element
     */
    protected native JavaScriptObject addDojoWidget(Element elem, String
kind, DojoWidget ddw) /*-{

         var wid=$wnd.dojo.widget.createWidget(kind);
         elem.appendChild(wid.domNode);
         return wid;
    }-*/;

    /**
     *  Connect a dojo event on this widget to our class
     */
    protected void connect(String event, DojoWidget dw)
    {
        connect(event, wid, dw);
    }

    private native void connect(String event, JavaScriptObject wid,
DojoWidget dw) /*-{
        $wnd.dojo.event.connect(wid, event, function()
         {
             d...@com.yourpackage.client.DojoWidget
::onDojoEvent(Lcom/google/gwt/core/client/JavaScriptObject;)(wid);
         });
    }-*/;

    protected static native String getJSProperty(JavaScriptObject jsobj,
String propName) /*-{
        var v = jsobj[propName];
        return (v === undefined) ? null : String(v);
    }-*/;

}

Then here is the DojoDateWidget subclass

public class DojoDateWidget extends DojoWidget implements
SourcesChangeEvents {
    public DojoDateWidget() {
        super("datePicker");
        connect("setDate", this);
    }

    public String getDate() {
        return date;
    }

    private String date;

    public void onDojoEvent(JavaScriptObject dojoWidget) {
         date = getJSProperty(dojoWidget, "date");
         listeners.fireChange(this);
    }

    private ChangeListenerCollection listeners=new
ChangeListenerCollection();
    public void addChangeListener(ChangeListener listener) {
        listeners.add(listener);
    }

    public void removeChangeListener(ChangeListener listener) {
        listeners.remove(listener);
    }

}

To use, just add it to a Form, add a ChangeListener to the widget, and call
getDate() on a change to retrieve the picked date.

-Vivian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vivian Li  
View profile  
 More options Aug 24 2006, 1:24 am
From: "Vivian Li" <v...@google.com>
Date: Wed, 23 Aug 2006 22:24:12 -0700
Local: Thurs, Aug 24 2006 1:24 am
Subject: Re: migrate Widgets from other AJAX-frameworks to GWT

BTW, don't forget to add the necessary Dojo scripts to your public directory
as well as modifying your html entry point page to contain a script tag to
include the dojo toolkit, such as

    <script type="text/javascript" src="dojo.js"></script>

        <script type="text/javascript">
        dojo.require("dojo.widget.DatePicker");
        </script>

You will need to require each widget you're using.

-Vivian

On 8/23/06, Vivian Li <v...@google.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »