Vaadin 7 Accordion - Problem 2

Found another problem with Accordion.
Please have a look at the code below that was tested in Chrome and Firefox under Linux. Clicking the of button will remove the tab ‘Me’ containing the button and it adds another tab ‘Next’. However, the caption of the panel (‘Me’) will remain and visible in the ‘Next’ tab added.


public class Application extends UI {

	private final Accordion tabs = new Accordion();

	@Override
	protected void init(VaadinRequest request) {
		setContent(tabs);
		tabs.setHeight(500, Unit.PIXELS);
		Button remove = new Button("Remove 'Me'");
		final Tab me = addTab("Me", remove);
		remove.addClickListener(new Button.ClickListener() {

			@Override
			public void buttonClick(ClickEvent event) {
				tabs.removeTab(me);
				Tab tab = addTab("Next");
				tabs.setSelectedTab(tab);
			}
		});
	}

	private Tab addTab(String tag, Component... components) {
		VerticalLayout layout = new VerticalLayout();
		layout.addComponent(new Label("On tab: " + tag));
		for(Component c: components) {
			layout.addComponent(c);
		}
		Panel panel = new Panel(tag, layout);
		return tabs.addTab(panel);
	}
}

Looks like a bug - please
submit a bug report
.


Ticket #11367