Results 1 to 3 of 3

Thread: IndexOutOfBounds Exception when building nested tabPanel with bottom tabs

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTGWT-3743 in 3.1.2.
  1. #1
    Ext GWT Premium Member dardison's Avatar
    Join Date
    Apr 2008
    Location
    Buenos Aires, Argentina
    Posts
    180

    Default IndexOutOfBounds Exception when building nested tabPanel with bottom tabs

    Hi,

    we are having this error when we are trying to build nested tabPanels with bottom tabs.

    You can see the stacktrace here:

    https://gist.github.com/dardison/df93a1597b1ff0f1aa6c

    Also this code will reproduce the problem:

    Code:
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.user.client.ui.IsWidget;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.VerticalPanel;
    import com.google.gwt.user.client.ui.Widget;
    import com.sencha.gxt.widget.core.client.TabItemConfig;
    import com.sencha.gxt.widget.core.client.TabPanel;
    import com.sencha.gxt.widget.core.client.TabPanel.TabPanelAppearance;
    import com.sencha.gxt.widget.core.client.TabPanel.TabPanelBottomAppearance;
    
    
    public class AdvancedTabsExample  implements IsWidget, EntryPoint {
    
    
    
    
        private VerticalPanel vp;
        private TabPanel advanced;
        private int firstTopindex = 0;
        private int secondTopIndex = 0;
        private int firstBottomIndex = 0;
    
    
        public void onModuleLoad() {
            RootPanel.get().add(asWidget());
        }
        
        public Widget asWidget() {
            if (vp == null) {
                vp = new VerticalPanel();
                vp.setSpacing(10);
    
    
    
    
                advanced = new TabPanel();
                advanced.setPixelSize(600, 250);
                advanced.setAnimScroll(true);
                advanced.setTabScroll(true);
                advanced.setCloseContextMenu(true);
    
    
    
    
                while (firstTopindex < 3) {
                    addTab();
                }
    
    
                advanced.setActiveWidget(advanced.getWidget(1));
    
    
                vp.add(advanced);
            }
            return vp;
        }
    
    
        
    
    
        private void addTab() {
            
            advanced.add(getButtomTab(), new TabItemConfig("First Top Tab " + ++firstTopindex, firstTopindex != 1));            
            
        }
    
    
        private TabPanel getButtomTab() {
            TabPanel  panel = new TabPanel(GWT.<TabPanelAppearance> create(TabPanelBottomAppearance.class));
            
            while(firstBottomIndex < 3){
                panel.add(getTopTab(), new TabItemConfig("First Bottom Tab " + ++firstBottomIndex, firstBottomIndex != 1));
            }
            firstBottomIndex = 0;
            return panel;
        }
        
        private TabPanel getTopTab(){
            TabPanel  panel = new TabPanel();
            secondTopIndex = 0;
            
            while(secondTopIndex < 3){
                panel.add(getSecondBottomTab(), new TabItemConfig("Second Top Tab " + ++secondTopIndex, secondTopIndex != 1));
            }
            return panel;
            
        }
        
        private TabPanel getSecondBottomTab(){
            
            TabPanel  panel = new TabPanel(GWT.<TabPanelAppearance> create(TabPanelBottomAppearance.class));
            int secondBottomIndex = 0;
            
            while(secondBottomIndex < 3){
                Label item = new Label("Second Bottom Tab: " + (secondBottomIndex +1) + "Of Second Top Tab of: " + (secondTopIndex + 1) + " Of First Bottom Tab: " + (firstBottomIndex + 1) + " Of First Top tab : " + (firstTopindex + 1));
                item.addStyleName("pad-text");
                panel.add(item, new TabItemConfig("Second Bottom Tab " + ++secondBottomIndex, secondBottomIndex != 1));
            }
            return panel;
        }
    
    
    }
    GXT 3.0.6

    Please let me know if you need any other data.
    Regards.
    Daniel

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

    From the stack trace, it looks like the TabPanel is assuming that more tabpanels (with the same appearance) can't be nested. This may be specific to bottom tabs, I can't quite tell yet, but we'll look more into it.

  3. #3
    Ext GWT Premium Member dardison's Avatar
    Join Date
    Apr 2008
    Location
    Buenos Aires, Argentina
    Posts
    180

    Default

    I can confirm that we have nested TabPanels with top tabs and works fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •