Accessing a method in a server not through RPC ?

1 view
Skip to first unread message

Suren

unread,
May 18, 2009, 2:49:45 AM5/18/09
to Google Web Toolkit
Hi All,

I have a question here...My sincere apologies if it sounds odd ( I
knew it will :-) )

I have a method defined in a server class, I want to access that
methodfrom my client but not through RPC. Just like normal JAVA
inhertiance can I call a method defined in the server class??


The reason why I am asking / thinking like this because, I am thinking
of accessing methods in two different server classes

how is that possible?

Thanks
Suren

Salvador Diaz

unread,
May 18, 2009, 3:40:17 AM5/18/09
to Google Web Toolkit
Hi,

> inhertiance can I call a method defined in the server class??

Well, the class is located in the server, I'm not sure how you imagine
the client-side javascript would call a java method in a class that it
is not aware of.

> The reason why I am asking / thinking like this because, I am thinking
> of accessing methods in two different server classes

And why can't you use normal RPC for this? (Hint: you can)

Cheers,

Salvador

Suren

unread,
May 18, 2009, 4:13:56 AM5/18/09
to Google Web Toolkit
Hi,

Thanks for the reply. Yes I do agree thats not possible now..

But my requirements are making me to think such stupid things..

Here is what I am trying to do..

I have an already defined RPC, which I am using to fetch DB values
returned to my client. And in the client, I am populating the data
into a Grid with 100 rows and 80 columns.

Now my pblm is to refresh that Grid in a regular interval..

My assumption and what I 've done :
If I call that same RPC inside a timer to update the Grid every 2
minutes.. I wanted to do this process in a background. So I am
populating the data into a different Grid anyway...once thats done, I
can assign the refreshed Grid to the old Grid. So that user can have
feel that the Grid is refreshed without any issues..

This is what happend :
Eventhough I am trying to populate into a new Grid, my previously
populated Grid is also affected..My Grid Display is lost..Only after
that population is done,..the grid is visible to the user..

so what I thought was..If I can use a different RPCs for initial
population and further refresh..this wont happen..

But I couldnt have two RPCs in a single client...servlet path and
mapping issues..

So I thought of asking such question here..

I had already posted this pblm before in this forum..this can be an
extension to that...

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/b61b72a390d09d96/0f7e4fbb37f648cd?lnk=gst&q=nsurendiran#0f7e4fbb37f648cd

I have put enough effort for this already..

Kindly help me

Thanks
Suren
> > Suren- Hide quoted text -
>
> - Show quoted text -

Carl Pritchett

unread,
May 18, 2009, 11:14:45 PM5/18/09
to Google Web Toolkit



> This is what happend :
> Eventhough I am trying to populate into a new Grid, my previously
> populated Grid is also affected..My Grid Display is lost..Only after
> that population is done,..the grid is visible to the user..
>

It would seem to me that this is caused by sharing some common data -
perhaps you could make a copy of the data to ensure the two grids are
independent?

> But I couldnt have two RPCs in a single client...servlet path and
> mapping issues..

I think that the issue above is the real issue, but to address this
point - you could have one RPC servlet mapped to two different servlet
paths - or even two serperate RPC servlets that both call common
code.

Regards,
Carl

Suren

unread,
May 19, 2009, 1:16:43 AM5/19/09
to Google Web Toolkit
Hi Carl,

Thanks for the reply.


>you could make a copy of the data to ensure the two grids are
>independent?

I've tried this with the existing code..still I have the same issue..

>you could have one RPC servlet mapped to two different servlet
>paths - or even two serperate RPC servlets that both call common code.

sorry for my ignorance..Did you mean the change to be made in
<app>.gwt.xml file ?

Thanks
Suren

Suren

unread,
May 19, 2009, 1:19:47 AM5/19/09
to Google Web Toolkit
<module>
..
..
<servlet path="/DBFetch"
class="com.ibsplc.idaho.thinclient.server.DBFetchImpl"/>
</module>

This is what I have now..

Say if I am introducing new RPC named DBRefresh..

What would be form of declaring it?

Also in my <client.appname>.java file, I have the following code

final DBFetchAsync dbFetch = (DBFetchAsync) GWT.create(DBFetch.class);
ServiceDefTarget endpoint = (ServiceDefTarget) dbFetch;
endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "DBFetch");

can I create a similar entry for DBRefreshAsync after the change in
the xml file??

Thanks
Suren
> > Carl- Hide quoted text -

Suren

unread,
May 19, 2009, 2:25:02 AM5/19/09
to Google Web Toolkit
Hi All,

Now as Carl mentioned,

I tried using two different services with the same code, and in my
client, for initial Grid population I used the first service and for
the refresh, I used different service, which doesnt share any common
data or widget.

But still I am having that problem..

I got the answer for the question I asked. But that ultimately ended
in not giving the result as I expect.

Also I heard that no Javascript engine is capable for
multithreading..so obviously any javascript compilation will affect
the display of the browser..or gives a display hang kind of
impression..

Any thoughts are advise are welcome

Thanks again
> > - Show quoted text -- Hide quoted text -

alex.d

