Re: Not able to use Celltable for a requirement where I need different widgets under one column.

2012-09-06 Thread Adam T
Hi!

You should be able to use custom table rendering of a GWT 2.5 cell table to 
do what you want in your point (1) (extending AbstractCellTableBuilder and 
implement the buildStandardRowImpl method to put the relevant cell type 
into the column that alters based upon your condition in your point (2). 
 Then pass that renderer to the cell table, instead of the standard one, 
using its setTableBuilder method)

Information about this is a little sparse, but you could check out:

* http://showcase2.jlabanca-testing.appspot.com/#!CwCustomDataGrid , or
* GWTinAction edition 2  - a relevant example 
(different 
cells in the Tags column) can be found in code 
here.
 
(it is still work in progress just now, so missing comments, but should be 
relatively self explanatory)

Hope that helps in some way!

//Adam

On Sunday, September 2, 2012 11:43:43 AM UTC+2, Saurabh Tripathi wrote:
>
> Hi all,
>
> I am stuck here with a requirement which is mentioned as follow:
>
> 1)A table where one or more (for now just one) column need to have 
> different widgets in editable cell.
>for example: Class is Plant having property: 'name' and 
> access method: 'String getName()';
>   Now if(name.equals("true") || 
> name.equals("false"){ 
>  ---> Render 
> CheckBox with respective checked value
>  }else if(name.equals("~")) {
>-> Render 
> ListBox with some predefined items
>  }else {
> ->just render 
> the String.
>  }
> 2)The cell where we render just the String should be Editable (i.e on 
> click textbox appear for edit), other than this other cells should be 
> non-editable i.e cells for checkbox and listbox should be non editable, 
>
> You may find this requirement very unusual and I agree it is because here 
> we dealing with raw xml/text kind of metadata.
> Anyway I have given a lot of effort over this, but I am in a catch 22 
> situation if somehow I am able to attain 1 condition than I am have 
> editable problem, if somehow I make that up, the valueupdater doesn't seem 
> to work properly
>
> At last I am thinking that may be 'CellTable' API was never there for such 
> kind of requirement. So FlexTable could be the answer.
> Even if it is so there would be a lot of work for me then like -> 
> implementing sorting(while click on header), pagination etc, it would be 
> great if 
> some open source library is already there for it.  
>
> Thanks in advance 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Xy3F9oc6y0EJ.
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.



Re: Formatting lists with GWT i18n API

2011-12-15 Thread Adam T
Hi Luiz,

If you've not stumbled across this already, just add the format marker
"text" in your message definitions and it should work, i.e.

@DefaultLocale("pt_BR")
public interface AppMessages extends Messages {


@DefaultMessage("elementos: {0,list,text}")
@AlternateMessage({"one", "elemento: {0,list,text}"})
String formatElements(@PluralCount List elements);
}

//Adam

On 15 Dec, 00:43, Luiz Mineo  wrote:
> Hi,
>
> I'm trying to format a list of Strings using a Messages interface:
>
> @DefaultLocale("pt_BR")
> public interface AppMessages extends Messages {
>
>         @DefaultMessage("elementos: {0, list}")
>         @AlternateMessage({"one", "elemento: {0, list}"})
>         String formatElements(@PluralCount List elements);
>
> }
>
> In my module.gwt.xml, I have:
>
> 
> 
> 
>
> But when I try to format a list, for example:
>
> AppMessages appMessages = GWT.create(AppMessages.class);
> appMessages.formatElements(Arrays.asList({"A"}));
> appMessages.formatElements(Arrays.asList({"A","B","C"}));
>
> I get:
>
> "elemento: 1"
> "elementos: 3"
>
> Instead of:
>
> "elemento: A"
> "elementos: A, B e C"
>
> I'm using pt_BR for default locale, since it is the only language my
> app supports for now. Does it only work for en? I tryied to change the
> default locale for en, but it didn't work either :(
>
> So, what I'm doing wrong?

-- 
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.



Re: Shortcomings in Places

2011-06-05 Thread Adam T
Hi,

I think you can do this relatively simply, but it's not directly noted
in the documentation.

(warning, a little plug ahead...) We're looking at how to do this for
the 2nd edition of the GWT in Action book, and the approach below is
where we are at the moment, though we have not thought through all
implementations yet.  The final solution will be described in detail
in the book, but the following is the essence of the current solution:

*  GWT has a FilteredActivityMapper that you can use to run another
activity rather than the one associated with the requested Place; for
example if you go to a PhotoEditPlace when not logged in, you might
want to run the LoginActivity rather than PhotoEditActivity.
*  To do that, we created a Filter, such as:

Filter filter = new Filter(){
public Place filter(Place place) {
// Always allow the WelcomePlace
if(place instanceof WelcomePlace) return place;

// If user is not logged in, redirect
the activity for requested place to the login activity
if(!isLoggedIn()) return loginPlace;

// If user is logged in, then allow
the requested place/activity
else return place;
}};

* To use the filter, we created the ActivityMapper using a
FilteredActivityMapper instead of the standard ActivityMapper, i.e.:

// Difference to normal here
ActivityMapper activityMapper = new
FilteredActivityMapper(filter, new AppActivityMapper(clientFactory));
// Carry on as normal from here
ActivityManager activityManager = new
ActivityManager(activityMapper, eventBus);


