After digging through Showcase and doing some more research I figured out
that no, LayoutPanels don't work the way I would expect them to in rtl
mode.


If I do a LayoutPanel.setLeftWidth(....)

it sets the widget left regardless of if it is in ltr or rtl mode. Which
seems like it is a bug/potential enhancement to me.

You'll notice that DockLayoutPanel does switch, that was because some very
specific logic was added to handle those situations, two methods
#addLineStart and #addLineEnd.

TabPanel is implemented with tables, so it switches itself perfectly in rtl
mode, but if TabLayoutPanel were in there, you wouldn't see any of the top
tabs. I now believe this bug is fixed in trunk since getting rid of
getStyle().setFloat(Float.Left); for the new line-block style.

I have a new proposal, and that would be to take care of rtl conversions in
either the  LayoutImpl class or Layout. I would have to spend some more time
digging through that code to understand which one is the best fit.


On Thu, Mar 31, 2011 at 7:42 PM, Jeff Larsen <[email protected]> wrote:

> Huh, I must be doing something wrong then in my test implementations
> because layouts etc aren't being switched even though images are being
> swapped when picking the ar locale. I'll have to investigate deeper into
> showcase. Thanks.
>
>
> On Thu, Mar 31, 2011 at 4:49 PM, Ray Ryan <[email protected]> wrote:
>
>> The LayoutPanels' already swap properly in RTL locales, don't they?
>>
>> http://gwt.google.com/samples/Showcase/Showcase.html?locale=ar_YE
>> http://gwt.google.com/samples/Showcase/Showcase.html?locale=en
>>
>> On Thu, Mar 31, 2011 at 2:33 PM, Jeff Larsen <[email protected]> wrote:
>>
>>> In some instances, it would be nice to have LayoutPanel swap left and
>>> right. I was thinking of something like adding a
>>>
>>> private boolean bidi = false;
>>>
>>>   public void setWidgetLeftWidth(Widget child, double left, Unit
>>> leftUnit, double width,
>>>       Unit widthUnit) {
>>>     assertIsChild(child);
>>>     if (bidi && isRtl()) {
>>>       getLayer(child).setRightWidth(left, leftUnit, width, widthUnit);
>>>     } else {
>>>       getLayer(child).setLeftWidth(left, leftUnit, width, widthUnit);
>>>     }
>>>     animate(0);
>>>   }
>>>
>>>
>>> public void setBidiEnabled(boolean enable){
>>>    bidi = enable;
>>> }
>>>
>>> etc etc etc.
>>>
>>> What do you guys think? This would allow for future enhancements like
>>> making TabLayoutPanel bidi enabled, where the tabs appear on the right side
>>> and work their way left instead of on the starting on the left and being
>>> added to the left.
>>>
>>> --
>>> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>>
>>
>>
>

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

Reply via email to