Re: Apache ProxyPass does not return errors, only 500 (Internal Server Error)

2013-04-29 Thread Gregor Kovač
I'm using 
RequestHeader edit X-GWT-Module-Base ^(http)://([^/]+)/(.*)$ 
$1://$2/babyCenter/$3

and it works. :) Thanks a lot.

Dne petek, 19. april 2013 23:39:19 UTC+2 je oseba Thomas Broyer napisala:



 On Friday, April 19, 2013 9:20:49 AM UTC+2, Gregor Kovač wrote:

 I have two ProxyPass directives:

 ProxyPass /client/ http://10.0.0.8:8080/client/Location /client/
 RequestHeader edit X-GWT-Module-Base ^(.*)/client/(.*)$ 
 $1/client/$2/Location
 ProxyPass / http://10.0.0.8:8080/client/Location /
 RequestHeader edit X-GWT-Module-Base ^(.*)/(.*)$ $1/client/$2/Location

 10.0.0.8 is running Glassfish on port 8080 and 
 http://10.0.0.8:8080/client/ is URL to a GWT based application. Both 
 proxy's work OK ,except when it comes to an error on the Glassfish side. If 
 I go via /cllient/ proxy then I see the actual error that was produced on 
 the Glassfish side. If I go via / proxy then I only see Error 500 The call 
 failed on the server, please see server log. I've tried 
 settingProxyErrorOverride 
 Off, but it didn't help.

 Why don't I see the error via / proxy? I think that the X-GWT-Module-Base 
 header gets edited wrong. This apache configuration is done by 
 https://code.google.com/p/google-web-toolkit/issues/detail?id=4817#c4


 Assuming X-GWT-Module-Base contains http://myserver/foo/bar, there's no 
 reason it wouldn't be rewritten as http:/client//myserver/foo/bar, 
 http://client/myserver/foo/bar or http://myserver/foo/client/bar instead 
 of the http://myserver/client/foo/bar you're expecting.
 You have to rework your regexp. Maybe mapping something like 
 ^(https?)://([^/]+)/(.*)$ to $1://$2/client/$3


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




Apache ProxyPass does not return errors, only 500 (Internal Server Error)

2013-04-19 Thread Gregor Kovač


I have two ProxyPass directives:

ProxyPass /client/ http://10.0.0.8:8080/client/Location /client/
RequestHeader edit X-GWT-Module-Base ^(.*)/client/(.*)$ 
$1/client/$2/Location
ProxyPass / http://10.0.0.8:8080/client/Location /
RequestHeader edit X-GWT-Module-Base ^(.*)/(.*)$ $1/client/$2/Location

10.0.0.8 is running Glassfish on port 8080 and http://10.0.0.8:8080/client/ is 
URL to a GWT based application. Both proxy's work OK ,except when it comes 
to an error on the Glassfish side. If I go via /cllient/ proxy then I see 
the actual error that was produced on the Glassfish side. If I go via / 
proxy then I only see Error 500 The call failed on the server, please see 
server log. I've tried settingProxyErrorOverride Off, but it didn't help.

Why don't I see the error via / proxy? I think that the X-GWT-Module-Base 
header gets edited wrong. This apache configuration is done by 
https://code.google.com/p/google-web-toolkit/issues/detail?id=4817#c4

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




Application cache searches cssmap

2012-08-03 Thread Gregor Frey
Hi,
I try to follow the video about GWT and Mobile of Chris Ramsdale 
(http://www.youtube.com/watch?v=N1aCo5LvMf8) and let the linker generate 
the appcache-manifest. But when the browser loads the manifest it fails 
because the manifest refers to cssmap files within a cssResource directory, 
which are not within the generated artifacts. I have no clou what these 
maps are and how I can get them. Anybody can help me with this?
Ciao
Gregor

-- 
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/-/Vp4SkOEsNUUJ.
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: Application cache searches cssmap

2012-08-03 Thread Gregor Frey
I managed to remove the cssmap entries from the manifest by including them 
in the list of resources to skip in the SimpleAppCacheLinker class. The 
question remains: what are the cssmaps and why are they EmittedArtifacts, 
when not emitted? Is this a bug in the 2.5 compiler / linker?
Ciao
Gregor

On Friday, August 3, 2012 6:07:12 PM UTC+2, Gregor Frey wrote:

 Hi,
 I try to follow the video about GWT and Mobile of Chris Ramsdale (
 http://www.youtube.com/watch?v=N1aCo5LvMf8) and let the linker generate 
 the appcache-manifest. But when the browser loads the manifest it fails 
 because the manifest refers to cssmap files within a cssResource directory, 
 which are not within the generated artifacts. I have no clou what these 
 maps are and how I can get them. Anybody can help me with this?
 Ciao
 Gregor


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



How to post json content?

2012-05-20 Thread Gregor Frey
Hi,
I want to us the RequestBuilder to post a json request. What is the best 
way to do this? What content-type should be used? How do I encode the 
content? Can I send the content with the request body?
The content type url-form-encoded is not quite right, because I have a 
deeply nested java script object, and not a list of key-value pairs. On the 
other hand the content type application/json  doesn't indicate any 
encoding. But without being url-encoded the json-content gets ruined, when 
containing special characters and being send in the request header.
Gregor 

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



RequestBuilder does not use charset header for request payload

2012-05-20 Thread Gregor Frey
I have to support German umlauts in my http-request (put or post). But the 
RequestBuilder ignores the charset attribute in the Content-Type header, 
which was set to utf-8. Is there another way to get the character set right?
Gregor

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



How to get hold of the instance in an InstanceRequest

2011-12-22 Thread Gregor Frey
Hi,
I'm implementing an InstanceRequest on the server side in a dedicated 
service class, which is annotated as Service in the RequestContext. This 
works fine, but how can I get a reference to the instance of the entity, on 
which I need to operate?
The background of my question is, that the entity returns enum types that 
must be adapted for the client. My idea is to implement these adapter 
methods as instance methods in a service class. 

-- 
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/-/27CzE0KZjksJ.
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 to get hold of the instance in an InstanceRequest

2011-12-22 Thread Gregor Frey
Thank you. So there is no way to implement an instance method outside the 
domain class? But why woulnt I include all instance methods in the proxy 
definition then? I hoped I could add methods, that are originally not in the 
domain object, but are needed just for doing data transformations for the UI, 
in a separate class.

-- 
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/-/W4ecWrVMlroJ.
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: The RequestFactory ValidationTool must be run for the RequestFactory type

2011-10-23 Thread Gregor
When I added the option verbose=false to the Annotation Processing the 
.apt_generated folder got populated with the 
blaFactoryObfuscatorBuilder(s)and then it got also compiled to the classes 
directory in the war.
I can only underline the importance of this option (strange as it might 
seem).
Gregor

-- 
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/-/NMziSSVBQqMJ.
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: Diffrent UI behaviour with browsers

2009-05-14 Thread gregor

Hi jagadesh,


 i am also working on the same issue . i developed a application which
 is working differently in firefox and ie.. the main problem araises
 with the css . width , height are working differently in both
 broswers .


yep, they do. This is the IE broken box model. HTML specs say
borders/padding margins etc should be added to the hight/width of the
widget. That's what FF  Safari do. But IE subtracts them. There are
various ways to deal with this, for example:

1. Look up CSS hacks as Salvador points out.
2. Design your UI widget layouts so it doesn't actually matter -
that's what Google tend to do (see some GWT examples in both FF  IE
to see this, they are slightly different)
3. Wrap widgets you want to apply borders etc to with an extra
SimplePanel (a decorator panel basically) and apply the border/margin
etc to the decorator, not the panel.

What happens in 3 is FF  Safari put the border on the outside of the
decorator SimplePanel, but IE puts the border on the inside of it.
However the result is the widget itself comes out exactly the same
size and in the same place in all three.

regards
gregor



--~--~-~--~~~---~--~~
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 to share RPC service between GWT applications?

2009-04-15 Thread gregor

I would be careful about multiple Hibernate session factories etc. You
may be able to get away with it, but there are potential problems that
might be difficult to trace. I would do some research into your
options as they relate to your particular use case. Two main ways to
deal with this are:

1. configure data source as JNDI lookup. That works with servlet
container only, e.g. Tomcat, Jetty. I'm pretty sure Spring provides
ways to do this in conjunction with Hibernate for example.
2. deploy as an EAR that houses both web apps (as WARs) and a common
data access/transaction management tier (as a JAR). You might delegate
the server side work and data access from your RPC servlets to a
session EJB for example. You will need to use a full blown Java EE app
server like JBoss for this of course, and run GWT hosted mode with -
noserver option etc.

On Apr 15, 8:38 am, jfeid jannis.feida...@gmail.com wrote:
 Thanks for the reply.

 The RPC servlet uses a db layer jar which configures a Hibernate
 factory.
 Because of different classloaders I assume that there will be 2
 instances of this factory.
 But I cannot say if this will present an issue until I test it.

 On Apr 14, 9:23 pm, gregor greg.power...@googlemail.com wrote:

  You can do this if you place your RPC services in a separate module
  that is inherited by the two main application modules. In this
  situation you can specify the RPC servlets in the common module
  gwt.xml file and this will work for hosted mode, but I think you have
  to map them separately (i.e. in duplicate) in each main module's
  web.xml for deployment - AFAIK there is no way around that (app server/
  servlet specification issue, not GWT).

  At run time you will end up with two instances of each servlet loaded
  by the two main module's classloaders (again app server/servlet
  specification issue, not GWT) which may or may not present you with an
  issue depending on what you are doing.

  On Apr 14, 4:14 pm, jfeid jannis.feida...@gmail.com wrote:

   Hello,

   I have the following problem that puzzles me.

   Suppose I have 2 different GWT applications running on different
   contexts:
   -http://server/context1
   -http://server/context2

   Is there a way to share an RPC service between them?

   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: efficiency of my gwt application

2009-04-15 Thread gregor


 - the rpc is quite slow. i am using it to return a few thousand by
 eleven column of data(String)

a) RPC is *much* slower in hosted mode than deployed in web mode. You
should time your RPC performance (separately to the table draw time)
when deployed to find out how it is really performing
b) having said that, fetching several thousand rows of data and
displaying it in one operation is likely to be unacceptably slow. It
takes javascript engines quite a long time attach thousands of HTML
elements to the DOM. It is generally much faster to do it in page-
fulls even though it takes multiple RPC calls to do it that way. You
might want to check out the PagingScrollTable in the incubator.

 - i have a tabset within my application which i copied from the
 smartgwt showcase when i click on new tab with google map on
 it.. it will normally hang and need  a few minutes to finally
 display the result. sometimes, it will hang forever.


SmartGWT is a GWT wrapper around a javascript library. It might be
difficult to figure out why it is not performing well for your use
case, and very difficult to do anything about it if you can. Generally
speaking, if you use pure GWT you will get higher performance and more
flexibility and code transparency.


 can you give me some links to these tutorials? if you have any.

 thanks again..

 On Apr 15, 3:13 pm, Thomas Broyer t.bro...@gmail.com wrote:

  On 15 avr, 13:51, ytbryan ytbr...@gmail.com wrote:

   hi folks,

   my application has been running very slowly and i would like to know
   why.

  You could try compiling in -style DETAILED (or at least PRETTY) and
  run a JavaScript profiler (Firebug or IE8 developer tools).
  GWT comes with a benchmark framework, but you'd have to know what you
  want/have to measure...

   can somebody advise me on what are the common bottleneck that i need
   to optimise? I am pretty new with gwt.

  1. optimize network exchanges (generally, you'd better have 1 RPC call
  return 3 kinds of data, than 3 RPC calls)
  2. but GWT-RPC might be slow, particularly while serializing/
  deserializing large object graphs
  3. when updating the UI, working with hidden (display:none) or, even
  better, detached widgets is faster; sometimes, building a new widget
  from scratch, populating it and replacing an existing equivalent
  widget might be faster than updating the existing widget
  4. rendering-wise, try to set table-layout:fixed on your tables
  (including Horizontal/VerticalPanel, FlexTable, Grid, DecoratorPanel,
  DecoratedPopupPanel, DialogBox, etc.)

  5. what does slow mean?
--~--~-~--~~~---~--~~
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 to share RPC service between GWT applications?

2009-04-14 Thread gregor

You can do this if you place your RPC services in a separate module
that is inherited by the two main application modules. In this
situation you can specify the RPC servlets in the common module
gwt.xml file and this will work for hosted mode, but I think you have
to map them separately (i.e. in duplicate) in each main module's
web.xml for deployment - AFAIK there is no way around that (app server/
servlet specification issue, not GWT).

At run time you will end up with two instances of each servlet loaded
by the two main module's classloaders (again app server/servlet
specification issue, not GWT) which may or may not present you with an
issue depending on what you are doing.

On Apr 14, 4:14 pm, jfeid jannis.feida...@gmail.com wrote:
 Hello,

 I have the following problem that puzzles me.

 Suppose I have 2 different GWT applications running on different
 contexts:
 -http://server/context1
 -http://server/context2

 Is there a way to share an RPC service between them?

 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 to get internal widget to notify its parent widget when clicked (and have the parent execute something)

2009-04-05 Thread gregor

Hi matttai,

unless you have a big reason to do so, I would avoid sinking/unsinking
events etc. I would go for one of two options:

1. if the inner widget is *only* ever used by the parent (owned by
parent only), then you can make it an inner class of the parent
widget. This is convenient since you just call the parent widget
method directly from the inner widget code
(MyParentWidget.class.methodTocall()

2. If that is not true and the inner widget must be a separate class,
you should use the Observer pattern which GWT supports. If you are
using 1.5.x or earlier, you could use the ChangeListener and
SourcesChangeEvents interfaces for example, of if 1.6.x you should use
maybe HasValueChangeHandlers and ValueChangeHandler.

regards
gregor

On Apr 5, 3:51 am, matttai matt...@hotmail.com wrote:
 As per the title :)

 How to get internal widget to notify its parent widget when clicked
 (and have the parent execute something)?

 I think it has something to do with sinking and unsinking events but I
 haven't been able to find a very good example of doing this.

 Any help would be appreciated!
--~--~-~--~~~---~--~~
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: Building your own GWT library

2009-04-04 Thread gregor

Hi Gugle,

yes, you need to make a module.gwt.xml file. you will then probably
need to specify the source path in it - that can be as simple as:

module
inherits name='com.google.gwt.user.User'/
!-- inherit any other GWT modules your library uses --
source path=src/  // or whatever
/module

so src (whatever) specifies your module source code location
relative to the module.gwt.xml file itself in the jar. Then all you
have to do is inherit the new module in your main GWT application
gwt.xml file and make sure its jar is in the classpath for the GWT
compilation. The GWT compiler will find the module.gwt/xml file
first, then follow the source path instruction to find the .java
files.

regards
gregor

On Apr 4, 5:28 pm, Gugle gugle.ru...@gmail.com wrote:
 Hi all,
 I'm trying to build a small GWT library of my own to implement a new
 widget. I have created a jar file with the java classes I've written.
 I added this jar file to my classpath in Eclipse and I can access
 these classes from my Eclipse project without any compilation errors.
 For e.g., I have a class 'A' which uses class 'B' which I've developed
 as part of my library. This class compiles fine in Eclipse, but when I
 try to do a GWT compilation using com.google.gwt.dev.GWTCompiler to
 get the JS files generated, I get an error indicating that the class
 'B' cannot be found, even though the jar file is in classpath in the
 compile command.

 Can someone advise me on what all should be added to the jar file if I
 need to publish it as a generic GWT library? What all should I define
 in my 'libraryname'.gwt.xml file and where should it be placed??
--~--~-~--~~~---~--~~
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: RPC Performance/Response Problem

2009-03-27 Thread gregor

Hi Lord-67

I don't think your selection of data structure for the data transfer
will make nuch material difference.

Your observation that 500 strings works hunky dory, but 10,000 doesn't
is pretty much my experience. The issue is divided into two parts:
first the time taken to assemble, serialize and then deserialze the
List of objects. Second the time taken to render the objects in a
widget. You may not know this but it takes browsers an appreciable
amount of time to render thousands of items - each one has to have a
number of HTML boxes drawn for it. Test this yourself by making a
simple test Tree created from some nested for loops on the client, and
you will see that once you get up to 1500 or so TreeItems it starts to
slow down noticably, and round about 5000 it takes seconds to draw.
Note also different browsers give different performance in some
situations, so you need to consider that too.

Another important thing is that RPC is *much* slower in hosted mode
than it is deployed in web mode (in case you haven't rumbled that
yet).

You can try two approaches to solve this: the classic lazy load, and
the FastTree approach.

In the  lazy load approach you fetch only a screen full of items at a
time (in a tree you would get just the top level items etc). next link
fetches the next batch. This usually produces a response time from the
user's perspective of 0.5s, which for them is a good as instant.
Therefore although technically each page flip is slow (involving a
fresh RPC call for each page) it is not perceived as such, the user
does not have to wait seconds for the data to load.

In the fast tree approach you fetch all the data in one RPC call, but
only actually draw screen full at a time, using the full list as a
backing model instead of making a fresh RPC call for each page. This
makes navigating the items in the UI very fast once the data model is
loaded because only the visible HTML boxes required are actually
drawn, but you pay a pre-loading price up front in the big RPC call.

Which is best depends largely on your application and user
requirements and also on the precise time it takes to fetch the entire
list over RPC. For example if your users will routinely want to sort,
filter or search through a large data set in complex ways, then they
will probably thank you for implementing the fast tree idea and be
happy to wait maybe 2 or 3 seconds to fetch the all data up front
because the subsequent operations will be much faster. On the other
hand if a 1 item list is unusual, or they would normally only be
interested in first page of two (typical for search results for
example) then the classic lazy load is almost certainly best as it
gives them a much quicker render of the first screen full.

I'd say the first thing to do is to is to time your RPC call round
trip separately from your screen render times to get a feel for the
numbers, but do this in web mode either over web or on LAN, whichever
is appropriate for your typical user, in a selection of popular
browsers.

regards
gregor

On Mar 27, 10:35 am, -Lord-67 -lord...@web.de wrote:
 No, i haven't tried that so far, i will do so and let you know if it's
 getting better. Maybe a List needs less time to be serialized and
 deserialized.

 Greetings,
 -Lord-67

 On Mar 26, 6:27 pm, lukehashj bobwazn...@gmail.com wrote:

  Have you tried using a List instead of an array?

  On Mar 26, 2:46 am, -Lord-67 -lord...@web.de wrote:

   First of all: Hi to everyone!

   I'm new to GWT and just programming my first app. Since i've some
   experience in Java it's not a big problem, but in this case i am stuck
   and hopefully someone can help me.

   In my app i make a RPC: On server side i get some data out of a
   database and save it into an array of type String. Up to 10.000
   Strings atm, later on maybe up to 50.000. It is no problem so far. The
   server is handling this really fast. I measured 5 RPCs with about 500
   Strings each and it took less time than 200 milliseconds each (SQL
   Statement + creating the array).

   The problem now is: I have to wait 5 SECONDS to get the results of the
   RPC (the String[] created on the server) on the client side so i can
   do something with them. Regarding the overall time i measured, these 5
   seconds are more than 75% of the time which my app needs. Is it
   possible that the serialization and deserialization takes that much
   time? I don't think so and i have no clue where this 5 seconds come
   from. If someone has any ideas, solutions, suggestions on this problem
   i would appreciate any help!

   Thanks in advance,
   -Lord-67

   P.s.: Of course i searched for a solution for this problem for hours,
   if i somehow just typed the wrong keywords to get the fitting results,
   just let me know and post a link :-).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send

Re: How do I call a stateless session bean (EJB) from my RPC service?

2009-03-26 Thread gregor

yes it should, equally @EJB SomeRefLocal localRef should too.



