Thanks
-- pady
// Set up a DockPanel to contain the text and an image
DockPanel tabContainer = new DockPanel();
tabContainer.add(new Label("ABC"),DockPanel.WEST);
tabContainer.add(new Image("yes.gif"), DockPanel.EAST);
// Place the contents in a simple panel (if I remember right, one of IE
or Opera has a problem if you don't do this
SimplePanel dummyContainer = new SimplePanel();
// Add the previous DockPanel to the SimplePanel
dummyContainer.add(tabContainer);
// Now get the actual HTML for this panel
String htmlTabValue = DOM.getInnerHTML(dummyContainer.getElement());
// Add the new panel to the TabPanel, using the htmlTabValue we just
got as the (html) label
addresses.add(addressesA2CPanel,htmlTabValue,true);
You might want to style the new tab, e.g. length, and maybe right
justify the 2nd component, but this all works nicely. This comes from
an approach used in the GWT In Action book (but there we use it for
some fancy menus).
There is another approach someone posted the other day which uses two
"real" tabs per visual tab and styling to try and hide the overlap
(http://groups-beta.google.com/group/Google-Web-Toolkit/browse_thread/thread/4cfbcadba7afdaf6/2091dcc523786262?lnk=gst&q=TabPanel&rnum=3#2091dcc523786262)
Hope that is of some use!
//Adam
Co-author of GWT In Action (http://www.manning.com/hanson)
Thanks
-- pady
body{
font: 12px verdana;
}
span{
background: #e5e5e5;
padding: 0px 0px;
margin:0px;
border: 1px solid #000000;
position: relative;
top: 0px;
}
.left{
float:left;
padding:0px 0px;
margin:0px;
}
.right{
float:right;
padding: 0px 0px;
margin:0;
}
.spacer {
clear: both;
}
.tabContent{
padding: 10px;
border: 1px solid black;
height: 200px;
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<link href="tabs.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="tabContainer">
<div class="left">
<span>Tab1</span>
<span>Tab2</span>
<span>Tab3</span>
</div>
<div class="right"><span>Tab Right Very Very long sentence</span></div>
<div class="spacer"></div>
</div>
<div class=tabContent>
tab content - test
</div>
</div>
</body>
</html>
Copy the style code above as tabs.css and save the html and run the
html. You will see a tab on the right side of the browser area.
Thanks
-- pady
AbsolutePanel absPanel = new AbsolutePanel();
absPanel.setWidth("100%");
String absHtmlValue = DOM.getInnerHTML(absPanel.getElement());
tabPanel.add(new Label(), absHtmlValue, true);
I also tried adding a label to the absolute panel. The only way I can
get it to work is to set the enclosing "TD" to align right.
Can you give me the example you tried for fixed width panel that worked
?
Thanks
-- pady
public static TabPanel setTabStyleAttrib(
TabPanel tabPanel
, int tab
, String attr
, String value)
{
Element el = tabPanel.getElement();
for (int i = 0; i < 7; i++)
{
el = DOM.getFirstChild(el);
}
for (int i = 0; i < tab + 1; i++)
{
el = DOM.getNextSibling(el);
}
// Added the style attribute to the parent also
DOM.setStyleAttribute(el, attr, value);
el = DOM.getFirstChild(el);
DOM.setStyleAttribute(el, attr, value);
return tabPanel;
}