GXT TabPanel ActiveWidget & TabItemConfig

For those of you GXT Devs, selecting tabs are not always easy.

Here is a method to set the active tab using a TabItemConfig.

    /**
     * Sets the active widget using TabItemConfig.
     *
     * @param config the TabItemConfig
     * @param container the TabPanel
     */
    public void setActiveWidget(TabPanel tabGroup, TabItemConfig config){
    	int len = tabGroup.getWidgetCount();
    	for ( int i = 0; i < len; i++ ) {
    		Widget panel = tabGroup.getWidget(i);
    		TabItemConfig panelConfig = tabGroup.getConfig(panel);

    		if(panelConfig.equals(config)){
    			tabGroup.setActiveWidget(panelConfig);
    			break;
    		}
    	}
    }

Also, this method gets the TabItemConfig of the active tab.

    /**
     * Gets the TabItemConfig or Null of the active widget.
     *
     * @param container the TabPanel
     */
    public TabItemConfig getActiveWidgetTabItemConfig(TabPanel tabGroup){
    	Widget activeWidget = tabGroup.getActiveWidget();
    	return tabGroup.getConfig(activeWidget);
    }

Aaron Gwin

I'm developer at MasterCard focused on user experience and user interface design using Java & GXT. Web Developer, JavaScript, UX, Usability, RWD, a11y/ARIA/ADA, Java GWT/GXT, .NET, PHP. I led a patent-pending effort to create a client-side rapid html prototyping tool to demonstrate screen flows. patents US20120204102 Past positions: Business Analysts and Pega Process Architect. I love to learn.​ I'm currently learning JS Touch Events and Icon Font development.​

More Posts - Website - Twitter - LinkedIn

About Aaron Gwin

I'm developer at MasterCard focused on user experience and user interface design using Java & GXT. Web Developer, JavaScript, UX, Usability, RWD, a11y/ARIA/ADA, Java GWT/GXT, .NET, PHP. I led a patent-pending effort to create a client-side rapid html prototyping tool to demonstrate screen flows. patents US20120204102 Past positions: Business Analysts and Pega Process Architect. I love to learn.​ I'm currently learning JS Touch Events and Icon Font development.​
This entry was posted in GXT. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>