On Mar 26, 7:18 am, stsc...@schliwinski.de wrote:
 Update: A full JNDI lookup is working, but why do I not get a
 reference using the annotations?

 If I have

 SomeBean --Bean Implementation
 SomeRef -- Remote Interface
 SomeRefLocal -- Local Interface

 then

 @EJB
 SomeRef ref;

 should work to get the remote interface, right?

 -Steffen-

 On 25 Mrz., 21:39, stsc...@schliwinski.de wrote:

  Hi Gregor,

  thanks for this extensive answer. I deployed a very simple sample
  application to JBoss but for any reason I cannot access myEJBfrom my
  RPC service. Neither with the @EJBannotation nor with the @Resource
  SessionContext ctx statement. That's what my service implementation
  looks like:

  package de.stsch.j2ee.gwt.server;

  import javax.annotation.Resource;
  import javax.ejb.EJB;
  import javax.ejb.SessionContext;

  import com.google.gwt.user.server.rpc.RemoteServiceServlet;

  import de.stsch.j2ee.ejb.StSch;
  import de.stsch.j2ee.gwt.client.GwtClientSrc;

  public class GwtClientSrcImpl extends RemoteServiceServlet implements
  GwtClientSrc {
          @EJB
          StSch bean;

          @Resource
          SessionContext ctx;

          @Override
          public String getName() {
                  StringBuffer sb = new StringBuffer();
                  if (ctx == null) {
                          sb.append(ctx is null);
                  } else {
                          sb.append(ctx is not null);
                  }

                  if (bean == null) {
                          sb.append(, bean is null);
                  } else {
                          sb.append(, bean is not null);
                  }
                  return sb.toString();
          }

  }

  And it always returns that both ctx and bean is null :-(

  Any idea why?

  -Steffen-

  On 25 Mrz., 16:26, gregor greg.power...@googlemail.com wrote:

   Hi Steffen,

   The simplest way to do this is to add your GWT app as a module (WAR)
   to your EAR. The GWT RPC servlets will then have direct access to your
   session beans local interfaces (which you must define BTW).

   If you cannot do this for some reason, the situation is a bit
   trickier. Your standalone Java client probably uses RMI to call your
   session beans? Is so, then it is calling the beans remote interfaces
   and call parameters/return values are serialized over the wire. AFAIK
   you cannot call the local interface of a session bean from a class
   outside its EAR. You can always use JNDI to look up the remote
   interfaces of your session beans from a separate GWT module's RPC
   servlets (which mimics what happens with the Java client) but this
   involves your app server serializing and deserializing all objects
   passed betweeen the GWT app and the enterprise app, i.e. the app
   server will be serializing to itself, which is a serious performance
   drain you will want to avoid.

   BTW I think the reason why this is so is that each EAR or WAR deployed
   on your app server is allocated it's own classloader, so in this
   situation your session beans are not directly visible by reference to
   your GWT module classes and visa versa, so they must be called
   remotely (which means serialization).

   One way around this is to set up yourEJBapplication as a Resource
   Adapter ARchive (RAR). This is not normally used in applications as
   such, and is usually associated with some external data source common
   to a number of applications in an enterprise situation (a bit like a
   database, it's comparable to a JDBC). Normally vendors use it, for
   example Apache Jackrabbit uses a RAR. However this complicates things,
   and I am not sure you will get optimal performance out of it anyway
   (although I am not sure, I use RAR's but have never written one
   myself), but it will probably perform better than using remote
   interfaces to your session beans.

  http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic...

   For these reasons, unless you have the strongest possible reasons for
   not doing so, I think your best bet is to include your GWT module in
   your main enterpise application (so it is a WAR inside the EAR) and
   then you will be able to call your session beans directly from GWT RPC
   servlets using their local interfaces. This should give you the best
   performance from the simplest code.

   regards
   gregor

   On Mar 25, 2:15 pm, stsch stsc...@schliwinski.de wrote:

In Eclipse I have one project (j2eeEjb) containing the Enterprise Java
Beans, one projects (j2eeClient) contains the corresponding Remote
Interfaces and one project (j2eeEar) only assembles everything into an
ear-file. The resulting ear-file contains 2 jar-files, j2eeEjb.jar and
j2eeClient.jar; this is the corresponding application.xml of the ear-
file

?xml version=1.0 encoding=ASCII?
application xmlns:xsi=http://www.w3.org/2001/XMLSchema

Re: How do I call a stateless session bean (EJB) from my RPC service?

2009-03-25 Thread gregor

Hi Steffen,

The simplest way to do this is to add your GWT app as a module (WAR)
to your EAR. The GWT RPC servlets will then have direct access to your
session beans local interfaces (which you must define BTW).

If you cannot do this for some reason, the situation is a bit
trickier. Your standalone Java client probably uses RMI to call your
session beans? Is so, then it is calling the beans remote interfaces
and call parameters/return values are serialized over the wire. AFAIK
you cannot call the local interface of a session bean from a class
outside its EAR. You can always use JNDI to look up the remote
interfaces of your session beans from a separate GWT module's RPC
servlets (which mimics what happens with the Java client) but this
involves your app server serializing and deserializing all objects
passed betweeen the GWT app and the enterprise app, i.e. the app
server will be serializing to itself, which is a serious performance
drain you will want to avoid.

BTW I think the reason why this is so is that each EAR or WAR deployed
on your app server is allocated it's own classloader, so in this
situation your session beans are not directly visible by reference to
your GWT module classes and visa versa, so they must be called
remotely (which means serialization).

One way around this is to set up your EJB application as a Resource
Adapter ARchive (RAR). This is not normally used in applications as
such, and is usually associated with some external data source common
to a number of applications in an enterprise situation (a bit like a
database, it's comparable to a JDBC). Normally vendors use it, for
example Apache Jackrabbit uses a RAR. However this complicates things,
and I am not sure you will get optimal performance out of it anyway
(although I am not sure, I use RAR's but have never written one
myself), but it will probably perform better than using remote
interfaces to your session beans.

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/cdat_resourcead.html

For these reasons, unless you have the strongest possible reasons for
not doing so, I think your best bet is to include your GWT module in
your main enterpise application (so it is a WAR inside the EAR) and
then you will be able to call your session beans directly from GWT RPC
servlets using their local interfaces. This should give you the best
performance from the simplest code.

regards
gregor








On Mar 25, 2:15 pm, stsch stsc...@schliwinski.de wrote:
 In Eclipse I have one project (j2eeEjb) containing the Enterprise Java
 Beans, one projects (j2eeClient) contains the corresponding Remote
 Interfaces and one project (j2eeEar) only assembles everything into an
 ear-file. The resulting ear-file contains 2 jar-files, j2eeEjb.jar and
 j2eeClient.jar; this is the corresponding application.xml of the ear-
 file

 ?xml version=1.0 encoding=ASCII?
 application xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns=http://java.sun.com/xml/ns/javaee; xmlns:application=http://
 java.sun.com/xml/ns/javaee/application_5.xsd
 xsi:schemaLocation=http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/application_5.xsd;
  version=5
   display-namej2eeEAR/display-name
   module
     ejbj2eeEjb.jar/ejb
   /module
 /application

 and this is the corresponding ejb-jar.xml of the j2eeEjb.jar

 ?xml version=1.0 encoding=UTF-8?
 ejb-jar
   xmlns=http://java.sun.com/xml/ns/javaee;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:ejb=http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd;
   
 xsi:schemaLocation=http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd;
   version=3.0
     display-namej2ee/display-name
     enterprise-beans
     session
       ejb-nameStSchBean/ejb-name
     /session
   /enterprise-beans
   ejb-client-jarj2eeClient.jar/ejb-client-jar
 /ejb-jar

 I can call a stateless session bean from a stadalone Java client
 without any problems.

 To the experts: Does this structure make sense? Or any suggestions for
 improvement?

 To develop a GWT application I would create a new project in eclipse
 and deploy it to my application server as a separate war-file. Does
 that make sense? Or should I try to include it into the ear-file
 extending the application.xml by a web module-entry?

 Nevertheless I couldn't make a call from my GWT RPC service to my
 session bean. What would be the best approach to do so? In my opinion
 there are 2 options: use the @EJB annotation or use

 @Resource
 SessionContext ctx;

 and do a lookup. Or is there any other option?

 Thanks in advance for any help, I really feel a bit stuck now :-(

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

Re: weak listener in GWT?

2009-03-25 Thread gregor

Interesting question Ed.

I read this:

http://docstore.mik.ua/orelly/webprog/jscript/ch11_03.htm

and a couple of other things. Looks like different browsers do things
differently with javascript gc, with IE (surprise surprise) noticeably
differing from the others.

My feeling is that the JVM does this in Java basically and it's in the
Java spec that it does, so you can rely on it. I don't think there is
an equivalent javascipt spec for this behavior, so you probably cannot
rely on this working, x-browser anyway, and you probably have to
explicitly kill the listener yourself.

On Mar 25, 2:59 pm, Ed post2edb...@hotmail.com wrote:
 He all,

 Please a bit of advice on the following?

 In Java you can use the WeakReference object to work with so called
 weak Listeners. More details on this can be found here for 
 example:http://www.javalobby.org/java/forums/t19468.html
 or:http://www.ibm.com/developerworks/java/library/j-jtp11225/

 I would love to do something similar but WeakReference isn't supported
 in GWT. How do others deal with it ?

 My problem: Suppose the following:
 ViewCategory is created and adds a property listener to a global Model
 to listen to Member name changes.
 The view isn't needed anymore and as such his instance reference made
 null in the controller where it's used.
 The next time this view is needed, a new ViewCategory instance is
 created, a listener is registered and the view is shown. We assume
 that the old instance was garbage collected - wrong assumption :(
 Suppose that I forget to unregister the listener - memory leak.
 The model keeps an association to the nested listener in the
 ViewCategory instance such that this object and his nested objects
 stay in memory.

 Ofcourse you then say: then clean this properly... Yep... I do my
 best, but in a complex situation with many requirements and things
 going from left to right, it can happen that this is forgotten.

 What would be nice:  weak listeners, like Swing has, such that when he
 ViewCategory isn't associated anymore, it's removed and as such also
 his listener from the global model.

 How do I realize something like this ?

 -- Ed
--~--~-~--~~~---~--~~
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: waiting for help

2009-03-24 Thread gregor

Hi Poonam,

It would also help answer your question if you could give more
information as to why you want to introduce struts. Or are you obliged
to do so for some reason?

regards
gregor


On Mar 24, 9:09 am, Ed post2edb...@hotmail.com wrote:
 Hi,

 It's difficult to give a concrete answer to your question as it's to
 vaque and global. You have to come up with concrete question.

 I would suggest that you play with some of the examples and read the
 documentation to get a good understanding of the different components
 and their boundaries. For example: GWT is purely a front-end
 (javascript) application that connects with the backend through HTTP
 POST/get. That's it... You can use the GWT RPC mechanism to easily to
 connect to a java backend. In your case this would be struts. Said
 this, have a look how you can connect to Struts. If I google I find a
 lot of info likehttp://cwiki.apache.org/WW/struts-2-gwt.html.

 I suppose that you know how to connect Spring and Hibernate.
 The only thing to consider then is: ho to pass hibernate objects to
 the front-end as Hibernate objects contain java jre elements that
 aren't supported by GWT. So you have to decouple this. There is a tool
 like gwt-hibernate that does that for you. i myself use Dozer and I
 don't want my backend domain objects to contain any gwt thing, even
 not some simple interface/class from gwt-hibernate (isn't allowed).
 There is a lot of info abut this subject. Consider it well as both
 have their advantages/disadvantages. Look for Spring Hibernate Dozer
 and you know enough.
 BTW: I made my own Dozer version such that I does exactly what I want
 and handles hibernate proxies well. Most of these things are being
 included in Dozer as we speak (Dozer has improved a lot the last
 months).

 Hope this helps.
 Good luck,
 Ed
--~--~-~--~~~---~--~~
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: waiting for help

2009-03-24 Thread gregor

yes, check the group for struts posts Poonam.

Bottom line is don't use struts on server with GWT app unless you
absolutely have to (legacy situation), better to use GWT RPC and keep
state on client. Reasons have all been spelled out several times
before so no point in reiterating them.

On Mar 24, 10:47 am, Ed post2edb...@hotmail.com wrote:
 Please first search the forum or internet for answers to your question
 before posting yours.

 There is a lot of information out there and I am sure you find most of
 your answers there.
 If not, post your concrete question here.

 GoodLuck,
 Ed
--~--~-~--~~~---~--~~
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 to configure web.xml to include RPC service?

2009-03-22 Thread gregor

I've always used the same URL mapping formula as that - I have never
got to bottom of how to get it to work using wild cards etc

I believe the reason is to something do with with the combination of
a) GWT.getModuleBaseURL() returning the module path with '.' (dots)
instead of '/' (slashes) and b) the way Tomcat etc treat dots in a URL
pattern. I recall something about Tomcat treats everything that comes
after the first dot in the url as an extension rather than treating
the dots as directories (hence the *.do etc in struts). I also believe
this comes directly from the servlet 2.4 specification definition of
how to treat wild cards in url pattern matches, and last time I looked
that up I recall I did not find it particularly intuitive.

I think if one wrote one's own static helper that called
GWT.getModuleBaseURL() and replaced all the dots with slashes and used
that instead in your RPC call set ups, then I think it might behave as
one might expect, but I've never got round to trying this yet - I just
cut and paste the full module path, dots 'n all, into web.xml :-(

There might be a way to manipulate the servlet spec wild card rules to
get round this, but I've never yet seen a post explaining how for
GWT.getModuleBaseURL() based URLs.


On Mar 22, 10:28 am, stsc...@schliwinski.de wrote:
  The requested resource (/gwtejb/de.stsch.gwtejb.GwtEjb/GwtEjbSrc) is
  not available.

 Hm, it works when I change my web.xml to

 url-pattern/de.stsch.gwtejb.GwtEjb/GwtEjbSrc/url-pattern

 Why do I have to include the full package name?
--~--~-~--~~~---~--~~
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: Differences

2009-03-20 Thread gregor

GWT RPC is a propriety GWT mechanism that serializes/deserializes Java
objects (those that are supprted by the GWT JRE emulation library) for
transport between client and named methods in servlets that implement
RemoteServiceServlet. It also provides an asynchronous callback
mechanism for the client. Since Java objects (or javascript
translations thereof in the case of the client) are delivered directly
to your code fully formed, it is a very convenient, concise and
efficient mechanism if you have a Java back end.

RequstBuilder is the GWT implementation of the standard javascript
XMLHttpRequest. Using this requires that you serialize/desialize
objects yourself (or use an appropriate library to do it in for
example JSON or XML format (GWT provides a JSON and an XML parser
parser for GWT clients) . This is typically used where the back end is
not Java based, e.g. php or python, or when using 3rd party JSON
services for mash ups etc. It is also often used if binary data needs
transporting across the wire since GWT RPC is text based and BASE64
encoding/decoding is slow.

HttpSession is an abstraction of a connection and subsequent
conversations between a specific client and a servlet container. It is
maintained by the serlvet container. Each request the servlet
container receives is tracked against the client's HttpSession, and
HttpSession enables session state to be maintained for the life time
of the session between separate requests from the client.


On Mar 20, 3:58 am, jagadesh jagadesh.manch...@gmail.com wrote:
 What are the differences between

 GWT RPC,
 Request Builder
 HttpSession

 why do we need 3 for the same thing .

 thank u,
 jagadesh
--~--~-~--~~~---~--~~
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 to sort a list with objects on client side?

2009-03-19 Thread gregor

Hi Danny,

I think it may be because you have not implemented the compare method?
One simple comparator I use for sorts looks like this:

public class TermComparator implements Comparator  {
public int compare(Object term1, Object term2) {
String first = ((Term) term1).getText().toUpperCase();
String second = ((Term) term2).getText().toUpperCase();
return first.compareTo(second);
}

This is pre-1.5 so not generic etc, and it obviously uses the built in
String.compareTo(..) method, so for integers you need to replace with
code to comply with the Comparator.compare(..) contract:

Compares its two arguments for order. Returns a negative integer,
zero, or a positive integer as the first argument is less than, equal
to, or greater than the second.

I actually use this on the server before list to the client since I
thought it would probably be faster in Java than in javascript and it
always has to be done and in alpha order only. Subsequently I have
considered that this puts additional pressure on the server, so even
if it would be technically slower on client, if not materially so,
then maybe better on the client.

regards
gregor

On Mar 19, 7:49 am, Danny Schimke schimk...@googlemail.com wrote:
 Hello!

 I have a list with objects I've got from backend-side. Every object has a
 getSort() method, which returns an integer value. I've never worked with
 Comparator before, but I tried like the following:

 public ListObjecttype getObjectListe() {
     ListObjecttype sortedList = model.getObjects();
     Collections.sort(sortedList, new ComparatorObjecttype() {
         public int compare(Objecttype o1, Objecttype o2) {
             // compare the o1.getSort() value with o2.getSort() value here
         }
     });
     return sortedList;

 }

 And this is the error I got:

 [ERROR] Uncaught exception escaped
 java.lang.UnsupportedOperationException: null
     at
 com.incowia.tkbase.unternehmenspflege.core.client.BaseReferenceList.toArray(BaseReferenceList.java:166)
     at java.util.Collections.sort(Collections.java:158)

 What have I to do, to sort my list?

 -Danny
--~--~-~--~~~---~--~~
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: Generic Serialization

2009-03-16 Thread gregor

Hi Tercio,

You can read about this issue in these posts:

http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/25d151960b48b5c4
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/85cfb087d061e3c6/d325d250c7c19564?lnk=gstq=gregor+generic+RPC+#d325d250c7c19564

The solution outlined by Scott in the the first one definitely works
(I tried it)

regards
gregor


On Mar 16, 10:08 pm, Tercio terciofi...@gmail.com wrote:
 Hi!

 In my module I need to call a RPC service and this service need to
 return an array of values with various types.

 I tried to use ListObject and fill with Integer, Boolean, String and
 so on, but Object is not serializable.

 How to accomplish that?

 Regards.,

 Tercio
--~--~-~--~~~---~--~~
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 to align TabPanel on right

2009-03-16 Thread gregor

Not sure, but TabBar has the styles:

# .gwt-TabBar .gwt-TabBarFirst { the left edge of the bar }
# .gwt-TabBar .gwt-TabBarRest { the right edge of the bar }

so if you give TabBarFirst 100% width and give TabBarRest maybe a
fixed width to give you a little indent from the right edge if you
wanted one, it might push the tabs over.

On Mar 16, 4:52 pm, dialloma malim...@gmail.com wrote:
 Hello group,

 I use GWT TabPanel in big entreprise Application. I would like to
 align all tab items on the right. Please do you have idea about it ?

 Thanks in advance
 dialloma
--~--~-~--~~~---~--~~
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: Loading Images into GWT via MySQL

2009-03-13 Thread gregor

+1 to Ze's comment

My reply assumed you had a reason why you *must* store images in DB.
If you don't Ze is right that it is a very inefficient way to store
and serve images.


On Mar 13, 9:04 am, Zé Vicente josevicentec...@gmail.com wrote:
 Hi,

 I will give you my honestly opinion. It seems that you are new on the
 subject and I can say that I have a lot of experience on that.

 First of all, don't store images on the database :)

 It is true that we can do it, but depending of what you are going to
 do, the site of your database will be 90% images and 10% data.

 The images are always served by httpservers, even if you retrieve it
 from the database. So if you store the images in the file system of
 your httpserver, there is no need for network usage in case your
 database is hosted in a different server.

 So, use the database just to store the path of your images. Then in
 GWT, retrieve the object or list of objects that contains the path for
 your images. Again in GWT, Create an Image object and set the src
 property.

 That is all you need to do to display the image.

 What do you think?

 Regards,
 José Vicente

 On Mar 13, 2:52 am, Itamar Ravid itamar.ira...@gmail.com wrote:

  Don't forget however to set the content type on the response to an image of
  some type, otherwise the client's browser will try to download the picture
  rather than display it.

  On Fri, Mar 13, 2009 at 2:28 AM, gregor greg.power...@googlemail.comwrote:

   I think Itamar is right, Jack, you should use a standard HttpServlet
   for this, not GWT-RPC, because this sends the image over to the
   browser as byte steam, and I don't think RPC can do that.

   First, I take it these are not images used in your UI (like icons
   etc), 'cos those should go in an ImageBundle. I assume you know that 
   these images are downloaded as user selections etc.

   1) Consult your MySQL docs/forum to find out how to obtain an
   InputStream for the image via JDBC. You want to pass an InputStream
   back to your image download HttpServlet. You don't want to read out
   the image bytes yet.

   2) You write the HttpServlet something like this example (there are
   lots of others around):

  http://snippets.dzone.com/posts/show/4629

   Notice that the key is a looping read of the InputStream (which you
   got from MySQL) that writes straight into the HttpServlet's response
   OutputStream. Notice also it uses a buffer byte[] array. This is so
   that your web server does not get it's memory clogged up with big
   image byte arrays - the image bytes just get shunted from the DB
   straight out to the browser via this buffer. Therefore set this buffer
   small. Apache tend to use 2048 bytes. I think Oracle prefer 4096. That
   sort of size for the buffer. Take care to set the response content
   type so the browser knows what it's dealing with.

   3) In your client you can set the Image widget's URL to your image
   download HttpServlet adding a parameter for the image id.

   regards
   gregor

   On Mar 12, 8:54 pm, fatjack1...@googlemail.com
   fatjack1...@googlemail.com wrote:
Hi,

I'm not too sure how to implement a HTTPServlet. Does anyone know how
to use images using RPC?

Im really stuck on this.

On Mar 12, 8:43 pm, Itamar Ravid itamar.ira...@gmail.com wrote:

 The best way, IMO, is to not use GWT-RPC, but rather implement an
 HttpServlet, that retrieves the data from the database and returns it
   with
 the appropriate Content-Type in response to a GET http request. Then,
   you
 simply place an image in your GWT code, with its source being the path
   to
 the servlet (defined in your web.xml), passing along any parameters
   required
 - such as the ID of the image in the database.

 On Thu, Mar 12, 2009 at 12:59 PM, fatjack1...@googlemail.com 

 fatjack1...@googlemail.com wrote:

  Hi,

  I am new to loading images into GWT from MySQL and am abit lost on
   the
  best way to do it.

  I already have my image in the database. How do I retrieve it? I 
  read
  somewhere that it can just be stored as a String. Is this correct? 
  So
  my code on the server side would look like:

  //Open database connection
  dc.openConnection();
  resultSet = dc.statement.executeQuery(SELECT CategoryImage FROM
  itemcategory_table WHERE ItemType = 'Test');

    while(resultSet.next()) {
         String test = resultSet.getString(1);
  }

  dc.closeConnection();

  Or have I got this completely wrong?

  Next, I need to send this over to the client. What is the best way 
  to
  send an image over from the server to the client and how should it 
  be
  stored?

  Any help on how to use images would be much appreciated!

  Regards,
  Jack
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post

Re: Tree Performance

2009-03-11 Thread gregor

I have never tried using StackPanel like that, but I did look at it's
code once to enhance it and I think it is at least as complicated as
Tree (in the sense it has many HTML boxes) so I would guess it would
probably be if anything worse than Tree in your situation.

The classic way to deal with large trees is to lazy load them by
layer, but obviously that is not an option for you as you only have
one layer.

I think you'll have to figure out a creative way to design a widget to
deal with this edge case (1000 items). It's a bit difficult to suggest
anything because we don't know either the contents of the tree nodes
(what these 100 items are) or how they are used (presume user selects
them?)

One idea that that immediately occurred to me was to use
DisclosurePanels. This has a right pointing triangle when closed, and
when clicked reveals the contents, rather like clicking the + on a
Tree. I am assuming also that the problem is purely rendering and that
there is no time problem fetching the 1000 items over RPC. You could
make a Composite widget like so:

Choose a container, could be FlowPanel, VerticalPanel etc
Keep a list of the items as a member of this class, and a cursor to
keep an index against the list
Set a maximum number to be rendered at any one time, say a few more
than your happy days case of =10
Iterate through the list making DisclosurePanels and adding them to
the container as you go
If the list size  your chosen max, add a button bar to the bottom
giving forward/back options

Etc, I'm sure you get the idea. I think rendering 10 - 15
DiclosurePanels at a time will probably be quick enough.



On Mar 11, 5:49 am, GWTFan valavanur...@gmail.com wrote:
 I read the 
 threadhttp://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
 on tree performance.

 We are having a similar issue with the tree, where most of the cases
 it would have 1-10 items. However rarely it would have 500-1000 items,
 which slows down IE badly.

 Ours is just one level hierarchy and I don't really need tree. Do you
 think using a stack panel would be faster than tree?
--~--~-~--~~~---~--~~
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: Tree Performance

2009-03-11 Thread gregor

yeah, I thought of that Vitali, but I thought what FastTree did was to
pre-load the entire TreeItem dataset (i.e. fetch all data in one RPC
operation) but then only actually draw visible tree layers, thus
cutting down repeated RPC fetches on lazy tree node open but still
only draw what is required on open clicks.

Which is no good for this situation because GWTFan has a flat tree
structure, i.e. all 1000 items in same branch?

On Mar 11, 12:18 pm, Vitali Lovich vlov...@gmail.com wrote:
 FastTree already takes care of all of this, so I'd recommend using it.

 http://collectionofdemos.appspot.com/demo/com.google.gwt.demos.fasttr...

 On Wed, Mar 11, 2009 at 7:37 AM, gregor greg.power...@googlemail.comwrote:



  I have never tried using StackPanel like that, but I did look at it's
  code once to enhance it and I think it is at least as complicated as
  Tree (in the sense it has many HTML boxes) so I would guess it would
  probably be if anything worse than Tree in your situation.

  The classic way to deal with large trees is to lazy load them by
  layer, but obviously that is not an option for you as you only have
  one layer.

  I think you'll have to figure out a creative way to design a widget to
  deal with this edge case (1000 items). It's a bit difficult to suggest
  anything because we don't know either the contents of the tree nodes
  (what these 100 items are) or how they are used (presume user selects
  them?)

  One idea that that immediately occurred to me was to use
  DisclosurePanels. This has a right pointing triangle when closed, and
  when clicked reveals the contents, rather like clicking the + on a
  Tree. I am assuming also that the problem is purely rendering and that
  there is no time problem fetching the 1000 items over RPC. You could
  make a Composite widget like so:

  Choose a container, could be FlowPanel, VerticalPanel etc
  Keep a list of the items as a member of this class, and a cursor to
  keep an index against the list
  Set a maximum number to be rendered at any one time, say a few more
  than your happy days case of =10
  Iterate through the list making DisclosurePanels and adding them to
  the container as you go
  If the list size  your chosen max, add a button bar to the bottom
  giving forward/back options

  Etc, I'm sure you get the idea. I think rendering 10 - 15
  DiclosurePanels at a time will probably be quick enough.

  On Mar 11, 5:49 am, GWTFan valavanur...@gmail.com wrote:
   I read the threadhttp://
  groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
   on tree performance.

   We are having a similar issue with the tree, where most of the cases
   it would have 1-10 items. However rarely it would have 500-1000 items,
   which slows down IE badly.

   Ours is just one level hierarchy and I don't really need tree. Do you
   think using a stack panel would be faster than tree?
--~--~-~--~~~---~--~~
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: Issue WIth TableListener

2009-03-07 Thread gregor

The simplest way is the have DynamicFormDisplayGrid implement
SourcesTableEvents. Then in it's addTableListener(TableListener
listener) method you just write:

table.addTableListener(listener)

So client widgets implementing Table Listener interface can be
notified of selection events on the internal FlexTable without
actually knowing about it, only DynamicFormDisplayGrid.

Not sure if this is exactly what you mean though


On Mar 7, 8:37 am, jagadesh jagadesh.manch...@gmail.com wrote:
 HI Guys,

 i need help in table listener.
 what i have done is i have written a widget extendsing composite. i
 have  code like

         public DynamicFormDisplayGrid(int columns) {
                 this.columns = columns;

                 SimplePanel panel = new SimplePanel();
                 panel.setStyleName(MD-Standard-DisplayGrid);

                 table = new FlexTable();
                 panel.setWidget(table);

                 initWidget(panel);

         }

 now i will be using this DynamicFormDisplayGrid in other classes.i
 will place widgets in the rows and columns in the grid.

 now what i need i i need to set tableListener for the
 DynamicFormDisplayGrid so that i can catch which row is clicked

 Please Sort me out from this issue.

 Thank u,
 jagadesh
--~--~-~--~~~---~--~~
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: Sequential workflow in an asynchronous GWT world

2009-03-05 Thread gregor

In general I think it is better to try to avoid this situation if
possible - and often it is if you think about it for a bit - because
a) the less RPC round trips you make the better, and b) the less
callbacks you have in your client code the simpler it is. In general
two good question to ask are:

1. Can the various logic branches be resolved automatically in the
happy days use case on the server as a result of one call? Often they
can if you look at things in a different way. If so you can then think
about how to deal with edge cases.
2. How much of the server state would the client really need to know
to successfully control the logic branches?  Often less than you'd
think at first.

For example, it may be that in your app the first selections the user
makes in this work flow are sufficient to generate a graph of
permissible branches and/or additional required data values on the
server from a single initial RPC call. In effect, create a simple
model for your work flow process on the server and transfer it to the
client up front. Thereafter the client could handle the UI dialog by
itself until completed (with no horrible async callback interruptions
and chains in the code) and then send the transaction details in one
final RPC call.

Of course this may not in the end be possible in your application, but
it's worth looking into as it will increase performance and decrease
complexity, as I think you have realized from your OP

regards
gregor.

On Mar 5, 6:12 am, hazy1 matt.egyh...@gmail.com wrote:
 Making an async call appear to be sequential is easy, just block or
 fade out or have a pop up progress bar until the async operation
 completes.

 On Mar 4, 10:15 pm, rlaferla robertlafe...@comcast.net wrote:

  How is everyone managing to implement sequential workflows when GWT
  only allows async calls?

  I have a series of panels that user must respond to in sequence and
  their answers may lead to a different path of panels (warnings, error
  panels, etc..)  I think every GWT programmer working on a large
  project must have run into this.   I'm interested in what strategies/
  techniques/code you used to help keep the complexity down.
--~--~-~--~~~---~--~~
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: Fix for HorizontalSplitPanel?

2009-03-05 Thread gregor

Might this have something to do with GTX FilllLayout? AFAIK if you
place, say, a Composite in HSP and set it's size to 100%,100% it will
fill the left/right panel and respond to moving the splitter.

On Mar 5, 5:09 pm, Michael mikecg...@gmail.com wrote:
 The HorizontalSplitPanel class has method to obtain the splitter
 element, but it is protected. The class itself is final. This is
 obviously broken, or they do not want you to have access to the
 splitter. This is problematic for me, because any container I put in
 the HorizontalSplitPanel (left or right side) never gets resized. I
 have created a simple example using one widget wrapped in a container.
 When I apply the FillLayout class (from GXT), or if I drop the widget
 into a HorizontalPanel and set the width to 100% the widget is never
 resized according to the width of the split panel.

 It seems to only work in the trivial examples posted around the
 Internet, ie: dumping text into an HTML widget. Has anyone actually
 used the HorizontalSplitPanel in a real world application where there
 are widgets (panels containing other widgets) on the left and right
 sides? How did you get them to resize correctly when the splitter is
 dragged to the left or right? I will post code to reproduce the
 problem if anyone needs it.

 Thanks,
 Michael
--~--~-~--~~~---~--~~
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: Fix for HorizontalSplitPanel?

2009-03-05 Thread gregor

