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

2013-04-28 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/
>> RequestHeader edit X-GWT-Module-Base ^(.*)/client/(.*)$ 
>> $1/client/$2
>> ProxyPass / http://10.0.0.8:8080/client/
>> RequestHeader edit X-GWT-Module-Base ^(.*)/(.*)$ $1/client/$2
>>
>> 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/
RequestHeader edit X-GWT-Module-Base ^(.*)/client/(.*)$ 
$1/client/$2
ProxyPass / http://10.0.0.8:8080/client/
RequestHeader edit X-GWT-Module-Base ^(.*)/(.*)$ $1/client/$2

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.




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.



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.



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 post json content?

2012-05-19 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.



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.



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: 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 
FactoryObfuscatorBuilder(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: Design pattern for db driven GWT application

2009-05-10 Thread gregor

Hi Neo,

>
> I would like to put all my RPC calling logic in some sort of a
> delegate class and let the delegate class return the values to my
> Client class. But I doubt if that will work out as the return type of
> the onSuccess method is void :(
>
> To summerize, this is what I would like to have :
> Client (Design Layout, Call delegate method) >
> Delegate (make RPC calls, return value to Client) ->
> Server (Implement DAO logic, return value to delegate)
>
> Is it possible to achieve this sort of a design with GWT apps ?
>

What I think is causing you a problem is the asynchronous nature of
AJAX server calls and GWT RPC in particular. You cannot avoid this, so
you cannot have your server call simply return a value to the method
that originated it  - you have to call a method on your widget
somewhere (or something else) from the callback, i.e. onSuccess().

As Miroslav demonstrates, you can use a full blown MVC design to
encapsulate this process. In this case the view (i.e. widgets) will
delegate the task of calling the server to a controller which now
handles the asynch call details and updates the Model. An model change
event is then fired that the widgets listen out for and update their
displays accordingly.

IMO opinion the real value in this approach is if you have more than
one widget, or UI component, that uses the same model objects (and
therefore would ideally share server calls) since this makes for
significant reuse and also keeps multiple views of the same model data
in line. Otherwise it can make for more work and more complicated
code.

Whatever, the thing is you cannot avoid the asynchronous nature of RPC
calls, you have to live with them.

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: 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  wrote:
>
> > On 15 avr, 13:51, ytbryan  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-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  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  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  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 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  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  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 .gwt.xml file. you will then probably
need to specify the source path in it - that can be as simple as:




  // or whatever


so "src" (whatever) specifies your module source code location
relative to the .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 .gwt/xml file
first, then follow the source path instruction to find the .java
files.

regards
gregor

On Apr 4, 5:28 pm, Gugle  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  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!
>
> 

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

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  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: 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  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
>
> 
> 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">
>   j2eeEAR
>   
>     j2eeEjb.jar
>   
> 
>
> and this is the corresponding ejb-jar.xml of the j2eeEjb.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">
>     j2ee
>     
>     
>       StSchBean
>     
>   
>   j2eeClient.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+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  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: 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  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: 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
>
> /de.stsch.gwtejb.GwtEjb/GwtEjbSrc
>
> 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  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  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 List getObjectListe() {
>     List sortedList = model.getObjects();
>     Collections.sort(sortedList, new Comparator() {
>         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: 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  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: 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=gst&q=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  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 List 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: RPC error - garbled text as the response.

2009-03-13 Thread gregor

(DefaultServlet.java:698)
at org.apache.catalina.servlets.DefaultServlet.doGet
(DefaultServlet.java:354)

That doesn't look right. Are you sure this stack trace was caused by
your RPC service call? If it was you need to figure out how come a
doGet(..) is being called. GWT RPC servlets use POST AFAIK.


On Mar 13, 10:25 am, Magius  wrote:
> I remenber to have read that GWT-RPC zips the data sent in some cases.
> And your message has a "PK" mark, the same that for ZIP files.
> If this is true the RPC message could be ok.
>
> I cannot help wtith the rest. In the exception log there isn't any gwt
> classes...
>
> By the way, I migrated from GWT 1.4 to 1.5 with almost no changes in
> the code.
> And GWT 1.5 compiles faster and using a lot of less memory.
>
> I hope it helps a bit.
>
> On Mar 12, 10:16 am, cij100  wrote:
>
> > Hi,
>
> > I have a gwt based application,that uses RPC calls to communicate with
> > the server. Normally this works fine, however occasionally the
> > response fails and I'm unsure what is causing it. Using firebug, I can
> > see the response is garbled text instead of the OK message. An example
> > of the response is below:
>
> > f8
> >   PKk 0 /9 ` G > 0rXYz ] Q f ~N 8
> > V IH 77 k "  ~ I4 *3 , A1 e_< - * vچ xi th r + '8F C
> > $ + q  xJ ' F ˛7q O 6 ̵ J h/ ㍕
>
> > ռ j y Vb O ^g " +  -5
> > 0
>
> > The server logs seem to show the server impl processing was completed
> > sucessfully, but the localhost log shows the following stack trace:
>
> > 12-Mar-2009 08:52:13 org.apache.catalina.core.StandardWrapperValve
> > invoke
> > SEVERE: Servlet.service() for servlet default threw exception
> > java.lang.IllegalStateException
> >         at org.apache.catalina.connector.ResponseFacade.sendError
> > (ResponseFacade.java:404)
> >         at org.apache.catalina.servlets.DefaultServlet.serveResource
> > (DefaultServlet.java:698)
> >         at org.apache.catalina.servlets.DefaultServlet.doGet
> > (DefaultServlet.java:354)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> > (ApplicationFilterChain.java:252)
> >         at org.apache.catalina.core.ApplicationFilterChain.doFilter
> > (ApplicationFilterChain.java:173)
> >         at org.apache.catalina.core.StandardWrapperValve.invoke
> > (StandardWrapperValve.java:213)
> >         at org.apache.catalina.core.StandardContextValve.invoke
> > (StandardContextValve.java:178)
> >         at org.apache.catalina.core.StandardHostValve.invoke
> > (StandardHostValve.java:126)
> >         at org.apache.catalina.valves.ErrorReportValve.invoke
> > (ErrorReportValve.java:105)
> >         at org.apache.catalina.core.StandardEngineValve.invoke
> > (StandardEngineValve.java:107)
> >         at org.apache.catalina.connector.CoyoteAdapter.service
> > (CoyoteAdapter.java:148)
> >         at org.apache.coyote.http11.Http11AprProcessor.process
> > (Http11AprProcessor.java:833)
> >         at org.apache.coyote.http11.Http11AprProtocol
> > $Http11ConnectionHandler.process(Http11AprProtocol.java:639)
> >         at 
> > org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:
> > 1285)
> >         at java.lang.Thread.run(Thread.java:619)
>
> > At present I am still using gwt1.4, the inention is to upgrade to 1.5
> > shortly, and it's running against a tomcat 6 server.
>
> > Is there anything obvious that I need to do to avoid these sorts of
> > error, or methods to debug what has gone wrong between me completing
> > the impl code processing and recieving the response on the client?
>
> > 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: 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  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  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 wrote:
>
> > > 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"
> > >  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  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 
> &g

Re: Loading Images into GWT via MySQL

2009-03-12 Thread gregor

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"
 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  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 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  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 wrote:
>
>
>
> > 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  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

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  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: Performance better setting attributes in CSS or in Java code?

2009-03-10 Thread gregor

I think theoretically assigning width/height properties via CSS is
faster than in code. However since this is typically done only once
per widget, the difference is immaterial for most practical purposes.
In javascript it's repetition that kills you performance wise, say
creating many table cells for a tree or a grid, or iterating through a
large array repeatedly. In this case the difference would be
undetectable by a user and that's all that matters really.

So I concur with Ian. Choose the method that suits your application
best according to other criteria. In Ian's example he needs to enable
certain properties to altered by page designers, but others that would
break the UI not. In my case I set most size properties in code
because I find it much easier to write and maintain layout logic that
way, but everything else (e.g. fonts, colours, margins) I set in CSS
styles.

On Mar 10, 10:52 am, ginger_ninja  wrote:
> Donald Knuth is credited as once saying "Premature optimization is the
> root of all evil". I think the question you're asking here is well
> intentioned John, however misguided. Whilst performance is important
> we're often blinded by it's supposed benefits as developers and forget
> more important concepts like separation of concerns. This is the key
> design principle that should be considered here, not performance. As
> you'll also see though there are some nice performance benefits in
> taking steps to keep things separate.
>
> Setting a style in CSS allows for the presentation aspects of the
> application to be nicely decoupled from the application code. Using
> CSS over code however is beneficial for a number of reasons:
>
> 1. It reduces the amount of code you have to write.
>
> This cannot be understated enough. In browser land less code == better
> performance. The vast majority of AJAX/RIA performance shortcomings
> have nothing to do with running code, but rather the time taken to
> download and parse your JS (check out the YSlow plugin for Firebug if
> you're in any doubt as to the truth of this statement...oh but I must
> warn you, it will hurt your feelings). So by doing the right thing in
> keeping your different concerns separate you actually win when it
> comes to performance.
>
> 2. It keeps your code clean and focused on solving the business
> problem at hand.
>
> When it comes to maintenance (which we all learn at uni is actually
> 80% of any application's total cost over its lifetime) there's nothing
> worse than trying to pick your way through a veritable minefield of
> presentation related cruft in an attempt to fix a logical problem. One
> wrong move, one misunderstood line and BAM, you've broken your
> carefully crafted interface. This is part of the reason why separating
> your concerns is so valuable, in a way it's your insurance against
> complexity. If you can adequately separate things you're effectively
> confining the risk to a single discrete, and usually well understood
> unit of functionality.
>
> 3. You can modify the look of your application without touching your
> code.
>
> From a straight development perspective this is a real time saver. If
> you're like me and have to develop large parts of your app in situ
> inside an existing web application you don't have the luxury of using
> the Hosted Mode browser for the home stretch. If you insist on putting
> all of your styles inside your code you're stuck with a total
> recompile (which for me takes up to a minute) before you can see if
> your change was successful. Painful.
>
> Further down the track if your client changes their mind and wants
> something changed, say a particular color or font, it's really nice if
> you can make the change without a recompile. With every code change/
> recompile there's always the possibility that you will break something
> that was previously working. Not good when you're working on something
> mission critical, or high availability.
>
> 4. CSS style are computed natively.
>
> Again this is a performance win. Anything that can be carried out
> natively by the browser is going to win over interpreted code. Sure
> some JS VMs like TraceMonkey and Squirrelfish can analyse your code
> and improve execution speed (and in some cases surpass native
> performance), however the issue here is that this on the fly
> optimisation doesn't come free. This is really only beneficial for
> repetitive or frequently run pieces of code which may be aggressively
> optimised. Styles for the most part, bar dynamic ones (e.g. setting
> width in animations), don't change often enough for this to be of
> use.
>
> A common strategy which I use in real life is to apply classes to
> absolutely everything that could require styling. Then when I start
> the process of pulling together the look and feel I simply load the
> page, start analysing the page structure and the class names, then
> write my CSS. You'd be surprised how much flexibility you have and how
> quickly it all comes together.
>
> Regards

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  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: 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  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: 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  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: 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  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  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: Models not added to Serialization Policy

2009-03-03 Thread gregor

Hi Ben,

That should work. I would guess an non-obvious mistake in either
Adress or Customer is resposible.

regards
gregor


On Mar 1, 11:02 am, ben  wrote:
> Hi
>
> I have a model class Customer and this one has as a member variable an
> instance of the model class Address. Both of them satisfy the
> requirements for serializable Java beans (default constructor,
> serialVersionUID, implements java.io.Serializable). The path to the
> model classes are also included as source tag in the .gwt.xml property
> file: 
>
> The Service method getCustomer() has as return value a Customer. When
> I execute a RPC-call an exception will occur: Type
> 'com.company.gwt.server.model.Address' was not included in the set of
> types which can be serialized by this SerializationPolicy.
>
> The Address Class is really not included in the SerializationPolicy.
> When I add a dummy service Method which include the Address Object as
> an argument or return value - also Address will be included in the
> Policy.
>
> How are the relevant Model classes elected for the
> SerializationPolicy? Doesn't the gwt compiler iterate over the whole
> object graph? How can I force the compiler to include also indirectly
> used model classes in the policy?
>
> Thanks in advance
> ben
--~--~-~--~~~---~--~~
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  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: 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  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: 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  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: 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  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  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: 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  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

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

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

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



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  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  wrote:
>
> > I think you are missing gwt-servlet.jar from the classpath section.
>
> > On Feb 21, 5:26 am, BobM  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:
> > > 
> > >   
> > >      > >       fork="true"
> > >       spawn="true"
> > >       maxmemory="256m" >
> > >       
> > >       
> > >       
> > >       
> > >         
> > >         
> > >          > > path="/usr/local/Java/GWT/gwt-linux-1.5.0/gwt-user.jar"/
>
> > >         
> > >       
> > >     
> > >     
> > > The GWT shell is starting.
> > >     
> > >   
>
> > > 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:
> > >    > >            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 runnin

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

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

On Feb 21, 5:26 am, BobM  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:
> 
>   
>            fork="true"
>       spawn="true"
>       maxmemory="256m" >
>       
>       
>       
>       
>         
>         
>         
>         
>       
>     
>     
> The GWT shell is starting.
>     
>   
>
> 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:
>               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  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  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 hoste

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  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  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  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  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  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" 
> > >> > 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  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
> > >> > > >    Ser

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  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: 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-5&s=google-web-toolkit-doc-1-5&t=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



or alternatively in the module get.xml file as









On Feb 18, 4:22 am, BobM  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  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  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  wrote:
>
> > On Feb 18, 1:39 am, BobM  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  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  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: Resource not found: org.bcs.Main/org.bcs.Main.nocache.js ??

2009-02-17 Thread gregor



On Feb 18, 1:39 am, BobM  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  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  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-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  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  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


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

You don't use doGet() in RPC servlets, you call methods specified in
the RemoteService interface. Perhaps a better way is to transfer your
data to client is create a simple DTO class that represents a row of
data. You then return a List of these DTO's from your RPC servlet
method. Create the DTO's  by iterating through the result set of your
SQL query. This is lot easier and more efficient than parsing a CSV
string client side.

On Feb 17, 1:30 pm, ytbryan  wrote:
> hi all,
> i am not sure if i am doing the right thing.
>
> i put a doGet() in my  MySQLConnServiceImpl class which extends the
> remoteserviceservlet.
>
> because i want to call the class so that it can allow me to download a
> csv.
>
> but i got this error when i call it from my client class.
>
> my client method
>    public void onClick(BaseItem button, EventObject e) {
> Window.open("http://www.localhost:/
> com.tribling.gwt.test.mysqlconn.server.MySQLConnServiceImpl",
>                                   "testing", "");
>
> }
>
> my MySQLConnServiceImpl doGet
>
>         response.setContentType("text/plain");
>         response.setHeader("Content-Disposition", "attachment;
> filename=myjdbcfile.csv");
>               PrintWriter out = response.getWriter();
>               FileWriter fw = new FileWriter(filename);
>               fw.append("Date");
>               fw.append(',');
>               fw.append("Sourceforge");
>               fw.append(',');
>               fw.append("Trial");
>               fw.append(',');
>               fw.append("Sale");
>               fw.append(',');
>               fw.append("OSTrial");
>               fw.append(',');
>               fw.append("TrialSale");
>               fw.append(',');
>               fw.append("OSSale");
>               fw.append('\n');
>              .
>              .
>              .
>              .
>
> 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.
--~--~-~--~~~---~--~~
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  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: 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=gst&q=gregor+command+line+client#17cbba95ae5e58e0



On Feb 16, 4:07 pm, Allahbaksh  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: 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  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  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  wrote:
>
> > > That looks like a glassfish message? Are we talking about hosted mode
> > > here or web mode?
>
> > > On Feb 14, 8:07 pm, BobM  wrote:
>
> > > > This is how the service is called:
>
> > > >     selectionSearchService.findAllLikeThis(serviceProvider,
> > > > selectionSearchCallBack);
>
> > > > How the service is setup in the module xml file:
>
> > > >    > > >            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";>GlassFish/v3
> > > > - Error report<!--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;}--> HTTP Status 404 -  > > > h1>type Status reportmessage > > > p>descriptionThe requested resource () is not available. > > > p>GlassFish/v3
>
> > > > 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-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-5&s=google-web-toolkit-doc-1-5&t=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=gst&q=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  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  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
> > Compo

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  wrote:
> This is how the service is called:
>
>     selectionSearchService.findAllLikeThis(serviceProvider,
> selectionSearchCallBack);
>
> How the service is setup in the module xml file:
>
>               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";>GlassFish/v3
> - Error report HTTP Status 404 -  h1>type Status reportmessage p>descriptionThe requested resource () is not available. p>GlassFish/v3
>
> 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: 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  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

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

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  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: 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: Struts+GWT

2009-02-12 Thread gregor

I would search the group for many posts about struts and GWT. Some
people are forced to integrate GWT with legacy struts systems, but the
bottom line is that if you are starting out a new app, you do not need
to use struts. Use GWT RPC.

On Feb 12, 10:09 am, Rockster  wrote:
> Could you state what the reason is you want to use Struts in
> combination with GWT ?
>
> On Feb 12, 8:37 am, GWT GWT  wrote:
>
>
>
>
>
> > Hi ,
> > I am trying to develp an application using GWT+Struts .
> > I had search on net But I am not getting tutorial to develop  an application
> > using GWT+Struts.
> > So from where will I get that tutorial.
--~--~-~--~~~---~--~~
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"  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  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  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=gst&q=file+download+servlet#86ae704a16f5a077



On Feb 10, 3:47 am, pettysoldier  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: 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  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: 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  wrote:
> well, at least replace it..
>
> On 6 feb, 10:41, "alex.d"  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  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  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 
> > > > > > wrote:
>
> > > > > > > On 5 Feb., 16:10, gregor  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 chang

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


>
> 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  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 
> > > wrote:
>
> > > > On 5 Feb., 16:10, gregor  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"  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  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  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

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) {  wrote:
> can someone help?
>
> below are my rpc request code.
>
> private void getData() {
>
>   AsyncCallback callback = new AsyncCallback() {
>    // 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;
>
>           AsyncCallback callback1 = new AsyncCallback()
> {
>            // 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  wrote:
>
> > I just insert Window.alert("") into getdata1(); and i realised that
> > the method is called but no window alert appears. i inserted  a
> > println after onsuccess and onfailure and something is printed out.
>
> > basically, onsuccess and onfailure are skipped? how is it possible?
>
> > On Feb 6, 11:58 am, ytbryan  wrote:
>
> > > below is the code where i execute the rpc request. i create getdata()
> > > and getdata1() to get execute different query. i am using two Async
> > > object to make call. i am  not sure is it correct as i got error when
> > > i use one. any help/advice is welcome and appreciated. :D
>
> > > private void getData() {
>
> > >   AsyncCallback callback = new AsyncCallback() {
> > >    // fail
> > >    public void onFailure(Throwable ex) {
> > >     RootPanel.get().add(new HTML(ex.toString()));
> > >    }
>

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

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  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 wrote:
>
>
>
> > On 5 Feb., 16:10, gregor  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"  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

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"  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: 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  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: 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  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: Best image preloading practice?

2009-02-05 Thread gregor
issue? A cpu one? I think in total we are only talking
> about 20MB of images here, 30MB at most.

You are thinking of loading 20MB of images into the DHTML DOM of you
application. The DOM is maintained by the browser, and it is not
designed to deal with 20MB documents (big e.g. 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  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 

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  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: 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=gst&q=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  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  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  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  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 

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

2009-02-03 Thread gregor
ner equivalent to method 2.
It's instructive to compare this with how a normal Button is
constructed in methods 1 & 2.

function $SandBox(this$static){
  this$static.layout = $HorizontalPanel(new HorizontalPanel());
  this$static.ajaysButtonOne = $SandBox$1(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  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 .

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



On Jan 30, 1:44 pm, Ajay Garg  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  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  wrote:
>
> > > Also, that might also eliminate the "Memory Leak" problem, as stated
> > > athttp://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=goog...
>
> > > On Jan 30, 5:27 pm, Ajay Garg  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  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-5&s=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 Composi

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  wrote:
> Also, that might also eliminate the "Memory Leak" problem, as stated
> athttp://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=goog...
>
> On Jan 30, 5:27 pm, Ajay Garg  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  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-5&s=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  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  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  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  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 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  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  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  wrote:
>
> > > On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
> > >  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

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  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  wrote:
>
> > On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
> >  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

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-5&s=google-web-toolkit-doc-1-5&t=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  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  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  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  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-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  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  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: 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" 
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: 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  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: 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  wrote:
> Some help would be much appreciated.
>
> On Jan 17, 6:25 am, Feltros  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:
> > 
> > 
> > 
>
> > The problem reveals itself when I do the following:
> >    service = (ServerAsync) Registry.get("server");
> >     service.fillUserData(unfilled, new AsyncCallback(){
>
> >                 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: 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  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 :
>
> > I try.
>
> > P.S.
> > If solution work, it's not important if are better or not :)!!!
>
> > 2009/1/23, seanowenha...@googlemail.com :
>
> >> I had a similar problem.
>

Re: Concerns about scalability and limitation in GWT

2009-01-23 Thread gregor

Hi RamiK

On Jan 23, 11:47 pm, RamiK  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: 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  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  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: 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  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  wrote:
>
> > I don't understand..
>
> > 2009/1/20, gregor :
>
> > > 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  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 :
>
> > >> > 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  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  tag misconfigured???
>
> > >> >> Obviously when I reload application, this message disappear.
>
> > >> >> Daniele
>
> > >> >> 2009/1/19, Daniele :
>
> > >> >> > I try!
>
> > >> >> > 2009/1/18, gregor :
>
> > >> >> >> so if you place a debug point here:
>
> > >> >> >>       private static final long serialVersionUID = 403L;
>
> > 

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  wrote:
> I don't understand..
>
> 2009/1/20, gregor :
>
>
>
> > 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  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 :
>
> >> > 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  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  tag misconfigured???
>
> >> >> Obviously when I reload application, this message disappear.
>
> >> >> Daniele
>
> >> >> 2009/1/19, Daniele :
>
> >> >> > I try!
>
> >> >> > 2009/1/18, 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  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 :
>
> >> >> >>> > I try some.
> >> >> >>> > Thanks.
>
> >> >> >>> > Daniele.
>
> >> >> >&

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



  1   2   3   >