Hi,
I am using ITMill 5.3.0-rc11 under Ubuntu 8.04
The TabSheet component appears to have 2 problems:
- When the TabSheet is disabled by calling setEnabled(false), the
right most tab will always become selected, no matter which tab was
selected prior to the setEnabled(false) call.
For example: if “Tab1” or “Tab2” or “Tab3” was selected, “Tab3” would
always be selected after the setEnabled(false) call (see sample
code below).
The sample code below shows two different ways of triggering this
problem:
a) By clicking the “Enable/Disable Tabsheet” button.
b) By clicking a tab on the TabSheet.
- If a tab is programmatically selected, the selection does not
change, until a manual browser refresh is performed.
Please advise if either of these are known problems, which are already
scheduled to be fixed, or if not, when they might be fixed. If a fix
will not be available soon, could you suggest a fix I could implement
for both of these problems, or a workaround for them.
Thanks Andrew
package sample.tabsheet;
import com.itmill.toolkit.Application;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.Panel;
import com.itmill.toolkit.ui.TabSheet;
import com.itmill.toolkit.ui.Window;
import com.itmill.toolkit.ui.Button.ClickEvent;
import com.itmill.toolkit.ui.Button.ClickListener;
import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeEvent;
import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeListener;
public class TabProblemTestApplication extends Application
{
private Window mainWindow = new Window("Main Window");
@Override
public void init()
{
final TabSheet tabSheet = createITMillTabSheet();
Button button = new Button("Enable/Disable Tabsheet");
button.addListener(new ClickListener()
{
public void buttonClick(ClickEvent event)
{
if (tabSheet.isEnabled())
tabSheet.setEnabled(false);
else
tabSheet.setEnabled(true);
}
});
mainWindow.getLayout().setSizeFull();
mainWindow.setSizeFull();
mainWindow.addComponent(tabSheet);
mainWindow.addComponent(button);
setMainWindow(mainWindow);
}
private TabSheet createITMillTabSheet()
{
final TabSheet tabSheet = new TabSheet();
Panel panel1 = new Panel("Tab1");
panel1.setSizeFull();
panel1.getLayout().setSizeFull();
panel1.addComponent(new Label("This is first panel"));
tabSheet.addTab(panel1);
Panel panel2 = new Panel("Tab2");
panel2.setSizeFull();
panel2.getLayout().setSizeFull();
panel2.addComponent(new Label("This is second panel"));
tabSheet.addTab(panel2);
Panel panel3 = new Panel("Tab3");
panel3.setSizeFull();
panel3.getLayout().setSizeFull();
panel3.addComponent(new Label("This is third panel"));
tabSheet.addTab(panel3);
tabSheet.addListener(new SelectedTabChangeListener()
{
public void selectedTabChange(SelectedTabChangeEvent event)
{
System.out.println("Tab selection changed.");
tabSheet.setEnabled(false);
}
}
);
return tabSheet;
}
}