* In the login activity, there is code to refresh the browser page if
the user logs in successfully (a simple Window.Location.reload() has
worked so far)

The flow is:

* User goes to a protected page
* If logged in the FilteredActivityMapper allows the appropriate
activity to start
* If not logged in,
   * the FilteredActivityMapper starts the login activity
   * when user logs in successfully, the fact they are logged in is
captured and the browser page is reloaded
   * since the filter only redirected the activity, not the place,
then the reload goes to the original place, this time the filter
should detects the user is logged in, and so the requested activity is
started, rather than the login activity.

Hope that is of some use!

//Adam

On 5 Juni, 11:34, Thomas Broyer  wrote:
> On Saturday, June 4, 2011 11:47:08 PM UTC+2, Jeff Schnitzer wrote:
>
> > I'm trying to implement a simple pattern that is *very* common in the
> > world of "normal" webapps:
>
> > 1) Most of my application requires authentication in order to access.
> > 2) I allow deep links to protected content.
> > 3) When visiting a deep link, you are given a login page - after
> > logging in, you get the content.
>
> > I have a single-page GWT app that uses Places.  I've spent a lot of
> > time on this issue, and I *almost* have it working - but it's not
> > elegant and there are still broken edge cases.  If you want to
> > experience it firsthand, visithttp://www.similarity.com/#matches:
>
> > The specific issues with the Places system are:
>
> >  * The default place is different in authenticated mode vs anonymous
> > mode.  When you are anonymous, your default place is the "hello,
> > stranger" place but when you're logged in, the default place is "all
> > about your account".  Since I can't reset the default place in the
> > PlaceHistoryHandler, I need to swap out the instance when I switch
> > modes.
>
> Or maybe you could have a single place and have the ActivityMappers (or
> whatever PlaceChangeHandler if you're not using Activities) react
> differently whether the user is authenticated or not.
>
>  * The PlaceController has no way to reset the current place.  When an
>
> > anonymous user tries to go to the #matches: link, the place is set to
> > MatchesPlace (which my special handler translates into a "you must log
> > in first" message).  When the user logs in, I force another
> > handleCurrentHistory(), but it doesn't actually do anything - because
> > the PlaceController is already at MatchesPlace.  I'll have to swap out
> > the PlaceController instance when I switch modes.
>
> Authentication is (should be) orthogonal to navigation. When the user
> authenticates, you should dispatch a LoginEvent (or similar) on the event
> bus and have the activities (or whatever) refresh their content ("restart").
>
> > And now a little rant:
>
> > All in all, this seems ludicrously difficult for something I could
> > have done with dozen lines of code if I wasn't trying to use the
> > standard GWT tools.  I feel like I've wasted a lot of time learning
> > the system, and what I've ultimately learned is that I would be better
> > off building it from scratch.
>
> > Am I the only one that thinks t

Re: Garmin Communicator API

2009-11-22 Thread Adam T
Stephen,

You're most likely going to need to use the $wnd or $doc variable
within your JSNI code as the Garmin JS is not loaded into the same
area as GWT code (http://code.google.com/webtoolkit/doc/1.6/
DevGuideCodingBasics.html#DevGuideJavaScriptNativeInterface)

i.e. var display = new $wnd.Garmin.DeviceDisplay("garminDisplay",
{

//Adam

On 21 Nov, 20:25, Stephen Walsh  wrote:
> I am trying to use the above api to implement some JSNI code in my
> onModuleLoad method.  I am having the darnedest time trying to get it to
> recognize that I have the extra javascript files available.  The JS debugger
> in Chrome keeps saying that Garmin is undefined (see below).  Here's the
> dilemma: when I create my JSNI it gets compiled in the main JS code and
> evidently the Garmin JS code is out of the scope of where the call happens
> in the compiled JS.  I'm somewhat new to GWT, and I'm not sure if I'm doing
> something incorrectly or not. Here's what I've got in my project:
>
> src
> ---public
> --communicator-api
> -miscellaneous garmin folders in the original structure
> ---garmin_project.gwt.xml
>
> com.stephenlwalsh.garmin_project.client
> ---garmin_project.java
>
> Contents of garmin_project.gwt.xml  The script src tags are doing a fine job
> of pulling in the js needed and the entire communicator-api folder on
> compile.
>
> 
>  "http://google-web-toolkit.googlecode.com/svn/tags/1.7.1/distro-source...
> ">
> 
>   
>   
>
>   
>   
>   
>   
>   
>   
>
>   
>   

Re: Connecting Widgets

2009-11-02 Thread Adam T

The following library might work for you, or give you hints on what
you need to do: http://code.google.com/p/gwt-diagrams/

//Adam

On 2 Nov, 00:23, sony  wrote:
> My project is about drawing ER Diagrams, for this I am using GWT. For
> now i have most of the frontend working. Now I want to have lines
> connecting two widgets to create a relationship between the entities
> and attributes. For that I want to create 4 corner points to which the
> lines can connect (Technology something similar to EDrawMax or DIA).
> Example picturehttp://www.cs.uofs.edu/~sudhakaras2/Example.jpg
>
> Any help would be appreciated.
> Thank you.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How do I boostrap my Entry Point class with the User service?

2009-10-25 Thread Adam T

This tutorial might help, particularly section 3 that covers using
AppEngine User service in GWT : 
http://code.google.com/webtoolkit/tutorials/1.6/appengine.html

//Adam

On 24 Okt, 19:43, nacho  wrote:
> Hi, im developing an aplication in gwt and i have an entry point
> class. What i do no realize how to do is how to only permit access to
> the user that is logged using the user service 
> (http://code.google.com/appengine/docs/java/gettingstarted/usingusers
> )
>
> Do i have to put something in the web.xml?
>
> Can somebody please help me?
>
> Thanks a lot.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: GWT and DragListener

2009-10-22 Thread Adam T

Hi Sony,

It's not part of GWT out of the box, you need to add it.  See the
project page, which has instructions and a getting started guide,
here: http://code.google.com/p/gwt-dnd/

//Adam

On 22 Okt, 15:31, sony  wrote:
> Hello,
>
> Is DragListener part of GWT? because when i type in
> com.google.gwt.user.client.dnd.DragListener it is not recognizing. i
> saw this in an example. Is there anything i need to add to make it
> work? any help would be appreciated.
>
> Thank you.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: change css rules dynamically

2009-10-18 Thread Adam T

...if you mean actually changing a value in an already defined style
sheet, then you need to use JSNI (or rethink your application to
change the style applied to elements rather than the style
definition).

//A

On 18 Okt, 15:52, Adam T  wrote:
> You can do it in at least 4 different ways in GWT.  Say you define a
> label as Label first = new Label("First Label") and add it to the DOM,
> then you can do one of the following to hide it:
>
> a) first.setVisible(false);
> b) first.getElement().getStyle().setVisibility(Visibility.HIDDEN);
> c) first.getElement().getStyle().setProperty("display", "hidden");
> d) first.addStyleName("hidden-style");  (assuming you have hidden-
> style defined in your style sheet and that sets the display property
> to hidden)
>
> //Adam
>
> On 18 Okt, 09:07, bhomass  wrote:
>
> > I found there is a way to change css rules using javascript.
>
> >http://twelvestone.com/forum_thread/view/31411.
>
> > is there a way to do this using gwt?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: change css rules dynamically

2009-10-18 Thread Adam T

You can do it in at least 4 different ways in GWT.  Say you define a
label as Label first = new Label("First Label") and add it to the DOM,
then you can do one of the following to hide it:

a) first.setVisible(false);
b) first.getElement().getStyle().setVisibility(Visibility.HIDDEN);
c) first.getElement().getStyle().setProperty("display", "hidden");
d) first.addStyleName("hidden-style");  (assuming you have hidden-
style defined in your style sheet and that sets the display property
to hidden)