I think pretty much most straight GWT widgets will do that. It's
pretty standard HTML behaviour that if you size a box to 100%,100% it
will fill the space made available for it. GXT? Is that part of the
Ext family (I can't remember these days). I think the Ext JS library
widgets have their own resizing framework. I believe that that they
all get sized up with hard pixel values  (i.e. they all get a
calculated height and width) rather than let the browser do the work
like GWT does so that their layouts mimic the windows desktop style.

Therefore I think if you just drop an Ext widget into a standard GWT
container (rather than an Ext container), the undelying Ext resizing
framework may not kick in properly because standard GWT HSP does not
broadcast the necessary resizing event the Ext widgets listen for, so
maybe that's why the contents of the FillLayout panel didn't resize
with the HSP.



On Mar 5, 9:00 pm, Michael mikecg...@gmail.com wrote:
 You're absolutely right - placing the widgets in a composite did the
 trick. I emphasize the word trick here because I really have no idea
 why that is the case. I must have tried every other viable container
 and had no luck. For instance I used the LayoutContainer with a
 FillLayout (GXT) which resized when expanding the size of the left
 widget, but didn't shrink the child widgets in the container when it
 was made smaller. If I had the time I would dig in to the source code
 and discover why the magic only works with specific containers. I
 would really appreciate an explanation if you can spare a few minutes.
--~--~-~--~~~---~--~~
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: tabpanel and size computation in onLoad

2009-03-02 Thread gregor

If you size you tab content widgets in % terms, they will size up
automatically when tab is selected if the main one is set to 100%,
100%. If you can't do that, there are several ways to approach the
problem depending on exactly what your situation is. Perhaps you can
be more specific.

As Alex says, non-selected TabPanel decks themselves always have a
width/height of zero, so in general you can get the base height you
need from DeckPanel itself (rather than the individual deck's) maybe
accurately only after one deck has been selected I think.

On Mar 2, 12:40 pm, LEDUQUE Mickaël mledu...@gmail.com wrote:
 Well, I would already have done that if that was possible.
--~--~-~--~~~---~--~~
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: tabpanel and size computation in onLoad

2009-03-02 Thread gregor



  1. Widgets that adjust themselves depending on the size of neighbour
 widgets. Some widgets have their size fixed decided in CSS styles, the
 other ones adjust depending on this size in the onload()

Widgets given fixed sizes in CSS/code should appear correctly when tab
selected. Is there a reason why you cannot size the remaining
relatively sized widgets in percentage terms? So long as they are told
to fill up available space (or proportion of it) they should do so
when tab selected. That's the way it's expected to work.

In general I think one should avoid calculating sizes manually in code
like the plague - use percentages and leave it to the browser
otherwise you will go mad. AFAIK the only common situation you can't
do that is with ScrollPanels which must be given a fixed height in
pixels to kick in properly.

  2. widgets like the incubator PagingScrollTable that have internal
 components that compute their size. For example

 (in com.google.gwt.widgetideas.table.client.ScrollTable)
 int totalHeight = DOM.getElementPropertyInt(getElement(),
 clientHeight);
 int headerHeight = headerTable.getOffsetHeight();
 int footerHeight = 0;
 if (footerTable != null) {
   footerHeight = footerTable.getOffsetHeight();
 }
 DOM.setStyleAttribute(headerWrapper, height, headerHeight +
 px);
 if (footerWrapper != null) {
   DOM.setStyleAttribute(footerWrapper, height, footerHeight +
 px);
 }
 DOM.setStyleAttribute(dataWrapper, height,
 (totalHeight - headerHeight - footerHeight) + px);

I'm not sure how PagingScrollTable works in TabPanels. Have you tried
setting it to size(100%,100%) and proved it does not behave properly
when it's tab is selected? I would be surprised if it didn't as that
would be an obvious flaw.

On Mar 2, 1:20 pm, LEDUQUE Mickaël mledu...@gmail.com wrote:
 Well, there are multiple case here :
  1. Widgets that adjust themselves depending on the size of neighbour
 widgets. Some widgets have their size fixed decided in CSS styles, the
 other ones adjust depending on this size in the onload()
  2. widgets like the incubator PagingScrollTable that have internal
 components that compute their size. For example

     (in com.google.gwt.widgetideas.table.client.ScrollTable)
     int totalHeight = DOM.getElementPropertyInt(getElement(),
 clientHeight);
     int headerHeight = headerTable.getOffsetHeight();
     int footerHeight = 0;
     if (footerTable != null) {
       footerHeight = footerTable.getOffsetHeight();
     }
     DOM.setStyleAttribute(headerWrapper, height, headerHeight +
 px);
     if (footerWrapper != null) {
       DOM.setStyleAttribute(footerWrapper, height, footerHeight +
 px);
     }
     DOM.setStyleAttribute(dataWrapper, height,
         (totalHeight - headerHeight - footerHeight) + px);
--~--~-~--~~~---~--~~
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: Unique color for each tab in a TabPanel

2009-03-01 Thread gregor

Hi Ando,

You can use TabPanel.add(Widget tabContent, Widget tabHeader).

The tabHeader widgets can be any type of widget, so you can style them
how you like. If you extend TabPanel with your own method to create
the tab header widgets when you add tabs, then you could assign each
new tab header added a particular colour style from a set list based
on tab index. If you MOD it, then the colour cycle would repeat.

gregor

On Mar 1, 8:25 pm, Ando and...@infiniteloop.co.nz wrote:
 Hi,

 I am trying to set a unique color for each tab in a TabPanel, i.e I
 want the first tab to be blue, the second to be green etc. The only
 way I can see to do this is to get a hold of the underlying DOM and
 set the css id manually, but even then I'm not sure this will work. Is
 there an easier way to do this?

 Thanks,
 Andrew
--~--~-~--~~~---~--~~
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: Two TabPanels, different CSS styles

2009-02-27 Thread gregor

CSS is often hierarchical in GWT widgets. You have a primary style
name and then additional secondary styles that are swapped out
according to user actions (like select, hover etc). With a Tab panel
the tabs are controlled by the TabBar class, and you can see it has a
primary style gwt-TabBar and a selection of additional styles.

.gwt-TabBar {
}

.gwt-TabBar .gwt-TabBarFirst {
}

.gwt-TabBar .gwt-TabBarRest {
}

.gwt-TabBar .gwt-TabBarItem {
}

.gwt-TabBar .gwt-TabBarItem-selected {
}

To custom style TabBars differently all you have to do is copy this
template CSS and replace gwt-TabBar with my-TabBar. Then you set the
style as:

myTabPanel.getTabBar().setPrimaryStyleName(my-TabBar);

Do not change the gwt- part of the secondary style names as the
internal TabBar code won't recognize them. E.g. you end up with

.my-TabBar .gwt-TabBarItem-selected {
}

So you can have as many different styles for the same GWT widget class
within the same application as you like.


On Feb 27, 4:25 am, Ananda ananda.hayavadh...@googlemail.com wrote:
 I belive you can do it..
 Use the different style name , it will work

 Regards,
 AR

 -Original Message-
 From: Google-Web-Toolkit@googlegroups.com

 [mailto:google-web-tool...@googlegroups.com] On Behalf Of Master Shake
 Sent: Friday, February 27, 2009 8:18 AM
 To: Google Web Toolkit
 Subject: Two TabPanels, different CSS styles

 Is there a way to have different css styles for two of the same GWT
 composite types (i.e. TabPanels) in the same document? I have two
 TabPanels and I want one TabPanel to have larger tabs...

 Thanks,
 -ms
--~--~-~--~~~---~--~~
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: Error in Application

2009-02-27 Thread gregor

[WARN]StandardContext[]Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.util.List
com.company.client.rpc.TeacherService.getPupils(java.lang.Integer)'
threw an unexpected exception: java.lang.NoClassDefFoundError: org/
springframework/context/ApplicationContext

This means that org.srping.framework.ApplicationContext is not in your
classpath. You probably need to add a Spring jar to it. If this is
happening when you run hosted mode, then you need to make sure the jar
is listed in the -cp arguement of your dev shell shell start script.
If in deployed (web) mode, it needs to be in the web app's lib
directory.

On Feb 27, 7:21 am, poonam poonam...@gmail.com wrote:
 Hello,
       Actually I have developed an Application integrating GWT+Spring
 +Hibernate in the Hosted mode , with the help of the below given
 links by you -
  Part One :http://eggsylife.blogspot.com/2007/10/well-this-tutorial-
 aims-at-helping.html
 Part 
 Two:http://eggsylife.blogspot.com/2007/11/hibernate-spring-google-web-too...
 Part 
 Three:http://eggsylife.blogspot.com/2008/02/hibernate-spring-google-web-too...
 Now I am getting many warnings in this application, but the warning I
 am unable to solve is :

 [WARN]StandardContext[]Exception while dispatching incoming RPC call
 com.google.gwt.user.server.rpc.UnexpectedException: Service method
 'public abstract java.util.List
 com.company.client.rpc.TeacherService.getPupils(java.lang.Integer)'
 threw an unexpected exception: java.lang.NoClassDefFoundError: org/
 springframework/context/ApplicationContext
         at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
 (RPC.java:360)
         at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
 (RPC.java:546)
         at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
 (RemoteServiceServlet.java:164)
         at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
 (RemoteServiceServlet.java:86)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at com.google.gwt.dev.shell.GWTShellServlet.service
 (GWTShellServlet.java:289)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
 (ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter
 (ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke
 (StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal
 (StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke
 (StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke
 (StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke
 (ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke
 (StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:
 929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
 160)
         at org.apache.coyote.http11.Http11Processor.process
 (Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol
 $Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt
 (PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
 (ThreadPool.java:683)
         at java.lang.Thread.run(Unknown Source)
 Caused by: java.lang.NoClassDefFoundError: org/springframework/context/
 ApplicationContext
         at com.company.server.gwt.TeacherServiceImpl.getPupils
 (TeacherServiceImpl.java:28)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at 

Re: What are your thoughts on Cappuccino and SproutCore?

2009-02-27 Thread gregor

If you watch the Hello world starter tutorial for Cappuccino, there
is the basic problem highlighted: He creates an action on the button
to call swap to change Hello world to Goodbye - but he forgets
to actually create the swap method itself, so app crashes and you see
this in firebug:

Exception...  - [AppController: swap] unrecognized selector sent to
instance 0x000133 when calling method

Aside from the fact that in GWT first your IDE and if not then then
the compiler will pick that up before you even try to run it and your
IDE will probably auto-write a stub for the fix for you to boot,
Eclipse etc java debugging tools are light years ahead of this, partly
due to Java having strong static typing, which Cappuccino clearly
doesn't

No big deal in the small, but scale up and you are back to the
javascript maintenance nightmare. It can't compete with Java tooling
nor Java itself. Looks pretty and has a few fancy widgets that do a
bit more out of the box than GWT equivalents. Be interested to see how
they they cope with data structures like hash maps and how you could
hook up widgets using Observer pattern for example.

On Feb 27, 12:18 pm, Rockster rjan...@gmail.com wrote:
 Looks nice though.
 I checked the video and was impressed

 (only thing : yet another language to learn Objective J, not hard, but
 again another one...)

 On Feb 26, 2:26 pm, ivo ivo.reduto.fre...@gmail.com wrote:

  Cappuccino and SproutCore have been around for a while and they are
  really starting to make an impression on web developers.

  I've been using GWT in one project for 2 months, and I'm loving it.
  However I tried out Cappuccino, just to get the felling of it, and I
  was truly impressed. I was able to re-design the project's UI in
  Cappuccino in one week, and it seems to me that a lot of my server
  side code can be re-utilized if I use something like cp2javaws
  (haven't tried it).

  So, my question to you guys is how will GWT compete with Cappuccino or
  SproutCore, (and I'm not even mentioning JavaFX), and if you have
  anything planned to extend GWT capabilities of building really rich
  UIs just as easy as Cappuccino.

  Don't get me wrong, I'm a truly GWT lover. In my opinion GWT is
  superior in both performance and code security (minimization /
  obfuscation), but right now I'm really tempted to throw away 2 months
  of GWT work...

  Some pointers:http://280atlas.com/(justannounced, I recommend watching the 
  video)http://cappuccino.org/http://sourceforge.net/projects/cp2javaws/http:..
--~--~-~--~~~---~--~~
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: MVC + RPC architecture

2009-02-25 Thread gregor

Hi Reza,

I think I made an unfortunate choice of words with dogma. I do not
mean to diss MVC, what I really meant to convey was that there is an
awfull lot more documentation around about MVC than there is about
Model Delegate and the the use of the Observer and Mediator patterns
in this context. You are quite right IMO that newbies should learn and
apply well established patterns, but my point is that the MVC pattern
has so much exposure that it is possibly unbalanced.

I think part of the reason relates to your comment:

And finally, I don't have anything against ModelDelegate, but I think
you wouldn't use it in a jsp web site by putting all controllers code
inside jsp. (which is possible and most newbies start coding this way)
You definitely use a well established MVC framework.

You are undeniably right about this: you should definitely use a MVC
framework like struts for a JSP based application. The thing is,
though, that JSP based applications are a perfect fit for the MVC
pattern since each request from a view needs to be processed and
redirected to the next view. A struts Action class, i.e. a controller,
is perfect for this. MVC got a huge boost to its profile through
struts and JSP Model 2.

But a GWT AJAX application is a different animal. It is technically a
thin client since it runs in a browser with no native executables or
libraries required, but functionally it has a lot more in common with
a traditional thick client - complex UI, no paging, asynchronous
server calls, session state shifted from server to client etc. In a
Java thick client, say Swing, you typically set a model graph directly
on a widget, and the widget binds itself to it and controls user
events and how they affect the model.

In GWT it is similar to this, because events are propagated from the
browser via the widgets themselves, so if you have separate
controllers that need to know about events (which they do) it can
become complicated and messy. This is exacerbated by the asynchronous
RPC mechanism as Charles pointed out in the OP. If a widget itself is
not coordinating the asynch call, but calls a method on a separate
controller, you need another callback mechanism to relay the results
back to the widget.

There are situations where doing this is necessary. My favourite
example is a work flow application where a work flow process may have
many different views all of which are based on the same model graph
for the process. In this case a MVC decomposition some thing like this
makes sense:

 view
  / \
   controller \
  /\  \
 /   \ \
RPC\\
   \ ---  model

IMO in many, if not most, situations that is over-engineering.

However none of this answers the OP question really, nor does it
answer your point that newbies should follow good practice based on
known sound patterns. If not MVC then what exactly? To be sure the
answer is not that well documented. The current GWT event system which
is based pretty much on the Observer pattern. it works well in the
simple case but has shortcomings when you scale in terms of
complexity. It can get messy with dozens of different listener
interfaces etc. I think the new event system coming in with 1.6 will
make a big difference to this.

My own response has been to experiment with the Mediator pattern as
defined in the GoF book. I am pleased with the results so far. The GoF
book actually uses a set of collaborating widgets as the example for
Mediator. I use a mediator to coordinate events between colleague
widgets (usually Composites) around a specific functional area. The
Mediator only handles event subscription, publishing and routing. The
Composites themselves are responsible for deciding what to do in
response to a particular event. The main shortcoming of this approach
I have found so far is if an event requires several Composites to
refresh their data at once since this implies multiple concurrent RPC
calls when one would be better. I'm still thinking about how to best
deal with that in general terms.

Anyway, I have nothing against MVC, only that it is not IMO an
automatic or universal best choice for a GWT client. Only sometimes.

regards
gregor






On Feb 25, 1:35 pm, Adligo sc...@adligo.com wrote:
 Hi charles,

   I have also written and open sourced a mvc architecture (gwt_util
 and gwt_util_demo) projects at;http://www.adligo.com
 It is designed specifically to be used with storage (databases, ldap
 servers, files exc).  It also has a logging framework, so you can
 figure out whats going on in my gwt mvc classes.
   Give the large number of gwt mvc architectures out there I would
 have to say it is a good idea.   On thing it took me years to realize
 (due to falling asleep in computer science 1?) is that mostly when you
 hear the words re-use they pertain to re using a design (like mvc,
 observers, command

Re: MVC + RPC architecture

2009-02-24 Thread gregor

Hi Charles,

 - do I have to duplicate datas in my Model (MVC) ?
 - what about asyncCallback when calling a service: whe doing that part
 in a widget (view side), I was able to display a window (Window.alert)
 when the RPC failed. Now, this code is done in the Model (MVC) so it
 doesn't make sense to add this kind of code there...
 - how can I handle exceptions? For example, as I can't display a
 window in the Model part, I would like throw an exception which will
 be thrown from the Model to the View through the controller.. How can
 I do that? I can see that onFailure method from AsyncCallback doesn't
 throw any controlled exception. In addition, it is an asynchronous
 call...


You observations illustrate some reasons why when Swing and SWT where
designed they did not follow classic MVC, but implemented a variant of
it sometimes called Model Delegate. It's more convenient and concise.
There are no downsides because there is nothing to stop you
implementing full blown MVC (by which I mean rigorous separation of
view and controller in the UI) if you need to. See:

http://c2.com/cgi/wiki?ModelDelegate

GWT is loosely based on Swing/SWT programming model (as far as it can
given it runs as javascript). It makes sense to follow the programming
model of your tool kit, or at least to investigate why it follows the
pattern it does, rather than blindly follow traditional MVC dogma.

regards
gregor
--~--~-~--~~~---~--~~
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 RPC issue: Unable to instantiate 'org.bcs.server.SelectionSearchServiceImpl

2009-02-21 Thread gregor

I think you are missing gwt-servlet.jar from the classpath section.

On Feb 21, 5:26 am, BobM bmar...@bcscomputers.com wrote:
 Thank you, Gentlemen, both!

 Let deal with these responses one at a time:
 Gregor:

 I am running an ant script based on the AppName-shell which was
 created by applicationCreator.  Here is the relevant section of the
 ant build.xml:
 !-- === CSRapp: Run this application in GWT shell
 == --
   target name=debug
     java classname=com.google.gwt.dev.GWTShell
       fork=true
       spawn=true
       maxmemory=256m 
       arg value=-out/
       arg value=www/
       arg value=org.bcs.CSRapp/CSRapp.html /
       classpath
         pathelement path=src/
         pathelement path=${java.class.path}//
         pathelement path=/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-user.jar/

         pathelement path=/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-dev-
 linux.jar/
       /classpath
     /java
     echo
 The GWT shell is starting.
     /echo
   /target

 And here is the tree diagram of the files layout under src::
 src
 `-- org
     `-- bcs
         |-- CSRapp.gwt.xml
         |-- client
         |   |-- CSRappEntryPoint.java
         |   `-- gui
         |       |-- MainFrame.java
         |       |-- MessagePanel.java
         |       |-- SelectionPage.java
         |       |-- SelectionSearchService.java
         |       `-- SelectionSearchServiceAsync.java
         |-- public
         |   |-- CSRapp.html
         |   |-- WEB-INF
         |   |   `-- web.xml
         |   |-- messagePanel.css
         |   `-- selectionPage.css
         `-- server
             |-- SelectionSearchServiceImpl.java
             |-- db
             |   |-- HibernateUtil.java
             |   |-- ModelFacade.java
             |   `-- package.html
             `-- utils
                 |-- ClientException.java
                 |-- ServiceProvider.hbm.xml
                 |-- ServiceProvider.java
                 |-- SpChangeEvent.java
                 `-- SpChangeListener.java

 And this is the way the service is mapped in the module.xml:
   servlet path=/selectionSearchService
            class=org.bcs.server.SelectionSearchServiceImpl /

 Now, to respond to Isaac:

 Yes I am certainly confused, then.  In the book GWT in Action the
 authors state, on page 87, last line in the first paragraph, Hosted
 mode also includes an embedded version of the Tomcat servlet engine
 into which any server-side Java code is deployed automatically.  And
 that was specifically referring to the behavior of the hosted mode
 shell, not to an IDE.

 It is possible that statement in that book is incorrect.  So I went
 chasing after confirmation in the Developer's Guide.  I couldn't find
 any statement quite as bold and forthright as that but I could find no
 contrary instructions and most of what I did find implied agreement
 with that statement.

 The documentation does specifically state that compilation is required
 and a standard war file deployment is required to support running in
 web mode (as I would expect).  If I cannot sort this out I may just
 try to effect deployment to a separate Tomcat instance and see if I
 have the same problems there, running in web mode.

 Thank you both for thinking about this issue with me.

 On Feb 20, 7:46 pm, Isaac Truett itru...@gmail.com wrote:

  No, there's no getting around compiling your server-side Java. Now, a
  lot of examples are written with the assumption that you're using
  Eclipse or some other IDE. And since anything that can properly be
  termed an IDE will be doing the compilation for you, automatically,
  and usually in the background without you noticing, it would be easy
  to omit even mentioning that part. That's probably what led you
  astray.  If you're not using an IDE you'll need to run javac yourself.
  If you are using one, make sure that it is compiling to bin (or
  classes or whatever other directory you have in your classpath).

  On Fri, Feb 20, 2009 at 5:41 PM, BobM bmar...@bcscomputers.com wrote:

   Whoa!  Wait a minute.  You've sent me back to the books ... back to
   the Developer's Guide and other GWT documentation. to re-confirm my
   understanding.

   I am simply trying to run this application in hosted mode.  My
   understanding is that I don't have to compile anything or set any
   adjustments to the classpath specified by AppName-shell provided by
   applicationCreator.  Is that not correct?

   My understanding is that, in hosted mode, the server-side code is
   automatically deployed to the embedded tomcat server.  Now, I cannot
   see in tomcat and its subdirctories any evidence that has happened,
   but I have no idea what I am looking for either.

   I understand from my reading of the process for hosted mode that all I
   should have to do - provided, of course, that my module.xml file
   provides proper mapping of the service - is run AppName-shell and
   everything should work ... if the code and configuration files

Re: Get subtree parent index?

2009-02-21 Thread gregor

Maybe a cleverer/simpler way to do this, but you could try extending
Button to include a reference to the TreeItem it's attached to, say
TreeButton. Then in your ClickListener onClick(Widget sender) {
   if (sender instanceof TreeButton) {
   TreeItem item = ((TreeButton)sender).getTreeItem();
   }

That would save you slogging through the tree searching for an id or
something.

On Feb 20, 11:22 pm, nebs nebspetro...@gmail.com wrote:
 Hello,

 I'm having trouble identifying tree elements.  Let me explain with an
 example.

 Let's say I have a Tree object which contains a few TreeItem objects.
 Each TreeItem object in turn contains a few TreeItems and a button.
 These buttons are generated via loops and so do not have an object
 name associated (eg. they all must call the same event handler).  Each
 button is set to trigger the same function (let's say buttonClicked
 (Widget sender)) when clicked on.

 My problem now is that within the buttonClicked(Widget sender) method
 I don't know how to figure out which branch (or TreeItem) that
 particular button belongs to.

 Here's a visual example:
 Tree:
 [ -] Fruits
    - Apple
    - Orange
    - [ ADD ] (--- This is a Button widget)
 [ -] Vegetables
    - Carrot
    - Eggplant
    - Pepper
    - [ ADD ] (--- This is a Button widget)
 [+] Dairy

 All the button click events call this function:
 private void buttonClicked(Widget sender){
   // How can I get the parent tree index via sender?

 }

 Let's say the user clicks on the ADD button which is under the
 Fruits subtree.  How can I know that the button called belongs to
 Fruits?

 I would like to have something like:
 int treeindex = sender.getParent().getPositionInTree();
 And have it return for example 0 for fruits, 1 for Vegetables, 2 for
 Dairy, etc.
 I've looked through the JavaDoc but nothing jumped out at me right
 away.
 Maybe I'm missing something obvious.

 Thanks in advance for any help.
--~--~-~--~~~---~--~~
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 RPC issue: Unable to instantiate 'org.bcs.server.SelectionSearchServiceImpl

2009-02-21 Thread gregor

You just need to adjust things so that offending servlet's
compiled .class file is in the classpath, that's all it is, no
mystery.

I don't use ant for hosted mode, so I havn't got a straight crib for
you, but in my deployment ant builds for gwt compile task I have

arg line=-out build/www/

And this puts all the servlet code under /build/com/foo/myapp/server/
myServletImpl.class and the html/js stuff under build/www  */build is
in my classpath definition*.

You need to check exactly what you output is to track this down. What
matters is that the servlet .class file is created somewhere that is
within the classpath definition in your ant script (which it clearly
isn't at the moment)


On Feb 21, 1:55 pm, BobM bmar...@bcscomputers.com wrote:
 Oh, Gregor.  That was a good shot.  I was so hopeful, but no joy.  I
 added gwt-servlet.jar to classpath but I get the same result ... no
 improvement.  I do believe the solution will be something like your
 suggestion, however.

 I think I will peel off to try running the application in web mode.
 Maybe that process will reveal something new to me.

 Thank you so much!

 On Feb 21, 5:05 am, gregor greg.power...@googlemail.com wrote:

  I think you are missing gwt-servlet.jar from the classpath section.

  On Feb 21, 5:26 am, BobM bmar...@bcscomputers.com wrote:

   Thank you, Gentlemen, both!

   Let deal with these responses one at a time:
   Gregor:

   I am running an ant script based on the AppName-shell which was
   created by applicationCreator.  Here is the relevant section of the
   ant build.xml:
   !-- === CSRapp: Run this application in GWT shell
   == --
     target name=debug
       java classname=com.google.gwt.dev.GWTShell
         fork=true
         spawn=true
         maxmemory=256m 
         arg value=-out/
         arg value=www/
         arg value=org.bcs.CSRapp/CSRapp.html /
         classpath
           pathelement path=src/
           pathelement path=${java.class.path}//
           pathelement 
   path=/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-user.jar/

           pathelement path=/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-dev-
   linux.jar/
         /classpath
       /java
       echo
   The GWT shell is starting.
       /echo
     /target

   And here is the tree diagram of the files layout under src::
   src
   `-- org
       `-- bcs
           |-- CSRapp.gwt.xml
           |-- client
           |   |-- CSRappEntryPoint.java
           |   `-- gui
           |       |-- MainFrame.java
           |       |-- MessagePanel.java
           |       |-- SelectionPage.java
           |       |-- SelectionSearchService.java
           |       `-- SelectionSearchServiceAsync.java
           |-- public
           |   |-- CSRapp.html
           |   |-- WEB-INF
           |   |   `-- web.xml
           |   |-- messagePanel.css
           |   `-- selectionPage.css
           `-- server
               |-- SelectionSearchServiceImpl.java
               |-- db
               |   |-- HibernateUtil.java
               |   |-- ModelFacade.java
               |   `-- package.html
               `-- utils
                   |-- ClientException.java
                   |-- ServiceProvider.hbm.xml
                   |-- ServiceProvider.java
                   |-- SpChangeEvent.java
                   `-- SpChangeListener.java

   And this is the way the service is mapped in the module.xml:
     servlet path=/selectionSearchService
              class=org.bcs.server.SelectionSearchServiceImpl /

   Now, to respond to Isaac:

   Yes I am certainly confused, then.  In the book GWT in Action the
   authors state, on page 87, last line in the first paragraph, Hosted
   mode also includes an embedded version of the Tomcat servlet engine
   into which any server-side Java code is deployed automatically.  And
   that was specifically referring to the behavior of the hosted mode
   shell, not to an IDE.

   It is possible that statement in that book is incorrect.  So I went
   chasing after confirmation in the Developer's Guide.  I couldn't find
   any statement quite as bold and forthright as that but I could find no
   contrary instructions and most of what I did find implied agreement
   with that statement.

   The documentation does specifically state that compilation is required
   and a standard war file deployment is required to support running in
   web mode (as I would expect).  If I cannot sort this out I may just
   try to effect deployment to a separate Tomcat instance and see if I
   have the same problems there, running in web mode.

   Thank you both for thinking about this issue with me.

   On Feb 20, 7:46 pm, Isaac Truett itru...@gmail.com wrote:

No, there's no getting around compiling your server-side Java. Now, a
lot of examples are written with the assumption that you're using
Eclipse or some other IDE. And since anything that can properly be
termed an IDE will be doing the compilation for you, automatically

Re: GWt RPC issue: Unable to instantiate 'org.bcs.server.SelectionSearchServiceImpl

2009-02-20 Thread gregor

What is the classpath arguement in your hosted mode command line or
script? Whatever it is, it doesn't look like it's got
org.bcs.server.SelectionSearchServiceImp covered in it.

On Feb 20, 10:41 pm, BobM bmar...@bcscomputers.com wrote:
 Whoa!  Wait a minute.  You've sent me back to the books ... back to
 the Developer's Guide and other GWT documentation. to re-confirm my
 understanding.

 I am simply trying to run this application in hosted mode.  My
 understanding is that I don't have to compile anything or set any
 adjustments to the classpath specified by AppName-shell provided by
 applicationCreator.  Is that not correct?

 My understanding is that, in hosted mode, the server-side code is
 automatically deployed to the embedded tomcat server.  Now, I cannot
 see in tomcat and its subdirctories any evidence that has happened,
 but I have no idea what I am looking for either.

 I understand from my reading of the process for hosted mode that all I
 should have to do - provided, of course, that my module.xml file
 provides proper mapping of the service - is run AppName-shell and
 everything should work ... if the code and configuration files are
 correct.

 If there is more to it, then I need guidance on what I have left
 undone.

 On Feb 19, 1:56 pm, Isaac Truett itru...@gmail.com wrote:

  ClassNotFound means something needs to be in your classpath and it isn't.

  1. Is the class compiled?
  2. Is the .class file in the appropriate location somewhere on your 
  classpath?

  That's really all there is to it.

  On Thu, Feb 19, 2009 at 2:52 PM, BobM bmar...@bcscomputers.com wrote:

   Setting loglLevel to ALL did not provide anything new or
   enlightening.  As when trying to effect an GWT RPC in my own app I get
   the message, Unable to instantiate and the cause is ClassNotFound.

   I am at a loss.

   On Feb 19, 1:22 pm, BobM bmar...@bcscomputers.com wrote:
   I have build another project, using applicationCreator, but used the
   already written code from a tutorial on writing GWT RPCs.  I get the
   same failure using this code, when running appName-shell: Unable to
   instantiate.

   What is going on here?  I haven't a clue or a way to dig deeper.
   Well, I will re-run these application with debug level set up to
   greater detail.

   On Feb 19, 8:04 am, BobM bmar...@bcscomputers.com wrote:

Mike, that was a good catch, but that difference was just a typo on
my part.  When I copied and pasted the messages into my post I just
missed including the l in Impl on one of the messages.  Actually
both are the same.

Now, I have scanned other posts on this same issue.  Most suggest it
is a classpath issue.  Okay, when I include www in the GWTShell
command, it I get the same results ... no improvement.

I think the question I have is, How to deploy the server-side
compiled code into the embedded Tomcat?  I do not see evidence that
Tomcat even knows about the service Impl.  As I understand it, I
should only have to run CSRapp-compile and CSRapp-shell for everything
to work.  Correct?  I have re-visited both the tutorial and the
developer's guide and I can find nothing that provides good guidance
on this issue.

On Feb 19, 4:59 am, mikedshaf...@gmail.com mikedshaf...@gmail.com
wrote:

 The first thing I noticed is that at one place in your message it's
 referred to as
 SelectionSearchServiceImp and in another it's
 SelectionSearchServiceImpl.
 That would indicate that your class is named one and is referenced in
 your
 Gwt.xml as the other.  Again, that's the first thing I noticed.

 Good luck!

 Later,
 Shaffer

 On Feb 18, 8:15 pm, BobM bmar...@bcscomputers.com wrote:

  More detail from this message which was presented in the GWT shell
  when I made a GWT RPC call attempt:
  java.lang.ClassNotFoundException:
  org.bcs.server.SelectionSearchServiceImp

  The message from caught.getMessage():
  Unable to find/load mapped servlet class
  'org.bcs.server.SelectionSearchServiceImpl

  The rpc.log (which to my surprise gets created upon gwt compile)
  reports this:
  Reachable types computed on: Wed Feb 18 20:29:40 CST 2009
  com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException
     Serialization status
        Instantiable
     Path
        Started from
  'com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException'

  java.lang.Exception
     Serialization status
        Field serializable
     Path
        Started from
  'com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException'

  java.lang.Object
     Serialization status
        Not serializable
     Path
        Started from 'java.lang.String'

  java.lang.RuntimeException
     Serialization status
        Field serializable
     Path
        Started from
  

Re: Resource not found: org.bcs.Main/org.bcs.Main.nocache.js ??

2009-02-18 Thread gregor

You do really need to get familiar with the GWT project structure, and
what the default path expectations are - that will get you up and
running quicker.

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=ConfiguringaGWTProject

All resources specified in your module gwt.xml file are specified
relative to the directory location of the resource file with the
default expectation that GWT UI widgets will be located under /client,
html, CSS, images etc under /public, and RPC servlets and other server
code under /server.

Therefore a typical project, say c:/../com/foo/myapp/MyApp.gwt.xml,
will have CSS file at

c:/../com/foo/myapp/public/MyApp.css

and this will be referred to in the module HTML file as

link rel=stylesheet href=MyApp.css

or alternatively in the module get.xml file as

stylesheet src='MyApp.css'/







On Feb 18, 4:22 am, BobM bmar...@bcscomputers.com wrote:
 Gregor, you get another medal!  I am a little frustrated because I
 don't really understand why that fixed that problem, but I am happy to
 let that go for now.

 However, now my application cannot find the css files which do reside
 in org.bcs.public.  Here are the hosted shell log messages:
 * The development shell servlet received a request for 'org/bcs/public/
 selectionPage.css' in module 'org.bcs.CSRapp.gwt.xml
    *  Resource not found: org/bcs/public/selectionPage.css; (could a
 file be missing from the public path or a servlet tag misconfigured
 in module org.bcs.CSRapp.gwt.xml
 * The development shell servlet received a request for 'org/bcs/public/
 messagePanel.css' in module 'org.bcs.CSRapp.gwt.xml
    * Resource not found: org/bcs/public/messagePanel.css; (could a
 file be missing from the public path or a servlet tag misconfigured
 in module org.bcs.CSRapp.gwt.xml

 I am sure you will sort that out quickly, too, but I am very
 frustrated that I could be experiencing so many simple configuration
 errors.  Why couldn't I have avoided that?

 Many thaks for you very good help.

 On Feb 17, 8:29 pm, gregor greg.power...@googlemail.com wrote:

  On Feb 18, 1:39 am, BobM bmar...@bcscomputers.com wrote:

   Oh, Gregor!  You are so good!

   I did find the text specifying org.bcs.Main in the CSRapp.html.

   Now ... when I fixed that I now get the message:

   * The development shell servlet received a request for 'org.bcs.CSRapp/
   org.bcs.CSRapp.nocache.js' in module 'org.bcs.CSRapp.gwt.xml
          * Resource not found: org.bcs.CSRapp/org.bcs.CSRapp.nocache.js;
   (could a file be missing from the public path or a servlet tag
   misconfigured in module org.bcs.CSRapp.gwt.xml

  org.bcs.CSRapp/org.bcs.CSRapp.nocache.js doesn't look right. Try
  org.bcs.CSRapp.nocache.js in the HTML file instead

   I can see www/org.bcs.CSRapp/org.bcs.CSRapp.nocache.js.  Why can't the
   process find that .js?

   On Feb 17, 4:48 pm, gregor greg.power...@googlemail.com wrote:

 * The development shell servlet received a request for 'org.bcs.Main/
 org.bcs.Main.nocache.js' in module 'org.bcs.CSRapp.gwt.xml'
       * Resource not found: org.bcs.Main/org.bcs.Main.nocache.js

It may be finding org.bcs.Main/org.bcs.Main.nocache.js in CSRapp.html

 I cannot find any reference to anything Main (except, maybe,
 MainEntryPoint.java) in the module file, CSRapp.gwt.xml.  How do I
 chase this down?

 The command used to run the GWTShell is ...
 java  -Xmx256M -cp $APPDIR/src:$APPDIR/web:/usr/local/Java/GWT/gwt-
 linux-1.5.0/gwt-user.jar:/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-dev-
 linux.jar com.google.gwt.dev.GWTShell -out $APPDIR/www $@
 org.bcs.CSRapp/CSRapp.html;

 BTW, tomcat directory gets created as a consequence of running
 GWTShell, but directory www does not.

It should create it when the compilation succeeds

 Thanks for your time and assistance.
--~--~-~--~~~---~--~~
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: doGet in remoteserviceservlet (HELP!)

2009-02-18 Thread gregor

Hi Lothar,

I thought RPC servlets were always called via a POST and you couldn't
change that, whereas if you use a standard HttpServlet you can use a
HttpRequest on the client and specify a GET for it.

Surely overriding stuff in a RemoteServiceServlet is more complicated
than using HttpRequest? Is there some special reason you do this?

gregor

On Feb 18, 9:22 am, Lothar Kimmeringer j...@kimmeringer.de wrote:
 gregor schrieb:

  Sorry, I misunderstood what you where trying to do. You want the user
  to be able top download the CSV file to their own disk, right?

  You can't use GWT RPC to do that,

 He's overwriting doGet of a RemoteServiceServlet and let the browser
 do a GET-request. So it should work, in fact I do that all the time
 and the file-delivery always happens here in the RemoteServiceServlet.

  and I don't think you can return the
  file as a String either.

 You get a Writer from the Response-parameter passed from the container.
 A writer lets you write Strings easily, so it is possible.

  I think you need a standard HttpServlet that
  writes the CSV file as binary data to the servlet response stream.

 RemoteServiceServlets are standard HttpServlets with an already
 implemented doPost-method. But you still can overwrite doGet which
 is sufficient for downloading files delivered by that server.

 Regards, Lothar
--~--~-~--~~~---~--~~
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 STRUTS 2

2009-02-17 Thread gregor

Hi Gilles,

Have you already searched the group for posts about the Struts/GWT
issue? There are a lot of them

regards
gregor

On Feb 17, 9:28 am, Gilles gilles_ta...@yahoo.fr wrote:
 I am investigating the use of Struts 2 and GWT and I would have a
 technical questions for this group. Let's suppose that I have no
 choice and have to use those two technologies together.

 I will have my main application which will be designed 100 % with Gwt.
 This application will open pop-ups windows designed with struts. Now
 it seems fairly easy to communicates datas from GWT to the pop-up
 window. What appears more tricky is in the other direction : how do I
 send vars and request actions in the gwt application from the Struts2
 pop-up window ?

 Thanks and best regards,
 GT
--~--~-~--~~~---~--~~
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: Resource not found: org.bcs.Main/org.bcs.Main.nocache.js ??

2009-02-17 Thread gregor



 * The development shell servlet received a request for 'org.bcs.Main/
 org.bcs.Main.nocache.js' in module 'org.bcs.CSRapp.gwt.xml'
       * Resource not found: org.bcs.Main/org.bcs.Main.nocache.js


It may be finding org.bcs.Main/org.bcs.Main.nocache.js in CSRapp.html

 I cannot find any reference to anything Main (except, maybe,
 MainEntryPoint.java) in the module file, CSRapp.gwt.xml.  How do I
 chase this down?

 The command used to run the GWTShell is ...
 java  -Xmx256M -cp $APPDIR/src:$APPDIR/web:/usr/local/Java/GWT/gwt-
 linux-1.5.0/gwt-user.jar:/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-dev-
 linux.jar com.google.gwt.dev.GWTShell -out $APPDIR/www $@
 org.bcs.CSRapp/CSRapp.html;

 BTW, tomcat directory gets created as a consequence of running
 GWTShell, but directory www does not.


It should create it when the compilation succeeds

 Thanks for your time and assistance.
--~--~-~--~~~---~--~~
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: doGet in remoteserviceservlet (HELP!)

2009-02-17 Thread gregor

Sorry, I misunderstood what you where trying to do. You want the user
to be able top download the CSV file to their own disk, right?

You can't use GWT RPC to do that, and I don't think you can return the
file as a String either. I think you need a standard HttpServlet that
writes the CSV file as binary data to the servlet response stream.
There are examples of file download servlets in the group, and around
the net. You may also need to adjust the response header so the
browser knows it should open the save file dialog when it receives the
response.

On Feb 17, 8:58 pm, ytbryan ytbr...@gmail.com wrote:
 thanks for the reply. but how do i prompt the user through save as
 dialog box from the client side?

 lothar, it is String. sorry i missed that out..  i write it as a csv
 file

 On Feb 17, 2:58 pm, Lothar Kimmeringer j...@kimmeringer.de wrote:

  ytbryanschrieb:

   but i got this error when i call it from my client class.

  [...]

   The website is encountering problems.
   There might be a typing error in the address.

      What you can try:
        Check your Internet connection. Try visiting another website to
   make sure you are connected.

        Retype the address.

        Go back to the previous page.

        More information

   This problem can be caused by a variety of issues, including:

   Internet connectivity has been lost.
   The website is temporarily unavailable.
   The Domain Name Server (DNS) is not reachable.
   The Domain Name Server (DNS) does not have a listing for the website's
   domain.

  more interesting would be the error-message residing in the
  log-file of the webserver.

            PrintWriter out = response.getWriter();
            FileWriter fw = new FileWriter(filename);

  Why do you write into a file? What is filename?

  Regards, Lothar
--~--~-~--~~~---~--~~
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: Resource not found: org.bcs.Main/org.bcs.Main.nocache.js ??

2009-02-17 Thread gregor



On Feb 18, 1:39 am, BobM bmar...@bcscomputers.com wrote:
 Oh, Gregor!  You are so good!

 I did find the text specifying org.bcs.Main in the CSRapp.html.

 Now ... when I fixed that I now get the message:

 * The development shell servlet received a request for 'org.bcs.CSRapp/
 org.bcs.CSRapp.nocache.js' in module 'org.bcs.CSRapp.gwt.xml
        * Resource not found: org.bcs.CSRapp/org.bcs.CSRapp.nocache.js;
 (could a file be missing from the public path or a servlet tag
 misconfigured in module org.bcs.CSRapp.gwt.xml

org.bcs.CSRapp/org.bcs.CSRapp.nocache.js doesn't look right. Try
org.bcs.CSRapp.nocache.js in the HTML file instead


 I can see www/org.bcs.CSRapp/org.bcs.CSRapp.nocache.js.  Why can't the
 process find that .js?





 On Feb 17, 4:48 pm, gregor greg.power...@googlemail.com wrote:

   * The development shell servlet received a request for 'org.bcs.Main/
   org.bcs.Main.nocache.js' in module 'org.bcs.CSRapp.gwt.xml'
         * Resource not found: org.bcs.Main/org.bcs.Main.nocache.js

  It may be finding org.bcs.Main/org.bcs.Main.nocache.js in CSRapp.html

   I cannot find any reference to anything Main (except, maybe,
   MainEntryPoint.java) in the module file, CSRapp.gwt.xml.  How do I
   chase this down?

   The command used to run the GWTShell is ...
   java  -Xmx256M -cp $APPDIR/src:$APPDIR/web:/usr/local/Java/GWT/gwt-
   linux-1.5.0/gwt-user.jar:/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-dev-
   linux.jar com.google.gwt.dev.GWTShell -out $APPDIR/www $@
   org.bcs.CSRapp/CSRapp.html;

   BTW, tomcat directory gets created as a consequence of running
   GWTShell, but directory www does not.

  It should create it when the compilation succeeds

   Thanks for your time and assistance.
--~--~-~--~~~---~--~~
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 SVN Build Failed com.google.gwt .ant.taskdefs.SvnInfo cannot be found

2009-02-16 Thread gregor

Might be this:

http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/1116e49af25aab8b/17cbba95ae5e58e0?lnk=gstq=gregor+command+line+client#17cbba95ae5e58e0



On Feb 16, 4:07 pm, Allahbaksh a.allahba...@gmail.com wrote:
 Hi,
 I am trying to build GWT from the SVN. I am getting following error

 BUILD FAILED
 D:\tools\gwt\google-web-toolkit\platforms.ant.xml:36: The following
 error occurr
 ed while executing this line:
 D:\tools\gwt\google-web-toolkit\platforms.ant.xml:13: The following
 error occurr
 ed while executing this line:
 D:\tools\gwt\google-web-toolkit\dev\core\build.xml:97: The following
 error occur
 red while executing this line:
 D:\tools\gwt\google-web-toolkit\common.ant.xml:207: taskdef class
 com.google.gwt
 .ant.taskdefs.SvnInfo cannot be found

 Total time: 4 seconds

 Can some one from the community point out where I am going wrong.

 Regards,
 Allahbaksh
--~--~-~--~~~---~--~~
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: Code refactoring to minimize listeners decoupling actions from view class

2009-02-15 Thread gregor

I take it you mean:

http://martinfowler.com/eaaDev/SupervisingPresenter.html

I confess to having done nothing like as much as I probably should
have with regard to testing GWT UI components. But I'm working on a
bigger app now, so I have been thinking about it. A couple of points
occurred to me:

A GWT component is not a Java class, it is a javascript program
manipulating the browser DOM. Much UI logic involves CSS, for example
switching styles, etc so it would be hard to create a Test Double in
the manner Fowler describes. In fact the GWT dev shell already *is* a
test double in many ways. For this reason I am not sure that
Supervising Controller affords the same advantages for testing in GWT
as it might in Swing for example.

So I am looking at a model something like this: Put components (or
batches of closely related components) into separate modules (there is
no overhead in either dev or production for this AFAIK). Make a test
Entrypoint class in a separate module (e.g.MyComponent_test.gwt.xml)
for each of these component modules so they can be individually test
driven. Use the GWTTestCase Junit extension to drive the component
tests via this Entrypoint. Use of Observer pattern is important to
enable this, i.e. it is important that no component has any upwards
dependencies or this becomes more difficult, e.g. you start to need
mock versions of things.

On the listeners issue:

a) yes, this is why using a single listener as per I described above
is efficient.

b) There is definitely an overhead associated with listeners, so at a
certain level of application complexity you need to worry about it.
See Google's own doc:

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=FAQ_UIUseOneListener

c) In relation to another discussion about listeners I did a quick
test to see how GWT generates javascript for them. You may find it
interesting, it's towards the bottom of this thread:

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/1fa4af5d2728c5ab/d693b9ac6256fde1?lnk=gstq=gregor+clicklistener#d693b9ac6256fde1

d) I think the issue is mainly the total number of listeners of a each
type (i.e. the compiled javascript has a list of ClickListeners,
another list of ChangeListeners etc which need to be checked in
response browser events). I think if you have, say, 10 or 20 click
listeners, that's no real problem, but if you have 100 then there may
be an issue with this and you may need to look at ways to get the
count down. Sharing a listener between multiple widgets within a
Composite is a simple way to do that which does not break
encapsulation.







On Feb 15, 4:55 pm, dodo rajd...@gmail.com wrote:
 Well the purpose of separating out the action related methods from the
 view is code reusability and testability without actually using the
 GWT container. Thus we thought that it would be a good idea if we
 follow supervising controller pattern. And we would also like to
 minimize the number of listeners in our app to enhance performance.

 On Feb 14, 5:15 pm, gregor greg.power...@googlemail.com wrote:

  Hi dodo,

   Currently in my app all the services and action related methods are
   there inside the view class itself. How can Irefactormy code to
   decouple action related methods in a different controller/supervisor
   class?

  Why would you want to do that? GWT follows (roughly) Swing/SWT
  programing model which is sometimes known as Model Delegate, a
  derivative of Model View Controller in which the Controllers and Views
  are merged:

 http://c2.com/cgi/wiki?ModelDelegate

  Therefore the current situation as you describe is typical. There are
  specific situations where it is a good idea to abstract action related
  code to separate controllers, and various ways to do it, but It is use
  case dependent.

   Another aspect of my problem is that, I have created composite
   widgets of my own, thus when a event is generated by an inner widget I
   should get the reference of sender and since I need to perform action
   on some other inner widget thus I need reference of that also. How can
   I achieve this without actually taking a direct reference of each
   inner widget of my composite?

  Again, this is a standard pattern with a Composite and makes for
  simpler more readable code. If (and only if) the widgets contained in
  the composite are invisible to the outside world (private , no public
  getters) then it is simplest and cleanest to have them call each other
  directly as necessary. For example if you have a row of tool buttons
  then a single ClickListener can handle their clicks and the main
  Composite can control behaviour most simply e.g. :

  public void onClick(Widget sender) {
     if (sender==button1) {doX();}
     if (sender==button2 {doY();}
     // where doX() and doY() are private methods of the composite

  }

  Where an event fired from such private widgets does need to be
  propagated to the outside world

Re: How to debug/resolve RPC call problem?

2009-02-15 Thread gregor

It looks like NB might be setting things up to run GWT hosted mode
with -noserver option deploying to glassfish. In that case you have to
make sure everything is set up properly for deployment to glassfish
(i.e. as external server), including web.xml etc. Normally one would
not recommend running -noserver option unless you had to, for example
if you are using EJB's or a non-java back end. It may be NB does this
because it is easier to debug hosted mode server code using glassfish
+ -noserver.

Probably simplest thing is to consult NB forums for clues on how to
stop NB doing this, i.e. get it to run hosted mode normally using
embedded Tomcat server. There should be a script somewhere you can
edit, or a way to install your own. The script you are looking for
should have com.google.gwt.dev.GWTShell in it after a long classpath
statement and one of the switches following should be -noserver as
well as -style and -out etc if this theory is correct.

What IDE's do is simply write versions of standard GWT start up
scripts for you inserting their own choice of parameters, hiding the
details. They are trying to be helpful, but often it just causes
problems.The trick is to find out how to edit these scripts and take
control of them.

Same is true of deploying your app in web mode to production/test
server IMO. It is much easier in the long run if you write your own
ant script to build a WAR rather than let your IDE do it for you. This
is especially true in team situation where different IDE settings can
cause all sorts of problems otherwise.





On Feb 15, 12:51 am, BobM bmar...@bcscomputers.com wrote:
 When I run in web mode, NB starts Firefox.  Both hosted mode and web
 mode run against localhost:8080/GWTwHibernate, so I think both are
 running using the application deployed to glassfish.
 .

 On Feb 14, 6:22 pm, BobM bmar...@bcscomputers.com wrote:

  Yes.  It certainly seems to be a glasfish message, but it is hosted
  mode.  I am using netbeans 6.5 and glassfish v3 prelude.  When I click
  Debug main project in NB, it deploys to glassfish but brings up the
  hosted mode shel and runs the app in a sub shell.

  On Feb 14, 5:28 pm, gregor greg.power...@googlemail.com wrote:

   That looks like a glassfish message? Are we talking about hosted mode
   here or web mode?

   On Feb 14, 8:07 pm, BobM bmar...@bcscomputers.com wrote:

This is how the service is called:

    selectionSearchService.findAllLikeThis(serviceProvider,
selectionSearchCallBack);

How the service is setup in the module xml file:

  servlet path=/selectionSearchService
           class=org.bcs.server.SelectionSearchServiceImpl /

this is the report from caught.getMessage():
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;htmlheadtitleGlassFish/v3
- Error report/titlestyle type=text/css!--H1 {font-
family:Tahoma,Arial,sans-serif;color:white;background-
color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-
serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-
family:Tahoma,Arial,sans-serif;color:white;background-
color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-
serif;color:black;background-color:white;} B {font-
family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P {font-family:Tahoma,Arial,sans-
serif;background:white;color:black;font-size:12px;}A {color : black;}
HR {color : #525D76;}--/style /headbodyh1HTTP Status 404 - /
h1hr/pbtype/b Status report/ppbmessage/b/
ppbdescription/bThe requested resource () is not available./
phr/h3GlassFish/v3/h3/body/html

There are no log entries showing on the hosted mode shell window; it
is clear.
--~--~-~--~~~---~--~~
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: Code refactoring to minimize listeners decoupling actions from view class

2009-02-14 Thread gregor

Hi dodo,

 Currently in my app all the services and action related methods are
 there inside the view class itself. How can I refactor my code to
 decouple action related methods in a different controller/supervisor
 class?

Why would you want to do that? GWT follows (roughly) Swing/SWT
programing model which is sometimes known as Model Delegate, a
derivative of Model View Controller in which the Controllers and Views
are merged:

http://c2.com/cgi/wiki?ModelDelegate

Therefore the current situation as you describe is typical. There are
specific situations where it is a good idea to abstract action related
code to separate controllers, and various ways to do it, but It is use
case dependent.

 Another aspect of my problem is that, I have created composite
 widgets of my own, thus when a event is generated by an inner widget I
 should get the reference of sender and since I need to perform action
 on some other inner widget thus I need reference of that also. How can
 I achieve this without actually taking a direct reference of each
 inner widget of my composite?

Again, this is a standard pattern with a Composite and makes for
simpler more readable code. If (and only if) the widgets contained in
the composite are invisible to the outside world (private , no public
getters) then it is simplest and cleanest to have them call each other
directly as necessary. For example if you have a row of tool buttons
then a single ClickListener can handle their clicks and the main
Composite can control behaviour most simply e.g. :

public void onClick(Widget sender) {
   if (sender==button1) {doX();}
   if (sender==button2 {doY();}
   // where doX() and doY() are private methods of the composite
}

Where an event fired from such private widgets does need to be
propagated to the outside world, it is common to to delegate the task
to the Composite itself, for example:

public void onClick(Widget sender) {
   if (sender==button1)  {
   this.listeners.fireChange(this); // i.e. not the button
}

So the Composite provides a single view to the outside world, and the
internals can talk to each other freely in the knowledge no outside
class has any knowledge of them (i.e. they are fully encapsulated, and
outside client classes register listeners with the Composite itself
only.). There are specific classes in GWT to assist with this idea,
for example DelegatingClickListenerCollection etc. I think this may be
the origin of the Model Delegate pattern name. Basically it makes
coding many common UI situations simpler and more readable than full
MVC decomposition with no nasty side effects in most cases.

Some situations benefit from full MVC decomposition. One example is a
bulk data grid renderer, especially where the user can sort by column
etc. Having a controller that manages and coordinates the paging/
sorting with the server data source separately from the view is
probably worth it. Another is where you have several views in the UI
that show different aspects of the same data model. For example a work
flow process might have several views, and a step might be ticked off
in any of them, but that might require an update of all the other
views as well. That implies a single shared model which in turn argues
for a single controller with which the views interact and listen to.

regards
gregor


--~--~-~--~~~---~--~~
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 to debug/resolve RPC call problem?

2009-02-14 Thread gregor

Hi Bob,

Most likelly either you have not specified SelectionSearchServiceImpl
in your module xml file correctly (so the URL doesn't match and it
can't find it), or there is something wrong with your own code that's
throwing an exception.

if 1) In the main dev shell window, you should see some exception
entries and one of them should say it can't find
SelectionSearchServiceImpl - what does it say?

if 2) you should be getting to here

  public void onFailure(Throwable caught) {
  setMessage(Selection search failed. );
  }

what is caught.getMessage()?

gregor



On Feb 14, 12:48 pm, BobM bmar...@bcscomputers.com wrote:
 Okay.  Here is my code:

 From the client side:

 The proxy inerface:

 // SelectionSearchService
 package org.bcs.client.gui;
 import com.google.gwt.user.client.rpc.RemoteService;
 public interface SelectionSearchService extends RemoteService {
     public String[][] findAllLikeThis(String[] serviceProviderRecord);

 }

 The Async interface:

 // SelectionSearchServiceAsync
 package org.bcs.client.gui;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 public interface SelectionSearchServiceAsync {
     public void findAllLikeThis(String[] serviceProviderRecord,
 AsyncCallback callBack);

 }

 From the server side:

 The Async interface implementation:

 package org.bcs.server;
 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
 import org.bcs.client.gui.SelectionSearchService;

 public class SelectionSearchServiceImpl extends RemoteServiceServlet
 implements SelectionSearchService {
   public String[][] findAllLikeThis ( String[] serviceProviderRecord )
 {
     String[] resultsList = new String[3][];
     String[] strAry1 = {Mary , had , a , little , lamb.};
     resultsList[0] = strAry1;
     String[] strAry2 = {Its , fleece , was , white , as ,
 snow.};
     resultsList[1] = strAry2;
     String[] strAry3 = {It , followed , her , everywhere.};
     resultsList[2] = strAry3;
     return resultsList;
   }

 } //End SelectionSearchServiceImpl

 And again from the client side:

 The creation of the proxy:

     selectionSearchService = (SelectionSearchServiceAsync) GWT.create
 (SelectionSearchService.class);
     ((ServiceDefTarget) selectionSearchService).setServiceEntryPoint
 (GWT.getModuleBaseURL() +
       /selectionSearchService);

 And the implementation of the callback (as an anonymous inner class):

     selectionSearchCallBack = new AsyncCallback() {
       public void onSuccess(Object result) {
         selectionSearchMatches = (String[][]) result;
         setMessage(Search succeeded.);
       }
       public void onFailure(Throwable caught) {
           setMessage(Selection search failed. );
       }
     };

 I think that is all of the pieces.  I look forward to your counsel.
 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: How to debug/resolve RPC call problem?

2009-02-14 Thread gregor

Bob,

It's not clear from your post where the problem is. Chances are either
you have set up the RPC servlet wrong in your module xml file (i.e. it
doesn't match ((ServiceDefTarget)
selectionSearchService).setServiceEntryPoint
(GWT.getModuleBaseURL() +
  /selectionSearchService);

so the servlet cannot be found, or there is something wrong with your
code causing an exception somewhere.

If you are running hosted mode you should see any exceptions in the
dev shell window - it should tell you if it can't find
SelectionSearchServiceImpl and how it's trying to find it. That's what
we need.

Does your program get to

  public void onFailure(Throwable caught) {
  setMessage(Selection search failed. );
  }

in which case what is caught.getMessage()?

gregor



On Feb 14, 12:48 pm, BobM bmar...@bcscomputers.com wrote:
 Okay.  Here is my code:

 From the client side:

 The proxy inerface:

 // SelectionSearchService
 package org.bcs.client.gui;
 import com.google.gwt.user.client.rpc.RemoteService;
 public interface SelectionSearchService extends RemoteService {
     public String[][] findAllLikeThis(String[] serviceProviderRecord);

 }

 The Async interface:

 // SelectionSearchServiceAsync
 package org.bcs.client.gui;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 public interface SelectionSearchServiceAsync {
     public void findAllLikeThis(String[] serviceProviderRecord,
 AsyncCallback callBack);

 }

 From the server side:

 The Async interface implementation:

 package org.bcs.server;
 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
 import org.bcs.client.gui.SelectionSearchService;

 public class SelectionSearchServiceImpl extends RemoteServiceServlet
 implements SelectionSearchService {
   public String[][] findAllLikeThis ( String[] serviceProviderRecord )
 {
     String[] resultsList = new String[3][];
     String[] strAry1 = {Mary , had , a , little , lamb.};
     resultsList[0] = strAry1;
     String[] strAry2 = {Its , fleece , was , white , as ,
 snow.};
     resultsList[1] = strAry2;
     String[] strAry3 = {It , followed , her , everywhere.};
     resultsList[2] = strAry3;
     return resultsList;
   }

 } //End SelectionSearchServiceImpl

 And again from the client side:

 The creation of the proxy:

     selectionSearchService = (SelectionSearchServiceAsync) GWT.create
 (SelectionSearchService.class);
     ((ServiceDefTarget) selectionSearchService).setServiceEntryPoint
 (GWT.getModuleBaseURL() +
       /selectionSearchService);

 And the implementation of the callback (as an anonymous inner class):

     selectionSearchCallBack = new AsyncCallback() {
       public void onSuccess(Object result) {
         selectionSearchMatches = (String[][]) result;
         setMessage(Search succeeded.);
       }
       public void onFailure(Throwable caught) {
           setMessage(Selection search failed. );
       }
     };

 I think that is all of the pieces.  I look forward to your counsel.
 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: Servlets / war file help

2009-02-14 Thread gregor

Hi Dan,

Yes, to get it to work in web mode (i.e. deployed) you need to a) make
sure your web.xml file has the correct RPC servlet mappings, and b)
you need to deploy all the static HTML/js/CSS etc and the java classes/
libs in the right structure.

The simplest way (IMO) to deploy is to use an Ant script to build a
WAR file. A WAR file is basically a zip file that contains all the
resources necessary to run a web application including a GWT one, and
all you have to do is toss it into Tomcat's webapps directory and off
you go. Ant has a convenient WAR task that will build one for you with
the right structure providing you give it a few relatively simple
instructions.

Personally I always write my own rather than let my IDE do it for me
because that way that way you get a bomb proof build/deploy that is
immune from local IDE settings/different IDE's etc and you can teak it
how you want. I would search the group for posts about web.xml and
ant build.xml etc to get up to speed on these questions (they have
been asked once or twice before, plenty of examples) and see how you
get on.

Yes, you need a java servlet container for your your RPC servlets to
run JDBC code. It doesn't have to be Tomcat, any Java EE application
server or servlet container will do. If you don't have such a thing,
you could use HttpRequets instead of GWT RPC using JSON as your wire
data transfer protocol. If you had a php or python server for example,
this is a popular approach I believe.

gregor



On Feb 14, 2:25 pm, Dan daniel.burn...@gmail.com wrote:
 Hi Guys

 I'm relatively new to web development, I have a lot of experience with
 C++, C, Java a bit of php and Symbian C++.

 Would anyone mind If I asked a couple of generic servlet / war file
 questions?

 I have started to created a site using the google web toolkit (GWT).
 So far my server side my code inserts and selects from a mysql
 database using JDBC.

 Having built everything where the appropriate javascript is created
 and all runs fine and accesses my DB using the tomcat server that
 comes with the GWT I want to make sure I am going to be able to deploy
 the site somewhere.

 http://www.pimtext.co.uk/gwtTestshows everything I have placed on the
 server.
 If I go 
 tohttp://www.pimtext.co.uk/gwtTest/build/gwtOutput/pimtext.Start/Start
 it is not possible to add a new user because something is wrong with
 the set-up - the client side does not appear to be able to talk to the
 server side.

 I hope it would not be to ambiguous to ask where you think I might be
 going wrong? My eclipse plugin (cypal) for the GWT also has the
 ability to build a WAR file for me. What is a war file and is it
 appropriate to me.

 The site is for a university project. I am hosting at eukhost and not
 on my university servers as they do not have tomcat servers for
 student use - are tomcat servers the only real way to carry on using
 JDBC?

 Everything works fine from my computer when using the tomcat server
 that comes with the GWT.

 Many Thanks for any help you can provide.

 Dan
--~--~-~--~~~---~--~~
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 to debug/resolve RPC call problem?

2009-02-14 Thread gregor

That looks like a glassfish message? Are we talking about hosted mode
here or web mode?


On Feb 14, 8:07 pm, BobM bmar...@bcscomputers.com wrote:
 This is how the service is called:

     selectionSearchService.findAllLikeThis(serviceProvider,
 selectionSearchCallBack);

 How the service is setup in the module xml file:

   servlet path=/selectionSearchService
            class=org.bcs.server.SelectionSearchServiceImpl /

 this is the report from caught.getMessage():
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;htmlheadtitleGlassFish/v3
 - Error report/titlestyle type=text/css!--H1 {font-
 family:Tahoma,Arial,sans-serif;color:white;background-
 color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-
 serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-
 family:Tahoma,Arial,sans-serif;color:white;background-
 color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-
 serif;color:black;background-color:white;} B {font-
 family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
 P {font-family:Tahoma,Arial,sans-
 serif;background:white;color:black;font-size:12px;}A {color : black;}
 HR {color : #525D76;}--/style /headbodyh1HTTP Status 404 - /
 h1hr/pbtype/b Status report/ppbmessage/b/
 ppbdescription/bThe requested resource () is not available./
 phr/h3GlassFish/v3/h3/body/html

 There are no log entries showing on the hosted mode shell window; it
 is clear.
--~--~-~--~~~---~--~~
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: Buttons in horizontal panel not aligning to the left

2009-02-10 Thread gregor

yes, I had other reasons to have extra HP panel - Alex is right and
it's simpler.

On Feb 10, 7:44 am, alex.d alex.dukhov...@googlemail.com wrote:
 Actually just a filler-widget(a HP with 100% width) on the right side
 is enough. Another way is to put your buttons in a second HP with no
 width defined and set it's cell-horizontal-align to left.

 On 10 Feb., 05:02, gregor greg.power...@googlemail.com wrote:

  You could try putting the buttons in a second HP nested inside your
  existing one and assign it to cell 1. Don't size it (or maybe you will
  have to give it a cell width of 1%) but set spacing as desired. Then i
  think you may need to put a filler widget of some kind (e.g.
  SimplePanel/HTML) in cell 2 and give this a cell width of 100%. This
  should squash the buttons to the left and make them immune to resizing
  of the outer HP as the filler widget only will expand. If you want a
  margin to the left to slightly indent the button row, same trick: add
  an additional filler widget and give it a hard pixel value cell width.

  On Feb 10, 12:58 am, zackmac zack.macom...@gmail.com wrote:

   I've set up a horizontal panel with width set to 100% in css.  I've
   added a couple of buttons in the panel.  Is there anyway to force them
   to line up to the left despite the fact that the panel is 100%?  Right
   now the buttons change position when the window is resized and they
   have a starting position with a gap in between them...
--~--~-~--~~~---~--~~
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: Buttons in horizontal panel not aligning to the left

2009-02-09 Thread gregor

You could try putting the buttons in a second HP nested inside your
existing one and assign it to cell 1. Don't size it (or maybe you will
have to give it a cell width of 1%) but set spacing as desired. Then i
think you may need to put a filler widget of some kind (e.g.
SimplePanel/HTML) in cell 2 and give this a cell width of 100%. This
should squash the buttons to the left and make them immune to resizing
of the outer HP as the filler widget only will expand. If you want a
margin to the left to slightly indent the button row, same trick: add
an additional filler widget and give it a hard pixel value cell width.

On Feb 10, 12:58 am, zackmac zack.macom...@gmail.com wrote:
 I've set up a horizontal panel with width set to 100% in css.  I've
 added a couple of buttons in the panel.  Is there anyway to force them
 to line up to the left despite the fact that the panel is 100%?  Right
 now the buttons change position when the window is resized and they
 have a starting position with a gap in between them...
--~--~-~--~~~---~--~~
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: help for normal servlet

2009-02-09 Thread gregor

Use RequestBuilder, see docs. There are examples of how to do the
servlet in the group if you are in doubt, e.g.

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/9b59ee258f01d5bb/86ae704a16f5a077?lnk=gstq=file+download+servlet#86ae704a16f5a077



On Feb 10, 3:47 am, pettysoldier pettysold...@gmail.com wrote:
 Hi , I want to use a normal servlet to show image that generated by
 JFreeChart in a gwt project,How could I do in this situation?
 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: ScrollPanel maxWidth or maxHeight?

2009-02-06 Thread gregor



 Is there a real browser-event or should i
 just call a check procedure whenever i add elements?


The latter, no browser event available AFAIK.


  I have looked in vain for a general method to get ScrollPanels to
  resize and generally behave by themselves. I think the reason is that
  individual divs/table cells etc do not generate events when their size
  changes. ScrollPanel is basically a div with an overflow setting. I
  have supposed this is because there can be hundreds if not thousands
  of boxes on a page, so if they all emitted an event every time they
  changed their width/heights the browser's event queue would be brought
  to its knees.

  On Feb 5, 4:13 pm, Litty Preeth preeth.h...@gmail.com wrote:

   there is some max-height CSS property. But dont know if it works.

   On Thu, Feb 5, 2009 at 8:59 PM, alex.d 
   alex.dukhov...@googlemail.comwrote:

On 5 Feb., 16:10, gregor greg.power...@googlemail.com wrote:
 Hi Alex,

 I think you have to explicitly specify the height of a ScollPanel in
 pixels to get the scroll bars to kick in, and that will set the height
 of the panel from the word go. If what you mean is that you want a
 panel to start at a minimum size, then grow as things are added to it,
 but then to stop growing and go into scroll mode at a certain point,

exactly what i meant.

 I do not think that is realistically possible since there is no event
 you can listen for that would tell you when the panel had grown to a
 given height. You can listen for the browser window changing, but not
 for an individual panel.

 I suppose one approach might be to set up a timer to check the current
 height at intervals and take appropriate action when it hit the limit,
 but this sounds very inefficient.

Indeed it does. I kind of hoped somebody will have a genious idea
about it ;-) Thank you for your input anyway.

 regards
 gregor

 On Feb 5, 9:29 am, alex.d alex.dukhov...@googlemail.com wrote:

  Hi folks,
  I'm trying to impelement a scrollpanel that becomes bigger (height) 
  to
  the certain size (maxHeight) when populating it with data.  After 
  that
  vertical scrollbar should appear and the panel should stop growing.
  Any ideas on how to implement this would be appreciated.
--~--~-~--~~~---~--~~
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: Best image preloading practice?

2009-02-06 Thread gregor

@Litty: yes, I think you are right, my ignorance. Image.prefetch()
will causes the image to be loaded into browser cache. You then use
the same URL to instantiate an Image object later in code, and
hopefully the image binary will be already downloaded. This old
Mozzilla doc describes the process:

http://devedge-temp.mozilla.org/viewsource/2003/link-prefetching/index_en.html

The doc suggests the behavior darkflame described in OP, namely,
browser is busy downloading all the prefetches it finds in the page.

@darkflame:


 b) If I do have to load, say, upto 10 images that have to be seperate,
 is it better to just loop over a list of them prefetching and leave it
 upto the browseror should I put a timer and trigger a load every,
 say, 5 seconds ?
 (or dosnt it make much difference).


My reading of the Mozzilla doc is that the browser will notice all the
prefetch tags when it loads the page, and it will then get busy
downloading them. So I have doubts whether where you put the
Image.prefetch(url) in execution logic makes any difference, i.e. you
do not have fine tune programmatic control over prefetch so you can't
code to prefetch first 10, then later trigger prefetching next 10. For
example the Mozzilla doc states The link tag has to be inside the
head tag to make prefetching work etc.







 On Feb 6, 9:14 am, Litty Preeth preeth.h...@gmail.com wrote:

You are thinking of loading 20MB of images into the DHTML DOM of you
application

Am I? Does the DOM keep them there even when not displayed?
These images certainly wouldnt be displayed all at once. 1 or 2 at a
time at most.

   I'm not absolutely sure, but I think if you load an image it is
   basically attached to a document, whether the browser caches it or
   not, and whether it is currently visible of not. You don't control the
   browser cache, I mean I don't think you can tell it to conveniently
   download all your images and store them neatly on disk until you need
   to display them for example.

  ah, pig.
  I thought that was exactly that prefetch was doing -sigh-
  I thought it loaded it to ram first, then the browser keeps a copy in
  its cache for reloading if needed.
  -sigh-
  That does change things indeed then.

  AFAIK the prefetch creates an IMG element but its not attached to the DOM.

  - Litty

  On Fri, Feb 6, 2009 at 1:03 PM, darkflame darkfl...@gmail.com wrote:

 You are thinking of loading 20MB of images into the DHTML DOM of you
 application

 Am I? Does the DOM keep them there even when not displayed?
 These images certainly wouldnt be displayed all at once. 1 or 2 at a
 time at most.

I'm not absolutely sure, but I think if you load an image it is
basically attached to a document, whether the browser caches it or
not, and whether it is currently visible of not. You don't control the
browser cache, I mean I don't think you can tell it to conveniently
download all your images and store them neatly on disk until you need
to display them for example.

   ah, pig.
   I thought that was exactly that prefetch was doing -sigh-
   I thought it loaded it to ram first, then the browser keeps a copy in
   its cache for reloading if needed.
   -sigh-
   That does change things indeed then.

 Again, not at once.
 Surely a staggered download they wouldnt have a problem with?
 Emulating, say, what it would expect from a user browseing DeviantArt?

yeah, the staggered download is basically the idea of the maze - each
time you move to next location you've only got one locations worth of
images to fetch. Or if it worked fast enough you could fetch all the
required images for the adjoining locations so they would be ready to
go instantly. It depends entirely on no of image bytes per location.

   Yes, I looks like I'll be switching to a as-you-go-along-it-loads-the-
   next-rooms approach.
   Allthough...

Point is doing it this way old images are thrown away and can be
garbage collected as you go, so you are not accumulating images in
memory. It's stable. (assuming I'm right about the how this works of
course).

   ...I'm not sure there will be much that can be chucked away in this
   game.
   My engine is able to remove items easily enough, but for this game
   items from the start of the game are still usefull at the end, so
   theres only a few case's when images can be removed never to be
   recalled.

 . The point of
 the composite image strip is to fetch several images in one request
 since they come in a single binary file. 

 Yes, I understand the point of them, and I think image bundles are a
 great idea.
 (In fact, online in general, theres probably a lot of wasted bandwidth
 used on little UI elements on webpages..like 5kb gifs etc)
 In this specific case though they arnt approperate.
 Not unless I got the server to dynamically splice the images together
 and the client to 

Re: multiple rpc calls to server (can someone advise me!)

2009-02-06 Thread gregor

Your problem looks like it's here:

private void updateGrid1(GridPanel gridPanel, int cols, int rows) {
 if (store != null) {
 store.removeAll();
 }
 getData1(1);   PROBLEM

 Object[][] data = null;

 if(displayData1!= null) { PRBLEM: displayData not
yet updated
 data = getCompanyData(displayData1, 1);
 }
 else {
 System.out.println(exception at update1(););
 return;
 }

caused by:

   // success
   public void onSuccess(Object result) {
// Cast the result into the object that was sent
// This casts the random object into DataContainer
// Since the object is an array we use []
displayData1 = (DataContainer[]) result;   CAUSE:
you set variable, you do not call grid update method

   }
  };


what you need to do is rearrange your logic to call updateGrid1(..)
from the async callback onSuccess(..) method. What is happening at the
moment is that the grid update code is running at the same time the
RPC call is executing over the wire, so ther is no new data in
displayData1.

regards
gregor


On Feb 6, 12:33 pm, ytbryan ytbr...@gmail.com wrote:
 can someone help?

 below are my rpc request code.

 private void getData() {

   AsyncCallbackObject callback = new AsyncCallbackObject() {
    // fail
    public void onFailure(Throwable ex) {
     RootPanel.get().add(new HTML(ex.toString()));
    }
    // success
    public void onSuccess(Object result) {
     // Cast the result into the object that was sent
     // This casts the random object into DataContainer
     // Since the object is an array we use []
     DataContainer[] displayData = (DataContainer[]) result;
    }
   };

   callProvider.getData(callback);
  }
  private void getData1() {
            final int value1 = value;

           AsyncCallbackObject callback1 = new AsyncCallbackObject()
 {
            // fail

            public void onFailure(Throwable ex) {
             RootPanel.get().add(new HTML(ex.toString()));

            }
            // success
            public void onSuccess(Object result) {
             // Cast the result into the object that was sent
             // This casts the random object into DataContainer
             // Since the object is an array we use []
             displayData1 = (DataContainer[]) result;

            }
           };

           // remote procedure call to the server to get the data
           callProvider1.getData1(callback1);

          }

 below is updategrid1 code which calls the getData1() code

 private void updateGrid1(GridPanel gridPanel, int cols, int rows) {
      if (store != null) {
          store.removeAll();
      }
      getData1(1);

      Object[][] data = null;

      if(displayData1!= null) {
          data = getCompanyData(displayData1, 1);
      }
      else {
          System.out.println(exception at update1(););
          return;
      }

      RecordDef recordDef = new RecordDef(
              new FieldDef[]{

                    new StringFieldDef(date),
                    new IntegerFieldDef(opensource),
                    new IntegerFieldDef(trial),
                    new IntegerFieldDef(sales),
                    new StringFieldDef(ostrial),
                    new StringFieldDef(trialsale) ,
                    new StringFieldDef(ossale)
              }
      );
      ColumnConfig[] columns = new ColumnConfig[]{
              //column ID is company which is later used in
 setAutoExpandColumn
              new ColumnConfig(Date, date, 160, true, null,
 company),
              new ColumnConfig(Open Source, opensource, 35,true),
              new ColumnConfig(Trial, trial, 45,true),
              new ColumnConfig(Sales, sales, 65,true),
              new ColumnConfig(OS-Trial, ostrial, 65),
              new ColumnConfig(Trial-Sale, trialsale, 60, true),
              new ColumnConfig(OS-Sale, ossale, 60, true)
      };

      ColumnModel columnModel = new ColumnModel(columns);

      MemoryProxy proxy = new MemoryProxy(data);
      ArrayReader reader = new ArrayReader(recordDef);
      store = new Store(proxy, reader);
      store.load();

      gridPanel.reconfigure(store, columnModel);

  }

 below is my button code which get trigger when pressed. and it has
 listener that will call updategrid1()!!! please ignore those
 unnecessary parameter that are unused.

  ToolbarButton generateButton1 = new ToolbarButton(test, new
 ButtonListenerAdapter() {
                       public void onClick(Button button, EventObject e) {
                           updateGrid1(gridPanel, cols.getValue().intValue(),
 rows.getValue().intValue());
                       }
                   });
                   generateButton1.setIconCls(database-add-icon);
                   bottom.addButton(generateButton1);

 }

 can someone help!

 On Feb 6, 12:14 pm, ytbryan ytbr...@gmail.com wrote:

  I just insert Window.alert() into getdata1

Re: Calling of business method from Client

2009-02-06 Thread gregor

Hi Arul,

Check out:

http://code.google.com/p/google-web-toolkit-incubator/wiki/TreeTable

Personally I find tree tables sometimes look confusing, especially if
there are significant differences in the structure and/or size of the
nodes, but a lot of people like them. They are also complicated
widgets. I would consider as an alternative breaking up the structure
into three widgets, for example:

1. A list of Accounts (Acc No) to pick from left side (a
HorizontalPanel basically).
2. A standard Tree widget representing Account Name nodes at top level
with the rules and tests nested underneath located top right
3. A leaf data panel to show details of a particular test or rule
selected from the Tree, located bottom right.

You could use HorizontalSplitPanel and VerticalSplitPanel to divide up
the display giving much more flexibility to the user's view of the
data, and I think you may find it looks a lot better and is easier to
use. There are other alternatives involving DisclosurePanels etc. This
approach may not only be easier for the user, but you may find it a
lot easier to code as well.

regards
gregor



On Feb 6, 3:48 pm, Arul arulmanikandan.sriniva...@gmail.com wrote:
 Hi Gregor,
     I some how managed GWT component as replacement of my presentation
 layer.
 currenlty my application will be displaying like tree structure as
 menu in the left hand and selecting each link its content is diplayed
 in right side in grid with rows and columns. This kind of requirement
 suits most of the places.

    In partcular link, the grid in right hand side would be dipslayed
 like.
      a)Acct no       Accont Name
          1000            ABC ( 2 tests)
                               Test1 (2 rule)
                             Rule1
                              Test2( 2 rules)
                             Rule1
                             Rule2

         2000            XYZ ( 1 tests)
                               Test1 (5 rules)

 Here first only acct no and name woold be displayed , test belongs to
 an account would be expaned if user uses kind of arrow on acct name.
 then rules belongs to each test expaned on request basis as selecting
 the arrow.

 Would you please assist me how I can achive this behavior in Grid? or
 send me some usefule links if you have.?

 Thanks a Lot
 Arul

 On Jan 2, 7:35 pm, gregor greg.power...@googlemail.com wrote:

   Here in the existing application it is easy for getting session values
   (JSP) and assigned as part of query string.

   Would you please tell me how the same can be acheived in GWT client
   code(JAVA)?
   How I can get those session values so that I can assign in Window.open
   method?.

  Well your existing JSPs are running server side as servlets whereas
  your GWT code is running as javascript client side, so whereas your
  JSPs have automatic access to httpsession your GWT client code
  obviously does not. I think you might have to make a preparatory RPC
  call to get the necessary parameters from the user's session before
  you construct the URL.

   Thanks
   Arul- Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
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: ScrollPanel maxWidth or maxHeight?

2009-02-06 Thread gregor

Oh right...

I think you've got to make sure that the whatever the ScrollPanel
contains has actually reduced in size already - if it hasn't the
ScrollPanel will refuse to cooperate (i.e. it won't squash it's
contents by itself). Then you need to reset it to 1px  more than the
height/width of its contents (1px is fine if contents is now 0) in
order to get rid of the scroll bars (0px etc is ignored as I
recall). It won't do that by itself. After that you'll have to try
things out - I've always reset ScrollPanel's to a specific height
after this procedure, so I don't know how to release it from the 1px
instruction without specifying another. I think I would use debugger
to find out exact style properties of ScrollPanel whilst it's in
growing mode to start with, and attempt to replicate that. If it has
nothing in height/width you may have a problem because, as you say,
you may not be allowed to actually remove a style attribute once it's
there, only modify it, in which case the ScrollPanel may stubbornly
refuse to cooperate.

You might be forced to attempt a detach of the items widget, replace
ScollPanel with a new one, and reattach the items widget to it, or
some such...

 or you might consider another way to do this altogether -
ScrollPanel's can be tiresome, uncooperative widgets at times ;-)

On Feb 6, 3:46 pm, Davsket g.ave...@gmail.com wrote:
 well, at least replace it..

 On 6 feb, 10:41, alex.d alex.dukhov...@googlemail.com wrote:

  Haven't found one either. But checking height while adding elements is
  ok - have it almoust working already. Well, almoust - the problem is
  that when height or width properties are set once, you can't take it
  back. So, while panel shows the desired behaviour while adding
  elements, it remains big when elements are removed. I've already
  tried:

  scrollPanel.setWidth();
  scrollPanel.setWidth(null);

  but no luck. I've also tried to set the style-attribute directly with

  DOM.setStyleAttribute(scrollPanel.getElement(), width, );

  but no luck either.
  Sadly, i haven't found a removeStyleAttribute-method.

  Any ideas?
  Thx

  On 6 Feb., 15:23, gregor greg.power...@googlemail.com wrote:

Is there a real browser-event or should i
just call a check procedure whenever i add elements?

   The latter, no browser event available AFAIK.

 I have looked in vain for a general method to get ScrollPanels to
 resize and generally behave by themselves. I think the reason is that
 individual divs/table cells etc do not generate events when their size
 changes. ScrollPanel is basically a div with an overflow setting. I
 have supposed this is because there can be hundreds if not thousands
 of boxes on a page, so if they all emitted an event every time they
 changed their width/heights the browser's event queue would be brought
 to its knees.

 On Feb 5, 4:13 pm, Litty Preeth preeth.h...@gmail.com wrote:

  there is some max-height CSS property. But dont know if it works.

  On Thu, Feb 5, 2009 at 8:59 PM, alex.d 
  alex.dukhov...@googlemail.comwrote:

   On 5 Feb., 16:10, gregor greg.power...@googlemail.com wrote:
Hi Alex,

I think you have to explicitly specify the height of a 
ScollPanel in
pixels to get the scroll bars to kick in, and that will set the 
height
of the panel from the word go. If what you mean is that you 
want a
panel to start at a minimum size, then grow as things are added 
to it,
but then to stop growing and go into scroll mode at a certain 
point,

   exactly what i meant.

I do not think that is realistically possible since there is no 
event
you can listen for that would tell you when the panel had grown 
to a
given height. You can listen for the browser window changing, 
but not
for an individual panel.

I suppose one approach might be to set up a timer to check the 
current
height at intervals and take appropriate action when it hit the 
limit,
but this sounds very inefficient.

   Indeed it does. I kind of hoped somebody will have a genious idea
   about it ;-) Thank you for your input anyway.

regards
gregor

On Feb 5, 9:29 am, alex.d alex.dukhov...@googlemail.com 
wrote:

 Hi folks,
 I'm trying to impelement a scrollpanel that becomes bigger 
 (height) to
 the certain size (maxHeight) when populating it with data.  
 After that
 vertical scrollbar should appear and the panel should stop 
 growing.
 Any ideas on how to implement this would be appreciated.
--~--~-~--~~~---~--~~
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

Re: Best image preloading practice?

2009-02-05 Thread gregor
. PDF's are downloaded
into viewer plug-ins etc). Would you serve a single 20MB static HTML
page? Most people consider a 1MB javacript file to be big. I'm not
sure what the practical limits really are for the different browsers,
and it probably also depends to some extent on what else they have
running in other browser tabs. Personally I would avoid this approach,
it doesn't feel right at all.

 I'm thinking there should be a way to load continiously in the
 background, but not to burden the browser with too many call's at
 once.

You can only download one binary file per http request. Remember there
are security restrictions in place around this since binaries are
dangerous things so you are limited in what you can do in a straight
AJAX web app (you need an applet or flex to escape from these).
Consequently browsers control binary file download with a view to
enabling image files to be fetched easily enough, but other file types
require user confirmation for what to do. It's this security issue and
how the browsers deal with it that you are running up against. They
are deliberately designed to make downloading huge chunks of binary
data difficult, especially transparently, and they are not expecting
to have to display 20MB worth of images at once.

If you leave it to the browser, it makes one Http call per image and
you cannot guarantee the order they will be fetched. If you do it
yourself (using file download servlet), you also get one binary file
per request, but you can chain calls in a specific order. The point of
the composite image strip is to fetch several images in one request
since they come in a single binary file.



 Cheers,
 Darkflame

 On Feb 4, 7:51 pm, gregor greg.power...@googlemail.com wrote:

  I'm not sure this a best practice issue as such - I think you may
  have more of an edge case here. I've tried your game (although I
  can't understand what to do after first screen), but what happens is
  that the browser is slogging away downloading data (presumably your
  images) which gives gutter messages and hour glasses etc. This is very
  distracting, but if you had to wait for the whole lot to download
  before the game started you'd probably get bored and go somewhere
  else.

  I would have thought the best approach might be to download the images
  as required for each level as the player advances through the game,
  and I would think displaying a Loading area... type message after
  they have completed a level is a traditional approach for games,
  especially giving them something to read whilst they are waiting.

  This approach is not so well served by GWT because AFAIK you can only
  have one ImageBundle per module and in any case it is downloaded on
  initial page load. You may find this thread interesting:

 http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...

  In it Bruce Johnson comments:

  4) History is the answer to apps that are too big. If you combine
  the
  points from #2 and #3 above, hopefully it makes sense that whenever
  you fear
  your app is becoming too big for a single page, all you need to do
  is
  split it into multiple pages such that each page has a unique module
  with a
  unique entry point. History smooths all the page junction points, and
  the
  compiler is smart enough to eliminate code you don't use from each
  page's
  entry point(s).

  Which would appear to answer the one ImageBundle per module issue and
  provide convenient inter-level load points. However I would also read
  what Reinier has to say about it as he also knows what he's talking
  about. It would certainly complicate your program.

  Failing that, you could consider handling image strips yourself. You
  assemble a single composite image manually of all images required for
  a single level in some convenient extraction grid. Then you use an
  Image object for this composite image, but before you give it the URL,
  you attach a LoadListener to it - this is so can tell when its
  finished loading in your code and control the loading message and the
  UI during level load procedure and kick off extracting the individual
  image parts etc.

  It's a bit tricky to extract bits of one image to create several
  others in your own code. I did it once for an experiment, it looked
  like this:

  Image sampleImage = new Image(someURL)
  .
  .
      HTML box = new HTML();
      Node imageClone = sampleImage.getElement().cloneNode(false);
      box.getElement().appendChild(imageClone);
      grid.setWidget(i, j, box);
      Image part = Image.wrap((Element)imageClone);
      part.setVisibleRect(7,7,10,10);

  The problem I found is that you can use an img Element to make a new
  Image object (which you can then clip), but it must be attached to the
  DOM already, hence the messing about. This works, but I make no claim
  that it is the most, or even a reasonably, efficient way to do it.
  There may be a much better way to do this in GWT, or you may find that
  you can

Re: Get remaining height of a panel or window

2009-02-05 Thread gregor

It sounds as though you are calling getOffsetHeight before the display
has been fully rendered. A solution is to put your sizing algorithms
inside a DeferredCommand. That way panel A should have been rendered
already, and now it will have its height property set.

On Feb 5, 1:15 pm, aragorn sagar5...@gmail.com wrote:
 Imagine I create a containerPanel which contains 2 different panels-
 consider A and B. One of these contained panels, say A, changes its
 dimensions at runtime so I have to reset the other panel B's size
 accordingly.
 Is there any way to get the current height of that panel A.

 What is the getOffsetHeight function supposed to return since it
 always returns me a zero value?
--~--~-~--~~~---~--~~
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: View remaining content of a full ocuupied window after resizing

2009-02-05 Thread gregor

Hi Aragorn,

Enabling scrolling in Window class should give you main window scroll
bars. Resizing the browser window can be difficult to get right, it
depends on your application. If all your widgets are sized relatively
in percentage terms then sometimes it works out OK automatically. If
not you can attach a WindowResizeListener to your EntryPoint class and
kick off resizing algorithms from the onWIndowResize(..) method.

regards
gregor

On Feb 5, 1:09 pm, aragorn sagar5...@gmail.com wrote:
 I have created a webpage which fits itself to the size of the browser
 window at start. Whenevr it resizes, I want to get a scrollbar which
 will help me navigate the entire page. I tried using CSS overflow
 property but that doesnt work as in i am not able to view all the
 contents. The scrollbar does appear but then doesnt help show all the
 contetns inside the page.
 Another undesired effect I get is that the inner contents overlap each
 other after resizing to a smaller size.
--~--~-~--~~~---~--~~
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: ScrollPanel maxWidth or maxHeight?

2009-02-05 Thread gregor

Hi Alex,

I think you have to explicitly specify the height of a ScollPanel in
pixels to get the scroll bars to kick in, and that will set the height
of the panel from the word go. If what you mean is that you want a
panel to start at a minimum size, then grow as things are added to it,
but then to stop growing and go into scroll mode at a certain point, I
do not think that is realistically possible since there is no event
you can listen for that would tell you when the panel had grown to a
given height. You can listen for the browser window changing, but not
for an individual panel.

I suppose one approach might be to set up a timer to check the current
height at intervals and take appropriate action when it hit the limit,
but this sounds very inefficient.

regards
gregor

On Feb 5, 9:29 am, alex.d alex.dukhov...@googlemail.com wrote:
 Hi folks,
 I'm trying to impelement a scrollpanel that becomes bigger (height) to
 the certain size (maxHeight) when populating it with data.  After that
 vertical scrollbar should appear and the panel should stop growing.
 Any ideas on how to implement this would be appreciated.
--~--~-~--~~~---~--~~
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: ScrollPanel maxWidth or maxHeight?

2009-02-05 Thread gregor

Oh, in your use case, Alex, you do have an event - adding an item to
the panel. Just check the height after new item added and set the
height of the ScrollPanel in pixels if max value reached I would think
answers.

I have looked in vain for a general method to get ScrollPanels to
resize and generally behave by themselves. I think the reason is that
individual divs/table cells etc do not generate events when their size
changes. ScrollPanel is basically a div with an overflow setting. I
have supposed this is because there can be hundreds if not thousands
of boxes on a page, so if they all emitted an event every time they
changed their width/heights the browser's event queue would be brought
to its knees.

On Feb 5, 4:13 pm, Litty Preeth preeth.h...@gmail.com wrote:
 there is some max-height CSS property. But dont know if it works.

 On Thu, Feb 5, 2009 at 8:59 PM, alex.d alex.dukhov...@googlemail.comwrote:



  On 5 Feb., 16:10, gregor greg.power...@googlemail.com wrote:
   Hi Alex,

   I think you have to explicitly specify the height of a ScollPanel in
   pixels to get the scroll bars to kick in, and that will set the height
   of the panel from the word go. If what you mean is that you want a
   panel to start at a minimum size, then grow as things are added to it,
   but then to stop growing and go into scroll mode at a certain point,

  exactly what i meant.

   I do not think that is realistically possible since there is no event
   you can listen for that would tell you when the panel had grown to a
   given height. You can listen for the browser window changing, but not
   for an individual panel.

   I suppose one approach might be to set up a timer to check the current
   height at intervals and take appropriate action when it hit the limit,
   but this sounds very inefficient.

  Indeed it does. I kind of hoped somebody will have a genious idea
  about it ;-) Thank you for your input anyway.

   regards
   gregor

   On Feb 5, 9:29 am, alex.d alex.dukhov...@googlemail.com wrote:

Hi folks,
I'm trying to impelement a scrollpanel that becomes bigger (height) to
the certain size (maxHeight) when populating it with data.  After that
vertical scrollbar should appear and the panel should stop growing.
Any ideas on how to implement this would be appreciated.
--~--~-~--~~~---~--~~
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: Best image preloading practice?

2009-02-05 Thread gregor



 Ah, this sounds quite usefull to hide the loading, allthough I'll have
 to read up.
 I assume this is how, say, GoogleMaps does it?

I think it's quite common where you want to have control over how
images are handled yourself - as I say there are plenty of examples
around of how to do the serlvet.

 You are thinking of loading 20MB of images into the DHTML DOM of you
 application

 Am I? Does the DOM keep them there even when not displayed?
 These images certainly wouldnt be displayed all at once. 1 or 2 at a
 time at most.

I'm not absolutely sure, but I think if you load an image it is
basically attached to a document, whether the browser caches it or
not, and whether it is currently visible of not. You don't control the
browser cache, I mean I don't think you can tell it to conveniently
download all your images and store them neatly on disk until you need
to display them for example. It's also more than likely each browser
does things differently.


 But the vaste majority of players should happily be able to load
 20-30MB onto their hard disk for the course of the game.

That's my point: I don't think it works like that, I can see why it
would be nice for you if it did. The browser probably does store
images locally in some circumstances, but I believe this would be for
virtual backing for the document it's loaded/displaying if required
for memory management purposes. I.e. you've got a document of 20MB
loaded which it must manipulate. I may be wrong, you'd need to
investigate to be sure.


 They
 are deliberately designed to make downloading huge chunks of binary
 data difficult, especially transparently, and they are not expecting
 to have to display 20MB worth of images at once. 

 Again, not at once.
 Surely a staggered download they wouldnt have a problem with?
 Emulating, say, what it would expect from a user browseing DeviantArt?


yeah, the staggered download is basically the idea of the maze - each
time you move to next location you've only got one locations worth of
images to fetch. Or if it worked fast enough you could fetch all the
required images for the adjoining locations so they would be ready to
go instantly. It depends entirely on no of image bytes per location.

Point is doing it this way old images are thrown away and can be
garbage collected as you go, so you are not accumulating images in
memory. It's stable. (assuming I'm right about the how this works of
course).

 If you leave it to the browser, it makes one Http call per image and
 you cannot guarantee the order they will be fetched. I

 Yes, I noticed this already. Its interesting, as I expected it to be
 in a first-come-first-served base's, but I guess theres some
 optimisation within a timeframe.
 I do wonder though what the limit of this is and if its the same per
 browser. (I mean, if I loaded no more then 1 image every 10 seconds,
 it would probably do it in the order I asked, but not if I asked for
 one to be prefetched every 10ms)
 This is more a curiousity though.

 . The point of
 the composite image strip is to fetch several images in one request
 since they come in a single binary file. 

 Yes, I understand the point of them, and I think image bundles are a
 great idea.
 (In fact, online in general, theres probably a lot of wasted bandwidth
 used on little UI elements on webpages..like 5kb gifs etc)
 In this specific case though they arnt approperate.
 Not unless I got the server to dynamically splice the images together
 and the client to cut them up.
 But thats beyond the scope of the projects timeframe.

This is exactly what the GWT ImageBundle does (and what has been best
practice in web design for years). Annoyingly for you GWT only does
this once per module because Bruce says they can't think of a single
use case for needing separate ImageBundles!  My bet is that if you
just start loading all the images as you are suggesting, you will have
to attach them to the DOM somewhere, so ultimately what you will be
doing is building the entire game at the same time as the player is
trying to play the first locations. So my betting is three to one on
a) whilst this build is going on the game play will be badly affected
at precisely the time you least want it to, and b) once you've loaded
it all it will run like a dog anyway.

I may well be wrong, but if I'm not, and you looked at the maze idea
as plan B, then using image strips a la ImageBundle will make the game
run much faster and smoother, so the effort might well be critical in
the end. This is after all the heart of your technical challenge. This
has been done so many times I expect you will find some javascript
code that cuts them up (or maybe CSS stuff) to crib from somewhere and
some server side tools to pack the image strips as well.





 On Feb 5, 3:27 pm, gregor greg.power...@googlemail.com wrote:

  I'm not sure I can be of much more help on this myself, since I have
  never written anything like this, and I have not come across any
  specific

Re: Best image preloading practice?

2009-02-04 Thread gregor

I'm not sure this a best practice issue as such - I think you may
have more of an edge case here. I've tried your game (although I
can't understand what to do after first screen), but what happens is
that the browser is slogging away downloading data (presumably your
images) which gives gutter messages and hour glasses etc. This is very
distracting, but if you had to wait for the whole lot to download
before the game started you'd probably get bored and go somewhere
else.

I would have thought the best approach might be to download the images
as required for each level as the player advances through the game,
and I would think displaying a Loading area... type message after
they have completed a level is a traditional approach for games,
especially giving them something to read whilst they are waiting.

This approach is not so well served by GWT because AFAIK you can only
have one ImageBundle per module and in any case it is downloaded on
initial page load. You may find this thread interesting:

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/1106bc10356e9880/60fc5167fe4b1040?lnk=gstq=multiple+module+bruce+ian+buffoon#60fc5167fe4b1040

In it Bruce Johnson comments:

4) History is the answer to apps that are too big. If you combine
the
points from #2 and #3 above, hopefully it makes sense that whenever
you fear
your app is becoming too big for a single page, all you need to do
is
split it into multiple pages such that each page has a unique module
with a
unique entry point. History smooths all the page junction points, and
the
compiler is smart enough to eliminate code you don't use from each
page's
entry point(s).

Which would appear to answer the one ImageBundle per module issue and
provide convenient inter-level load points. However I would also read
what Reinier has to say about it as he also knows what he's talking
about. It would certainly complicate your program.

Failing that, you could consider handling image strips yourself. You
assemble a single composite image manually of all images required for
a single level in some convenient extraction grid. Then you use an
Image object for this composite image, but before you give it the URL,
you attach a LoadListener to it - this is so can tell when its
finished loading in your code and control the loading message and the
UI during level load procedure and kick off extracting the individual
image parts etc.

It's a bit tricky to extract bits of one image to create several
others in your own code. I did it once for an experiment, it looked
like this:

Image sampleImage = new Image(someURL)
.
.
HTML box = new HTML();
Node imageClone = sampleImage.getElement().cloneNode(false);
box.getElement().appendChild(imageClone);
grid.setWidget(i, j, box);
Image part = Image.wrap((Element)imageClone);
part.setVisibleRect(7,7,10,10);

The problem I found is that you can use an img Element to make a new
Image object (which you can then clip), but it must be attached to the
DOM already, hence the messing about. This works, but I make no claim
that it is the most, or even a reasonably, efficient way to do it.
There may be a much better way to do this in GWT, or you may find that
you can do it better in javascript and use a JSNI interface. It might
be worth searching the javascript forums for some ideas, as I'm sure
this has been done before.

regards
gregor





On Feb 4, 1:37 pm, darkflame darkfl...@gmail.com wrote:
 No, this is a large number of very large images, bundles are not
 approporate as that would mean they would all be loaded at once, and
 the user would have to effectively preload the whole game.
 This is not about icons, but actual images. (as it, 640x480 or in some
 case's much larger).

 On Feb 4, 10:42 am, doopa niallhas...@googlemail.com wrote:

  Hi,

  The key is to use ImageBundles or use one large image that contains
  all the icons you want to use and then draw only parts of them when
  you want it displayed.

 http://code.google.com/p/google-web-toolkit/wiki/ImageBundleDesign

  How that helps.

  On Feb 3, 5:50 pm, darkflame darkfl...@gmail.com wrote:

   I have quite a large app being developed, and requires various large
   images to be displayed at certain times.

   As the app (rather, a educational game) has a login screen, it makes
   sense to start loading the images while the user is login in, and in
   the order of the images appearance.

   I thought I handled this ok with a while loop, going over a list of
   images and using ;
   Image.prefetch(URL);
   To get the images ready.

   However, from what I can tell, this is slowing down some systems (CPU
   wise). I think this is because I'm effectively telling all the images
   to load at once without a pause.
   Whats the best practice for loading a large number of images in a set
   order?

   You can actualy see the game 
   here;http://www.cuyperscode.com/CuypersCode2/CCIIstart.html
   But its in Dutch

Re: Events loop

2009-02-04 Thread gregor

It's difficult to see from this. You could strip out your data loading
code and event handling, put them back bit by bit until you hit the
problem, and post the relevant code if it's still not clear.


On Feb 4, 6:13 pm, Vijay bhvijayku...@gmail.com wrote:
 Hi

 I am new to GWT and currently developing an application.I am facing
 one problem. I have TabPanel and i have added the listeners to handle
 the data which loads in the each TabIems but the problem is when i
 change the tab the whole Panel freezes I could see that the
 application is waiting for events in threaddumps

 main prio=6 tid=0x000379a0 nid=0x17e4 runnable
 [0x0007f000..0x0007fc3c]
         at org.eclipse.swt.internal.win32.OS.WaitMessage(Native Method)
         at org.eclipse.swt.widgets.Display.sleep(Display.java:3736)
         at com.google.gwt.dev.GWTShell.sleep(GWTShell.java:749)
         at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:721)
         at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
         at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke
 (NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke
 (DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:
 90)

 Can anyone help me to debug this problem. ??  i have disabled all the
 listeners and still i can see this problem :-(

 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: What is the most preferred way !!??

2009-02-03 Thread gregor
(new SandBox$1(), Ajay's
One);
  this$static.ajaysButtonTwo = $SandBox$2(new SandBox$2(), Ajay's
Two);
  return this$static;
}

function $EButton(this$static, text){
  $ButtonBase(this$static, $doc.createElement('button'));
  adjustType(this$static.element);
  this$static.element['className'] = 'gwt-Button';
  $setInnerText(this$static.element, text);
  $addClickListener(this$static, this$static);
  return this$static;
}

function EButton(){
}

_ = EButton.prototype = new Button();
_.typeId$ = 23;
function $SandBox$1(this$static, $anonymous0){
  $EButton(this$static, $anonymous0);
  return this$static;
}

function onClick(sender){
  $wnd.alert('Ebutton 1');
}

function SandBox$1(){
}

_ = SandBox$1.prototype = new EButton();
_.onClick = onClick;
_.typeId$ = 24;
function $SandBox$2(this$static, $anonymous0){
  $EButton(this$static, $anonymous0);
  return this$static;
}

function onClick_0(sender){
  $wnd.alert('Ebutton 2');
}

function SandBox$2(){
}

_ = SandBox$2.prototype = new EButton();
_.onClick = onClick_0;
_.typeId$ = 25;


So my reading of this is:

1) All three methods involve creating a Button instance which
translates into a native Button element provided by the browser and
attached to the DOM.
2) All three methods involve creating one or more listener objects
(sandBox$1, SandBox$2 etc) that are added to the static ClickListsner
Collection
3) When a Click event is fired from the browser, the click listeners
are queried to see if any are registered with the clicked DOM element.
4) In method one there is only one of them, so that question is
answered very quickly
5) In methods 2  3, the more buttons there are, the longer this
takes.
6) Although EButtons appear to register themselves with themselves
($addClickListener(this$static, this$static)) they still go through
the same rigmarole through the listener collection if one is clicked -
they do not bypass it by saying oh, I can just call myself as far as
I can see.
7) The EButton option results in marginally more code than the inner
class option, and massively more than the shared listener option
(multiply it all up by e.g. 100), may run slower as a result even by
comparison with the inner class option, and will certainly increase
the size of the javascript files.
8) I think it demonstrates conclusively why using the single listener
technique can make a huge difference if you have a large number of
clickable widgets in an application.





