What's the difference between TabPanel and TabLayoutPanel in GWT? I can't find the answer in Google and it is difficult to understand reading docs
2 Answers
TabLayoutPanel is a layout panel: it's sized from the outside-in, it has to be given explicit dimensions and be notified when they changed (RequiresResize), and similarly will resize its children and notify them when it does so (ProvidesResize).
TabPanel is not; it's sized from the inside-out: it'll resize itself depending on the size of the widget in the selected tab.
- 64,353
- 7
- 91
- 164
-
Also note that TabLayoutPanel only works in Standards Mode while the TabPanel is supposed to be only used in QuirksMode. – David Nouls Sep 06 '13 at 11:47
-
is it only about resizing? when should I use one and when another? – Konstantin Milyutin Jul 14 '14 at 12:39
-
@damluar: See the answer provided by me – Abhijith Nagaraja Sep 25 '14 at 23:10
Addition to what Thomas is saying
In GWT, To layout the widgets in the screen there are two kind of panels: Panels ( Eg: TabPanel ) and Layout Panels ( Eg: TabLayoutPanel )
Panels or Non-layout panels
These panels (TabPanel, DockPanel, Horizontal panel, Vertical Panel, AbsolutePanel ... ) allow you to layout widgets in an explicit manner. It will render the widgets as imagined ( provided correct imagination ;) ). Its child widgets are not automatically resized when the browser resizes.
Layout panels
These Panels (TabLayoutPanel, DockLayoutPanel, ScrollPanel, FlexTable, SplitLayoutPanel... ) allow you to layout widgets in the explicit manner but also resize the child widget when the browser resizes as each of them implements RequiresResize and/or providesResize provided you maintain Layout panels hierarchy throughout and provide the size of panels and widgets in percentages.
Sources: GWT Docs and Personal Experience
- 3,370
- 6
- 27
- 55