Wednesday, May 24, 2006

ANNOUNCE: GWT Widget Library

The GWT Widget Library is a library of widgets and wrappers for the Google Web Toolkit. Currently this is a very short list, which will expand in time.

This is being distributed under the GNU-LGPL.

Version 0.0.1 Features:
Download:
Examples:

Example of using an effect with options:

Effect.highlight(widget, new EffectOption[]{
new EffectOption("startcolor", "#ff0000")
});


Example of using an effect with no options:

Effect.fade(widget);


Example of using an effect on a specific element id:

Effect.switchOff(RootPanel.get("leftNav"));

15 comments:

Anonymous said...

Hi Robert,

Hope you don't mind, but I put up a page demonstrating your Scriptaculous wrapper effects. You can see it here

Robert Hanson said...

Very cool. Thanks for letting me know about it.

Anonymous said...

Hi,

Is it possible for someone to put the source code for the effect on the web, I am having problems with the thing it gives me a error module load error when i start the project

Thanks

Robert Hanson said...

The Java source is in the Jar file, if that is what you are looking for.

You may also want to verify that your HTML code is including the Scriptaculous JS file at the proper location. ...You still need to download the Scriptaculous code, and reference it in your HTML (if you didn't already) as Effect is just a wrapper.

Anonymous said...

Hi,

I did download all the files to include and i am getting it to work sort of.

I want to use a fade effect on a label and it fades correctly but i need to display it again and it just does not want to appear. Can you help me i have used the effectsoptions but don't think i am inplementing it right

Thanx

ahpengleh said...

erm.. can u teach me how to delete one of my post?

Anonymous said...

Hi Robert !

Bad news...

As i was intenting to wrap scriptaculous's Slider, i decided to implement Slider options declaration like you did for Effects wrapping... And i found a bug. Actually, i realy wonder how the hell nobody found it before... nevermind.

The association of EffectOption class (polymorph constructor) and static method Effect.buildOptions do the job for callbacks but not for common native java types.

Just try to set the basic option 'duration' to 3.0 to any effect will cause an exception.

The fact is that even if JSNI is 'smart enougth' to translate native java types to javascript types, it is not enougth to enderstand that a String "3.0" is a double wich is what is intented here...

My proposal is to :
- add polymorph constructors to EffectOpion for native types (such as boolean, float, int, etc...) which saves the value as the wrapping Java Object (Boolean, Float, Integer and so...).
- add a type cheking in Effect.buildOptions method which call different methods :
if (value instanceof Integer)
--> call a addOption method for int (that make 'jso[name] = value;').
off course, value passed to this method is ((Integer)value).intValue();)

Easy and yes, it works.

Finishing Slider's wrapping and i'll let you kwow.

Ah, THANX FOR YOUR JOB !

Please contact me at seb dot ledan dot gmail dot com.

Anonymous said...

Has anyone made progress on wrapping the slider? BTW...Great blog.

-

Robert Hanson said...

> BTW...Great blog.

Thanks.

> Has anyone made progress on
> wrapping the slider?

If memory serves it was months ago someone was working on one, but I think they ran into some issue and I never heard back. I never got around to actually trying myself.

Anonymous said...

Newbie question.
To use the wrapper, do you still need to download and import prototype.js and scriptaculous.js?
or can you just include the GWTLibrary jar?

Robert Hanson said...

RE: Newbie question

Yes indeed, you still need the Scriptaculous.js file. I don't package any of the 3rd party JS files with the library.

Anonymous said...

Hi, I am using Eclipse to try out your .jar file. I have also included the Scriptaculous.js and prototype.js in the html code but i still get this error "Line 192: No source code is available for type org.hanson.gwt.widgets.client.Effect; did you forget to inherit a required module?"

Wonder if there is anything that I have left out?

Thanks alot

Robert Hanson said...

How are you launching the hosted-mode browser or gwt-compiler? If you are using the launch file that the GWT tools create it should work out of the box, assuming the GWT-WL is in your classpath. If you are using the shell scripts to run/compile, then you need to modify them.

Read the README that came with the dist, all the info should be there.

Anonymous said...

I'm using hosted-mode browser. As this is the first time that I'm using eclipse, pardon me if I'm wrong. I believe is something to do with attachment source code which is required by Eclipse when adding "gwt-widgets-0.0.1.jar" as external jar.

So is there any attachment source code that can be found in the zip file that I have downloaded from your link?

Thank you.

Robert Hanson said...

The source is in the jar, that is how the GWT compiler works.

I am guessing that your problem is that you are looking at a post that is 2 years old and trying to use gwt-widgets-0.0.1.jar. :)

Go here and get the latest release. http://gwt-widget.sourceforge.net/

Note that you want the GWT-WL (widget-lib) release and not the GWT-SL (server-lib).