Hi,
I am using ITMill 5.3.0-rc12 on Ubuntu 8.04.1, with Firefox 3.0.5.
There are 2 problems still persisting in the TabSheet. This was tested on a nightly build after the changes made by Artur in 2658 (Disabling a TabSheet should not change the selected tab).
Scenario no. 1:
1-0 Start/Restart the application. This will create an empty TabSheet.
1-1 I add two new tabs to this sheet, using button “Add Tabs”.
1-2 I remove these two newly-added tabs, using button “Remove Tabs”.
1-3 Then I add two more tabs, using button “Add Tabs”.
Only one tab is displayed.
If I press F5 now, or if I have pressed F5 after step 1-2 I can see two tabs.
Scenario no. 2:
2-0 Start/Restart the application. This will create an empty TabSheet.
2-1 I add two new tabs to this sheet, using button “Add Tabs”.
2-2 Then I remove these two newly-added tabs and add another two in the same time, using button “Add and Remove Tabs”.
2-3 I repeat step 2-2 a few times.
I still see two tabs.
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 itmill.testcases;
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;
public class SecondTabProblemTestApplication extends Application
{
private Window mainWindow = new Window("Main Window");
private TabSheet tabSheet;
private Panel panel1;
private Panel panel2;
private Integer counter = 0;
private Boolean removeTabs()
{
if (panel1 == null && panel2 == null)
{
mainWindow.showNotification("NOTE", "There are currently no tabs to be removed.");
return false;
}
tabSheet.removeComponent(panel1);
tabSheet.removeComponent(panel2);
panel1 = null;
panel2 = null;
return true;
}
private Boolean addTabs()
{
if (panel1 != null || panel2 != null)
{
mainWindow.showNotification("NOTE", "Remove existing tabs first.");
return false;
}
panel1 = new Panel("tab " + ++counter);
panel1.setSizeFull();
panel1.getLayout().setSizeFull();
panel1.addComponent(new Label("This is panel no. " + counter));
tabSheet.addTab(panel1);
panel2 = new Panel("tab " + ++counter);
panel2.setSizeFull();
panel2.getLayout().setSizeFull();
panel2.addComponent(new Label("This is panel no. " + counter));
tabSheet.addTab(panel2);
return true;
}
@Override
public void init()
{
tabSheet = createITMillTabSheet();
Button button1 = new Button("Remove Tabs");
button1.addListener(new ClickListener()
{
public void buttonClick(ClickEvent event)
{
removeTabs();
}
});
Button button2 = new Button("Add Tabs");
button2.addListener(new ClickListener()
{
public void buttonClick(ClickEvent event)
{
addTabs();
}
});
Button button3 = new Button("Remove and Add Tabs");
button3.addListener(new ClickListener()
{
public void buttonClick(ClickEvent event)
{
if (removeTabs())
addTabs();
}
});
mainWindow.addComponent(tabSheet);
mainWindow.addComponent(button1);
mainWindow.addComponent(button2);
mainWindow.addComponent(button3);
setMainWindow(mainWindow);
}
private TabSheet createITMillTabSheet()
{
tabSheet = new TabSheet();
return tabSheet;
}
}