//Adam

On 18 Okt, 09:07, bhomass  wrote:
> I found there is a way to change css rules using javascript.
>
> http://twelvestone.com/forum_thread/view/31411.
>
> is there a way to do this using gwt?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Gadget "more>>" ?

2009-09-29 Thread Adam T

can't you do it using the normal GWT menu and menuitem widgets?
//A

On 29 Sep, 13:50, Ice13ill  wrote:
> Does someone knows a library with gadget/widget like the "more>>" item
> from the google main menu ? (the menu seen on the top of the page,
> with links to other apps)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Problem with Getting Scripts Tag Working

2009-09-25 Thread Adam T

You might want to follow the getting started with Google maps api and
GWT guide (http://code.google.com/docreader/#p=gwt-google-apis&s=gwt-
google-apis&t=MapsGettingStarted)?

//A

On 25 Sep, 22:33, thc  wrote:
> Hi, I am creating a very simple GWT that uses Google Maps API, and
> trying to run in hosted mode. At runtime, I receive the exception:
>
> The Maps API has not been loaded.
> Is a 

Re: Compilation Error

2009-09-25 Thread Adam T

> u can not use these classes in GWT - client side,
> read the doc for the allowed class,
>

more specifically, this is what you are allowed to use on GWT client
side: http://code.google.com/webtoolkit/doc/1.6/RefJreEmulation.html

//A


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Problem compiling & deploying GWT-Fx

2009-09-19 Thread Adam T

Hi Carlos,

You shouldn't see anything in the war file, the code for gwt-fx gets
compiled into JavaScript by the GWT compiler - just adding the jar
file as you have to a lib directory and is enough (assuming your
classpaths are set up ok).

I'd suggest checking the log of the compile to make sure your code has
compiled, and if so, then using an inspection tool on your browser to
see what is happening (e.g. Firebug or similar).

Hope that helps,

Adam


On 12 Sep, 02:15, Carlos Niebla  wrote:
> Hi,
>
> I've been working with some examples ofGWT-Fx, they run fine in
> hosted mode within Eclipse, but when I compile and deply to web server
> they show nothing at all.
>
> I've inspected the resulting war dir, and there's not a "org/adam*"
> set of directories.
>
> As I said, in my setup I have added the jar filegwt-fxv4.0.0.jar to
> a "lib" sub-dir in my workspace, then added it to my build path. It's
> working without problems on hosted mode.
>
> Thanks in advance!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Need help with GWT FX

2009-09-08 Thread Adam T

Hi Rodders,

