Ticket #831 (closed defect: fixed)

Opened 16 months ago

Last modified 7 months ago

Re-enabling a tab does not display the change

Reported by: Marko Gronroos Owned by: Matti Tahvonen
Priority: undefined Milestone: User Interface Library 5.2.0 RC
Component: Server-side framework Version:
Keywords: Cc:
Known Issue description:
Hours estimate: Deadline (dd.mm.yyyy):
Known Issue version (since): Known Issue title:
Hours done: Depends to:
Affects documentation: no
Known Issue workaround:
Affects release notes: yes Contract:

Description

This example has a TabSheet? with three tabs. Clicking on the button in the first tab enables the tabs 2 and 3. Selecting the first tab again disables the later tabs until the button is clicked again.

This works just fine as long as you click the button, select the second tab, select the first tab, click the button again, and so on.

The problem occurs when you click the button, select the _third tab_, then select the first tab, and click the button, the page will not be updated and the tabs 2 and 3 remain disabled. Reloading the page shows the tabs correctly, with tabs 2 and 3 enabled.

import com.itmill.toolkit.ui.*;
import com.itmill.toolkit.ui.Button.ClickEvent;
import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeEvent;

public class TabSheetExample extends CustomComponent implements Button.ClickListener, TabSheet.SelectedTabChangeListener {
	TabSheet tabsheet = new TabSheet();
	Button tab1_root = new Button("Push this button");
	Label  tab2_root = new Label("Contents of Second Tab");
	Label  tab3_root = new Label("Contents of Third Tab");
	
	TabSheetExample () {
		setCompositionRoot (tabsheet);

		tabsheet.addListener(this);

		/* Listen for button click events. */
		tab1_root.addListener(this);
		tabsheet.addTab(tab1_root, "First Tab", null);

		/* A tab that is initially disabled. */
		tab2_root.setEnabled(false);
		tabsheet.addTab(tab2_root, "Second Tab", null);
		
		/* A tab that is initially disabled. */
		tab3_root.setEnabled(false);
		tabsheet.addTab(tab3_root, "Third tab", null);
	}

	public void buttonClick(ClickEvent event) {
		System.out.println("tab2="+tab2_root.isEnabled()+" tab3="+tab3_root.isEnabled());
		tab2_root.setEnabled(true);
		tab3_root.setEnabled(true);
	}

	public void selectedTabChange(SelectedTabChangeEvent event) {
		/* Cast to a TabSheet. This isn't really necessary in this example,
		 * as we have only one TabSheet component, but would be useful if
		 * there were multiple TabSheets. */
		TabSheet source = (TabSheet) event.getSource();
		if (source == tabsheet) {
			/* If the first tab was selected. */
			if (source.getSelectedTab() == tab1_root) {
				System.out.println("foo");
				tab2_root.setEnabled(false);
				tab3_root.setEnabled(false);
			}
		}
	}
}

Change History

Changed 9 months ago by Joonas Lehtinen

  • milestone set to User Interface Library 5.1.1

Check if the bug appears in version 5

Changed 9 months ago by Joonas Lehtinen

  • priority changed from major to undefined

Changed 9 months ago by Marc Englund

Broken differently in TK5: does not disable tab (component disabled correctly, but actually no way to disable tab)

Changed 9 months ago by Joonas Lehtinen

Should tabsheet disable tabs for disabled components? This would IMO be logical and useful.

Any comments?

Changed 9 months ago by Marc Englund

That is how it worked in tk4 (except for the reported bug, apparently); hence "broken differntly in tk5".

Yes, it would be useful.

Changed 8 months ago by Jani Laakso

  • version deleted

Changed 7 months ago by Joonas Lehtinen

  • milestone changed from User Interface Library 5.1.2 to User Interface Library 5.2.0

Milestone User Interface Library 5.1.2 deleted

Changed 7 months ago by Matti Tahvonen

  • owner changed from Jani Laakso to Matti Tahvonen
  • status changed from new to accepted

Changed 7 months ago by Matti Tahvonen

  • status changed from accepted to closed
  • resolution set to fixed

in [4338]

Note: See TracTickets for help on using tickets.