Register Javascript callback

2009-12-15 Thread Jason.Sadler
Hi folks, I am trying to build a system where some non-GWT Javascript
code can register itself to be run when a certain event happens within
a GWT widget.  (I don't mean a browser event, I mean a business-logic
event)

What I've come up with is a List of JavaScriptObjects that are invoked
via JSNI by the Java code.  I export the add and remove methods
for this list using a JSNI method:

$wnd.addCallback = /*JSNI code to my Java function*/

This functions exactly as I expect, except that addCallback is not
available to my plain-Javascript code when the page loads, only after
the GWT widget is finished loading.  So any code on my page like this:

SCRIPT TYPE=...
addCallback(myFunction);
/SCRIPT

says that addCallback is null.  Even using jQuery to do:

jQuery(document).ready(function() {addCallback(myFunction);})

doesn't help.

Any ideas on how to do this?

--

You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Testing a library

2009-08-05 Thread Jason.Sadler

Hello everybody,
I have a library built with GWT that I need to test thoroughly, and
preferably via automated testing.  For many components of it I can use
unit testing easily enough but some parts use remote HTTP requests.
I'm fairly inexperienced with formal testing in general - does anyone
have any advice / suggestions for formal, automated testing of what
appears to be non-unit-testable code?  (My only thought so far is to
build a small GWT module that uses the library and exercises all the
code paths that I'm interested in testing.)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Composite inside tree

2009-07-28 Thread Jason.Sadler

Hi everyone,
I'm having trouble building a customized tree.  I'm trying to build
something that looks like the Microsoft Visual Studio installer, where
you've got categories (root items on the tree) which expand into a
list of items with checkboxes beside them.  I've built a Composite
that puts a checkbox and a label in a horizontal panel, and I pass
this Composite to the TreeItem constructor.  This works fine in IE but
comes out very weird in other browsers.

There's an extra line before the start of my horizontal panel, so it
makes the tree very spaced out vertically.  Additionally, only this
first empty line (and even then, only a space a few pixels wide) gets
coloured in when the TreeItem is selected.  The actual widget that
should be highlighted remains as before, with just a white background.

It looks like the following:

 + Item 1
 -  Item 2
  ||
  [ ]  Subitem 1

  [ ]  Subitem 2

Where [ ] represents a checkbox, and || represents the very thin
highlighting that should in fact be covering the entirety of the
following line (Subitem 1).

Anyone have any ideas? Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Native JSON parsing

2009-06-30 Thread Jason.Sadler

I've been searching around to see if anyone's brought this up already
- I haven't found anything (which surprises me) so my apologies if
this is a repeat.
Browsers are slowly starting to support native JSON - I know in
particular Firefox 3.5 (released today) supports it and I'm under the
impression (although I haven't really done my homework on this one)
that some others already support it, or are working towards it.  Are
there any plans to change the GWT JSONParser to use native JSON
parsing instead of the slower and less-safe eval function?  A very
simple check along the lines of

if (undefined != JSON)
{
JSON.parse(myString);
}
else
{
eval('(' + myString ' + ')');
}

ought to do it, right?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



I18N with drop-in languages

2009-06-25 Thread Jason.Sadler

Hello all,
I have a fair bit of experience with GWT but am by no means an expert
- I have a question about I18N.
I am trying to introduce GWT UIs into a very large existing web
application where there is a requirement that language packs be
installable by the administrator of the web app.
Using static I18N like Messages and Constants is (at least on the
surface) not tenable because it requires a recompile every time a
locale is added or edited, and I'm not willing to make the GWT SDK (or
Java, for that matter) a server-side requirement.  I suppose I could
make some modifications to the bootstrap process to support hot-
swapping of localized compiled JS in and out of the server.  This
would obviously require getting rid of the strong hashing naming stuff
that gets applied to the GWT JS files, and I think this would require
a significant amount of work.
Going with the dynamic Dictionary method is also not ideal since the
app is very large and so a lot of strings might have to be downloaded
each time the page is loaded.
Has anyone done hot-swappable I18N in GWT before?  Any tips?
Thanks,
Jason
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---