On Apr 3, 9:44 am, Dan <danpr...@gmail.com> wrote:
> You can't add more than one widget to a PopupPanel. You have to add
> something like a VerticalPanel to the PopupPanel, and then you can add
> multiple widgets to the vertical panel.
>
Which is better? Adding a widget to the VerticalPanel inside the
PopupPanel,
or having a named 'error' widget to the VerticalPanel, and changing
its CSS
class to toggle its visibility?
Eric
SimplePanel, as its name suggests, allows only one child widge. And
you need to use setWidget to set the child widget. That is why it is
called "Simple".
In order to place more than one child widget, you have to set a
complex panel as its child widget. For example, you could set the
child widget to a HTMLPanel, and then add widgets to the HTMLPanel.
Or, you could use VerticalPanel or HorizontalPanel as its child.
Why:
That is a good design strategy, in my observation, because it lets me
the user be the decision maker on the orientation of the widgets
(flow, html, vertical, horizontal, grid, etc). I do not want
PopupPanel to decide for me the orientation because that would add an
extra layer of orientation control that I may not want.
Let us say that GWT architects decided to set FlowPanel as the complex
panel for PopupPanel. What if I wanted HTMLPanel or VerticalPanel
instead? Then I would have to add another complex panel into the
existing complex panel - why would I want to add an extra layer of
panel? I want to decide what to do myself rather than have some one
else decide how the flow of contents in my use of PopupPanel should
be.