/** * Enables the tab with the given index. * * <p> * * @param tabContent the content of the tab that should be enabled */ public void enableTab(E tabContent) { Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent)); Element tab = getTabElement(index.intValue()); if ((tab != null) && m_disabledTabIndexes.containsKey(index)) { tab.removeClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled()); tab.setTitle(m_disabledTabIndexes.get(index)); m_disabledTabIndexes.remove(index); } }
/** * Disables the tab with the given index. * * <p> * * @param tabContent the content of the tab that should be disabled * @param reason the reason why the tab is disabled */ public void disableTab(E tabContent, String reason) { Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent)); Element tab = getTabElement(index.intValue()); if ((tab != null) && !m_disabledTabIndexes.containsKey(index)) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(tab.getTitle())) { m_disabledTabIndexes.put(index, tab.getTitle()); } else { m_disabledTabIndexes.put(index, ""); } tab.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled()); tab.setTitle(reason); } }
/** * Add a new tab with the provided name and content and additional left margin. * * <p> * * @param tabContent the widget to add as a tab * @param tabName the name of the tab to display in the tabbar */ public void addWithLeftMargin(E tabContent, String tabName) { tabContent.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll()); m_tabPanel.add(tabContent, tabName); int tabIndex = m_tabPanel.getWidgetIndex(tabContent); Element tabElement = getTabElement(tabIndex); if (tabElement != null) { tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabLeftMargin()); if (!m_panelStyle.equals(CmsTabbedPanelStyle.classicTabs)) { tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.generalCss().buttonCornerAll()); tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().borderAll()); } } }