StackLayoutPanel has no styles at all??

197 views
Skip to first unread message

dflorey

unread,
Jan 3, 2010, 1:41:18 PM1/3/10
to Google Web Toolkit Contributors
Maybe I'm dumb but I do not find any styles associated with the new
StackLayoutPanel...
And no methods to add click listeners etc.
I'd expect the same styles as on StackPanel:

CSS Style Rules

.gwt-StackPanel { the panel itself }
.gwt-StackPanel .gwt-StackPanelItem { unselected items }
.gwt-StackPanel .gwt-StackPanelItem-selected { selected items }
.gwt-StackPanel .gwt-StackPanelContent { the wrapper around the
contents of the item }

I tried to set the primary name but no effect.

Any ideas?

Joel Webber

unread,
Jan 4, 2010, 10:47:35 AM1/4/10
to google-web-tool...@googlegroups.com
Coming up with a general structure for stack header widgets (a la TabLayoutPanel tabs), such that you could achieve whatever style you like, proved very difficult in practice. I basically punted and just allowed you to add an arbitrary widget, which you can style however you like.

I'm quite open to alternative structures that work more like tabs. The problem I ran into is that you typically want a stack header to extend vertically to cover the entire space between stacks. The layout system does this automatically, but it is rather difficult to place the "content" of a header wherever you want it.

dflorey

unread,
Jan 4, 2010, 11:06:27 AM1/4/10
to Google Web Toolkit Contributors
Correct me if I'm wrong but I found it quite hard to apply a
"selected" style to the selected stack panel header.
I came up with a workaround like this:

StackLayoutPanel danielStackPanel = new StackLayoutPanel
(Style.Unit.PX) {
@Override
public void showWidget(Widget widget) {
// Find associated header (map<widget,header>) and apply "selected"
style to header
// Remove "selected" style from all other header widgets
}
}
But for some reason that I don't remember (I tried that out
yesterday...) it did not work. I guess the style order was interfering
somehow...

I really would prefer if some of the useful styles would be set by
default.

Joel Webber

unread,
Jan 4, 2010, 12:05:01 PM1/4/10
to google-web-tool...@googlegroups.com
You're right, there is no notification to stack-header widgets of their selection state. I'll make a note to add a standard way for them to be notified of this.

As for standard CSS, with the current design (i.e., your own widget is the only header element), there's nothing to add a default style to. Perhaps we can find a way to add a default "wrapper" element to each stack header, but such that the header widget still fills the space.

Reply all
Reply to author
Forward
0 new messages