On Feb 3, 8:14 am, Ajay Garg ajaygargn...@gmail.com wrote:
 Hmm.. I looked at GWT's code, and went all the way 
 uptohttp://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/g...
 code.

 Button is a sub-subclass of FocusWidget, and this is what happens.
 Whenever a clickListener is added to a Button for the first time,
 Event.Click event is sunk in for the newly instantiated Button
 instance, and the clickListener added to ClickListenerCollection.
 Next, whenever an onBrowserEvent(Event event) method is triggered, the
 onClick() method is called for each of the clickListener registered in
 ClickListenerCollection.

 So, as far as managing a large number of ClickListeners goes, if we go
 by using EButton, the number of ClickListeners is equal to the number
 of anonymous abstract classes made out of EButton.

 I think a more thinking point would be to consider public void
 sinkEvents(int eventBitsToAdd) method of UIObject class, which
 happens to be a superclass of FocusWidget. This method is called
 whenever a ClickListener is added to an instance for the first time.
 Thus, it does not matter whether the ClickListener interface being
 added is the same reference as the anonymous abstract class of
 Ebutton, or a central wrapper ClickListener (per component, as is
 being talked about).

 Thus, in a nutshell, if we create an anonyous abstract class of
 EButton :

 1. We ensure tight coupling, in the sense that the widget, and its
 action-on-click are bound together.

 2. Since we do not require any external ClickListener (remember that
 EButton is a clickListener to itself), memory leak is not a problem;
 whenever the anonymous instance goes out of scope, that is the end. In
 other words, there is no chance of a dangling reference in the
 WrapperWidget's onClick method.

 3. There is no extra overhead of maintaining any extra ClickListener
 references, as the number of ClickListener references is equal to the
 number of anonymous instances.

 Your thoughts ..??

 On Feb 2, 11:17 pm, gregor greg.power...@googlemail.com wrote:

   This case requires one class ( anonymous extended EButton) creation.

   Your thoughts ..??

  Yes, but you are not reducing the number of event listeners by doing
  this. Each button is now itself a separate click event listener. So I
  don't think this answers the warning given in the link about large
  numbers of event listeners. Also I doubt if there would be much
  material difference if any in the javascript generated between your
  EButton and a normal Button with an anonymous

