/** * Sets the selected tab. The tab is identified by the tab content * component. Does nothing if the tabsheet doesn't contain the component. * * @param component * the component of the tab to select */ public void setSelectedTab(Component component) { setSelectedTab(component, false); }
/** * 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)); }
@Override public void setSelected(String key) { setSelectedTab(keyMapper.get(key), true); }
/** * 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); } }
/** * Method to invoke when a {@link TabSheet.Tab} is closed. * * @param tabsheet * @param tabContent */ public void onTabClose(final TabSheet tabsheet, final Component tabContent) { tabsheet.setSelectedTab(0); tabsheet.removeComponent(tabContent); m_wallboardEditorMap.remove(((WallboardEditor) tabContent).getWallboard()); }
attr, Boolean.class); if (selected) { this.setSelectedTab(tab.getComponent(), false);
@Override public void addChild(ProcessToolWidget child) { if (!(child instanceof ProcessToolVaadinWidget)) { throw new IllegalArgumentException("child is not instance of " + ProcessToolVaadinWidget.class.getName()); } Component component; ProcessToolVaadinWidget vChild = (ProcessToolVaadinWidget) child; try { component = vChild.render(); } catch (Throwable e) { logger.log(Level.SEVERE, e.getMessage(), e); Panel p = new Panel(); VerticalLayout vl = new VerticalLayout(); vl.addComponent(new Label(getMessage("process.data.widget.exception-occurred"))); vl.addComponent(new Label(e.getMessage())); ByteArrayOutputStream baos = new ByteArrayOutputStream(); e.printStackTrace(new PrintWriter(baos)); vl.addComponent(new Label("<pre>" + baos.toString() + "</pre>", CONTENT_XHTML)); vl.addStyleName("error"); p.addComponent(vl); p.setHeight("150px"); component = p; } ts.addTab(component, getMessage(child.getAttributeValue("caption")), null); if (ts.getSelectedTab() == null) ts.setSelectedTab(component); }
tabSheet.setSelectedTab(0); // select first component! tabSheet.addStyleName(Reindeer.TABSHEET_BORDERLESS);
tabSheet.setSelectedTab(0); // select first component! tabSheet.addStyleName(Reindeer.TABSHEET_BORDERLESS);
public ConfigResultView(JmxConfigGeneratorApplication app) { this.app = app; setSizeFull(); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.addComponent(tabSheet); mainLayout.addComponent(buttonPanel); tabSheet.setSizeFull(); // TODO set tab name differently (e.g. SNMP Graph properties snippet) tabContentMap.put(OutputDataKey.JmxDataCollectionConfig, new TabContent(OutputDataKey.JmxDataCollectionConfig)); tabContentMap.put(OutputDataKey.SnmpGraphProperties, new TabContent(OutputDataKey.SnmpGraphProperties)); tabContentMap.put(OutputDataKey.CollectdConfigSnippet, new TabContent(OutputDataKey.CollectdConfigSnippet)); // add all tabs for (TabContent eachContent : tabContentMap.values()) tabSheet.addTab(eachContent, eachContent.getCaption()); tabSheet.setSelectedTab(0); // select first component! buttonPanel.getNext().setVisible(false); // TODO MVR enable button again and allow to download buttonPanel.getNext().setCaption("download all"); buttonPanel.getNext().setIcon(IconProvider.getIcon(IconProvider.BUTTON_SAVE)); mainLayout.setExpandRatio(tabSheet, 1); setCompositionRoot(mainLayout); }
bBack.addClickListener(e -> { if (current < 1) return; layout.setSelectedTab(current-2); }); toolBar.addComponent(bBack); bNext.addClickListener(e -> { if (current >= tabIndex.size()) return; layout.setSelectedTab(current); }); toolBar.addComponent(bNext);
/** * This method enables or disables all tabs in a tabSheet. Therefore the * <code>ViewStatechangedEvent</code> is used. If the new view state is Edit * the method returns the last selected tab position. If the new view state * is not Edit the " <code>oldSelectedTabPosition</code>" is selected in the * given <code>tabSheet</code>. * * @param tabSheet * the tabsheet to enable or disable all tabs in * @param event * @param oldSelectedTabPosition * which tab was selected before view state was Edit * @return */ public static int enableTabs(final TabSheet tabSheet, final ViewStateChangedEvent event, final int oldSelectedTabPosition) { boolean editMode = event.getNewState().isEdit(); boolean enabled = !editMode; int newSelectedTabPosition = 0; // remember which tab was selected (before editing) if (editMode) newSelectedTabPosition = getSelectedTabPosition(tabSheet); // disable or enable for (int i = 0; i < tabSheet.getComponentCount(); i++) tabSheet.getTab(i).setEnabled(enabled); // select tab depending on selection (after editing) if (!editMode) tabSheet.setSelectedTab(tabSheet.getTab(oldSelectedTabPosition)); // return currently selected tab return editMode ? newSelectedTabPosition : getSelectedTabPosition(tabSheet); }
this.tabsheet.setSelectedTab(tabComponent);
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); }
rollout = null; groupsDefinitionTabs.setVisible(true); groupsDefinitionTabs.setSelectedTab(0);
rollout = null; groupsDefinitionTabs.setVisible(true); groupsDefinitionTabs.setSelectedTab(0);
groupsDefinitionTabs.setSelectedTab(1);
groupsDefinitionTabs.setSelectedTab(1);
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);