Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » computeSize returns different values after some point of time
computeSize returns different values after some point of time [message #1046842] Mon, 22 April 2013 13:00 Go to next message
Mariusz Cwikla is currently offline Mariusz Cwikla
Messages: 15
Registered: January 2012
Junior Member
Hi,
we have encountered a strange flickering effect. It's caused by size calculations. When you first start an application and open a window any widget that has a text gets it's size and quickly repositioned.

computeSize method returns different widget size for the same widget after some point of time.

For example - I have a login dialog with 3 labels. I noticed that problem lies in following piece of code (Label.computeSize):
  if( markupEnabled ) {
	extent = TextSizeUtil.markupExtent( getFont(), text, wrapWidth );
  } else {
	extent = TextSizeUtil.textExtent( getFont(), text, wrapWidth );
  }
  width = extent.x;

After a while "extent = TextSizeUtil.textExtent(....)" returns different results than in the beginning.
Here are values of extent after first, second and third call for three different labels:

Login = {26, 14} {26, 14} {26, 14}
Hasło = {26, 14} {26, 14} {27, 14}
Język = {26, 14} {26, 14} {28, 14}

We have the same problem with other widgets too.

Is it a bug in RAP?
Re: computeSize returns different values after some point of time [message #1046858 is a reply to message #1046842] Mon, 22 April 2013 13:19 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1845
Registered: July 2009
Senior Member
Hi Mariusz,
actually this is by design. The TextSizeDetermination (TSD) in RAP is
working that way:
- when you request the size of a text, which is not yet measured on the
client, an estimated size is returned.
- the text is sent to the client for real measurement.
- the real (measured) size is returned back to the server and stored.
- layout is performed in order to properly resize all the widgets with
the correct text size.
Best,
Ivan

On 4/22/2013 4:00 PM, Mariusz Cwikla wrote:
> Hi,
> we have encountered a strange flickering effect. It's caused by size
> calculations. When you first start an application and open a window
> any widget that has a text gets it's size and quickly repositioned.
>
> computeSize method returns different widget size for the same widget
> after some point of time.
>
> For example - I have a login dialog with 3 labels. I noticed that
> problem lies in following piece of code (Label.computeSize):
>
> if( markupEnabled ) {
> extent = TextSizeUtil.markupExtent( getFont(), text, wrapWidth );
> } else {
> extent = TextSizeUtil.textExtent( getFont(), text, wrapWidth );
> }
> width = extent.x;
>
> After a while "extent = TextSizeUtil.textExtent(....)" returns
> different results than in the beginning.
> Here are values of extent after first, second and third call for three
> different labels:
>
> Login = {26, 14} {26, 14} {26, 14}
> Hasło = {26, 14} {26, 14} {27, 14}
> Język = {26, 14} {26, 14} {28, 14}
>
> We have the same problem with other widgets too.
>
> Is it a bug in RAP?

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: computeSize returns different values after some point of time [message #1046876 is a reply to message #1046858] Mon, 22 April 2013 13:41 Go to previous messageGo to next message
Mariusz Cwikla is currently offline Mariusz Cwikla
Messages: 15
Registered: January 2012
Junior Member
Thank you Ivan for your quick response.

Is it possible to get rid of the flickering effect? Right now after server gets started and user opens an application in his browser, then after a short while (~0.5 second) all the widgets gets repositioned. It happens for the first time for every window he opens.
After that when a second, third user opens application (even when they use a different browser) then they don't have the same flickering effect that first user had or they have it rarely.
Re: computeSize returns different values after some point of time [message #1047434 is a reply to message #1046876] Tue, 23 April 2013 07:41 Go to previous message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1291
Registered: July 2009
Senior Member

The TextSizeDetermination is required to measure text sizes on the
client that are needed for server-side layout calculation. You can't get
rid of the mechanism but the good news is, as you discovered, that the
flickering only happens in the first session for every browser
configuration. The results are being cached on the server. As a result,
only few of your users will notice the flickering once the application
is deployed.

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:RAP app will not run from WAR file
Next Topic:Theming Button border when focused
Goto Forum:
  


Current Time: Thu Oct 30 14:01:58 GMT 2014

Powered by FUDForum. Page generated in 0.01841 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software