/** * Adds a new tab into TabSheet. Component caption and icon are copied to * the tab metadata at creation time. * * @see #addTab(Component) * * @param c * the component to be added. */ @Override public void addComponent(Component c) { addTab(c); }
/** * 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); } }
/** * Sets the selected tab, identified by its index. Does nothing if the * position is out of bounds. * * @param index * the index of the tab to select */ public void setSelectedTab(int index) { setSelectedTab(getTab(index)); }
/** * Constructs a new TabSheet. A TabSheet is immediate by default, and the * default close handler removes the tab being closed. */ public TabSheet() { super(); registerRpc(rpc); registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); // expand horizontally by default setWidth(100, UNITS_PERCENTAGE); setCloseHandler(TabSheet::removeComponent); }
/** * Returns the {@link Tab} (metadata) with the given index. The {@link Tab} * object can be used for setting caption,icon, etc for the tab. * * @param index * the index of the tab * @return The tab with the given index, or null if the index is out of * bounds. */ public Tab getTab(int index) { if (index >= 0 && index < getComponentCount()) { return getTab(components.get(index)); } else { return null; } }
bottomLayout.setSizeFull(); final TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); tabSheet.addTab(view, (view == m_alarmTable? "Alarms":"Nodes"), null); tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(final SelectedTabChangeEvent event) {
private void initComponents() { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); tabSheet = new TabSheet(); tabSheet.setSizeFull(); tabSheet.addTab(permissionTab = new ProcessPermissionTab(), messages.getMessage("process.editor.process.permissions")); tabSheet.addTab(processDefinitionTab = new ProcessDefinitionTab(), messages.getMessage("process.editor.process.definition")); tabSheet.addTab(queueTab = new QueueTab(), messages.getMessage("process.editor.queues")); tabSheet.addTab(messageTab = new MessageTab(), messages.getMessage("process.editor.messages")); tabSheet.addTab(dictionaryTab = new DictionaryTab(), messages.getMessage("process.editor.dictionary")); tabSheet.addTab(otherTab = new OtherTab(), messages.getMessage("process.editor.other")); saveButton = VaadinUtility.button(messages.getMessage("process.editor.save"), new Runnable() { @Override public void run() { ((ProcessEditorApplication) ProcessEditorApplication.getCurrent()).saveAndCallback(); } }); titleLabel = new Label(messages.getMessage("process.editor.title")); titleLabel.addStyleName("h1"); }
@Override public void init(VaadinRequest request) { if (dataCollectionDao == null) throw new RuntimeException("dataCollectionDao cannot be null."); TabSheet tabs = new TabSheet(); tabs.addStyleName("light"); tabs.setSizeFull(); tabs.addTab(new SnmpCollectionPanel(dataCollectionDao, new SimpleLogger())); tabs.addTab(new DataCollectionGroupAdminPanel(dataCollectionDao)); setContent(tabs); } }
private TabSheet createGroupDefinitionTabs() { final TabSheet tabSheet = new TabSheet(); tabSheet.setId(UIComponentIdProvider.ROLLOUT_GROUPS); tabSheet.setWidth(850, Unit.PIXELS); tabSheet.setHeight(300, Unit.PIXELS); tabSheet.setStyleName(SPUIStyleDefinitions.ROLLOUT_GROUPS); final TabSheet.Tab simpleTab = tabSheet.addTab(createSimpleGroupDefinitionTab(), i18n.getMessage("caption.rollout.tabs.simple")); simpleTab.setId(UIComponentIdProvider.ROLLOUT_SIMPLE_TAB); final TabSheet.Tab advancedTab = tabSheet.addTab(defineGroupsLayout, i18n.getMessage("caption.rollout.tabs.advanced")); advancedTab.setId(UIComponentIdProvider.ROLLOUT_ADVANCED_TAB); tabSheet.addSelectedTabChangeListener(event -> validateGroups()); return tabSheet; }
tabSheet.addTab(eachContent, eachContent.getCaption()); tabSheet.setSizeFull(); tabSheet.setSelectedTab(0); // select first component! tabSheet.addStyleName(Reindeer.TABSHEET_BORDERLESS);
vl.addComponent(new Label(messages.getMessage("userstep.editor.instructions"), Label.CONTENT_XHTML)); TabSheet ts = new TabSheet(); ts.setSizeFull(); ts.addTab(stepLayout, messages.getMessage("userstep.editor.widgets.tabcaption")); ts.addTab(stepDefinitionLayout, messages.getMessage("userstep.state.tabcaption")); ts.addTab(assignmentLayout, messages.getMessage("userstep.editor.assignment.tabcaption")); ts.addTab(permissionEditor, messages.getMessage("userstep.editor.permissions.tabcaption")); ts.setSelectedTab(stepLayout); vl.addComponent(ts); vl.setExpandRatio(ts, 1.0f);
public ProcessDataWidgetsDefinitionEditor() { hierarchyEditor = new ProcessDataHierarchyEditor(this); rawText.setNullRepresentation(""); rawText.setWidth("100%"); rawText.setHeight("400px"); TabSheet tabSheet = new TabSheet(); tabSheet.setWidth("100%"); tabSheet.addTab(hierarchyEditor, getLocalizedMessage("hierarchy-editor")); tabSheet.addTab(getRawTextEditorTab(), getLocalizedMessage("source-xml")); tabSheet.addTab(processPreview, getLocalizedMessage("preview")); tabSheet.setSelectedTab(hierarchyEditor); setCompositionRoot(tabSheet); }
TabSheet tabsheet= new TabSheet(); // Create an example of tab VerticalLayout tabExample= new VerticalLayout(); tabExample.addComponent(new Embedded(null, new ThemeResource("anyImage.jpg"))); tabExample.setCaption("Example"); tabsheet.addTab(tabExample).setIcon( new ThemeResource("anyIcon.png")); Iterator<Component> componentIterator = tabsheet.getComponentIterator(); while (componentIterator.hasNext()) { Component c = (Component) componentIterator.next(); Tab tab = tabsheet.getTab(c); System.out.println("test: " + tab.getCaption()); }
TabSheet ts = new TabSheet(); ts.addSelectedTabChangeListener(new LazyTabChangeListener()); ts.addTab(tab1, "Tab1"); ts.addTab(tab2, "Tab2"); setCompositionRoot(ts);
/** * Sets the visibility of the Swatches tab. * * @param visible * The visibility of the Swatches tab */ public void setSwatchesTabVisible(boolean visible) { if (visible && !isTabVisible(swatchesTab)) { tabs.addTab(swatchesTab, "Swatches", null); checkIfTabsNeeded(); } else if (!visible && isTabVisible(swatchesTab)) { tabs.removeComponent(swatchesTab); checkIfTabsNeeded(); } }
Tab tab = this.addTab(child); if (attr.hasKey("visible")) { tab.setVisible(DesignAttributeHandler.readAttribute("visible", attr, attr, Boolean.class); if (selected) { this.setSelectedTab(tab.getComponent(), false);