/** * 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); } }
DesignAttributeHandler.writeAttribute("enabled", attr, tab.isEnabled(), def.isEnabled(), Boolean.class, designContext); DesignAttributeHandler.writeAttribute("icon", attr, tab.getIcon(), def.getIcon(), Resource.class, designContext); DesignAttributeHandler.writeAttribute("icon-alt", attr, tab.getIconAlternateText(), def.getIconAlternateText(),
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 public Resource getIcon() { return tabbarTab.getIcon(); }
/** * 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()); }