Yes, I truly understand your considerations about the confusing of setting
the alignment of the widget itself. When I asked myself what might be your
reason on not having these methods for alignment I think of this point. But,
I think this is the wrong way. In my opinion, GWT should aim to encapsulate
all the HTML elements, styles and layouts for its users. Let developers to
set styles using getElement.getStyle().setProperty("name", "value") actually
breaks this encapsulation. It needs people to have knowledge on HTML to
truly understand what this element method means. Simply consider the menubar
as a normal object and forget about its underlying implementation, obviously
I think, this object should have methods to control its contents layout.

It's nice to heard voice from people inside google group. What do other
contributors think about this?

Chaoran Yang
School of Information Engineering,
Beijing Univ. of Posts. & Telecommunications,
Beijing, China.


On Tue, Jan 20, 2009 at 11:26 PM, John LaBanca <jlaba...@google.com> wrote:

> The fact that MenuBar uses a table to render itself is just an
> implementation detail, and sometimes we abstract away the DOM implementation
> of a widget.  Personally, I think adding a setHorizontal/VerticalAlignment()
> would be a little confusing because people might assume it would set the
> alignment of the widget itself (as in position to widget) as opposed to
> setting the alignment of the MenuItems in the cells.  There are other table
> based widgets that do not have these methods for the same reason, such as
> StackPanel.  Also, you can always set styles in code using the Element
> methods:
>
> myMenu.getElement().getStyle().setProperty("name", "value");
>>
>
> Still, I'll be interested to see what other contributors think.  Maybe
> there is a use case for this method in other widgets as well.
>
> Thanks,
> John LaBanca
> jlaba...@google.com
>
>
>
> On Mon, Jan 19, 2009 at 12:50 PM, jack.yang <jackyang0...@gmail.com>wrote:
>
>>
>> Since this widget is a Div which contains a Table, why it do not have
>> a method to set its cell alignment? This is not the only widget which
>> consists of a table but do not have a method to set alignment.
>>
>> I think this is not a good design. For some widget developers set
>> alignment by code while for others they can only set alignment using
>> CSS.
>>
>>
>>
>
> >
>

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

Reply via email to