I'm guessing you are using v4 or below of the library, in which case,
this is one of the limitations in those versions - effects are applied
to the content of the NEffectPanel.  So your contents would move but
the NEffectPanel would stay.

If you're able to download the code from trunk, then this limitation
disappears, as you no longer need to use an NEffectPanel and can apply
effects directly to widgets.  Hopefully it will only be a few weeks
before the trunk becomes a stand-alone download.

For example, in v4 and below you had to write

NEffectPanel ep = new NEffectPanel()
Move theEff = new Move(100,50);
Widget someWidget = new SomeWidget();
ep.add(someWidget);
ep.addEffect(theEff);
ep.playEffects();

With v5 (in trunk) you can just write

Widget someWidget = new SomeWidget();
Move theEff = new Move(someWidget.getElement(), 100, 50);
theEff.play();

Also, when you add a Move effect to an element then it gets assigned
position:absolute property, so if you apply a move to all your boxes,
you may not see the others alter position on screen if you move just
one of them.

Hope that helps in some way.

//Adam


On 7 Sep, 12:26, Rodders  wrote:
> Hi,
>
> I'm hoping someone can help... I've been using the (very useful) gwt-
> fx library (by Adam Tacy) and have run into a couple of problems and
> I'm not sure if it's how I'm structuring my code.
>
> I'm trying to layout a bunch of boxes (absolutely positioned) and then
> animate each of them independently
>
> e.g.
>
> FlowPanel container = new FlowPanel();
> container.setStylePrimaryName("my-container");
>
> Box boxA = new Box();
> container.add(boxA);
>
> Box boxB = new Box();
> container.add(boxB);
>
> ...
>
> The Box Class is a Composite that contains an NEffectPanel as it's
> "initWidget" and I add a bunch of other Widgets to the NEffectPanel
> (and I'm styling the NEffectPanel with a border, background etc).
>
> If I try and animate the position one of the Boxes it all goes a bit
> pear shaped - rather than the Box moving,  its contents moves...?
>
> Is this the correct behaviour and if so is there a way of doing what I
> want?
>
> Hope this makes sense!
>
> Cheers,
> Rodders
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Async socket

2009-07-30 Thread Adam T

The so-called "Comet" technique is perhaps what you are looking for:
http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications

//Adam

On 31 Juli, 02:03, Blessed Geek  wrote:
> In Flash, I could create an async socket.
> Which is very useful because it allows server pushing data
> asynchronously (i.e. on the events of new data is available or changes
> in data) to the client without the client's constant initiative.
>
> Does GWT have a means to create async sockets?
>
> Actually, how would you create an browser-side async socket in
> javascript?
>
> I know of a way some people play cheat by polling. Using the browser's
> javascript, they create a so-called listener in which you declare the
> url you wish to listen to and the interval of polling. And on the
> listenee side, you have to install a message pusher that would listen
> for the browser's "listener" polling.
>
> I think that is cheating because the actual listener is the server not
> the browser, because the browser is initiating data transfer by
> polling and the server listens to the poll.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: event when item is visible, and getOffsetHeight isn't 0

2009-07-30 Thread Adam T

try the onLoad() method:


  /**
   * This method is called immediately after a widget becomes attached
to the
   * browser's document.
   */
  protected void onLoad() {
  }

//Adam


On 30 Juli, 22:10, bradr  wrote:
> I'm working on a widget and need to do calculations based on it's
> height in order to layout its child components. So i do something like
> this:
>
> @Override
> public void setHeight(String height) {
>
>    super.setHeight(height);
>    ...do height calculations
>
> }
>
> The problem i'm having is that setHeight is called before the widget
> is visible on the screen, and therefore, I can't do the calculation
> because getOffsetHeight is equal to zero.
>
> Is there a method I can override or an event I can subscribe to that
> tells me when the widget is visible and has been laid out on the
> screen, at which point i could run the calculation?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: conversion to JavaScriptObject fails with cross site communication

2009-07-28 Thread Adam T

Hi Dale,

Could be a couple of things...

1) Your asBasicComputerInfo() method takes a variable "jso" and you
try and return a reference to a variable "json" - though maybe that's
just a typo in your message?

2) Your JSON response from server doesn't appear to be an array, so
ignoring any potential typo above, your asBasicComputerInfo() could be
failing when trying to "cast" a simple JavaScriptObject into a JsArray
- I'd suggest either returning an array from the server, or altering
your code so you don't use a JsArray.

Also, the data in your JSON is all strings, therefore methods like
public final native int RAM() will possibly fail later in your code -
you could create a new method in the BasicComputerInfo class that does
the conversion for you, e.g. public int getRAM(){Integer.parseInt(RAM
());} and change RAM() to return the String in the JSON.

Hope some of that helps!

//Adam

