List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java
License:Open Source License
/** * //w w w . j a va2 s. c o m * @param statusValues * @return */ public VerticalLayout createProjectStatusComponentNew(Map<String, Integer> statusValues) { VerticalLayout projectStatusContent = new VerticalLayout(); projectStatusContent.setResponsive(true); projectStatusContent.setMargin(true); projectStatusContent.setSpacing(true); Label planned = new Label(); Label design = new Label(); Label raw = new Label(); Label results = new Label(); Iterator<Entry<String, Integer>> it = statusValues.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Integer> pairs = (Map.Entry<String, Integer>) it.next(); if ((Integer) pairs.getValue() == 0) { Label statusLabel = new Label(pairs.getKey()); statusLabel.setStyleName(ValoTheme.LABEL_FAILURE); statusLabel.setResponsive(true); // statusLabel.addStyleName("redicon"); if (pairs.getKey().equals("Project planned")) { planned = statusLabel; } else if (pairs.getKey().equals("Experimental design registered")) { design = statusLabel; } else if (pairs.getKey().equals("Raw data registered")) { raw = statusLabel; } else if (pairs.getKey().equals("Results registered")) { results = statusLabel; } } else { Label statusLabel = new Label(pairs.getKey()); statusLabel.setStyleName(ValoTheme.LABEL_SUCCESS); statusLabel.setResponsive(true); // statusLabel.addStyleName("greenicon"); if (pairs.getKey().equals("Project planned")) { planned = statusLabel; } else if (pairs.getKey().equals("Experimental design registered")) { design = statusLabel; } else if (pairs.getKey().equals("Raw data registered")) { raw = statusLabel; } else if (pairs.getKey().equals("Results registered")) { results = statusLabel; } } } projectStatusContent.addComponent(planned); projectStatusContent.addComponent(design); projectStatusContent.addComponent(raw); projectStatusContent.addComponent(results); // ProgressBar progressBar = new ProgressBar(); // progressBar.setValue((float) finishedExperiments / statusValues.keySet().size()); // projectStatusContent.addComponent(progressBar); return projectStatusContent; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ExperimentComponent.java
License:Open Source License
private void initUI() { expSteps = new VerticalLayout(); expSteps.setWidth(100.0f, Unit.PERCENTAGE); expSteps.setMargin(new MarginInfo(true, true, true, true)); expSteps.setSpacing(true);// ww w .j a v a2 s. co m export = new Button("Export as TSV"); export.setIcon(FontAwesome.DOWNLOAD); VerticalLayout buttonLayoutSection = new VerticalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setHeight(null); buttonLayout.setWidth("100%"); buttonLayout.addComponent(this.export); buttonLayout.setMargin(new MarginInfo(false, false, false, false)); buttonLayoutSection.addComponent(buttonLayout); buttonLayoutSection.setSpacing(true); buttonLayoutSection.setMargin(new MarginInfo(false, false, false, false)); experiments = new Grid(); experiments.setReadOnly(true); experiments.setWidth(100.0f, Unit.PERCENTAGE); experiments.setCaption("Registered Experimental Steps"); // experiments.setContainerDataSource(new // BeanItemContainer<ExperimentBean>(ExperimentBean.class)); expSteps.addComponent(new Label( "This view shows the experimental steps which have been registered for this project. Experimental steps contain real biological experiments as well as executed computational workflows on project data", ContentMode.HTML)); expSteps.addComponent(experiments); expSteps.addComponent(buttonLayoutSection); setCompositionRoot(expSteps); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ExperimentView.java
License:Open Source License
/** * initializes the description layout/*ww w . ja va 2 s.co m*/ * * @return */ VerticalLayout initDescription() { VerticalLayout generalInfo = new VerticalLayout(); VerticalLayout generalInfoContent = new VerticalLayout(); idLabel = new Label(""); generalInfoLabel = new Label(""); statContentLabel = new Label(""); generalInfoContent.addComponent(idLabel); generalInfo.setMargin(new MarginInfo(true, false, true, true)); generalInfoContent.addComponent(generalInfoLabel); generalInfoContent.setMargin(new MarginInfo(true, false, true, true)); generalInfoContent.addComponent(statContentLabel); generalInfoContent.setSpacing(true); generalInfo.addComponent(generalInfoContent); return generalInfo; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ExperimentView.java
License:Open Source License
/** * //from w w w .j a v a 2s . c o m * @return * */ VerticalLayout initStatistics() { VerticalLayout statistics = new VerticalLayout(); HorizontalLayout statContent = new HorizontalLayout(); // statContent.setCaption("Statistics"); // statContent.setIcon(FontAwesome.BAR_CHART_O); // int numberOfDatasets = dh.datasetMap.get(experimentBean.getId()).size(); statContentLabel = new Label(""); statContent.addComponent(statContentLabel); statContent.setMargin(new MarginInfo(true, false, true, true)); // statContent.addComponent(new Label(String.format("%s dataset(s).",numberOfDatasets ))); // statContent.setMargin(true); // statContent.setMargin(new MarginInfo(false, false, false, true)); // statContent.setSpacing(true); /* * if (numberOfDatasets > 0) { * * String lastSample = "No samples available"; if (experimentBean.getLastChangedSample() != * null) { lastSample = experimentBean.getLastChangedSample();// .split("/")[2]; } * statContent.addComponent(new Label(String.format( "Last change %s", String.format( * "occurred in sample %s (%s)", lastSample, * experimentBean.getLastChangedDataset().toString())))); } */ statistics.addComponent(statContent); // statistics.setMargin(true); // Properties of experiment // VerticalLayout properties = new VerticalLayout(); // VerticalLayout propertiesContent = new VerticalLayout(); // propertiesContent.setCaption("Properties"); // propertiesContent.setIcon(FontAwesome.LIST_UL); // propertiesContentLabel = new Label("", ContentMode.HTML); // propertiesContent.addComponent(propertiesContentLabel); // properties.addComponent(propertiesContent); // propertiesContent.setMargin(new MarginInfo(true, false, false, true)); // properties.setMargin(true); // statistics.addComponent(properties); statistics.setMargin(new MarginInfo(true, false, true, true)); statistics.setSpacing(true); return statistics; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.HomeView.java
License:Open Source License
/** * sets the ContainerDataSource of this view. Should usually contain project information. Caption * is caption.//from w ww.j av a 2 s . co m * * @param homeViewInformation * @param caption */ public void setContainerDataSource(SpaceBean spaceBean, String newCaption) { caption = newCaption; currentBean = spaceBean; numberOfProjects = currentBean.getProjects().size(); projectGrid = new Grid(); GeneratedPropertyContainer gpcProjects = new GeneratedPropertyContainer(spaceBean.getProjects()); gpcProjects.removeContainerProperty("members"); gpcProjects.removeContainerProperty("id"); gpcProjects.removeContainerProperty("experiments"); gpcProjects.removeContainerProperty("contact"); gpcProjects.removeContainerProperty("contactPerson"); gpcProjects.removeContainerProperty("projectManager"); gpcProjects.removeContainerProperty("containsData"); gpcProjects.removeContainerProperty("containsResults"); gpcProjects.removeContainerProperty("containsAttachments"); gpcProjects.removeContainerProperty("description"); gpcProjects.removeContainerProperty("progress"); gpcProjects.removeContainerProperty("registrationDate"); gpcProjects.removeContainerProperty("registrator"); gpcProjects.removeContainerProperty("longDescription"); projectGrid.setContainerDataSource(gpcProjects); projectGrid.setHeightMode(HeightMode.ROW); projectGrid.setHeightByRows(20); // projectGrid.getColumn("space").setWidthUndefined(); // projectGrid.getColumn("code").setWidthUndefined(); // projectGrid.getColumn("secondaryName").setWidthUndefined(); // projectGrid.getColumn("principalInvestigator").setWidthUndefined(); projectGrid.getColumn("code").setHeaderCaption("Sub-Project").setWidth(150); // projectGrid.getColumn("space").setWidth(200); Column nameCol = projectGrid.getColumn("secondaryName"); nameCol.setHeaderCaption("Short Name"); nameCol.setMaximumWidth(450); projectGrid.getColumn("space").setMaximumWidth(350); projectGrid.getColumn("space").setHeaderCaption("Project"); projectGrid.getColumn("principalInvestigator").setHeaderCaption("Investigator"); projectGrid.setColumnOrder("code", "space", "secondaryName", "principalInvestigator"); projectGrid.setResponsive(true); helpers.GridFunctions.addColumnFilters(projectGrid, gpcProjects); gpcProjects.addGeneratedProperty("Summary", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "show"; } @Override public Class<String> getType() { return String.class; } }); projectGrid.getColumn("Summary").setWidthUndefined(); projectGrid.getColumn("Summary").setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { // Show loading window ProgressBar bar = new ProgressBar(); bar.setIndeterminate(true); VerticalLayout vl = new VerticalLayout(bar); vl.setComponentAlignment(bar, Alignment.MIDDLE_CENTER); vl.setWidth("50%"); vl.setSpacing(true); vl.setMargin(true); Window loadingWindow = new Window("Loading project summary..."); loadingWindow.setWidth("50%"); loadingWindow.setContent(vl); loadingWindow.center(); loadingWindow.setModal(true); loadingWindow.setResizable(false); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); ui.addWindow(loadingWindow); // fetch summary and create docx in tmp folder ProjectBean proj = (ProjectBean) event.getItemId(); summaryFetcher.fetchSummaryComponent(proj.getCode(), proj.getSecondaryName(), proj.getDescription(), new ProjectSummaryReadyRunnable(summaryFetcher, loadingWindow, proj.getCode())); } })); projectGrid.getColumn("Summary").setWidth(100); projectGrid.addSelectionListener(new SelectionListener() { @Override public void select(SelectionEvent event) { Set<Object> selectedElements = event.getSelected(); if (selectedElements == null) { return; } ProjectBean selectedProject = (ProjectBean) selectedElements.iterator().next(); if (selectedProject == null) { return; } String entity = selectedProject.getId(); State state = (State) UI.getCurrent().getSession().getAttribute("state"); ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); message.add(entity); message.add(ProjectView.navigateToLabel); state.notifyObservers(message); } }); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.LevelComponent.java
License:Open Source License
/** * Precondition: {DatasetView#table} has to be initialized. e.g. with * {DatasetView#buildFilterTable} If it is not, strange behaviour has to be expected. builds the * Layout of this view.//from w w w. java 2 s .c om */ private void buildLayout() { this.vert.removeAllComponents(); this.vert.setWidth("100%"); // Table (containing datasets) section VerticalLayout tableSectionDatasets = new VerticalLayout(); VerticalLayout tableSectionSamples = new VerticalLayout(); HorizontalLayout tableSectionContent = new HorizontalLayout(); HorizontalLayout sampletableSectionContent = new HorizontalLayout(); tableSectionContent.setMargin(new MarginInfo(false, false, false, false)); sampletableSectionContent.setMargin(new MarginInfo(false, false, false, false)); // tableSectionContent.setCaption("Datasets"); // tableSectionContent.setIcon(FontAwesome.FLASK); descriptionLabel.setWidth("100%"); tableSectionDatasets.addComponent(descriptionLabel); sampletableSectionContent.addComponent(sampleGrid); tableSectionContent.addComponent(this.datasetTable); tableSectionDatasets.setMargin(new MarginInfo(true, false, false, true)); tableSectionDatasets.setSpacing(true); tableSectionSamples.setMargin(new MarginInfo(true, false, true, true)); tableSectionSamples.setSpacing(true); tableSectionDatasets.addComponent(tableSectionContent); tableSectionSamples.addComponent(sampletableSectionContent); tableSectionSamples.addComponent(exportSamples); this.vert.addComponent(tableSectionDatasets); sampleGrid.setWidth("100%"); datasetTable.setWidth("100%"); tableSectionDatasets.setWidth("100%"); tableSectionSamples.setWidth("100%"); sampletableSectionContent.setWidth("100%"); tableSectionContent.setWidth("100%"); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(new MarginInfo(false, false, false, true)); buttonLayout.setHeight(null); buttonLayout.setSpacing(true); this.download.setEnabled(false); buttonLayout.setSpacing(true); Button checkAll = new Button("Select all datasets"); checkAll.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object itemId : datasetTable.getItemIds()) { ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()).setValue(true); } } }); Button uncheckAll = new Button("Unselect all datasets"); uncheckAll.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object itemId : datasetTable.getItemIds()) { ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()).setValue(false); } } }); buttonLayout.addComponent(exportData); buttonLayout.addComponent(checkAll); buttonLayout.addComponent(uncheckAll); // buttonLayout.addComponent(visualize); buttonLayout.addComponent(this.download); String content = "<p> In case of multiple file selections, Project Browser will create a tar archive.</p>" + "<hr>" + "<p> If you need help on extracting a tar archive file, follow the tips below: </p>" + "<p>" + FontAwesome.WINDOWS.getHtml() + " Windows </p>" + "<p> To open/extract TAR file on Windows, you can use 7-Zip, Easy 7-Zip, PeaZip.</p>" + "<hr>" + "<p>" + FontAwesome.APPLE.getHtml() + " MacOS </p>" + "<p> To open/extract TAR file on Mac, you can use Mac OS built-in utility Archive Utility,<br> or third-part freeware. </p>" + "<hr>" + "<p>" + FontAwesome.LINUX.getHtml() + " Linux </p>" + "<p> You need to use command tar. The tar is the GNU version of tar archiving utility. <br> " + "To extract/unpack a tar file, type: $ tar -xvf file.tar</p>"; PopupView tooltip = new PopupView(new helpers.ToolTip(content)); tooltip.setHeight("44px"); HorizontalLayout help = new HorizontalLayout(); help.setSizeFull(); HorizontalLayout helpContent = new HorizontalLayout(); // helpContent.setSizeFull(); help.setMargin(new MarginInfo(false, false, false, true)); Label helpText = new Label("Attention: Click here before Download!"); helpContent.addComponent(new Label(FontAwesome.QUESTION_CIRCLE.getHtml(), ContentMode.HTML)); helpContent.addComponent(helpText); helpContent.addComponent(tooltip); helpContent.setSpacing(true); help.addComponent(helpContent); help.setComponentAlignment(helpContent, Alignment.TOP_CENTER); /** * prepare download. */ download.setResource(new ExternalResource("javascript:")); download.setEnabled(false); for (final Object itemId : this.datasetTable.getItemIds()) { setCheckedBox(itemId, (String) this.datasetTable.getItem(itemId).getItemProperty("CODE").getValue()); } this.datasetTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (!event.isDoubleClick() & !((boolean) datasetTable.getItem(event.getItemId()) .getItemProperty("isDirectory").getValue())) { String datasetCode = (String) datasetTable.getItem(event.getItemId()).getItemProperty("CODE") .getValue(); String datasetFileName = (String) datasetTable.getItem(event.getItemId()) .getItemProperty("File Name").getValue(); URL url = null; try { Resource res = null; Object parent = datasetTable.getParent(event.getItemId()); if (parent != null) { String parentDatasetFileName = (String) datasetTable.getItem(parent) .getItemProperty("File Name").getValue(); try { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, parentDatasetFileName + "/" + URLEncoder.encode(datasetFileName, "UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, URLEncoder.encode(datasetFileName, "UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Window subWindow = new Window(); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true); subContent.setSizeFull(); subWindow.setContent(subContent); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); Boolean visualize = false; if (datasetFileName.endsWith(".pdf")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("application/pdf"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".png")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("application/png"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".qcML")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/xml"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".alleles")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".tsv")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".log")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".html")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/html"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".GSvar")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (visualize) { BrowserFrame frame = new BrowserFrame("", res); frame.setSizeFull(); subContent.addComponent(frame); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setSizeUndefined(); subWindow.setHeight("75%"); subWindow.setWidth("75%"); subWindow.setResizable(false); frame.setSizeFull(); frame.setHeight("100%"); // frame.setHeight((int) (ui.getPage().getBrowserWindowHeight() * 0.9), Unit.PIXELS); // Open it in the UI ui.addWindow(subWindow); } } catch (MalformedURLException e) { LOGGER.error(String.format("Visualization failed because of malformedURL for dataset: %s", datasetCode)); helpers.Utils.Notification("No file attached.", "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", "error"); // Notification // .show( // "Given dataset has no file attached to it!! Please Contact your project manager. Or // check whether it already has some data", // Notification.Type.ERROR_MESSAGE); } } } }); this.vert.addComponent(help); this.vert.addComponent(buttonLayout); this.vert.addComponent(tableSectionSamples); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientStatusComponent.java
License:Open Source License
private void initUI() { status = new VerticalLayout(); status.setWidth(100.0f, Unit.PERCENTAGE); status.setMargin(new MarginInfo(true, false, false, true)); status.setSpacing(true);/* ww w .j a v a 2 s . c o m*/ // status.setSizeFull(); VerticalLayout projectStatus = new VerticalLayout(); projectStatus.setMargin(new MarginInfo(true, false, true, true)); projectStatus.setSpacing(true); experiments = new Grid(); experiments.setReadOnly(true); experiments.setWidth(100.0f, Unit.PERCENTAGE); // experiments.setHeightMode(HeightMode.ROW); status.addComponent(experiments); ProgressBar progressBar = new ProgressBar(); progressBar.setValue(0f); status.addComponent(progressBar); projectStatus.addComponent(status); this.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.85f, Unit.PIXELS); this.setCompositionRoot(projectStatus); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java
License:Open Source License
/** * initializes the description layout// w ww .j a va 2 s . c o m * * @return */ VerticalLayout initDescription() { VerticalLayout projDescription = new VerticalLayout(); VerticalLayout projDescriptionContent = new VerticalLayout(); projDescription.setCaption(""); projDescription.setIcon(FontAwesome.FILE_TEXT_O); descContent = new Label(""); contact = new Label("", ContentMode.HTML); patientInformation = new Label("No patient information provided.", ContentMode.HTML); projDescriptionContent.addComponent(patientInformation); projDescriptionContent.addComponent(descContent); projDescriptionContent.addComponent(contact); projDescriptionContent.setMargin(new MarginInfo(true, false, true, true)); projDescriptionContent.setSpacing(true); projDescription.addComponent(projDescriptionContent); descContent.setStyleName("patientview"); contact.setStyleName("patientview"); patientInformation.setStyleName("patientview"); projDescription.setMargin(new MarginInfo(true, false, true, true)); projDescription.setSpacing(true); projDescription.setWidth("100%"); return projDescription; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java
License:Open Source License
VerticalLayout initMemberSection() { VerticalLayout projMembers = new VerticalLayout(); projMembers.setCaption("Members"); membersSection = new VerticalLayout(); Component membersContent = new VerticalLayout(); // membersContent.setIcon(FontAwesome.USERS); // membersContent.setCaption("Members"); membersSection.addComponent(membersContent); // membersSection.setMargin(new MarginInfo(false, false, false, true)); membersSection.setWidth("100%"); membersSection.setSpacing(true);//from w ww . j av a 2s . co m membersSection.setMargin(new MarginInfo(true, false, true, true)); projMembers.addComponent(membersSection); projMembers.setMargin(new MarginInfo(true, false, true, true)); projMembers.setWidth("100%"); projMembers.setSpacing(true); return projMembers; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java
License:Open Source License
/** * initializes the hla type layout/*w w w .jav a 2 s. c o m*/ * * @return */ VerticalLayout initHLALayout() { VerticalLayout hlaTyping = new VerticalLayout(); VerticalLayout hlaTypingContent = new VerticalLayout(); hlaTyping.setCaption("HLA Typing"); // String desc = currentBean.getDescription(); // if (!desc.isEmpty()) { // descContent.setValue(desc); // } hlaTypeLabel = new Label("Not available.", ContentMode.HTML); hlaTypeLabel.setStyleName("patientview"); hlaTypingContent.setMargin(new MarginInfo(true, false, true, true)); hlaTypingContent.setSpacing(true); // hlaTypingContent.setCaption("HLA Typing"); // hlaTypingContent.setIcon(FontAwesome.BARCODE); hlaTypingContent.addComponent(hlaTypeLabel); hlaTyping.addComponent(hlaTypingContent); hlaTyping.setMargin(new MarginInfo(true, false, true, true)); hlaTyping.setSpacing(true); hlaTyping.setWidth("100%"); return hlaTyping; }