Search code examples
gwtgwt-tablayoutpanel

Add tab dynamically using a tab item in GWT


I want to create a tabbed page and load different information on each tab click.

I want to be able to add tabs dynamically when clicked the '+' tab. enter image description here

So, on clicking '+' a new tab should be added to the same tabLayoutPanel.

Any suggestions on how to do it in GWT.

Thanks.


Solution

    • Add the '+' tab statically (e.g. ui xml).
    • Add a selection handler (see In GWT how do I handle the tab click event? for how to do this).
    • In this handler: if the last tab is selected, insert a new tab just before it and select it from code.