On 28 Juli, 23:57, dale  wrote:
> I am creating my first GWT app and have hit a snag. I suspect that the
> problem is one things below. I can see in the server logs that the
> server returns ok.
>
>    This is the method that fails, there is no error ... that I can
> see :)
>           private final native JsArray asBasicComputerInfo
> (JavaScriptObject jso) /*-{
>             return json;
>           }-*/;
>
> I am calling it in the handleJsonResonse  method and execution never
> makes it to the UpdateDetailPanel Method.
>
>           public void handleJsonResponse(JavaScriptObject jso) {
>                     if (jso == null) {
>                       displayError("Couldn't retrieve JSON");
>                       return;
>                     }
>
>                     updateDetailPanel(asBasicComputerInfo (jso));//<--After 
> the
> breakpoint here it never gets to updateDetailPanel
>
>                   }
>
> This is the response from the server looks like this when I get it
> from a browser.
>
> callback0(
> {
> "LastBootTime": "7/27/2009 8:46:25 AM",
> "UserName": "aUser",
> "OS": "xp",
> "OSVersion": "5.1.2600",
> "BuildDate": "5/6/2008 3:18:06 PM",
> "RAM": "1063329792",
> "HDCapasity": "2676800",
> "HDFree": "7487799296",
> "NumProcessors": "1",
> "PowerState": "Unknown",
> "Site": "NA",
> "Office": "NA",
> "IPAddress": "NA",
> "IPAddress": "Dell Inc.",
> "Model": "OptiPlex GX620"}
>
> );
>
> here is the BasicComputerInfo Class:
>
> public class BasicComputerInfo extends JavaScriptObject {
>
>         protected BasicComputerInfo(){}
>
>           // JSNI methods to get stock data.
>           public final native String LastBootTime() /*-{ return
> this.LastBootTime; }-*/;
>           public final native String UserName() /*-{ return this.UserName; }-
> */;
>           public final native String OS() /*-{ return this.OS; }-*/;
>           public final native String OSVersion() /*-{ return
> this.OSVersion; }-*/;
>           public final native String BuildDate() /*-{ return
> this.BuildDate; }-*/;
>           public final native int RAM() /*-{ return this.RAM; }-*/;
>           public final native Long HDCapasity() /*-{ return
> this.HDCapasity; }-*/;
>           public final native Long HDFree() /*-{ return this.HDFree; }-*/;
>           public final native int NumProcessors() /*-{ return
> this.NumProcessors; }-*/;
>           public final native String PowerState() /*-{ return
> this.PowerState; }-*/;
>           public final native String Site() /*-{ return this.Site; }-*/;
>           public final native String Office() /*-{ return this.Office; }-*/;
>           public final native String IPAddress() /*-{ return
> this.IPAddress; }-*/;
>           public final native String Manufacturer() /*-{ return
> this.Manufacturer; }-*/;
>           public final native String Model() /*-{ return this.Model; }-*/;
>
> }
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Indexed Panel

2009-07-27 Thread Adam T

Hi Rahul,

It's not a panel per se, it is an interface that a number of different
panels implement.  If a panel implements the interface, then you know
you can that you can get a widget at a particular index, count the
number of widgets on the panel, remove a widget at a particular index
and get the index of a particular widget.

There's always the JavaDoc if you need information, i.e.
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/IndexedPanel.html
.

Hope that helps.

//Adam

On 27 Juli, 17:36, Rahul  wrote:
> Hi,
> I could not find any documentation regarding this Panel
> Can someone get me started with Indexed Panel?
>
> Sincerely,
> Rahul Mukhedkar
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Reading styles directly from the stylesheet?

2009-07-24 Thread Adam T

Hi Graham, there's not a directly way in GWT as yet.

As part of a project I'm doing, I've been building up an animation
library that is based on tweening between 2 styles that I've been able
to kept as open source.  You can find the library here:
http://code.google.com/p/gwt-fx/ and an example here:
http://gwtfx.adamtacy.com/EffectsExample.html  (for example, the logo
is animated from styles in a style sheet); maybe it meets your needs*

If you wanted to do it your own way, then two bits that caused me the
most headaches were:

a) understanding when the style sheet was available to you wrt the GWT
code - simplest solution I've found is to use a 

Re: Problem while loading stylesheet dynamically

2009-07-23 Thread Adam T

Hi Rick,

The last line in your native method should read:

$doc.getElementsByTagName("head")[0].appendChild(fileref);

As GWT uses $doc to refer to the pages document.  See:
http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#DevGuideJavaScriptNativeInterface

//Adam

On 23 Juli, 15:03, Rick  wrote:
> Hi All
>
> I am building an application using GWT 1.6. In my application I need
> to load external stylesheet at runtime. But its not working. I am able
> to load stylesheet in an independent html file. But when I am using
> same with GWT, its not reflecting. Below is a sample code to produce
> this case. Any help/suggestion will be highly appriciated.
>
> StyleSheetEntryPoint.java
>
> package com.example.foo.client;
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.user.client.ui.HTML;
> import com.google.gwt.user.client.ui.RootPanel;
>
> public class StyleSheetEntryPoint implements EntryPoint {
>
>         public void onModuleLoad() {
>                 loadStyleSheet();
>                 HTML html = new HTML("Hello");
>                 html.setStyleName("sendButton");
>                 RootPanel.get().add(html);
>         }
>
>         public static native void loadStyleSheet()/*-{
>                 var fileref=document.createElement("link");
>                 fileref.setAttribute("rel", "stylesheet");
>                 fileref.setAttribute("type", "text/css");
>                 fileref.setAttribute("href", "Component.css");
>                 document.getElementsByTagName("head")[0].appendChild(fileref);
>         }-*/;
>
> }
>
> Component.css
>         .sendButton {font-weight:bold;font-size: 16pt;}
>
> Following HTML is giving me expected behaviour.
> 
> 
> 
> function loadCSS(){
>         var fileref=document.createElement("link");
>         fileref.setAttribute("rel", "stylesheet");
>         fileref.setAttribute("type", "text/css");
>         fileref.setAttribute("href", "Component.css");
>         document.getElementsByTagName("head")[0].appendChild(fileref);}
>
> 
> 
> 
> Hello
> 
> 
>
> Thanks and regards
>
> Rick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Selection of Widgets