Re: What is the most preferred way !!??

2009-02-02 Thread gregor



 This case requires one class ( anonymous extended EButton) creation.

 Your thoughts ..??

Yes, but you are not reducing the number of event listeners by doing
this. Each button is now itself a separate click event listener. So I
don't think this answers the warning given in the link about large
numbers of event listeners. Also I doubt if there would be much
material difference if any in the javascript generated between your
EButton and a normal Button with an anonymous ClickListener, or none
that would have any effect on performance anyway - you can always
compile with -PRETTY and check.


--~--~-~--~~~---~--~~
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: Self-Updating List

2009-01-31 Thread gregor

Use GWT RPC (or you can use HttpRequestBuilder if your backend is not
Java). It is an asynchronous mechanism therefore client's thread is
released as soon as the request is fired off, the response being
fielded later in a separate Callback method. The UI is therefore free
for the duration of the round trip to the server.

On Feb 1, 1:53 am, winhqwebm...@gmail.com winhqwebm...@gmail.com
wrote:
 Hello All,

 I'm new to AJAX and GWT in general. I have a project in mind and would
 like some hints as to how I should set my program up. I want to have a
 list that self-updates asynchronously by querying a remote server at
 certain intervals, let's say every 1 second. It would be something
 such a list that updates flight information or train departures.

 My question is how do I have each row in the list update without
 disrupting the rest of the site? I know JavaScript doesn't support
 multi-threading. The only method I could think of off the top of my
 head is to load the page and grab the initial data with a loop at the
 end executing at 1 second intervals.

 Thanks in advance,
 Mike
