0

i am unable to understand the difference between the two.

in which situation which one should be used?

any pros cons?

code http://gwt.google.com/samples/Showcase/Showcase.html#!CwStackPanel and for stacklayoutpanel and description looks same

Vik
  • 8,721
  • 27
  • 83
  • 168

2 Answers2

2

If you read the javadocs, you'll see that StackPanel only works in quirks mode, and StackLayoutPanel only works in standards mode. They are functionally identical, but you need to choose one or the other depending on what mode your application runs on.

Roddy of the Frozen Peas
  • 14,380
  • 9
  • 49
  • 99
  • whats the diff between quirk and standard mode? – Vik Oct 07 '12 at 21:27
  • @Vik -- Essentially "quirks" mode will render with a non-standard CSS implementation that usually worked for older browsers (think browser wars era.) In addition to Andrei's link above, which is quite good, see also [this page](http://www.quirksmode.org/css/quirksmode.html). – Roddy of the Frozen Peas Oct 08 '12 at 00:19
  • ok so here is the exact thing i am facing.. i have already a stackpanellayout implemented in my page which works fine as a menu on the left side. today for new requirements i thought to implement another stackPanelLayout in one of the tab of panelTabLayout. The issue is for this case stackPanelLayout doesnt work but stackPanel works just fine. So, how come on the same page at one place it is working and not on another. Also my browser is fairly modern as it is chrome 22 – Vik Oct 08 '12 at 00:24
  • sorry what you mean? we are in trouble and not seeing any magic here – Vik Oct 08 '12 at 00:49
  • If it works, why are you in trouble? StackPanel and StackLayoutPanel are the same from a functional standpoint. There is no difference except that one was intended to work in quirks mode, and the other in standards mode. I suspect that if you open your page in IE or another browser, it might not function as well as it does in Chrome. – Roddy of the Frozen Peas Oct 08 '12 at 01:02
  • well the trouble is that on the same page one long back implemented stacklayoutpanel is working just fine. and now another which is a new requirement doesnt work. i read somewhere that one work on quirk and other on modern. So, in that sense i am implementing mutually exclusive implementation of the same component and which doesnt look good to me. any advise? – Vik Oct 08 '12 at 01:22
  • Yes. Just implement one. Like I said in my answer, StackPanel works in Quirks mode, and StackLayoutPanel works in Standards mode. Each one is designed to only work in their particular mode. So if you have StackLayoutPanel working, this would indicate your page is designed for and works in Standards mode, and you should implement your second to also be StackLayoutPanel. – Roddy of the Frozen Peas Oct 08 '12 at 02:19
  • In your comment above you indicate that your second StackLayoutPanel doesn't work -- I would bet this is due to something in your implementation that's causing it to fail. Unfortunately, your question didn't include any code, so I can only guess as to why. – Roddy of the Frozen Peas Oct 08 '12 at 02:20
1

I persistently advocate, after understanding quirkiness of GWT Java and that you need to bear the attitude that you are actually programming in Javascript when programming GWT Java, ...

that the first concept to understand when learning GWT is to understand the purpose and functions of the ProvidesResize/RequiresResize interfaces.

ResizeLayoutPanel inside DisclosurePanel using GWT

GWT or not for enterprise apps

StackLayoutPanel falls into the framework of ProvidesResize/RequiresResize.

If you use non-layoutpanels like StackPanel, you would have to concoct your own resize framework, or at least try to implement these pair of interfaces in them, which could involve scheduling and debouncing actions to provide a pleasant experience to the user.

You can use non-layoutpanels if your UI is simple and does not comprise a complex and deep hierarchy of panels and widgets.

In order to allow the features of layout panels, you would need to place your hosting page on standards mode. Therefore, saying that the difference between layoutpanels and non-layoutpanels is Standards mode is not an accurate picture because you need to know the motivation behind having the ProvidesResize/RequiresResize interfaces.

https://developers.google.com/web-toolkit/doc/latest/DevGuideUiPanels#Resize

I guess quirks mode is to allow the browser page to operate in the outdated quirky mode where everybody tried to please everybody's quirky individualistic idea of how HTML should behave (where microsoft was about the most belligerent practitioner of HTML quirks).

What is Standards mode:

https://developers.google.com/web-toolkit/doc/latest/DevGuideUiPanels#Standards

Community
  • 1
  • 1
Blessed Geek
  • 21,058
  • 23
  • 106
  • 176