2009-07-23 Thread Adam T

Hi Ewald,

I guess it selects the whole of the html once you are out of it, as
you are only preventing default on the html widget, once outside the
html widget normal browser functionality is back in play.

One way you could consider solving your issue is to have the elements
you want to link together held within another panel and have the
default events on that outer panel prevented; or you could look at
previewing the event instead (so you trap the event before anything in
your application gets to use it ) - this is what the DialogBox class
in GWT does, so you could look at that to see how to use
PreviewNativeEvent.

(alternatively, maybe the gwt-diagrams library gives the functionality
similar to what you want? (http://kolos.math.uni.lodz.pl/~balon/gwt-
diagrams-demo/pl.balon.gwt.diagramsexample.GwtDiagramsExample/
GwtDiagramsExample.html))

//Adam

On 23 Juli, 10:06, Ewald Pankratz  wrote:
> Hi Adam
> I did something and it works partly. The text will not be selected as
> before but when I press the mouse and go out of the widget the full
> text will be selected again.
> Any idea?
>
> Regards,
> Ewald
>
> package g26v01.client;
>
> import com.google.gwt.dom.client.Element;
> import com.google.gwt.event.dom.client.MouseDownEvent;
> import com.google.gwt.event.dom.client.MouseDownHandler;
> import com.google.gwt.event.dom.client.MouseMoveEvent;
> import com.google.gwt.event.dom.client.MouseMoveHandler;
> import com.google.gwt.event.dom.client.MouseOutEvent;
> import com.google.gwt.event.dom.client.MouseOutHandler;
> import com.google.gwt.user.client.ui.HTML;
>
> public class MyHTML extends HTML {
>
>         public MyHTML() {
>                 super();
>                 // TODO Auto-generated constructor stub
>         }
>
>         public MyHTML(Element element) {
>                 super(element);
>                 // TODO Auto-generated constructor stub
>         }
>
>         public MyHTML(String html, boolean wordWrap) {
>                 super(html, wordWrap);
>                 // TODO Auto-generated constructor stub
>         }
>
>         public MyHTML(String html) {
>
>                 super(html);
>                 // TODO Auto-generated constructor stub
>
>                 MyMouseDownHandler ha = new MyMouseDownHandler();
>                 this.addMouseDownHandler(ha);
>
>                 MyMouseMoveHandler ha2 = new MyMouseMoveHandler();
>                 this.addMouseMoveHandler(ha2);
>
>                 MyMouseOutHandler ha3 = new MyMouseOutHandler();
>                 this.addMouseOutHandler(ha3);
>
>         }
>
>         class MyMouseOutHandler implements MouseOutHandler {
>                 @Override
>                 public void onMouseOut(MouseOutEvent event) {
>                         // TODO Auto-generated method stub
>                         event.preventDefault();
>                 }
>         }
>
>         class MyMouseDownHandler implements MouseDownHandler {
>                 @Override
>                 public void onMouseDown(MouseDownEvent event) {
>                         // TODO Auto-generated method stub
>                         event.preventDefault();
>                 }
>         }
>
>         class MyMouseMoveHandler  implements MouseMoveHandler {
>                 @Override
>                 public void onMouseMove(MouseMoveEvent event) {
>                         // TODO Auto-generated method stub
>                         event.preventDefault();
>                 }
>         }
>
> }
>
> On 23 Jul., 07:56, Adam T  wrote:
>
> > Hi Ewald,
>
> > Sounds like you want to prevent the default event handling of the
> > browser.  You'll need to add some event handlers to your HTML widget
> > and the call the preventDefault() method in them.  For example:
>
> >                 HTML widget = new HTML();
> >                 widget.addMouseDownHandler(new MouseDownHandler(){
> >                         public void onMouseDown(MouseDownEvent event) {
> >                                 event.preventDefault();
> >                         }
> >                 });
>
> > (you might get away with just handling the mouse down event, you might
> > have to also handle mouse move - I can't remember without building a
> > full example myself, but you get the point, hopefully).
>
> > Regards,
>
> > Adam
>
> > On 22 Juli, 22:37, Ewald Pankratz  wrote:
>
> > > Hi
> > > When I create a widget e.g. a HTML widget and go with the mouse over
> > > the widget and press the left mouse button and move the mouse
> > > somewhere else the widget or part of the widget will be selected. How
> >

Re: Suggestion: Toggle style name

2009-07-22 Thread Adam T

Célio,

GWT is of course open source, so you could easily create an issue in
the issue manager (http://code.google.com/p/google-web-toolkit/issues/
list) and submit a patch including your code below on, presumably, the
UIObject class.  It could then get discussed and perhaps included in
the main code.

