List of usage examples for com.vaadin.ui TabSheet addTab
public Tab addTab(Component c)
From source file:org.opennms.features.vaadin.config.SnmpCollectionAdminApplication.java
License:Open Source License
@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();// www . j a v a 2 s . co m tabs.addTab(new SnmpCollectionPanel(dataCollectionDao, new SimpleLogger())); tabs.addTab(new DataCollectionGroupAdminPanel(dataCollectionDao)); setContent(tabs); }
From source file:org.vaadin.addon.twitter.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { Responsive.makeResponsive(this); CssLayout info = new CssLayout(); info.setStyleName("tw-docs"); info.addComponent(markdown.get(0));/*from www . j a v a 2 s . co m*/ TabSheet tabSheet = new TabSheet(); tabSheet.setStyleName("tw-demo-tab"); tabSheet.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS); tabSheet.setSizeFull(); tabSheet.addTab(new TimelineDemo()).setCaption("Timeline"); tabSheet.addTab(new TweetDemo()).setCaption("Single Tweet"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Follow)).setCaption("Follow Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Share)).setCaption("Share Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Hashtag)).setCaption("Hashtag Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Mention)).setCaption("Mention Button"); tabSheet.addSelectedTabChangeListener(event -> { Component old = info.getComponent(0); Component newComp = markdown.get(tabSheet.getTabPosition(tabSheet.getTab(tabSheet.getSelectedTab()))); info.replaceComponent(old, newComp); }); final MHorizontalLayout layout = new MHorizontalLayout(info, tabSheet).withExpand(info, 4) .withExpand(tabSheet, 6).withFullWidth().withFullHeight().withMargin(false).withSpacing(true); setContent(new MPanel(layout).withFullWidth().withFullHeight().withStyleName(ValoTheme.PANEL_WELL, "root-container")); }
From source file:org.vaadin.spinkit.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull();//from w w w . jav a2s. c o m tabSheet.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS); tabSheet.addTab(spinnersContainer()).setCaption("Spinners"); tabSheet.addTab(spinnerSizesContainer()).setCaption("Sizes"); tabSheet.addTab(spinnersContainer("greenspin")).setCaption("Themed Spinners"); tabSheet.addTab(new RichText().withMarkDown(getClass().getResourceAsStream("source.md"))) .setCaption("Source code"); //layout.addComponent(tabSheet); //layout.expand(tabSheet); RichText info = new RichText().withMarkDown(getClass().getResourceAsStream("about.md")); MVerticalLayout layout = new MVerticalLayout().withMargin(true).with(info).expand(tabSheet).withFullHeight() .withFullWidth(); //layout.setExpandRatio(info, 1); //layout.setExpandRatio(tabSheet, 4); setContent(layout); }
From source file:v7cr.ReviewList.java
License:Open Source License
public void itemClick(ItemClickEvent event) { TabSheet tabs = (TabSheet) getParent(); Object iid = event.getItemId(); if (iid instanceof ObjectId) { // find existing tab int count = tabs.getComponentCount(); for (int i = 0; i < count; i++) { Component x = tabs.getTab(i).getComponent(); if (x instanceof ReviewTab && ((ReviewTab) x).reviewId.equals(iid)) { tabs.setSelectedTab(x);/*from w w w. ja va 2 s .c o m*/ return; } } Tab t = tabs.addTab(new ReviewTab((ObjectId) iid)); t.setClosable(true); tabs.setSelectedTab(t.getComponent()); } }
From source file:v7cr.TopPageWindow.java
License:Open Source License
private void initUI(V7CR app) { VerticalLayout vl = new VerticalLayout(); vl.setSizeFull();/*from w ww . j a va2 s. c o m*/ vl.addComponent(createToolbar(app)); TabSheet main = new TabSheet(); vl.addComponent(main); vl.setExpandRatio(main, 1); Map<String, Role> roles = app.getRoles(); if (roles.containsKey("admin")) { main.addTab(new RoleEditor(app)); main.addTab(new UserEditor(app)); main.addTab(new ProjectEditor(app)); } for (String r : roles.keySet()) { if (r.startsWith("project:")) { String p = r.substring(8); main.addTab(new ReviewList(p)); } } addComponent(vl); }