Home » Eclipse Projects » Remote Application Platform (RAP) » Layout issues due to stringExtend miscalculation?
Layout issues due to stringExtend miscalculation? [message #1016163] |
Tue, 05 March 2013 10:18 |
|
Hey again.
I'm having slight layout issues with our login dialog. It is a quite simple dialog with some labels and text-fields and an image. the shell is pack()ed, so i'd expect everything to be fine. Now, when opening the dialog for the very first time (i.e. firing up the application), it seems that string extents are calculated wrong. After this first time, no matter from which machine (session), the dialog looks correct. Only the very first user that connects gets a wrong layout.
I traced the issue down to the TextSizeUtil.determineTextSize, and set a conditional breakpoint there which sysout's the resulting point when calculating the length of "0" (which we use in that case).
This results in this output for the first user that connects:
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {5, 13}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {5, 13}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {5, 13}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {7, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {5, 13}
all subsequently connections yield this:
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {7, 12}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {7, 12}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {7, 12}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Verdana, "Lucida Sans", Arial, Helvetica, sans-serif,14,NORMAL},string=0, result=Point {8, 16}
font=Font {Courier New,11,ITALIC},string=0, result=Point {7, 12}
as you can see the results are quite different! i had no time until now to follow the issue deeper into the code. it must get something wrong somewhere. Is this a known issue, or shall i report a bug again?
Is there a possible workaround? (something like triggering calculation of extents when firing up the application, ...)
Thanks
|
|
|
Re: Layout issues due to stringExtend miscalculation? [message #1016170 is a reply to message #1016163] |
Tue, 05 March 2013 10:36 |
|
hm, it seems from the code that it is actually intended to only estimate (wrong in my case) until calculation is done in another thread... hm. Interesting is: with the breakpoint the UI is slow enough to see that when the dialog opens the first time, all elements fit the dialog itself but are too small to fit the text (labels for example). after a short (very short) while, a background thread seems to calculate text extents, and the UI elements sizes are adapted for the new font size - the dialog itself however is not resized, thus elements are then larger than the dialog... phew.
|
|
| | |
Re: Layout issues due to stringExtend miscalculation? [message #1016486 is a reply to message #1016418] |
Wed, 06 March 2013 16:04 |
|
thanks for the reply. in the meantime i set fixed dialog sizes for the login dialog, which leaves me with wrongly dimensioned input fields in the layout, but a determinable dialog size. also hooking on the resize event and trying all kinds of funny stuff from re-layouting to updating to initializeBounds() does not have any positive effect on the layout... but it's a minor issue, as we don't want to restart the application every 5 minutes anyway. still i thought it is worth mentioning.
|
|
|
Goto Forum:
Current Time: Wed Sep 25 14:19:14 GMT 2024
Powered by FUDForum. Page generated in 0.05416 seconds
|