(I wonder, for example, if you would also want a method that allows
you to inspect what the status of the toggle is - a sort of public
boolean widget.hasStyle("SomeStyleName") method that would return the
result of toggleStyleName, or, perhaps better and more generic,  the
result of querying the style for a particular name?)

//Adam

On 22 Juli, 19:00, Célio  wrote:
> Eventually I find my self doing this:
>
>         toggleStyleName = !toggleStyleName;
>         if (toggleStyleName)
>         {
>             widget.addStyleName("SomeStyleName");
>         }
>         else
>         {
>             widget.removeStyleName("SomeStyleName");
>         }
>
> So here goes my 2 cents: instead of manually toggling a style name, it
> could be simply:
>
>         widget.toggleStyleName("SomeStyleName");
>
> jQuery actually has such a method, it's usefull, helps keep my code
> clean.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Selection of Widgets

2009-07-22 Thread Adam T

Hi Ewald,

Sounds like you want to prevent the default event handling of the
browser.  You'll need to add some event handlers to your HTML widget
and the call the preventDefault() method in them.  For example:

HTML widget = new HTML();
widget.addMouseDownHandler(new MouseDownHandler(){
public void onMouseDown(MouseDownEvent event) {
event.preventDefault();
}
});

(you might get away with just handling the mouse down event, you might
have to also handle mouse move - I can't remember without building a
full example myself, but you get the point, hopefully).

Regards,

Adam

On 22 Juli, 22:37, Ewald Pankratz  wrote:
> Hi
> When I create a widget e.g. a HTML widget and go with the mouse over
> the widget and press the left mouse button and move the mouse
> somewhere else the widget or part of the widget will be selected. How
> can I get rid of this selection. I don't want any selection instead I
> want to draw a line from the widget to my current mouse pointer. Any
> ideas how to do that? I am a newbie.
> 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
-~--~~~~--~~--~--~---



Re: JSNI issues

2009-07-21 Thread Adam T

.perhaps you have the Javascript library in the wrong place and it
is not being loaded.  I'd still suggest you get hold of a debug tool
in your browser to see what's loaded etc as you're going to need it
when you get into trying to access the library and going further, but,
the following works for me to access the library.

1.  In my applications .gwt.xml file I have put: 
2.  I also have defined my module in the .gwt.xml file as follows:

3.  I'm using GWT1.6, so the protovis-r2.6.js file needs to go in
within the war file, i.e. it goes in the folder /war/testAA/
4.  In my application I just create a simple JSNI method

public native JavaScriptObject getVis()/*-{
var vis = new $wnd.pv.Panel().canvas("test");
return vis;
}-*/;

5.  In my onModuleLoad I simply call the method and alert the fact
that I have an object

public void onModuleLoad() {
JavaScriptObject v =  getVis();
Window.alert(v.toString());
}

that tells me I have got a valid JavaScript object and I see no
exceptions or errors.

Hope that helps, or at least gives you some hints.

//Adam

On 21 Juli, 16:23, wsaleem  wrote:
> I checked the link. Overlay types could surely make my life easier in
> terms of wrapping Protovis but as long as I cannot access $wnd.pv
> through JSNI, I cannot use them.
>
> On Jul 20, 11:28 pm, wsaleem  wrote:
>
> > 2) is the pure JS scenario, which I trying to port to GWT using JSNI.
> > I fail, though, as the very first command
> >       vis = new $wnd.pv.Panel().canvas("PVis");
> > fails with the following JavaScript exception
> >       $wnd.pv has no properties
> > I will see if the overlay types help. Thanks for the pointer!
>
> > On Jul 20, 7:48 pm, Adam T  wrote:
>
> > > It could still be a similar thing; I'm not 100% clear what you are
> > > trying to do above, but it looks like your steps are:
>
> > > 1) Load an external JavaScript library, e.g. "protovis.js"
> > > 2) Run some other JavaScript which creates something in the DOM, e.g.
> > > the vis = new pv.Panel().canvas("PVis"); .vis.render(); part
> > > 3) In GWT access the rendered PVis component.
>
> > > If that's correct, then by moving the "protovis.js" to the .gwt.xml
> > > part your ensuring that the library loads before your GWT, but it is
> > > still possible that part (2) is executing after your GWT code, and
> > > hence it is not available to your GWT code when it runs.  You could
> > > wrap that code in it's own file and load through the  tag
> > > (though I'm not sure about ordering in the gwt.xl file).
>
> > > I'd also suggest you use some debugging tools (Firebug for example in
> > > Firefox) to look at what your code is doing, that should show you the
> > > scoping of pv etc.
>
> > > (though you might be better off writing a wrapper using JavaScript
> > > Overlay types (<a  rel="nofollow" href="http://googlewebtoolkit.blogspot.com/2008/08/getting-to-">http://googlewebtoolkit.blogspot.com/2008/08/getting-to-</a>
> > > really-know-gwt-part-2.html) that would let you merge GWT and the
> > > protovis library in a more natural style, than the approach you're
> > > taking just now)
>
> > > Good luck,
>
> > > //Adam
>
> > > On 20 Juli, 17:41, wsaleem <wsal...@gmail.com> wrote:
>
> > > > Adam, I added
> > > >     <script src="protovis.js" />
> > > > to the .gwt.xml.
>
> > > > No change!
>
> > > > On Jul 20, 4:24 pm, Adam T <adam.t...@gmail.com> wrote:
>
> > > > > Hi,
>
> > > > > It might be the case that in both cases your GWT code is loaded and
> > > > > executing before the browser has loaded your externally referenced
> > > > > JavaScript file.  To remove that possiblity, you can place the
> > > > > <script> tag you have in the HTML into your module's .gwt.xml
> > > > > definition, i.e.
>
> > > > > <module>
> > > > >    <inherits name='com.google.gwt.user.User' />
> > > > >    <script type="text/javascript" src="protovis.js">
> > > > > </module>
>
> > > > > With this sett up, the GWT boostrap code should ensure the library
> > > > > JavaScript is loaded before your GWT code executes.
>
> > > > > //Adam
>
> > > > > On 19 Juli, 18:19, wsaleem <

