public void add( final Widget child, ImageResource icon, String docId, final String text, String tooltip, Integer position) { if (closeableTabs_) { DocTab tab = new DocTab( icon, docId, text, tooltip, new TabCloseObserver() { public void onTabClose() { int index = getWidgetIndex(child); if (index >= 0) { tryCloseTab(index, null); } } }); docTabs_.add(tab); if (position == null || position < 0) super.add(child, tab); else super.insert(child, tab, position); } else { if (position == null || position < 0) super.add(child, text); else super.insert(child, text, position); } }
/** * Inserts a widget into the panel. If the Widget is already attached, it will be moved to the * requested index. * * <p>Wrapper function for {@link com.google.gwt.user.client.ui.TabLayoutPanel#insert(Widget, * String, int)} * * @param tabContent the widget to be added * @param tabName the text to be shown on its tab * @param beforeIndex the index before which it will be inserted */ public void insert(E tabContent, String tabName, int beforeIndex) { m_tabPanel.insert(tabContent, tabName, beforeIndex); }