--~--~-~--~~~---~--~~
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: What is the most preferred way !!??

2009-01-30 Thread gregor

Hi Ajay,

A common reason for using a single event listener across many links/
buttons etc is performance. See:

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=FAQ_UIUseOneListener

As Danox says, there is no one best approach, it depends on the
application type and size. The main issues are encapsulation,
decoupling, and granularity. A good unit of granularity is, say, a
Composite panel that performs a main task in your UI and may have
several widgets inside it including a number of links/buttons.

Within the Composite all the buttons/links etc are visible, so a
single ClickListener instance can service them all, e.g. {

public void onClick(Widget sender) {
  if (sender==b1) {
   doSomething(..)
  else if (sender==b2) {
   changeListeners.fireChange(..);
  ..// etc
}

Technically you can make a second main Composite component implement
ClickListener and register it with a button buried in Composite 1. I
think that is probably a bit too fine grained and involves Composite 2
knowing about Composite 1 internals (breaks encapsulation). I prefer
to implement events visible to other main components at the Composite
level. So Composite 2 registers with Composite 1, and Composite 1
mediates between Composite 2 and the button concerned.

regards
gregor





On Jan 30, 6:15 am, Ajay Garg ajaygargn...@gmail.com wrote:
 Thanks danox for your viewpoint.

 However, just curious, isn't case 2 doable as a case 1; i.e. after the
 button is clicked, it calls a method elsewhere, which may then
 delegate to a RPC ...

 Ajay Garg

 On Jan 30, 10:14 am, danox danoxs...@gmail.com wrote:

  I'm not sure that there is a recommended way. Its really up to you or
  the coding style of your team.

  I tend to use 1. for most simple implementations (e.g. if I want a
  button click to call a method elsewhere) and 2. for more complex
  implementations (e.g. if I am adding a series of buttons
  programmatically, each of which will trigger an RPC call with unique
  parameters when clicked).

  I've never used 3 and it doesn't strike me as a great way to do it,
  but that's just me.

  On Jan 30, 3:38 pm, Ajay Garg ajaygargn...@gmail.com wrote:

   Right, and so that brings to the query in my first post :: What is the
   recommended way to attach a clicklistener to simple widgets like
   Button and Hyperlink ::

   1. Let a Button be listened by itself ?
   2. Let a Button be listened by a bigger widget (eg. DeckPanel,
   HorizontalPanel ..) encapsulating it?
   3. Let a Button be listened by the module of which it is a part?

   Ajay Garg

   On Jan 30, 9:08 am, ajay jetti programmera...@gmail.com wrote:

The Answer to second question depends on the scenario , but multiple
listners on a single button? i din know if that is possible- Hide 
quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
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: what design pattern to use with DWT

2009-01-30 Thread gregor

I think the guts of MVC was invented (as so much was) at Xerox's Palo
Alto research center when they invented the first WIMP UIs in the
70's. This fed into Smalltalk and was taken up also with Apple Lisa by
the early 80's. Since most systems at the time were based around text
screens run from mainframes, they needed a new programming model that
could handle the idea of the user being able to click on any widget on
the screen in any order at any time rather than being run through a
predetermined script, hence MVC.

I'm not sure they had the idea of the Observer pattern at the time,
and I think Ben is right that the Observer pattern is now an
alternative/replacement for Controllers in GUI programming. GWT is
designed to use it. In that sense, I would say maybe the best pattern
for GWT client coding might be called Model View Observer rather than
MVC.



On Jan 29, 8:56 pm, Flemming Boller flemming.bol...@gmail.com wrote:
 Now that you mention SmallTalk... I of course agree!
 when I wrote LISP, I have a funny feeling it about, but I thought it was so
 :-)

 anyway that for the correction.
 /Flemming

 On Thu, Jan 29, 2009 at 9:23 PM, Ian Petersen ispet...@gmail.com wrote:

  On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
  flemming.bol...@gmail.com wrote:
   MVC goes long back in time. long before web frameworks. I think it came
  from
   the language LISP.

  I don't know how relevant this is, but MVC was first so-named by a
  bunch of people designing GUIs in SmallTalk.  I don't remember the
  timeframe, but it was definitely before web frameworks became at all
  popular.  There's some interesting discussion of the pattern here:
 http://c2.com/cgi/wiki?ModelViewController Don't get too lost in that
  site--it's easy to burn a lot of time wandering around the Portland
  Pattern Repository's wiki.

  Ian
--~--~-~--~~~---~--~~
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: what design pattern to use with DWT

2009-01-30 Thread gregor

Actually, looking (briefly!) at Ian's links, GWT could probably be
best described as ModelDelegate, which is classified as a derivative
of MVC and is what Swing is called it seems.:

http://c2.com/cgi/wiki?ModelDelegate

Also this is a short explanation from Wikipedia of MVC and Swing

GUI frameworks

[edit] Java: Java Swing

Java Swing is different from the other frameworks in that it supports
two MVC patterns:

Model

Frame level model—Like other frameworks, the design of the real
model is usually left to the developer.
Control level model—Swing also supports models on the level of
controls (elements of the graphical user interface). Unlike other
frameworks, Swing exposes the internal storage of each control as a
model.

View
The view is represented by a class that inherits from Component.

Controller
Java Swing doesn't use a single controller. Because its event
model is based on interfaces, it is common to create an anonymous
action class for each event.[citation needed] In fact, the real
controller is in a separate thread, the Event dispatching thread. It
catches and propagates the events to the view and model.

I think this explanation fits very well into GWT's model - we have the
browser's event queue, and we also often use anonymous inner classes
for event listeners.



On Jan 30, 12:03 pm, gregor greg.power...@googlemail.com wrote:
 I think the guts of MVC was invented (as so much was) at Xerox's Palo
 Alto research center when they invented the first WIMP UIs in the
 70's. This fed into Smalltalk and was taken up also with Apple Lisa by
 the early 80's. Since most systems at the time were based around text
 screens run from mainframes, they needed a new programming model that
 could handle the idea of the user being able to click on any widget on
 the screen in any order at any time rather than being run through a
 predetermined script, hence MVC.

 I'm not sure they had the idea of the Observer pattern at the time,
 and I think Ben is right that the Observer pattern is now an
 alternative/replacement for Controllers in GUI programming. GWT is
 designed to use it. In that sense, I would say maybe the best pattern
 for GWT client coding might be called Model View Observer rather than
 MVC.

 On Jan 29, 8:56 pm, Flemming Boller flemming.bol...@gmail.com wrote:

  Now that you mention SmallTalk... I of course agree!
  when I wrote LISP, I have a funny feeling it about, but I thought it was so
  :-)

  anyway that for the correction.
  /Flemming

  On Thu, Jan 29, 2009 at 9:23 PM, Ian Petersen ispet...@gmail.com wrote:

   On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
   flemming.bol...@gmail.com wrote:
MVC goes long back in time. long before web frameworks. I think it came
   from
the language LISP.

   I don't know how relevant this is, but MVC was first so-named by a
   bunch of people designing GUIs in SmallTalk.  I don't remember the
   timeframe, but it was definitely before web frameworks became at all
   popular.  There's some interesting discussion of the pattern here:
  http://c2.com/cgi/wiki?ModelViewController Don't get too lost in that
   site--it's easy to burn a lot of time wandering around the Portland
   Pattern Repository's wiki.

   Ian
--~--~-~--~~~---~--~~
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: What is the most preferred way !!??

2009-01-30 Thread gregor

Well, buttons don't implement ClickListener, they implement
SourcesClickEvents (amongst other things). It looks to me like your
EButton would effectively be listening for it's own click events? So
each EButton would have to handle its own action independently, and
you could not then by definition share a ClickListener between
multiple buttons. I can't at the moment see what you are trying to
achieve with this line of reasoning.

On Jan 30, 12:30 pm, Ajay Garg ajaygargn...@gmail.com wrote:
 Also, that might also eliminate the Memory Leak problem, as stated
 athttp://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=goog...

 On Jan 30, 5:27 pm, Ajay Garg ajaygargn...@gmail.com wrote:

  Thanks Gregor.

  Seeing the link, it says that creating an anonymous clicklistener
  class per widget is a performance overhead. This repops the question -
  what if the Button itself is extended to implement ClickListener to
  make an abstract class EButton, and making onClick abstract. Thus,
  whenever a new EButton is instantiated, the user defines the onClick
  method. ( This is case 3 of my first post. )

  This keeps the encapsulation, as well causes no extra class
  instantiation.

  Your thoughts .. ??

  On Jan 30, 4:39 pm, gregor greg.power...@googlemail.com wrote:

   Hi Ajay,

   A common reason for using a single event listener across many links/
   buttons etc is performance. See:

  http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=goog...

   As Danox says, there is no one best approach, it depends on the
   application type and size. The main issues are encapsulation,
   decoupling, and granularity. A good unit of granularity is, say, a
   Composite panel that performs a main task in your UI and may have
   several widgets inside it including a number of links/buttons.

   Within the Composite all the buttons/links etc are visible, so a
   single ClickListener instance can service them all, e.g. {

   public void onClick(Widget sender) {
     if (sender==b1) {
          doSomething(..)
     else if (sender==b2) {
          changeListeners.fireChange(..);
     ..// etc

   }

   Technically you can make a second main Composite component implement
   ClickListener and register it with a button buried in Composite 1. I
   think that is probably a bit too fine grained and involves Composite 2
   knowing about Composite 1 internals (breaks encapsulation). I prefer
   to implement events visible to other main components at the Composite
   level. So Composite 2 registers with Composite 1, and Composite 1
   mediates between Composite 2 and the button concerned.

   regards
   gregor

   On Jan 30, 6:15 am, Ajay Garg ajaygargn...@gmail.com wrote:

Thanks danox for your viewpoint.

However, just curious, isn't case 2 doable as a case 1; i.e. after the
button is clicked, it calls a method elsewhere, which may then
delegate to a RPC ...

Ajay Garg

On Jan 30, 10:14 am, danox danoxs...@gmail.com wrote:

 I'm not sure that there is a recommended way. Its really up to you or
 the coding style of your team.

 I tend to use 1. for most simple implementations (e.g. if I want a
 button click to call a method elsewhere) and 2. for more complex
 implementations (e.g. if I am adding a series of buttons
 programmatically, each of which will trigger an RPC call with unique
 parameters when clicked).

 I've never used 3 and it doesn't strike me as a great way to do it,
 but that's just me.

 On Jan 30, 3:38 pm, Ajay Garg ajaygargn...@gmail.com wrote:

  Right, and so that brings to the query in my first post :: What is 
  the
  recommended way to attach a clicklistener to simple widgets like
  Button and Hyperlink ::

  1. Let a Button be listened by itself ?
  2. Let a Button be listened by a bigger widget (eg. DeckPanel,
  HorizontalPanel ..) encapsulating it?
  3. Let a Button be listened by the module of which it is a part?

  Ajay Garg

  On Jan 30, 9:08 am, ajay jetti programmera...@gmail.com wrote:

   The Answer to second question depends on the scenario , but 
   multiple
   listners on a single button? i din know if that is possible- Hide 
   quoted text -

 - Show quoted text -- Hide quoted text -

   - Show quoted text -- Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
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: What is the most preferred way !!??

2009-01-30 Thread gregor



On Jan 30, 1:44 pm, Ajay Garg ajaygargn...@gmail.com wrote:
 I have seen a WrapperWidget onClick() method get too crowded and
 cumbersome, as it listens to many widgets, that have been added over
 time as a part of project. Eventually, to change behaviour of say, a
 button, (which is being listened to by this WrapperWidget), one
 needs to hunt down in the WrapperWidget's onClick() method, which
 may be located way up or way down the same class, or may be even
 somewhere else !!

Yes, that is a problem and is what I was getting at talking about
granularity. If each main component (Composite) has one
ClickListener, then it's not much of a problem providing the component
isn't either too big or too small and hasn't got too many/few
responsibilities. Additionally it is sometimes convenient and more
readable to group event handling code for a component like that. The
new event system coming with 1.6 will make it much easier than it is
now to write readable and concise event handling code - I agree that
the current event system breaks down somewhat where multiple event
sources trigger multiple possible actions depending on various state
conditions.


 My only purpose to make Ebutton implement ClickListener, is to
 tightly-couple the button, and its action-on-click; so that it
 permits easy code view, and change, if and when required.

 And yes, I am - by this paradigm - avoiding the use of a shared
 clicklistener, at least for simple widgets like a button and a
 clicklistener.

Well, that's what the article I linked was warning you about. I can't
see that what you are proposing is that much different from the
standard anonymous ClickListener per button approach.



 Waiting for your thoughts ...

 On Jan 30, 6:00 pm, gregor greg.power...@googlemail.com wrote:

  Well, buttons don't implement ClickListener, they implement
  SourcesClickEvents (amongst other things). It looks to me like your
  EButton would effectively be listening for it's own click events? So
  each EButton would have to handle its own action independently, and
  you could not then by definition share a ClickListener between
  multiple buttons. I can't at the moment see what you are trying to
  achieve with this line of reasoning.

  On Jan 30, 12:30 pm, Ajay Garg ajaygargn...@gmail.com wrote:

   Also, that might also eliminate the Memory Leak problem, as stated
   athttp://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=goog...

   On Jan 30, 5:27 pm, Ajay Garg ajaygargn...@gmail.com wrote:

Thanks Gregor.

Seeing the link, it says that creating an anonymous clicklistener
class per widget is a performance overhead. This repops the question -
what if the Button itself is extended to implement ClickListener to
make an abstract class EButton, and making onClick abstract. Thus,
whenever a new EButton is instantiated, the user defines the onClick
method. ( This is case 3 of my first post. )

This keeps the encapsulation, as well causes no extra class
instantiation.

Your thoughts .. ??

On Jan 30, 4:39 pm, gregor greg.power...@googlemail.com wrote:

 Hi Ajay,

 A common reason for using a single event listener across many links/
 buttons etc is performance. See:

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=goog...

 As Danox says, there is no one best approach, it depends on the
 application type and size. The main issues are encapsulation,
 decoupling, and granularity. A good unit of granularity is, say, a
 Composite panel that performs a main task in your UI and may have
 several widgets inside it including a number of links/buttons.

 Within the Composite all the buttons/links etc are visible, so a
 single ClickListener instance can service them all, e.g. {

 public void onClick(Widget sender) {
   if (sender==b1) {
        doSomething(..)
   else if (sender==b2) {
        changeListeners.fireChange(..);
   ..// etc

 }

 Technically you can make a second main Composite component implement
 ClickListener and register it with a button buried in Composite 1. I
 think that is probably a bit too fine grained and involves Composite 2
 knowing about Composite 1 internals (breaks encapsulation). I prefer
 to implement events visible to other main components at the Composite
 level. So Composite 2 registers with Composite 1, and Composite 1
 mediates between Composite 2 and the button concerned.

 regards
 gregor

 On Jan 30, 6:15 am, Ajay Garg ajaygargn...@gmail.com wrote:

  Thanks danox for your viewpoint.

  However, just curious, isn't case 2 doable as a case 1; i.e. after 
  the
  button is clicked, it calls a method elsewhere, which may then
  delegate to a RPC ...

  Ajay Garg

  On Jan 30, 10:14 am, danox danoxs...@gmail.com wrote:

   I'm not sure that there is a recommended way. Its really up to 
   you

[gwt-contrib] 1.6 heap and stack size

2009-01-29 Thread gregor

I'm trying to compile a sizable module with 1.6 (trunk 4581). I seem
to be hitting JVM limits I can't resolve (I have 2G memory, XP
machine). I've had both stack overflow and out of memory, and I've
upped the anti so far to this:

-Xms512m -Xmx1080m -Xss86m

The 86m stack sorts out the stack overflow,  but the heap is still not
big enough. If I up this another 10M the JVM won't start:

Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create new native thread

Task Manager tells me I'm using 1.63G at -Xmx1080 (including Eclipse
etc etc), so I'm wondering if there's a way to release the extra 400M,
or some other trick to get this to compile.

The same module compiles under 1.5.3 at -Xms128m -Xmx150m (it fails
out of memory at -Xms128m -Xmx140m), so it looks like something is a
bit wrong here.

Gregor
--~--~-~--~~~---~--~~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~--~~~~--~~--~--~---



[gwt-contrib] Re: 1.6 heap and stack size

2009-01-29 Thread gregor


  Does running a single permutation at a
 time reduce the memory footprint?

Just a little! Compiling for gecko only works under 1.6 with -Xms128m -
Xmx160m with no requirement for -Xss setting. I rechecked this as well
(I was just a little surprised by this).

By contrast compiling for single permutation under 1.5.3 enables me to
reduce from -Xms128m -Xmx150m as stated above to -Xms128m -Xmx140m
only. It's just possible that I've got something wrong my end (this
project is not yet that familiar to me and I didn't personally build
it), but I can't see what it might be. It does look like there is an
order of magnitude increase in memory requirement (plus the stack
frame increase) when compiling for all permutations under 1.6.

Anyway, that's got me out of trouble for now, thanks Scott.




 On Thu, Jan 29, 2009 at 12:47 PM, gregor greg.power...@googlemail.comwrote:



  I'm trying to compile a sizable module with 1.6 (trunk 4581). I seem
  to be hitting JVM limits I can't resolve (I have 2G memory, XP
  machine). I've had both stack overflow and out of memory, and I've
  upped the anti so far to this:

  -Xms512m -Xmx1080m -Xss86m

  The 86m stack sorts out the stack overflow,  but the heap is still not
  big enough. If I up this another 10M the JVM won't start:

  Error occurred during initialization of VM
  java.lang.OutOfMemoryError: unable to create new native thread

  Task Manager tells me I'm using 1.63G at -Xmx1080 (including Eclipse
  etc etc), so I'm wondering if there's a way to release the extra 400M,
  or some other trick to get this to compile.

  The same module compiles under 1.5.3 at -Xms128m -Xmx150m (it fails
  out of memory at -Xms128m -Xmx140m), so it looks like something is a
  bit wrong here.

  Gregor
--~--~-~--~~~---~--~~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-28 Thread gregor

I would not get too hung up on the Controller part of MVC. I don't
know php, but it sounds the same as struts: cycles of pages (views)
rendered to client driven by action classes (controllers) that both
use a model (beans in Java speak). These action classes that drive
generation of the next view fit beautifully into MVC pattern as
controllers, but in a GWT application there is no need of them because
this work can be done on either the client or the server as
appropriate for the use case, and in general the more on the client
the better (keep as much state as possible on client). Therefore
exactly what a controller is in a GWT application is IMO a slippery
concept.

I would recommend two things:

1) If you are starting a new project download 1.6 from trunk to take
advantage of the new Event model. It is much more powerful than the
existing =1.5 event system. Unfortunately there is is little
documentation for it yet (even the javadoc is sparse) but I'm sure
questions about it would be answered here PDQ. Experimenting with this
will help you determine how you might best design your client GUI,
i.e. how your main components might best communicate between
themselves and when necessary with the server.

2)  In an ideal (MVC) world what Ian calls smarts should live in
domain model classes, and these should flow freely across networks. As
Ian points out this is sometimes possible and sometimes (perhaps most
often) it isn't because we are dealing with a given technology stack
that we can't alter in the short term. I don't think there is any one
satisfactory answer to this question - every application has it's own
use cases that will rub up against technology stack limitations in
different ways. My point is that thinking about this (i.e. how to
implement a domain model in a real world stack) is much more important
than worrying about what a controller is.

regards
gregor

On Jan 28, 4:35 pm, Jason Essington jason.essing...@gmail.com wrote:
 MVC is a good design pattern to use with GWT.
 If you are new to GWT, get Ryan Dewsbury's book Google Web Toolkit  
 Applications it does a very good job of outlining exactly what is  
 model, view and controller in each example project.

 -jason

 On Jan 28, 2009, at 9:10 AM, asdf_asdf wrote:



  His,

  I am new to GWT and evaluate it currently. Just happily went through
  the official tutorial and full of questions taunting my mind.
  Just a quick background (should my question seem a bit messy): I am
  coming from php field and have in past have been using a mvc framework
  (CodeIgniter) where links/forms on a single webpage are mapped to
  methods of a controller responsible for calling buisiness logic and
  putting together view components. So...

  * Is MVC the recommended design pattern to develop GWT applications? I
  see then the class implementing EntryPoint interface as being a
  controller, but what would be a view in that case? I am struggling
  to understand the relationship between html-page and the controller
  that gets called: does each controller get called by the html-page
  that loads the appropriate javascript file and how could a controller
  have methods mapped to specific a user actions. For instance, after a
  specific link is clicked a new widget is shown (in the tutorial this
  is achieved through listeners, but can there be a url to method
  mapping as well)?

  * In respect to tutorial, what does the attribute path=/stockPrices
  in servlet xml tag mean and the identical annotation
  @RemoteServiceRelativePath(stockPrices) in service interface? I
  assume that the server-side method gets called when under that url,
  but how is the client aware of the mapping?

  * So far I have only seen tutorials on implementing relatively easy
  projects. Does anyone know if there a more powerful sample application
  with open source available: something where there is a need for more
  than one html-page and controller exist?

  Many thanks,
  Denis
--~--~-~--~~~---~--~~
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: interacting users

2009-01-27 Thread gregor

Your server needs to run the games, and you need to look at server
push mechanisms to update the client board displays with moves. You
probably also need to do this so people can invite each other to play.
One method is polling, the other is blocking threads (known as
comet). You can look these up on this group and elsewhere for
details. Once two people decide to play, you can create a new game
instance on the server and push the game start state to both
clients. Basically if player 1 (White) makes a move e2e4 it is
submitted to server, but the request is left hanging (blocked). Player
2 (Black) already has a hanging request from the game start, so
e2e4 is transmitted to him/her to complete this request with the
move. When player 2 submits c7c5 player 1's hanging thread is
written to, and so on.

An interesting question would be how best to manage the player clocks,
especially for speed chess. Pushing opponent's move to client should
be reasonably easy, but synchronizing the three clocks (player
1client , player 2 client , server) in a fair way might be trickier
even though move packets should be very small. You probably need to
think through the implications of the delay between player I making
move and player 2 receiving it etc.

regards
gregor

On Jan 27, 3:33 pm, Owen Powell opow...@gmail.com wrote:
 Hi guys,

 I'd like to know a bit about how to setup user interactions. For
 example, suppose I wanted to make a website where people can play
 chess against each other. People login, see a list of open tables they
 can sit at, when two people sit at the same table a game begins.
 What's the general idea for setting this up? How do I share
 information from one client with another client (player X just sat at
 table Y)? Do both users have to share the same instance of my GWT
 app, or is this not at all how GWT works?

 Thanks in advance,

 ~Owen
--~--~-~--~~~---~--~~
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: Web ontology language file (OWL) into gwt tree

2009-01-27 Thread gregor

Hi Ed,

Are you talking about just a smallish ontology (i.e. the class
definitions etc) which you want to display/edit (e.g. for schema
design purposes), or are you talking about processing a lot of data
from/defined in an OWL source (e.g. navigation/search purposes)?

I don't use OWL sources, but I use RDF/RDFS data quite a lot. I load
RDF files into a Sesame memory store on server and fire SeRQL queries
against it from GWT RPC servlets. This works pretty well. Jenna is an
alternative.

I would think writing a client side OWL browser/editor is non-trivial,
and not helped by the limitations of GWT JRE Emulation. A lot easier I
would think to let Sesame/Jenna do the work on the server, and ship
the results in small chunks to the client. For example I use one RDF
source that defines about 3500 classes and subclasses. I use a lazy
load Tree widget for one view of this (i.e get the top layer, get next
layers if/when user clicks to open branch). This is very quick (Sesame
does the queries in about 16-32ms).

If you need to edit the ontology itself, that's another matter.

regards
gregor

On Jan 27, 11:42 pm, eoc...@googlemail.com eoc...@googlemail.com
wrote:
 Hi,

 I have a web ontology file (.owl) that I have parsed into a string
 using the RequestBuilder and was wondering how I can access all of the
 individual owl:classes and their subclasses on the client, then build
 a tree from this hierarchy as the xmlparser/dom does not work for this
 purpose (though as you might expect it has worked on a test xml case).

 An alternative would be to use the OWL api on the server and return a
 hashmap of all the owl:class,sub:class values, then construct the tree
 from the hashmap.

 I was just wondering whether its possible to do it on the client. Any
 help on this matter would be greatly appreciated!

 Thanks in advance,

 Ed
--~--~-~--~~~---~--~~
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 file upload

2009-01-24 Thread gregor

I think you understand the problem now.

If you wish to continue trying to get round this (i.e. continue to use
the Image newPhoto = new Image(category/photoName) approach) then you
will have to search around the Internet to see if someone has a good
solution for it (that also works in GWT hosted mode BTW!). Remember,
what you are doing is trying to use a very simple method to read the
new dynamically added photos (just by short relative URL) instead of
using a more robust persistence mechanism The public folder is not
designed to handle dynamic data like that, it's meant for static HTML,
CSS, js, image files etc. so you are hitting problems. There may be a
way to do it, I don't know. Someone must have tried before I suppose.

The alternative is to create a more robust mechanism for storing your
photo albums, setting it up automatically when you deploy the
application. One way to do this is to follow these steps:

1) Place your start up example albums in, say, \src\albums. When you
deploy to real Tomcat copy this folder to WEB-INF\classes\album. This
means it is in the classpath for both development and deployment.
2) Add an override init() method to your LoadPhotoFromAlbum RPC
servlet (or any other sevlet you always call before that). In this
method examine if you have already created the real photo album on
disk (i.e. you have preciously run the application on this server),
and if not copy the start up album to set it up. In a real Tomcat
instance you can specify a start up servlet in web.xml to do this, but
you can't (easily) do this in GWT hosted mode). Because you put the
the start up albums in classes\albums  src\albums, you can get at
them using \albums.
3) You need a relative disk location to store the photo album that is
separate from your web application folders but still portable. You
can, for example, place it relative to your Tomcat instance
directories. To get the directory paths you can examine System
properties. This, for example, works for JBoss, Tomcat and GWT hosted
mode Tomcat:

   private static String getSystemBaseDir() {
// try JBoss
String dir = System.getProperty(jboss.server.home.dir);
if (dir!=null) {
log.info(Using JBoss:  + dir);
return dir + File.separator + data;
}
// try Tomcat
dir = System.getProperty(catalina.home);
if (dir!=null) {
log.info(Using Tomcat:  + dir);
return dir;
}
// otherwise GWT hosted mode default
dir = System.getProperty(user.dir);
log.info(Using default dir:  + dir);
return dir;
}