Re: JSNI issues

2009-07-20 Thread Adam T

It could still be a similar thing; I'm not 100% clear what you are
trying to do above, but it looks like your steps are:

1) Load an external JavaScript library, e.g. "protovis.js"
2) Run some other JavaScript which creates something in the DOM, e.g.
the vis = new pv.Panel().canvas("PVis"); .vis.render(); part
3) In GWT access the rendered PVis component.

If that's correct, then by moving the "protovis.js" to the .gwt.xml
part your ensuring that the library loads before your GWT, but it is
still possible that part (2) is executing after your GWT code, and
hence it is not available to your GWT code when it runs.  You could
wrap that code in it's own file and load through the  tag
(though I'm not sure about ordering in the gwt.xl file).

I'd also suggest you use some debugging tools (Firebug for example in
Firefox) to look at what your code is doing, that should show you the
scoping of pv etc.

(though you might be better off writing a wrapper using JavaScript
Overlay types (<a  rel="nofollow" href="http://googlewebtoolkit.blogspot.com/2008/08/getting-to-">http://googlewebtoolkit.blogspot.com/2008/08/getting-to-</a>
really-know-gwt-part-2.html) that would let you merge GWT and the
protovis library in a more natural style, than the approach you're
taking just now)

Good luck,

//Adam

On 20 Juli, 17:41, wsaleem <wsal...@gmail.com> wrote:
> Adam, I added
>     <script src="protovis.js" />
> to the .gwt.xml.
>
> No change!
>
> On Jul 20, 4:24 pm, Adam T <adam.t...@gmail.com> wrote:
>
> > Hi,
>
> > It might be the case that in both cases your GWT code is loaded and
> > executing before the browser has loaded your externally referenced
> > JavaScript file.  To remove that possiblity, you can place the
> > <script> tag you have in the HTML into your module's .gwt.xml
> > definition, i.e.
>
> > <module>
> >    <inherits name='com.google.gwt.user.User' />
> >    <script type="text/javascript" src="protovis.js">
> > </module>
>
> > With this sett up, the GWT boostrap code should ensure the library
> > JavaScript is loaded before your GWT code executes.
>
> > //Adam
>
> > On 19 Juli, 18:19, wsaleem <wsal...@gmail.com> wrote:
>
> > > I am not a JS developer and use it pretty much by example, so it might
> > > be that I am missing something really basic below.
>
> > > I have come across problems using JSNI in the following 2 scenarios:
>
> > > 1.
> > > I use Google Visualization API successfully in JS as follows:
> > > 
> > > HTML file
> > >     <script type="text/javascript" src="<a  rel="nofollow" href="http://www.google.com/jsapi"">http://www.google.com/jsapi"</a>;></
> > > script>
> > > JS file
> > >     google.load('visualization', '1', {'packages':['piechart']});  //
> > > <== future JSNI problems occur here
> > >     var chart = new google.visualization.LineChart
> > > (document.getElementById('GoogleVisChart'));
> > >     // other JS commands to draw the chart
> > > **
> > > and then try to write a wrapper using GWT JSNI as follows:
> > > 
> > > HTML file
> > >     <script type="text/javascript" src="<a  rel="nofollow" href="http://www.google.com/jsapi"">http://www.google.com/jsapi"</a>;></
> > > script>
> > > JAVA file
> > >     class GChart {
> > >       static { _init(); }
> > >       private static native void _init() /*-{ // <=== ERROR at this
> > > function
> > >         $wnd.google.load('visualization', '1', {'packages':
> > > ['piechart']});
> > >       }-*/;
>
> > >       JavaScriptObject gvis;
> > >       public GChart( String id ) { gvis = _chart( id ); }
> > >       private native JavaScriptObject _chart( String id ) /*-{
> > >         return new $wnd.google.visualization.LineChart
> > > ($wnd.document.getElementById( id ) );
> > >       }-*/;
> > >       // methods to draw the chart through native functions
> > > **
> > > The GWT compiler gives the following error for the above code
> > > 
> > > [ERROR] Unable to load module entry point class
> > > com.google.gwt.app.testGViz.client.TestGViz (see assoc

Re: JSNI issues

2009-07-20 Thread Adam T

Hi,

It might be the case that in both cases your GWT code is loaded and
executing before the browser has loaded your externally referenced
JavaScript file.  To remove that possiblity, you can place the
 tag you have in the HTML into your module's .gwt.xml
definition, i.e.