unread,
May 19, 2009, 3:12:34 AM5/19/09
to Google Web Toolkit
It's hard to populate that grid of yours completely in the background
since we have a singlethreaded environment. I'd probably even say it's
not possible. So try to change your paradigm instead: if smth. happens
(update) - users should know about it:
- show a timer: time till next update
- disable your grid while updating (glasspanel or smth.)
- show update status
You'll see - as long as users know what's happening and when it's
happening they are all happy. And when they are happy - your are
too ;-)

hth

Suren

unread,
May 19, 2009, 5:01:51 AM5/19/09
to Google Web Toolkit
Hi,

Thanks for the reply.
I tried with Glasspanel now. Thats is visible to me, only all the data
is populated..which is ultimately has no effect.

What could I do wrong here??

GlassPanel gp = new GlassPanel(true);
RootPanel.get().add(gp,0,0);

a:
...Grid population done here...

...Adding the grid to RootPanel..

b:

--glasspanel is only visible at here--- from a to b its taking 15
seconds to get even the glasspanel.

Something did I miss here?

Thanks

alex.d

unread,
May 19, 2009, 5:56:20 AM5/19/09
to Google Web Toolkit
Nothing, docs wouldn't help you with ;-)

to show glassPanel:
rootPanel.add(glassPanel, 0, 0);

to remove it:
glassPanel.removeFromParent();

don't forget to add CSS-rules:
/* Incubator - CSS */
.gwt-GlassPanel {
/* Override glass panel color to be `green` */
background-color: black !important;

/* Override glass panel to 10% opacity (= 90% transparency) */
filter: alpha(opacity = 30) !important; /* IE */
opacity: 0.3 !important; /* non-IE */

/*
NOTE: Please do NOT use either CSS 'width' or 'height' here, as
this would defeat much of the effort that went into GlassPanel
in order to get it to work consistently in a variety of
circumstances. Specifically, please resist the urge to use
'width/height: 100%' or similar constructs.
*/

Magius

unread,
May 19, 2009, 5:57:35 AM5/19/09
to Google Web Toolkit
Hi,

I think your 1st approach is the correct and that you don't need to
have 2 RPCs.
How many time takes the Grid loading (100x80 = 8000 cells)? Probably
some seconds.
While loading the new grid, the browser freezes and didn't repaint its
window (it's monothread).
Seems to be this the problem?

If this is the problem, you can store the data and update it line by
line using calls to DefferedCommand.
This is a mechanism to sent tasks to the browser to do when he's idle,
after he has repainted the screen.
> http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...

Suren

unread,
May 19, 2009, 6:02:26 AM5/19/09
to Google Web Toolkit
Hi Alex,

I checked the docs, and implemented it, I think I missed the CSS
styles..let me check that out..

Thanks

Suren

unread,
May 19, 2009, 6:08:27 AM5/19/09
to Google Web Toolkit
Hi Magius,

I am loading 100x80 cells in the beginning and updating the changed
cells in the during my refresh.

>How many time takes the Grid loading (100x80 = 8000 cells)? Probably some seconds.

This is taking some 30 seconds for me to get my grid with data. I am
loading checkbox widgets based on the data..thats also some reason for
this 30 seconds delay.

>While loading the new grid, the browser freezes and didn't repaint its window (it's monothread).
>Seems to be this the problem?

Yes you are right, its my problem,

>you can store the data and update it line by
>line using calls to DefferedCommand.
>This is a mechanism to sent tasks to the browser to do when he's idle,
>after he has repainted the screen

Thats some sort of the thing which I am looking for a long time..how
can I implement it..say like..

I have my arraylist of data with me in my AsyncCallback onSuccess
method. Currently I am trying to populate the Grid in the onSuccess
method itself.

So according to you..instead you asked me to move the code for the
Grid population to Deferred command.

Could you please explain, How can I do that?

Thanks to all again
Suren
> > > - Show quoted text -- Hide quoted text -

Magius

unread,
May 19, 2009, 7:18:15 AM5/19/09
to Google Web Toolkit
When I tested gids performance, it was acceptable the RPC time but
really slow the DOM manipulation (Grid population), specially with old
browser like IE6 that were not designed for Ajax&JS.

In the OnSuccess you can store the data and to create a
DefferedCommand to populate de Grid:

...
OnSuccess( Object o) {
data = o
currentRow = 0
DeferredCommand.addCommand(
new Command( ) {
public void execute( ) {
populateGrid( )
}
}
}
...

populateGrid( ) {
populate currentRow
currentRow += 1
if( currentRow < totalNumberOfRows ) {
DeferredCommand.addCommand(
new Command( ) {
public void execute( ) {
populateGrid( )
}
}
}
}
}


"populate currentRow" could be to update 1 row of the grid, or 1 row
of a new invisible grid, ....

Suren

unread,
May 19, 2009, 8:07:58 AM5/19/09
to Google Web Toolkit
Hi Magius,

It cannot be explained more than this.. :-)
Thanks alot for help.

Let me try this out and get back to you tomorrow..

Thanks again.
suren

David

unread,
May 19, 2009, 8:31:23 AM5/19/09
to Google-We...@googlegroups.com
Instead of rendering row by row there are alternative table
implementations that use bulk rendering techniques in the GWT
incubator project.
The spead difference is dramatic.

One way to get the grid to render quickly is to do the modification
when the widget is not attached.

Another possibility is to use the IncrementalCommand instead of a
regular command and render more than one row a time (checking that you
don't exceed too many milliseconds per run).

Davud
Reply all
Reply to author
Forward
0 new messages