/** * Gets the position of the tab. * * @param tab * The tab * @return */ public int getTabPosition(Tab tab) { return components.indexOf(tab.getComponent()); }
/** * Sets the position of the tab. * * @param tab * The tab * @param position * The new position of the tab */ public void setTabPosition(Tab tab, int position) { int oldPosition = getTabPosition(tab); components.remove(oldPosition); components.add(position, tab.getComponent()); getState().tabs.remove(oldPosition); getState().tabs.add(position, ((TabSheetTabImpl) tab).getTabState()); }
@Override public void setTabPosition(Tab tab, int position) { super.setTabPosition(tab, position); TabImpl tabImpl = (TabImpl) tabToContentMap.get(tab.getComponent()); if (tabImpl != null) { Component tabComponent = tabImpl.getComponent(); tabComponents.remove(tabComponent); tabComponents.add(position, tabComponent); } } };
public void containerItemSetChange(Container.ItemSetChangeEvent itemSetChangeEvent) { List<Wallboard> wallboardsToRemove = new ArrayList<>(); List<TabSheet.Tab> tabsToRemove = new ArrayList<>(); for (Map.Entry<Wallboard, TabSheet.Tab> entry : m_wallboardEditorMap.entrySet()) { WallboardEditor wallboardEditor = (WallboardEditor) entry.getValue().getComponent(); if (!WallboardProvider.getInstance().containsWallboard(wallboardEditor.getWallboard())) { wallboardsToRemove.add(wallboardEditor.getWallboard()); tabsToRemove.add(entry.getValue()); } } for (TabSheet.Tab tab : tabsToRemove) { m_tabSheet.removeTab(tab); } for (Wallboard wallboard : wallboardsToRemove) { m_wallboardEditorMap.remove(wallboard); } } });
public void moveTab(Component c, int position) { Tab oldTab = getTab(c); String tabId = tabIds.inverse().get(oldTab); String tabCubaId = getCubaId(oldTab); // do not detach close handler // call super super.removeComponent(oldTab.getComponent()); Tab newTab = addTab(c, position); newTab.setCaption(oldTab.getCaption()); newTab.setDescription(oldTab.getDescription()); newTab.setClosable(oldTab.isClosable()); newTab.setEnabled(oldTab.isEnabled()); newTab.setVisible(oldTab.isVisible()); newTab.setIcon(oldTab.getIcon()); newTab.setStyleName(oldTab.getStyleName()); setCubaId(newTab, tabCubaId); if (tabId != null) { tabIds.remove(tabId); tabIds.put(tabId, newTab); } }
@Override protected Component getActionTarget(Tab tab) { return getContentTab(tab.getComponent()).getComponent(); }
protected Component getActionTarget(Tab tab) { return tab.getComponent(); }
/** * This method is used for updating the available {@link DashletFactory} instances. * * @param factoryList the available {@link DashletFactory} instances. */ public void serviceListChanged(List<DashletFactory> factoryList) { for (Map.Entry<Wallboard, TabSheet.Tab> entry : m_wallboardEditorMap.entrySet()) { WallboardEditor wallboardEditor = (WallboardEditor) entry.getValue().getComponent(); wallboardEditor.updateServiceList(factoryList); } ((WallboardConfigUI) getUI()).notifyMessage("Configuration change", "Dashlet list modified"); }
@Override public Component getTabComponent(String tabId) { return getTabNN(tabId).getComponent(); }
/** * Sets the active {@link Tab}, i.e. sets the tab content as currently * visible and marks its button in the tab-bar as active. * * @param tab * the {@link Tab} to show */ public void setSelectedTab(Tab tab) { setSelectedTab(tab.getComponent()); }
/** * Removes the given tab (content and tab-bar button) from the TabBarView * * @param tab * the tab to remove */ public void removeTab(Tab tab) { removeTab(tab.getComponent()); }
private void updateTabVisibility() { for (int i=0; i<tabSheet.getComponentCount(); i++) { TabSheet.Tab tab = tabSheet.getTab(i); if (tab.getComponent() instanceof SelectionAwareTable) { ContentType contentType = ((SelectionAwareTable) tab.getComponent()).getContentType(); boolean visible = m_graphContainer.getTopologyServiceClient().contributesTo(contentType); tab.setVisible(visible); } } }
private void updateTabVisibility() { for (int i=0; i<tabSheet.getComponentCount(); i++) { TabSheet.Tab tab = tabSheet.getTab(i); if (tab.getComponent() instanceof SelectionAwareTable) { ContentType contentType = ((SelectionAwareTable) tab.getComponent()).getContentType(); boolean visible = m_graphContainer.getTopologyServiceClient().contributesTo(contentType); tab.setVisible(visible); } } }
attr, Boolean.class); if (selected) { this.setSelectedTab(tab.getComponent(), false);
tabElement.appendChild(designContext.createElement(tab.getComponent())); Attributes attr = tabElement.attributes(); def.getId(), String.class, designContext); if (getSelectedTab() != null && getSelectedTab().equals(tab.getComponent())) {
/** * Removes a {@link Tab} and the component associated with it, as previously * added with {@link #addTab(Component)}, * {@link #addTab(Component, String, Resource)} or * {@link #addComponent(Component)}. * <p> * If the tab was selected, the first eligible (visible and enabled) * remaining tab is selected. * </p> * * @see #addTab(Component) * @see #addTab(Component, String, Resource) * @see #addComponent(Component) * @see #removeComponent(Component) * @param tab * the Tab to remove */ public void removeTab(Tab tab) { removeComponent(tab.getComponent()); }
/** * Sets the selected tab. The tab is identified by the corresponding * {@link Tab Tab} instance. Does nothing if the tabsheet doesn't contain * the given tab. * * @param tab * the tab to select */ public void setSelectedTab(Tab tab) { if (tab != null) { setSelectedTab(tab.getComponent(), false); } }