/** * Moves all components from another container to this container. The * components are removed from the other container. * * If the source container is a {@link TabSheet}, component captions and * icons are copied from it. * * @param source * the container components are removed from. */ @Override public void moveComponentsFrom(ComponentContainer source) { for (final Iterator<Component> i = source.getComponentIterator(); i .hasNext();) { final Component c = i.next(); String caption = null; Resource icon = null; String iconAltText = ""; if (TabSheet.class.isAssignableFrom(source.getClass())) { Tab tab = ((TabSheet) source).getTab(c); caption = tab.getCaption(); icon = tab.getIcon(); iconAltText = tab.getIconAlternateText(); } source.removeComponent(c); Tab tab = addTab(c, caption, icon); tab.setIconAlternateText(iconAltText); } }
Iterator<Component> iterator = tabSheet.iterator(); while (iterator.hasNext()) { Component component = iterator.next(); TabSheet.Tab tab = tabSheet.getTab(component); if ("some tab caption".equals(tab.getCaption())) { // Found it!!! } }
for (Component component : tabSheet) { TabSheet.Tab tab = tabSheet.getTab(component); if ("some tab caption".equals(tab.getCaption())) { // Found it!!! } }
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); } }
private static void switchCaption(TabSheet tabSheet, MessageSourceAccessor messageSourceAccessor) { int j=0; for (final Iterator<Component> i = tabSheet.getComponentIterator(); i.hasNext();) { final Component component = i.next(); Tab tab = tabSheet.getTab(j++); String newCaption = getTranslatedCaption(tab.getCaption(),messageSourceAccessor); if (newCaption != null) { tab.setCaption(newCaption); } } } private static void switchCaption(Label label, MessageSourceAccessor messageSourceAccessor)
@Override public String getCaption() { return getVaadinTab().getCaption(); }
@Override public String getCaption() { return getVaadinTab().getCaption(); }
/** * Removes a tab identified by name */ public void removeTab(String name) { for(int i=0; i<m_tabSheet.getComponentCount(); i++) { Tab tab = m_tabSheet.getTab(i); if (name.equals(tab.getCaption())) { m_tabSheet.removeTab(tab); } } }
@Override public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabsheet = event.getTabSheet(); Tab tab = tabsheet.getTab(tabsheet.getSelectedTab()); if (tab != null) { Notification.show("Selected tab: " + tab.getCaption()); } }
@Override public String getCaption() { return tabbarTab.getCaption(); }
@Override public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabsheet = event.getTabSheet(); Tab tab = tabsheet.getTab(tabsheet.getSelectedTab()); if (tab != null) { Notification.show("Selected tab: " + tab.getCaption()); } }
tab.isClosable(), def.isClosable(), Boolean.class, designContext); DesignAttributeHandler.writeAttribute("caption", attr, tab.getCaption(), def.getCaption(), String.class, designContext); DesignAttributeHandler.writeAttribute("enabled", attr, tab.isEnabled(), def.isEnabled(), Boolean.class, designContext);
/** * Copies properties from one Tab to another. * * @param from * The tab whose data to copy. * @param to * The tab to which copy the data. */ private static void copyTabMetadata(Tab from, Tab to) { to.setCaption(from.getCaption()); to.setIcon(from.getIcon(), from.getIconAlternateText()); to.setDescription(from.getDescription()); to.setVisible(from.isVisible()); to.setEnabled(from.isEnabled()); to.setClosable(from.isClosable()); to.setStyleName(from.getStyleName()); to.setComponentError(from.getComponentError()); }