use this to create and subsequently query your album directory
structure under the main Tomcat home directory, but not under the
webapps directory, or your own application's directory. If in any
doubt about which system properties are available, just put this in a
servlet:

Properties props = System.getProperties();
props.list(System.out);

4) Use a Filedownload HttpServlet to get the images instead of using
Image(url) thatreads the photo file and writes it to the servlet
response output stream. Search this group for examples of that, and
there are many examples on the net.

This will definitely work, and it will also work in GWT hosted mode,
Tomcat, and any other servlet container or application server you add
support for in that getSystemBaseDir() method.

regards
gregor





On Jan 24, 12:24 pm, Daniele dany.hat...@gmail.com wrote:
 Nothing works!!!

 For Gregory:
 Application see new photo uploaded when I click on refresh button on
 gwt browser implementation.

 Maybe I have understanding problem.

 Images uploaded necessarily go on public directory because client
 don't have access to other directory on server or local machine, ok?
 When application starting, it's copy all file present on public
 directory and put it on public directory of gwt compilation output
 (usually call com.package.modulename).
 I think error probabilly is on UPLOAD_DIRECTORY path on server side.
 Whats proper path for UPLOAD_DIRECTORY??
 If I set UPLOAD_DIRECTORY= images/album/ application give me an
 error (resource not found or similar)...if I set
 UPLOAD_DIRECTORY=src/com/webphotogallery/public/album/ I go into
 error because this directory it's not seen by application when run,
 but only when I click on reload button..

 My idea are correct?

 Daniele

 (SORRY FOR MY ENGLISH!!! :) Many words are generated by Google Translate! :) )

 2009/1/23, Daniele dany.hat...@gmail.com:

  I try.

  P.S.
  If solution work, it's not important if are better or not :)!!!

  2009/1/23, seanowenha...@googlemail.com seanowenha...@googlemail.com:

  I had a similar problem.

  The problem I have is caused by cacheing of the images which can be
  circumvented with the following hack.

  img.setUrl( the_normal_url + ? + String.valueOf(Math.Random() ) );

  Why does it work, the browser sees it as a new url so does not use the
  cached image

Re: Deployment server side issues

2009-01-24 Thread gregor

Have you set up your web.xml file properly for deployment? Search
group for web.xml for loads of posts about that if not, otherwise post
your web.xml for help.

On Jan 24, 4:49 am, Feltros felt...@gmail.com wrote:
 Some help would be much appreciated.

 On Jan 17, 6:25 am, Feltros felt...@gmail.com wrote:

  Overview:
  Having uploaded all the compiled files (which run fine in hosted and
  compiled modes on my PC) to an Apache server, the front side no longer
  seems able to reach the server side servlets (and their mappings as
  stated in the main .gwt.xml file).

  Points to make clear firstly:
  The server cannot be at fault, my colleague has implemented his own
  GWT project on exactly the same server using server side code and it
  runs perfectly. We have looked over every millimetre of code and the
  directory structures etc and they match perfectly so I am assuming its
  something I do in the compiling phase or something to do with my build
  path?

  Secondarily, I do not have a project-compile.cmd or project-shell.cmd
  or project.launch file since I was creating a GXT (its a widget
  library) application and was compiling/running through eclipse
  (possibly incorrectly hence why things haven't worked?)

  Mappings are as such:
  servlet path=/service class=com.BTI.server.ServerImpl /
  servlet path=/albumUpload class=com.BTI.server.AlbumUpload /
  servlet path=/picture class=com.BTI.server.Picture /

  The problem reveals itself when I do the following:
     service = (ServerAsync) Registry.get(server);
      service.fillUserData(unfilled, new AsyncCallbackUserData(){

                  public void onFailure(Throwable caught) {
                          LoginDialog.this.retry(Server error);
                          Info.display(Error,caught.getMessage());
                  }
                  public void onSuccess(UserData result) {
                          //Other things
                  }});

  Now I am receiving the error (onFailure(Throwable caught)):
  The requested URL /myDomain/MyProject/www/com.BTI.Root/service was not
  found on this server.

  From what I can tell, any calls to com.BTI.root/* go to the tomcat
  directory and are then mapped to
  com.google.gwt.dev.shell.GWTShellServlet by web.xml under tomcat/
  webapps/ROOT/WEB-INF so if it handles the client side script running
  fine then why does it fail for the server side?

  Do I need the gwt-servlet.jar to be included to get servlets to run?
  Is there some special case for this jar? I've read multiple documents
  on how it needs to be in web-inf/lib for servlets to run, but this is
  not the case on my colleagues project which works fine.

  My classpath/buildpath:
  jre
  /src
  /bin
  GWT1.5.3 (gwt-user.jar and gwt-dev-windows.jar)
  GXT1.2.1
  Commons-IO
  Commons-fileupload
  MysqlConnector

  Basically it would appear my servlets aren't being initialised or
  correctly mapped to. Has anyone else encountered this problem and know
  a solution?

  Could it be that my server side is having trouble finding one of its
  imports (such as the mysqlconnector - which is the only import used in
  the login handler which is giving me all the trouble at the moment)?

  Thanks kindly to anyone who can help
--~--~-~--~~~---~--~~
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 MS Office interoperability

2009-01-23 Thread gregor

I came across an MS Office feature mentioned in some web page (can't
remember which I'm afraid) that suggested you could open an iframe in
a panel within MS Office apps. That might be worth exploring, but I
know no details.

On Jan 23, 1:47 am, Arthur Kalmenson arthur.k...@gmail.com wrote:
 I don't know, is it possible to do mail merge with MS Word using
 Javascript and HTML? If the answer is yes, then it's possible with
 GWT. Somehow I doubt it is, AFAIK you need to use VBA for that.

 --
 Arthur Kalmenson

 On Wed, Jan 21, 2009 at 4:55 PM, DanM dan_mara...@hotmail.com wrote:

  Hello - Is it possible to do a mail merge with MS Word using GWT? TIA
--~--~-~--~~~---~--~~
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: Concerns about scalability and limitation in GWT

2009-01-23 Thread gregor

Hi RamiK

On Jan 23, 11:47 pm, RamiK ramikl...@yahoo.com wrote:


 It seems to me that, at the end of the day, GWT creates 1 large HTML
 file (per browser type) that contains all my code in Javascript. That
 works great in small scale but already at this stage, when I have
 hardly written anything, the html files are 500kb.


If you have hardly written anything and you have js files of 500Kb,
something is very wrong with what you've done. A smallish non-trivial
app with maybe 30-40 client side classes should come in maybe 150K. An
app with maybe 200/300+ classes should come in around maybe 400K. The
latter being in range of a serious business web application UI. I
think people have mentioned js file sizes of around 800K - 1MB on the
group for big enterprise applications.

Make sure your GWT compiler setting is -OBFUSCATE if you haven't done
so - this makes a huge difference. Otherwise you may have written
something strange to produce this js file of 500Kb.

The other thing to remember is that these js files are usually cached
by the browser and subsequently checked for updates, so people using
the app every day from the same workstation don't wait for this
download. If the app is big, it is usually building the UI HTML (i.e.
running the javascript) that takes the time, therefore phasing
construction, generating parts in reasonable chunks on demand, can
make a much bigger difference.

regards
gregor









 What will happen when I finish developing my product? Will I end up
 with a 10Mb HTML file? The load performance will be terrible, not to
 mention that there may be some size limitation in the browser for
 length of HTML file or ability to handle thousands of lines of
 javascript code (??).

 Are my concerns founded? Is the GWT development team planning on
 addressing these issues in a future release?
 Did anybody already develop a massive GWT application? How large did
 the HTML file get?

 Thanks!
 R
--~--~-~--~~~---~--~~
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 file upload

2009-01-22 Thread gregor

Hi Danielle,

I might have twigged what the problem is if you are getting this
problem in hosted mode. In hosted mode, the GWT dev shell creates a
temporary Tomcat instance, but it does not seem to copy the public or
client folders to that instance, only the servlets and server side
stuff. I think it just reads the client and public folders from your
source tree and loads them internally so it can run the browser
simulation via Java (so you can debug your client in Java etc). It
will only pick up the new image if you click refresh.

If it does not pick it up if you click refresh, but does if you
recompile, you have a more difficult problem. You need to be quite
certain on this point. You can check this yourself  by creating an
Image in client for a file name that does not exist and running hosted
mode. It won't find it, and if you copy the image file to /public
whist it is still running it still won't find it. But if you hit
refresh it will.

Gregor


On Jan 21, 7:28 pm, gregor greg.power...@googlemail.com wrote:
 OK, say I have test project com.willow.sandbox.Sandbox.gwt.xml

 I run project in hosted mode and URL in the hosted mode browser when I
 run it is:

    http://localhost:/com.willow.sandbox.SandBox/SandBox.html

 I manually put an image in c:\\src\com\willow\sandbox\public\images
 \star.gif

 I display this image in panel like so in my test GWT application:

     someWidget.add(new Image(images/star.gif);

 I run application again and It works fine. Now, still in same hosted
 mode session, I select compile/browse. This displays my application
 in my system default browser, but as part of that process it also
 compiles all the javascirpt, HTML files etc and sets up the public
 folder - including my image, start.gif  This also works, so I close
 this browser tab for now.

 I know open new browser tab and enter this URL (but I do *not* stop
 the hosted mode run - this won't work if you do that because the GWT
 hosted mode Tomcat will be also stopped):

      http://localhost:/com.willow.sandbox.SandBox/images/star.gif

 So my system browser finds and displays the star.gif image no problem!

 If you follow these steps  (using your own paths for the URL of
 course), since we have already proved that the new image file has been
 correctly saved (because String[] photoList = photo.list(); picked it
 up), then you should be able to display the new image in your system
 browser, thus proving beyond reasonable doubt it is really there.

 That will further isolate your problem to either some error in your
 client side code (however unlikely that may seem since it works when
 you reboot), or something weird going on with browser caching.

 regards
 gregor

 On Jan 21, 5:27 pm, Daniele dany.hat...@gmail.com wrote:

  I don't understand..

  2009/1/20, gregor greg.power...@googlemail.com:

   There's something weird about this. Have you tried (while the image is
   in limbo, i.e. just after you've saved it) copying exactly the same
   URL string as your GWT client code produces into your browser/new
   browser tab?

   On Jan 20, 12:31 pm, Daniele dany.hat...@gmail.com wrote:
   Yes.
   Error is not introduced when I make the refresh through the
   push-button or reboot application.
   I am becoming crazy for this bug!!! :)

   Daniele.

   2009/1/20, gregor greg.power...@googlemail.com:

Have you tried hitting the refresh button rather than recompiling/
deploying the application after loading new image. Does this make a
difference?

On Jan 20, 8:59 am, Daniele dany.hat...@gmail.com wrote:
Image saving on folder and String[] photo are ok! I write array on a
file when click on widget album after uploading and image name it's
present.
In development shell, appears this message when I open a album widget
after uploading of image:

Resource not found wpimg/album/Sport/image1.jpg. Could a file missing
from the public path or a servlet tag misconfigured???

Obviously when I reload application, this message disappear.

Daniele

2009/1/19, Daniele dany.hat...@gmail.com:

 I try!

 2009/1/18, gregor greg.power...@googlemail.com:

 so if you place a debug point here:

       private static final long serialVersionUID = 403L;

         public String[] getImageName(String category) {

                 File photo = new
 File(src/com/webphotogallery/public/
 wpgimg/album/
 + category);
                 //File photo = new File(wpgimg/album/ + 
 category);

                 String[] photoList = photo.list();

                 return photoList;   DEBUG
         }

 Does the new image appear in the photoList array?

 On Jan 18, 3:32 pm, Daniele dany.hat...@gmail.com wrote:
 File are saved into a folder that I choose.
 I look into a folder when application make a upload call.
 But image doesn't appear when open a album widget...

 2009/1/14, Daniele dany.hat...@gmail.com:

  I

Re: How to know if my application is running in Firefox or in IE or in any other browser

2009-01-21 Thread gregor

Hi LFCPD,

I agree with Lothar that you should try to achieve your objective
without recourse to detecting the browser.

You are not clear if a) you are inserting the Strings in program code
or b) user is typing them in.

If a) you could back your TextArea entries with a simple model e.g.
String [] days or ListString days and use that later in your code.
If b) you could consider using e.g. a FlexTable with one row per day,
use KeyBoardListener/KeyboardListenerAdapter to pick up enter press
and prepare next input row. This should be more robust, albeit more
complicated to code.

If you absolutely must detect the browser you can do it something like
this (I've retired this code now so it's probably out of date).

public class Browser {

public static boolean isIE() {
 return getBrowserType().equals(ie6);
 }
public static native String getBrowserType() /*-{
  var ua = navigator.userAgent.toLowerCase();
  if (ua.indexOf(opera) != -1) {
  return opera;
  }
  else if (ua.indexOf(webkit) != -1) {
  return safari;
  }
  else if ((ua.indexOf(msie 6.0) != -1) ||
   (ua.indexOf(msie 7.0) != -1)) {
  return ie6;
}
  else if (ua.indexOf(gecko) != -1) {
  var result = /rv:([0-9]+)\.([0-9]+)/.exec
(ua);
  if (result  result.length == 3) {
var version = (parseInt(result[1]) * 10) +
parseInt(result[2]);
if (version = 18)
  return gecko1_8;
  }
  return gecko;
  }
  return unknown;
  }-*/;

}

