Hi All,
I am trying to do something that I'm sure breaks a million rules,
protocols, standards, covenants, agreements and pinky-swears.
Given the default TabPanel, I can get the embedded TabBar. That
TabBar
is a HorizontalPanel with at least two extra "td"s (on in the front
and the "last" one). The last table cell has a width of 100% set in
the widget code.
Now, I know I have broached this topic a couple of times over the
past two-ish years but all that empty real-estate in the "last"
cell is a tempting target in which to stuff text or a widget.
I have faked this behavior by rolling my own TabPanel-like class with
my own spin on the TabBar formatting. For various reasons though I am
revisiting the initial question.
Can I basically do a "setWidget()" on the last cell of the
TabPanel.TabBar?
My current answer is yes and no. Yes, in that i can crawl through the
DOM and find the last TD cell of the TabBar and I can "appendChild()"
into that element and stuff in "a widget". However, the events
associated with the assigned widget are not happening.
For example
TabPanel tp = new TabPanel()
TabBar tb = tp.getTabBar();
tp.add(new HTML("one"), "1");
tp.add(new HTML("two"), "2");
tp.add(new HTML("three"), "3");
Button test = new Button("text", new ClickListener() {
public void onClick(Widget sender) {
Window.alert("testing");
}
});
setLastTabBarElement((Widget) test);
public void setLastTabBarElement(Widget widget) {
Element e = tb.getElement();
int i = 0;
while ((i = DOM.getChildCount(e)) > 0) {
e = DOM.getChild(e, i - 1);
}
DOM.appendChild(e, widget.getElement());
}
Now, I know I am prolly not using the correct CamelCase. I suspect
that there is a better way to find the last TD cell of the tabBar --
but I don't know what that might be -- I would like to know though.
I have way too much code to post all of it here but the example above
is very similar to what I am trying to do. The biggest difference
is that i am trying to plug in a Composite widget instead of a
simple button.
The end result is that my Widget appears in the correct place in the
tabBar but clicking on the elements does nothing.
ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---