List of usage examples for com.vaadin.ui TabSheet addTab
public Tab addTab(Component component, int position)
From source file:com.m4gik.views.component.LibraryScreen.java
/** * @param audioFile//from ww w .j av a 2s .c om * @return */ private CssLayout addDetails(AudioFile audioFile) { CssLayout details = new CssLayout(); details.setWidth("100%"); Label title = new Label("<h3>" + audioFile.getArtist() + "–" + audioFile.getTitle() + "</h3>", ContentMode.HTML); details.addComponent(title); title.setSizeUndefined(); TabSheet tabs = new TabSheet(); tabs.addStyleName(Runo.TABSHEET_SMALL); tabs.setWidth("100%"); tabs.setHeight("180px"); details.addComponent(tabs); FormLayout formLayout = new FormLayout(); tabs.addTab(formLayout, "Info"); Label text = new Label(audioFile.getTitle()); text.setCaption("Title:"); formLayout.addComponent(text); text = new Label(audioFile.getArtist()); text.setCaption("Artist:"); formLayout.addComponent(text); text = new Label(audioFile.getAlbum()); text.setCaption("Album:"); formLayout.addComponent(text); text = new Label(audioFile.getGenre()); text.setCaption("Genre:"); formLayout.addComponent(text); text = new Label(audioFile.getPrice() + "$"); text.setCaption("Price"); formLayout.addComponent(text); formLayout = new FormLayout(); tabs.addTab(formLayout, "Decription"); text = new Label(audioFile.getAbout()); formLayout.addComponent(text); formLayout = new FormLayout(); tabs.addTab(formLayout, "Lyrics"); text = new Label(audioFile.getLyrics()); formLayout.addComponent(text); return details; }
From source file:com.ocs.dynamo.ui.composite.form.ModelBasedEditForm.java
License:Apache License
/** * Construct the layout (form and panel) for an attribute group * //from ww w . j a va 2 s .c o m * @param parent * the parent component * @param tabs * whether to include the component in a tab sheet * @param tabSheet * the parent tab sheet (only used if the "tabs" parameter is true) * @param caption * caption of the panel or tab sheet * @param lowest * indicates whether this is the lowest level * @return */ private Layout constructAttributeGroupLayout(Layout parent, boolean tabs, TabSheet tabSheet, String caption, boolean lowest) { Layout innerLayout = null; if (lowest) { innerLayout = new FormLayout(); ((FormLayout) innerLayout).setMargin(true); if (!tabs) { ((FormLayout) innerLayout).setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN); } } else { innerLayout = new DefaultVerticalLayout(true, true); } if (tabs) { tabSheet.addTab(innerLayout, caption); } else { Panel panel = new Panel(); panel.setStyleName("attributePanel"); panel.setCaption(caption); panel.setContent(innerLayout); parent.addComponent(panel); } return innerLayout; }
From source file:com.ocs.dynamo.ui.composite.layout.LazyTabLayout.java
License:Apache License
/** * Constructs the lazy tab sheet by setting up empty dummy tabs * @param tabs/* w w w . j a v a 2 s . c om*/ */ private void setupLazySheet(final TabSheet tabs) { // build up placeholder tabs that only contain an empty layout for (String caption : getTabCaptions()) { tabs.addTab(new DefaultVerticalLayout(false, false), caption); } // load the first tab ((Layout) tabs.getTab(0).getComponent()).addComponent(initTab(0)); replacedTabs.add(tabs.getTab(0).getCaption()); // respond to a tab change by actually loading the sheet tabs.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { Component selectedTab = event.getTabSheet().getSelectedTab(); Tab tab = event.getTabSheet().getTab(selectedTab); // lazily load a tab if (!replacedTabs.contains(tab.getCaption())) { replacedTabs.add(tab.getCaption()); // look up the tab in the copies int index = 0; for (int i = 0; i < tabs.getComponentCount(); i++) { Tab t = tabs.getTab(i); if (t.getCaption().equals(tab.getCaption())) { index = i; break; } } // paste the real tab into the placeholder Component realTab = initTab(index); ((Layout) selectedTab).addComponent(realTab); } else { // reload the tab if needed Layout layout = (Layout) selectedTab; Component next = layout.iterator().next(); if (next instanceof Reloadable) { ((Reloadable) next).reload(); } } } }); }
From source file:cz.zcu.pia.social.network.frontend.views.ViewProfile.java
/** * PostConstruct/* w w w .j a v a2 s . c om*/ */ @PostConstruct @Override public void postConstruct() { super.postConstruct(); if (!securityHelper.isAuthenticated()) { ((MyUI) UI.getCurrent().getUI()).getNavigator().navigateTo(ViewHome.NAME); } TabSheet tabsheet = new TabSheet(); tabsheet.setWidth(COMPONENT_WIDTH, Unit.PIXELS); tabsheet.addTab(friends, msgs.getMessage("view.profile.tab.friends")); tabsheet.addTab(profile, msgs.getMessage("view.profile.tab.profile")); this.getContentWrapper().addComponent(tabsheet); //this.getContentWrapper().addComponent(); }
From source file:de.datenhahn.vaadin.componentrenderer.demo.ComponentRendererDemoUI.java
License:Apache License
private void startDemoApp() { layout.setSizeFull();/*w w w. j av a 2 s. c om*/ layout.setMargin(true); layout.setSpacing(true); addHeader(); TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); layout.addComponent(tabSheet); tabSheet.addTab(new ClassicGridTab(), "Classic Grid"); tabSheet.addTab(new ClassicGridWithDecoratorTab(), "Classic Grid with Decorator"); tabSheet.addTab(new ComponentGridTab(), "Typed Component Grid"); tabSheet.addTab(new ViritinMGridTab(), "Viritin MGrid"); tabSheet.addTab(new NotABeanGridWithDecoratorTab(), "Not a bean grid"); tabSheet.addTab(new ClassicGridWithStaticContainerTab(), "Classic Grid with Static Container"); layout.setExpandRatio(tabSheet, 1.0f); setContent(layout); }
From source file:de.fatalix.bookery.view.admin.AdminView.java
License:Open Source License
@PostConstruct private void postInit() { TabSheet tabSheet = new TabSheet(); tabSheet.setStyleName("admin-screen"); tabSheet.addTab(createServerSettings(), "Server Settings"); tabSheet.addTab(createUserManagement(), "User Management"); tabSheet.addTab(batchJobsLayout, "Batch Jobs"); this.setCompositionRoot(tabSheet); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java
License:Open Source License
/** * for both graphs/*ww w . j a v a 2s . c o m*/ * * @return the tablayout containing both graphs */ Component initGraphs() { TabSheet graphTab = new TabSheet(); graphTab.setCaption("Project Graph"); VerticalLayout graphSection = new VerticalLayout(); graphSectionContent = new VerticalLayout(); graphSection.setCaption("Project Graph"); graphSectionContent.setMargin(new MarginInfo(true, false, true, true)); // graphSection.setMargin(new MarginInfo(true, false, true, true)); graphSection.setMargin(true); graphSection.setSpacing(true); graphSection.setWidth("100%"); graphSectionContent.setWidth("100%"); OpenBisClient openbis = datahandler.getOpenBisClient(); Map<String, String> taxMap = openbis.getVocabCodesAndLabelsForVocab("Q_NCBI_TAXONOMY"); Map<String, String> tissueMap = openbis.getVocabCodesAndLabelsForVocab("Q_PRIMARY_TISSUES"); newGraphContent = new GraphPage(taxMap, tissueMap); graphSection.addComponent(graphSectionContent); graphTab.addTab(graphSection, "Sample Graph"); graphTab.addTab(newGraphContent, "Sample Graph v2 (beta)"); return graphTab; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java
License:Open Source License
/** * for both graphs/* w ww.j a v a2s. co m*/ * * @return the tablayout containing both graphs */ Component initGraphs() { TabSheet graphTab = new TabSheet(); graphTab.setCaption("Project Graph"); VerticalLayout graphSection = new VerticalLayout(); graphSectionContent = new VerticalLayout(); graphSection.setCaption("Project Graph"); graphSectionContent.setMargin(new MarginInfo(true, false, true, true)); graphSection.setMargin(new MarginInfo(true, false, true, true)); graphSection.setWidth("100%"); graphSectionContent.setWidth("100%"); OpenBisClient openbis = datahandler.getOpenBisClient(); Map<String, String> taxMap = openbis.getVocabCodesAndLabelsForVocab("Q_NCBI_TAXONOMY"); Map<String, String> tissueMap = openbis.getVocabCodesAndLabelsForVocab("Q_PRIMARY_TISSUES"); newGraphContent = new GraphPage(taxMap, tissueMap); graphSection.addComponent(graphSectionContent); graphTab.addTab(graphSection, "Sample Graph"); graphTab.addTab(newGraphContent, "Sample Graph v2 (beta)"); return graphTab; }
From source file:edu.nps.moves.mmowgli.modules.actionplans.MediaSubWindow.java
License:Open Source License
public MediaSubWindow(Resource res) { setCaption("Action Plan Image"); setModal(true);//from ww w. j av a 2 s .com setWidth("640px"); setHeight("480px"); TabSheet tabs = new TabSheet(); tabs.setSizeFull(); setContent(tabs); Panel pan = new Panel(); tabs.addTab(pan, "Fit Window"); pan.setSizeFull(); VerticalLayout layout = new VerticalLayout(); pan.setContent(layout); layout.setSizeFull(); layout.addStyleName("m-background-lightgrey"); layout.setMargin(false); image = new ScaleImage(); image.setSizeFull(); image.setSource(res); layout.addComponent(image); layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); layout.setExpandRatio(image, 1.0f); tabs.addTab(buildNestedImage(res), "Actual Size"); }
From source file:eu.eco2clouds.portal.page.ExperimentLayout.java
License:Apache License
public void render() { TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull();/*w ww . j ava 2s. c om*/ /* sheet on experiment details*/ VerticalLayout detailsSheet = new VerticalLayout(); detailsSheet.setSpacing(true); detailsSheet.setMargin(true); detailsSheet.setSizeFull(); detailsSheet.addComponent(new ExperimentDetails(experiment)); detailsSheet.addComponent(new ResourceTable()); /* sheet reporting experiment energy */ VerticalLayout ecoReportSheet = new VerticalLayout(); ecoReportSheet.setSpacing(true); ecoReportSheet.setMargin(false); ecoReportSheet.setSizeFull(); ecoReportSheet.addComponent(new EcoReport()); /* sheet reporting adaptation actions */ VerticalLayout adaptationActionSheet = new VerticalLayout(); adaptationActionSheet.setSpacing(true); adaptationActionSheet.setMargin(false); adaptationActionSheet.setSizeFull(); adaptationActionSheet.addComponent(new AdaptationReport()); /* sheet reporting experiment energy */ /*VerticalLayout recommendationReportSheet = new VerticalLayout(); recommendationReportSheet.setSpacing(true); recommendationReportSheet.setMargin(false); recommendationReportSheet.setSizeFull(); recommendationReportSheet.addComponent(new RecommendationReport());*/ tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL); tabSheet.addTab(detailsSheet, "Details"); tabSheet.addTab(ecoReportSheet, "Eco Report"); tabSheet.addTab(adaptationActionSheet, "Adaptation Report"); //tabSheet.addTab(recommendationReportSheet, "Recommendation Report"); this.addComponent(tabSheet); Label space = new Label(""); this.addComponent(space); Label version = new Label("<hr/>ECO2Clouds Portal v." + E2CPortal.VERSION + " - (c) ECO2Clouds project 2012-2014 (<a href='http://www.eco2clouds.eu' target='_blank'>http://www.eco2clouds.eu</a>)", ContentMode.HTML); this.addComponent(version); this.setExpandRatio(tabSheet, 2.0f); }