regards
gregor

On Jan 21, 12:12 pm, LFCPD laieta.hip.hop...@gmail.com wrote:
 Thank Lothar for answering so fast.

 My problem may be solved in another way, but I didn't find it and I'm
 desperate. The problem I have in my application is the following one:

 In a TextArea I insert different strings separated by a new line
 symbol ('\n'). And they are shown well in Firefox and in IE.
 i.e.: If I insert the string: Monday\nTuesday\nWednesday\n...
 It is shown like this in the textArea:
 Monday
 Tuesday
 Wednesday

 Later in the code I need to read the content of the TextArea, and
 divide the strings I insterted before separated by '\n'. In Ie is done
 well, bot not in Firefox, in firefox i get the following:
 Monda
 Tuesda
 Wednesda

 how can I solve it?

 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: Problem with file upload

2009-01-21 Thread gregor

OK, say I have test project com.willow.sandbox.Sandbox.gwt.xml

I run project in hosted mode and URL in the hosted mode browser when I
run it is:

   http://localhost:/com.willow.sandbox.SandBox/SandBox.html

I manually put an image in c:\\src\com\willow\sandbox\public\images
\star.gif

I display this image in panel like so in my test GWT application:

someWidget.add(new Image(images/star.gif);

I run application again and It works fine. Now, still in same hosted
mode session, I select compile/browse. This displays my application
in my system default browser, but as part of that process it also
compiles all the javascirpt, HTML files etc and sets up the public
folder - including my image, start.gif  This also works, so I close
this browser tab for now.

I know open new browser tab and enter this URL (but I do *not* stop
the hosted mode run - this won't work if you do that because the GWT
hosted mode Tomcat will be also stopped):

 http://localhost:/com.willow.sandbox.SandBox/images/star.gif

So my system browser finds and displays the star.gif image no problem!

If you follow these steps  (using your own paths for the URL of
course), since we have already proved that the new image file has been
correctly saved (because String[] photoList = photo.list(); picked it
up), then you should be able to display the new image in your system
browser, thus proving beyond reasonable doubt it is really there.

That will further isolate your problem to either some error in your
client side code (however unlikely that may seem since it works when
you reboot), or something weird going on with browser caching.

regards
gregor








On Jan 21, 5:27 pm, Daniele dany.hat...@gmail.com wrote:
 I don't understand..

 2009/1/20, gregor greg.power...@googlemail.com:



  There's something weird about this. Have you tried (while the image is
  in limbo, i.e. just after you've saved it) copying exactly the same
  URL string as your GWT client code produces into your browser/new
  browser tab?

  On Jan 20, 12:31 pm, Daniele dany.hat...@gmail.com wrote:
  Yes.
  Error is not introduced when I make the refresh through the
  push-button or reboot application.
  I am becoming crazy for this bug!!! :)

  Daniele.

  2009/1/20, gregor greg.power...@googlemail.com:

   Have you tried hitting the refresh button rather than recompiling/
   deploying the application after loading new image. Does this make a
   difference?

   On Jan 20, 8:59 am, Daniele dany.hat...@gmail.com wrote:
   Image saving on folder and String[] photo are ok! I write array on a
   file when click on widget album after uploading and image name it's
   present.
   In development shell, appears this message when I open a album widget
   after uploading of image:

   Resource not found wpimg/album/Sport/image1.jpg. Could a file missing
   from the public path or a servlet tag misconfigured???

   Obviously when I reload application, this message disappear.

   Daniele

   2009/1/19, Daniele dany.hat...@gmail.com:

I try!

2009/1/18, gregor greg.power...@googlemail.com:

so if you place a debug point here:

      private static final long serialVersionUID = 403L;

        public String[] getImageName(String category) {

                File photo = new
File(src/com/webphotogallery/public/
wpgimg/album/
+ category);
                //File photo = new File(wpgimg/album/ + category);

                String[] photoList = photo.list();

                return photoList;   DEBUG
        }

Does the new image appear in the photoList array?

On Jan 18, 3:32 pm, Daniele dany.hat...@gmail.com wrote:
File are saved into a folder that I choose.
I look into a folder when application make a upload call.
But image doesn't appear when open a album widget...

2009/1/14, Daniele dany.hat...@gmail.com:

 I try some.
 Thanks.

 Daniele.

 2009/1/14, gregor greg.power...@googlemail.com:

 There's nothing obviously wrong with this, and the fact that the
 uploaded photo appears when you restart server supports that.
 Next
 obvious thing to eliminate may be to check exactly where on your
 disk
 the uploaded photo is actually written to. Perhaps it is not
 where
 you
 expect, and what is happening is that it is being copied over to
 the
 right location as part of your deployment/hosted mode running
 procedure when you restart server. If you upload a photo and
 then
 check where it goes while the app is still running, you should
 be
 able
 to confirm that one way or another.

 On Jan 14, 1:52 pm, Daniele dany.hat...@gmail.com wrote:
 Code of upload

 [CODE]
 package com.webphotogallery.server;

 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Iterator;
 import java.util.List;

 import javax.servlet.ServletException;
 import

Re: Problem with file upload

2009-01-20 Thread gregor

Have you tried hitting the refresh button rather than recompiling/
deploying the application after loading new image. Does this make a
difference?

On Jan 20, 8:59 am, Daniele dany.hat...@gmail.com wrote:
 Image saving on folder and String[] photo are ok! I write array on a
 file when click on widget album after uploading and image name it's
 present.
 In development shell, appears this message when I open a album widget
 after uploading of image:

 Resource not found wpimg/album/Sport/image1.jpg. Could a file missing
 from the public path or a servlet tag misconfigured???

 Obviously when I reload application, this message disappear.

 Daniele

 2009/1/19, Daniele dany.hat...@gmail.com:

  I try!

  2009/1/18, gregor greg.power...@googlemail.com:

  so if you place a debug point here:

        private static final long serialVersionUID = 403L;

          public String[] getImageName(String category) {

                  File photo = new File(src/com/webphotogallery/public/
  wpgimg/album/
  + category);
                  //File photo = new File(wpgimg/album/ + category);

                  String[] photoList = photo.list();

                  return photoList;   DEBUG
          }

  Does the new image appear in the photoList array?

  On Jan 18, 3:32 pm, Daniele dany.hat...@gmail.com wrote:
  File are saved into a folder that I choose.
  I look into a folder when application make a upload call.
  But image doesn't appear when open a album widget...

  2009/1/14, Daniele dany.hat...@gmail.com:

   I try some.
   Thanks.

   Daniele.

   2009/1/14, gregor greg.power...@googlemail.com:

   There's nothing obviously wrong with this, and the fact that the
   uploaded photo appears when you restart server supports that. Next
   obvious thing to eliminate may be to check exactly where on your disk
   the uploaded photo is actually written to. Perhaps it is not where you
   expect, and what is happening is that it is being copied over to the
   right location as part of your deployment/hosted mode running
   procedure when you restart server. If you upload a photo and then
   check where it goes while the app is still running, you should be able
   to confirm that one way or another.

   On Jan 14, 1:52 pm, Daniele dany.hat...@gmail.com wrote:
   Code of upload

   [CODE]
   package com.webphotogallery.server;

   import java.io.File;
   import java.io.IOException;
   import java.io.PrintWriter;
   import java.util.Iterator;
   import java.util.List;

   import javax.servlet.ServletException;
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;

   import org.apache.commons.fileupload.FileItem;
   import org.apache.commons.fileupload.FileItemFactory;
   import org.apache.commons.fileupload.FileUploadException;
   import org.apache.commons.fileupload.disk.DiskFileItemFactory;
   import org.apache.commons.fileupload.servlet.FileCleanerCleanup;
   import org.apache.commons.fileupload.servlet.ServletFileUpload;
   import org.apache.commons.io.FileCleaningTracker;

   public class UploadPhoto extends HttpServlet{

           /*
            *
            */

           private static final long serialVersionUID = 144332L;

           public void service(HttpServletRequest
   request,HttpServletResponse
   response)
                           throws ServletException, IOException {

                   FileItemFactory factory = new DiskFileItemFactory();
                   ServletFileUpload upload = new
   ServletFileUpload(factory);
                   String UPLOAD_DIRECTORY =
   ./src/com/webphotogallery/public/wpgimg/album/;
                   //String UPLOAD_DIRECTORY = wpgimg/album/;

                   ListFileItem items = null;

                   try {
                                   items = upload.parseRequest(request);
                   }
                           catch (FileUploadException e) {
                                   e.printStackTrace();
                   }

                           Iterator iter = items.iterator();
                           while(iter.hasNext())
                           {
                                   FileItem it = (FileItem)iter.next();

                                   if(it.isFormField())

   UPLOAD_DIRECTORY+=it.getString()
   +
   /;

                                   else
                                   {
                                           File uploadedFile = new
   File(UPLOAD_DIRECTORY + it.getName());

                                           try{

   it.write(uploadedFile);
                                           }catch (Exception e) {
                                                   e.printStackTrace();
                                                   }
                                   }
                           }
           }}

   [/CODE]

   Code of servlet wich return String[] of images
   [CODE]

   package com.webphotogallery.server

Re: Problem with file upload

2009-01-18 Thread gregor

so if you place a debug point here:

  private static final long serialVersionUID = 403L;

public String[] getImageName(String category) {

File photo = new File(src/com/webphotogallery/public/
wpgimg/album/
+ category);
//File photo = new File(wpgimg/album/ + category);

String[] photoList = photo.list();

return photoList;   DEBUG
}

Does the new image appear in the photoList array?


On Jan 18, 3:32 pm, Daniele dany.hat...@gmail.com wrote:
 File are saved into a folder that I choose.
 I look into a folder when application make a upload call.
 But image doesn't appear when open a album widget...

 2009/1/14, Daniele dany.hat...@gmail.com:

  I try some.
  Thanks.

  Daniele.

  2009/1/14, gregor greg.power...@googlemail.com:

  There's nothing obviously wrong with this, and the fact that the
  uploaded photo appears when you restart server supports that. Next
  obvious thing to eliminate may be to check exactly where on your disk
  the uploaded photo is actually written to. Perhaps it is not where you
  expect, and what is happening is that it is being copied over to the
  right location as part of your deployment/hosted mode running
  procedure when you restart server. If you upload a photo and then
  check where it goes while the app is still running, you should be able
  to confirm that one way or another.

  On Jan 14, 1:52 pm, Daniele dany.hat...@gmail.com wrote:
  Code of upload

  [CODE]
  package com.webphotogallery.server;

  import java.io.File;
  import java.io.IOException;
  import java.io.PrintWriter;
  import java.util.Iterator;
  import java.util.List;

  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;

  import org.apache.commons.fileupload.FileItem;
  import org.apache.commons.fileupload.FileItemFactory;
  import org.apache.commons.fileupload.FileUploadException;
  import org.apache.commons.fileupload.disk.DiskFileItemFactory;
  import org.apache.commons.fileupload.servlet.FileCleanerCleanup;
  import org.apache.commons.fileupload.servlet.ServletFileUpload;
  import org.apache.commons.io.FileCleaningTracker;

  public class UploadPhoto extends HttpServlet{

          /*
           *
           */

          private static final long serialVersionUID = 144332L;

          public void service(HttpServletRequest
  request,HttpServletResponse
  response)
                          throws ServletException, IOException {

                  FileItemFactory factory = new DiskFileItemFactory();
                  ServletFileUpload upload = new
  ServletFileUpload(factory);
                  String UPLOAD_DIRECTORY =
  ./src/com/webphotogallery/public/wpgimg/album/;
                  //String UPLOAD_DIRECTORY = wpgimg/album/;

                  ListFileItem items = null;

                  try {
                                  items = upload.parseRequest(request);
                  }
                          catch (FileUploadException e) {
                                  e.printStackTrace();
                  }

                          Iterator iter = items.iterator();
                          while(iter.hasNext())
                          {
                                  FileItem it = (FileItem)iter.next();

                                  if(it.isFormField())
                                          UPLOAD_DIRECTORY+=it.getString()
  +
  /;

                                  else
                                  {
                                          File uploadedFile = new
  File(UPLOAD_DIRECTORY + it.getName());

                                          try{
                                                  it.write(uploadedFile);
                                          }catch (Exception e) {
                                                  e.printStackTrace();
                                                  }
                                  }
                          }
          }}

  [/CODE]

  Code of servlet wich return String[] of images
  [CODE]

  package com.webphotogallery.server;

  import java.io.File;

  import com.google.gwt.user.server.rpc.RemoteServiceServlet;
  import com.webphotogallery.client.LoadPhotoFromAlbum;

  public class LoadPhotoFromAlbumImpl extends RemoteServiceServlet
  implements LoadPhotoFromAlbum{

          /**
           *
           */
          private static final long serialVersionUID = 403L;

          public String[] getImageName(String category) {

                  File photo = new
  File(src/com/webphotogallery/public/wpgimg/album/
  + category);
                  //File photo = new File(wpgimg/album/ + category);

                  String[] photoList = photo.list();

                  return photoList;
          }

  }

  [/CODE]

  Daniele.

  2009/1/14, gregor greg.power...@googlemail.com:

   Perhaps you

Re: GWT for SOA development

2009-01-16 Thread gregor

Spring + Hibernate + GWT is a sound choice and should support most all
of what you need to do. I would look at JBoss SEAM, but then I like
JBoss. All three are tried and tested in the field, so that should
tell you scalability is not an issue. With GWT clients, the key thing
is being able to move session state from the server (where it lives in
e.g. a Struts application), to the client. If it is possible for you
to eliminate most session state maintenance from your server cluster
you will get a significant boost to performance and scalability since
you get less HttpSession synchronization chatter across the cluster.

This of course is in your own hands. Spring, Hibernate, GWT  and your
application server won't stop you doing this right, but they won't do
it for you automatically either.

On Jan 16, 10:34 am, Paranoid Android paranoid.fa...@gmail.com
wrote:
 Thank you. I'm convincing myself that this could be the possible best
 solution.
 I also looked at the architecture of some white label social
 networking platforms and portals like Elgg, LinkedIn, Liferay etc..
 and it seems that the architecture i've described in the previous post
 could be both robust and flexible enought for  my solution.
 Using GWT I can develop an high quality interface, higher than a JSP
 based from my poit of view, also moving some complexity and computing
 overhead to the client.
 With the Spring framework I've an ascertained and robust backbone for
 implementing services and managing data with Hibernate in a simpler
 and managed way.
 Besides that, I can integrate some messaging system, maybe based on
 ActiveMQ and thanks to message driven beans provided by Spring, if
 such need will arise in the future or in the more detailed design
 phases.
 In this way I can concetrate, in the first design phases, to other
 concers more related to the social aspect of the platform (i.e.
 sociability design, data portability etc) than to spend a lot of time
 developing some kind of more advanced message-based architecture
 using ESB like ServiceMix.
 I've only one concern: scalability.
 How does this solution conciliate with scalability issues. Is this
 architecture scalable? Can this architecture support the goals of my
 project? What do you think?

 On Jan 15, 5:35 pm, gregor greg.power...@googlemail.com wrote:

   If, for example, I've an application with a rich client interface
   (e.g. builded using gwt) that interacts with, let's say, with a
   Session Facade..(ejb, spring, or whatever).
   My Model is composed of services and a typical persistence layer...
   now hypothesize that everything is well done, i.e. services reflects a
   business decomposition etc..etc...
   Isn't this a good solution? Is this SOA? Is this MVC?

  I think what you are describing here is an industrial strength Java EE
  + GWT architecture for a system that is fully capable of
  *participating* in an SOA since all the business services (EJB/Spring
  based, whatever) can be exposed in multiple ways to third party
  systems as required, including an ESB supporting an SOA environment.
  An application server like JBoss, for instance, has a plethora of
  tools to help you do this (including it's own ESB as it happens), and
  I think Spring is the same.

  MVC is another matter, and IMO it is another buzz term that means all
  sorts of things to different people. MVC was originally invented
  during the Apple Lisa project (the first real WIMP framework) in the
  early 1980's I believe, and I think it was implemented in Smalltalk,
  one of the first proper OO languages, which was specifically
  designed to support MVC. Struts is most definitely MVC:
  JSP==View;Action==Controller;Bean==Model etc. But it has to be that
  way to run the cycles of pages in the application.

  However in GUI programming environments the role of Controller becomes
  moot, or confused. Swing, for example, is often accused of not being
  true MVC because there is no real enforcement or even encouragement
  to cleanly separate a View (i.e. a widget) from a Controller, whatever
  that actually means in the context of a client GUI.

  For a GWT example, suppose you have a Tree, you select an item from it
  and you want to display some details about that item in second panel.
  You might have the widget containing the tree implement
  SourcesChangeEvents, and the display panel implement ChangeListener,
  so the display panel is notified when user selects a Tree item.
  DisplayPanel has its onChange(Widget sender) method called, retrieves
  the item identifier from the sender (the Tree) and calls an
  asynchronous RPC service to get the details. RPC servlet calls, say, a
  Session EJB to fetch the Model object concerned, then returns it to
  DisplayPanel callback onSuccess(object result) method, from whence
  DisplayPanel can populate its fields.

  As you can see the Controller element is split up all over the place
  because what you have here is a distributed n-tier architecture

Re: GWT for SOA development

2009-01-15 Thread gregor



 If, for example, I've an application with a rich client interface
 (e.g. builded using gwt) that interacts with, let's say, with a
 Session Facade..(ejb, spring, or whatever).
 My Model is composed of services and a typical persistence layer...
 now hypothesize that everything is well done, i.e. services reflects a
 business decomposition etc..etc...
 Isn't this a good solution? Is this SOA? Is this MVC?


I think what you are describing here is an industrial strength Java EE
+ GWT architecture for a system that is fully capable of
*participating* in an SOA since all the business services (EJB/Spring
based, whatever) can be exposed in multiple ways to third party
systems as required, including an ESB supporting an SOA environment.
An application server like JBoss, for instance, has a plethora of
tools to help you do this (including it's own ESB as it happens), and
I think Spring is the same.

MVC is another matter, and IMO it is another buzz term that means all
sorts of things to different people. MVC was originally invented
during the Apple Lisa project (the first real WIMP framework) in the
early 1980's I believe, and I think it was implemented in Smalltalk,
one of the first proper OO languages, which was specifically
designed to support MVC. Struts is most definitely MVC:
JSP==View;Action==Controller;Bean==Model etc. But it has to be that
way to run the cycles of pages in the application.

However in GUI programming environments the role of Controller becomes
moot, or confused. Swing, for example, is often accused of not being
true MVC because there is no real enforcement or even encouragement
to cleanly separate a View (i.e. a widget) from a Controller, whatever
that actually means in the context of a client GUI.

For a GWT example, suppose you have a Tree, you select an item from it
and you want to display some details about that item in second panel.
You might have the widget containing the tree implement
SourcesChangeEvents, and the display panel implement ChangeListener,
so the display panel is notified when user selects a Tree item.
DisplayPanel has its onChange(Widget sender) method called, retrieves
the item identifier from the sender (the Tree) and calls an
asynchronous RPC service to get the details. RPC servlet calls, say, a
Session EJB to fetch the Model object concerned, then returns it to
DisplayPanel callback onSuccess(object result) method, from whence
DisplayPanel can populate its fields.

As you can see the Controller element is split up all over the place
because what you have here is a distributed n-tier architecture with
an AJAX UI, and, unlike Struts, it doesn't fit neatly into pure MVC.
The same sort of thing happens with Swing/SWT. In the Apple Lisa days,
I think it was assumed an application would either run pretty much all
on a server to a dumb client or alternatively pretty much all on the
client just accessing maybe a database sever, so the original MVC
didn't really cater for all this.

This is not to say that you cannot implement pure MVC in a GWT client
(I think there are projects around that directly support this) but it
can take extra effort that may not really be worth it. One case where
true MVC does earn its dinner is where you have a complex model
(something like a work flow process for example) which supports
multiple views, all of which might update it and all of which need
notifying of changes to it. In this case the Views should interact
with the model via a Controller only or you will end up with
unmaintainable spaghetti.

I have no idea what MVC has got to do with messaging. Perhaps ESB
vendors would like people to think of their message buses as
Controllers, and in the multi-system business process scenario
discussed above they undoubtedly are, but MVC usually refers to how a
UI interacts with the Domain Model.

regards
gregor




 My idea is that, FROM A PRACTICAL (implementation) point of view, SOA
 can be (also) simply a way to think about the Model, in a reusable and
 loose-coupled way and can be a very good solution even without going
 to complex message-based MVC.

 On Jan 15, 9:53 am, Paranoid Android paranoid.fa...@gmail.com wrote:

  Thank you gregor, I think your advices could be very useful to me.
  My biggest concern, anyway, is not to run on multiple clients. Even if
  I can't discard this possibility by now, it has not yet been
  identified as a requirements of the application.
  The biggest concern is to expose a set of features that future
  developers that want to add some higher level functionalities can use
  with no or minimal changes to the underlying architecture.
  As I said, specifically to the domain of the application, something
  pretty similar to Google OpenSocial Apis, but using standars like web
  services.
  This is the biggest concern, than the system should be scalable and
  maybe distributed, so the architecture must be
  thought in a way that it will not be a problem if users scale from 100
  to 10

Re: Problem with file upload

2009-01-14 Thread gregor

Perhaps you are building a data structure to hold a map of image names
for the different albums that is done once and once only in one of
your servlets? That would explain why when you add a new image it does
not appear on your album lists until you restart the server.

If you post the code for your file upload servlet (the one that
uploads a new image) and your RPC servlet that returns lists of image
names for a given album, we might be able to help you sort it out

regards
gregor

On Jan 14, 8:56 am, mon3y darkside...@hotmail.com wrote:
 Hmmm..i just read that and it confused me

 What i meant to say is. Every time you send a photo to your servlet
 add a timestamp

 myPhoto + System.getCurrentTime() + . jpg;

 Then your are going to have to keep and array of timestamps for each
 photo. So when you load the photos you know which timestamp belongs to
 which photo.

 Just an idea.

 HTH
 :)

 On Jan 14, 2:02 am, Daniele B dany.hat...@gmail.com wrote:

  I've a problem with my photogallery application.
  Application work like this:
  On textbox enter a album name.
  On FileUpload widget, select image to upload on server.
  When user click on album widget, program send a GWT-RPC call to a
  servlet which send back string array of images URL.
  But when I upload a new photo, it's not viewed...only when I restart
  application new photo are view.

  Sorry for my english.

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



  1   2   3   >