List of usage examples for com.vaadin.server Page getCurrent
public static Page getCurrent()
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientStatusComponent.java
License:Open Source License
public void updateUI(final ProjectBean currentBean) { BeanItemContainer<ExperimentStatusBean> experimentstatusBeans = datahandler .computeIvacPatientStatus(currentBean); int finishedExperiments = 0; status.removeAllComponents();// w ww. ja va 2 s .c o m status.setWidth(100.0f, Unit.PERCENTAGE); // Generate button caption column final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(experimentstatusBeans); gpc.addGeneratedProperty("started", new PropertyValueGenerator<String>() { @Override public Class<String> getType() { return String.class; } @Override public String getValue(Item item, Object itemId, Object propertyId) { String status = null; if ((double) item.getItemProperty("status").getValue() > 0.0) { status = "<span class=\"v-icon\" style=\"font-family: " + FontAwesome.CHECK.getFontFamily() + ";color:" + "#2dd085" + "\">&#x" + Integer.toHexString(FontAwesome.CHECK.getCodepoint()) + ";</span>"; } else { status = "<span class=\"v-icon\" style=\"font-family: " + FontAwesome.TIMES.getFontFamily() + ";color:" + "#f54993" + "\">&#x" + Integer.toHexString(FontAwesome.TIMES.getCodepoint()) + ";</span>"; } return status.toString(); } }); gpc.removeContainerProperty("identifier"); experiments.setContainerDataSource(gpc); // experiments.setHeaderVisible(false); // experiments.setHeightMode(HeightMode.ROW); experiments.setHeightByRows(gpc.size()); experiments.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.6f, Unit.PIXELS); experiments.getColumn("status").setRenderer(new ProgressBarRenderer()); // experiments.setColumnOrder("started", "code", "description", "status", "download", // "runWorkflow"); experiments.setColumnOrder("started", "code", "description", "status", "workflow"); experiments.getColumn("workflow").setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { ExperimentStatusBean esb = (ExperimentStatusBean) event.getItemId(); TabSheet parent = (TabSheet) getParent(); PatientView pv = (PatientView) parent.getParent().getParent(); WorkflowComponent wp = pv.getWorkflowComponent(); // TODO WATCH OUT NUMBER OF WORKFLOW TAB IS HARDCODED AT THE MOMENT, NO BETTER SOLUTION // FOUND SO FAR, e.g. get Tab by Name ? // TODO idea get description of item to navigate to the correct workflow ?! if (esb.getDescription().equals("Barcode Generation")) { ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); message.add(currentBean.getId()); //TODO navigate to barcode dragon rawwwr // message.add(BarcodeView.navigateToLabel); // state.notifyObservers(message); } else if (esb.getDescription().equals("Variant Annotation")) { /* * ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); * StringBuilder sb = new StringBuilder("type="); sb.append("workflowExperimentType"); * sb.append("&"); sb.append("id="); sb.append(currentBean.getId()); sb.append("&"); * sb.append("experiment="); sb.append("Q_WF_NGS_VARIANT_ANNOTATION"); * message.add(sb.toString()); message.add(WorkflowView.navigateToLabel); * state.notifyObservers(message); */ Map<String, String> args = new HashMap<String, String>(); args.put("id", currentBean.getId()); args.put("type", "workflowExperimentType"); args.put("experiment", "Q_WF_NGS_VARIANT_ANNOTATION"); parent.setSelectedTab(9); wp.update(args); } else if (esb.getDescription().equals("Epitope Prediction")) { /* * ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); * StringBuilder sb = new StringBuilder("type="); sb.append("workflowExperimentType"); * sb.append("&"); sb.append("id="); sb.append(currentBean.getId()); sb.append("&"); * sb.append("experiment="); sb.append("Q_WF_NGS_EPITOPE_PREDICTION"); * message.add(sb.toString()); message.add(WorkflowView.navigateToLabel); * state.notifyObservers(message); */ Map<String, String> args = new HashMap<String, String>(); args.put("id", currentBean.getId()); args.put("type", "workflowExperimentType"); args.put("experiment", "Q_WF_NGS_EPITOPE_PREDICTION"); parent.setSelectedTab(9); wp.update(args); } else if (esb.getDescription().equals("HLA Typing")) { /* * ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); * StringBuilder sb = new StringBuilder("type="); sb.append("workflowExperimentType"); * sb.append("&"); sb.append("id="); sb.append(currentBean.getId()); sb.append("&"); * sb.append("experiment="); sb.append("Q_WF_NGS_HLATYPING"); message.add(sb.toString()); * message.add(WorkflowView.navigateToLabel); state.notifyObservers(message); */ Map<String, String> args = new HashMap<String, String>(); args.put("id", currentBean.getId()); args.put("type", "workflowExperimentType"); args.put("experiment", "Q_WF_NGS_HLATYPING"); parent.setSelectedTab(9); wp.update(args); } else { Notification notif = new Notification("Workflow not (yet) available.", Type.TRAY_NOTIFICATION); // Customize it notif.setDelayMsec(60000); notif.setPosition(Position.MIDDLE_CENTER); // Show it in the page notif.show(Page.getCurrent()); } } })); experiments.getColumn("started").setRenderer(new HtmlRenderer()); ProgressBar progressBar = new ProgressBar(); progressBar.setCaption("Overall Progress"); progressBar.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.6f, Unit.PIXELS); progressBar.setStyleName("patientprogress"); status.addComponent(progressBar); status.addComponent(experiments); status.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); status.setComponentAlignment(experiments, Alignment.MIDDLE_CENTER); /** * Defined Experiments for iVac - Barcodes available -> done with project creation (done) - * Sequencing done (Status Q_NGS_MEASUREMENT) - Variants annotated (Status * Q_NGS_VARIANT_CALLING) - HLA Typing done (STATUS Q_NGS_WF_HLA_TYPING) - Epitope Prediction * done (STATUS Q_WF_NGS_EPITOPE_PREDICTION) */ for (Iterator i = experimentstatusBeans.getItemIds().iterator(); i.hasNext();) { ExperimentStatusBean statusBean = (ExperimentStatusBean) i.next(); finishedExperiments += statusBean.getStatus(); // statusBean.setDownload("Download"); statusBean.setWorkflow("Run"); } progressBar.setValue((float) finishedExperiments / experimentstatusBeans.size()); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java
License:Open Source License
void updateProjectStatus() { BeanItemContainer<ExperimentStatusBean> experimentstatusBeans = datahandler .computeIvacPatientStatus(currentBean); int finishedExperiments = 0; status.removeAllComponents();// www . j a v a 2s .c o m status.setWidth(100.0f, Unit.PERCENTAGE); // Generate button caption column final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(experimentstatusBeans); gpc.addGeneratedProperty("started", new PropertyValueGenerator<String>() { @Override public Class<String> getType() { return String.class; } @Override public String getValue(Item item, Object itemId, Object propertyId) { String status = null; if ((double) item.getItemProperty("status").getValue() > 0.0) { status = "<span class=\"v-icon\" style=\"font-family: " + FontAwesome.CHECK.getFontFamily() + ";color:" + "#2dd085" + "\">&#x" + Integer.toHexString(FontAwesome.CHECK.getCodepoint()) + ";</span>"; } else { status = "<span class=\"v-icon\" style=\"font-family: " + FontAwesome.TIMES.getFontFamily() + ";color:" + "#f54993" + "\">&#x" + Integer.toHexString(FontAwesome.TIMES.getCodepoint()) + ";</span>"; } return status.toString(); } }); gpc.removeContainerProperty("identifier"); experiments.setContainerDataSource(gpc); // experiments.setHeaderVisible(false); experiments.setHeightMode(HeightMode.ROW); experiments.setHeightByRows(gpc.size()); experiments.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.6f, Unit.PIXELS); experiments.getColumn("status").setRenderer(new ProgressBarRenderer()); experiments.setColumnOrder("started", "code", "description", "status", "download", "runWorkflow"); ButtonRenderer downloadRenderer = new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { ExperimentStatusBean esb = (ExperimentStatusBean) event.getItemId(); if (esb.getDescription().equals("Barcode Generation")) { new Notification("Download of Barcodes not available.", "<br/>Please create barcodes by clicking 'Run'.", Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } else if (esb.getIdentifier() == null || esb.getIdentifier().isEmpty()) { new Notification("No data available for download.", "<br/>Please do the analysis by clicking 'Run' first.", Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } else { ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); StringBuilder sb = new StringBuilder("type="); sb.append("experiment"); sb.append("&"); sb.append("id="); // sb.append(currentBean.getId()); sb.append(esb.getIdentifier()); message.add(sb.toString()); message.add(DatasetView.navigateToLabel); state.notifyObservers(message); } } }); experiments.getColumn("download").setRenderer(downloadRenderer); experiments.getColumn("runWorkflow").setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { ExperimentStatusBean esb = (ExperimentStatusBean) event.getItemId(); // TODO idea get description of item to navigate to the correct workflow ?! if (esb.getDescription().equals("Barcode Generation")) { ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); message.add(currentBean.getId()); // TODO link to barcode dragon // message.add(BarcodeView.navigateToLabel); // state.notifyObservers(message); } else { ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); StringBuilder sb = new StringBuilder("type="); sb.append("workflowExperimentType"); sb.append("&"); sb.append("id="); sb.append("Q_WF_MS_PEPTIDEID"); sb.append("&"); sb.append("project="); sb.append(currentBean.getId()); message.add(sb.toString()); message.add(WorkflowView.navigateToLabel); state.notifyObservers(message); } } })); experiments.getColumn("started").setRenderer(new HtmlRenderer()); ProgressBar progressBar = new ProgressBar(); progressBar.setCaption("Overall Progress"); progressBar.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.6f, Unit.PIXELS); progressBar.setStyleName("patientprogress"); status.addComponent(progressBar); status.addComponent(experiments); status.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); status.setComponentAlignment(experiments, Alignment.MIDDLE_CENTER); /** * Defined Experiments for iVac - Barcodes available -> done with project creation (done) - * Sequencing done (Status Q_NGS_MEASUREMENT) - Variants annotated (Status * Q_NGS_VARIANT_CALLING) - HLA Typing done (STATUS Q_NGS_WF_HLA_TYPING) - Epitope Prediction * done (STATUS Q_WF_NGS_EPITOPE_PREDICTION) */ for (Iterator i = experimentstatusBeans.getItemIds().iterator(); i.hasNext();) { ExperimentStatusBean statusBean = (ExperimentStatusBean) i.next(); // HorizontalLayout experimentStatusRow = new HorizontalLayout(); // experimentStatusRow.setSpacing(true); finishedExperiments += statusBean.getStatus(); // statusBean.setDownload("Download"); statusBean.setWorkflow("Run"); /* * if ((Integer) pairs.getValue() == 0) { Label statusLabel = new Label(pairs.getKey() + ": " * + FontAwesome.TIMES.getHtml(), ContentMode.HTML); statusLabel.addStyleName("redicon"); * experimentStatusRow.addComponent(statusLabel); * statusContent.addComponent(experimentStatusRow); } * * else { * * Label statusLabel = new Label(pairs.getKey() + ": " + FontAwesome.CHECK.getHtml(), * ContentMode.HTML); statusLabel.addStyleName("greenicon"); * experimentStatusRow.addComponent(statusLabel); * statusContent.addComponent(experimentStatusRow); * * finishedExperiments += (Integer) pairs.getValue(); } * experimentStatusRow.addComponent(runWorkflow); * * } */ } progressBar.setValue((float) finishedExperiments / experimentstatusBeans.size()); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java
License:Open Source License
VerticalLayout initTable() { this.table = this.buildFilterTable(); this.tableClickChangeTreeView(); VerticalLayout tableSection = new VerticalLayout(); VerticalLayout tableSectionContent = new VerticalLayout(); tableSection.setCaption("Exp. Steps"); // tableSectionContent.setCaption("Registered Experiments"); // tableSectionContent.setIcon(FontAwesome.FLASK); tableSectionContent.addComponent(this.table); tableSectionContent.setMargin(new MarginInfo(true, false, false, true)); tableSection.setMargin(new MarginInfo(true, false, false, true)); this.table.setWidth("100%"); tableSection.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.8f, Unit.PIXELS); tableSectionContent.setWidth("100%"); tableSection.addComponent(tableSectionContent); this.export = new Button("Export as TSV"); buttonLayoutSection = new VerticalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setHeight(null);/*from w w w . j ava 2 s . c o m*/ buttonLayout.setWidth("100%"); buttonLayout.addComponent(this.export); buttonLayout.setMargin(new MarginInfo(false, false, true, false)); buttonLayoutSection.addComponent(buttonLayout); buttonLayoutSection.setSpacing(true); buttonLayoutSection.setMargin(new MarginInfo(false, false, true, true)); tableSection.addComponent(buttonLayoutSection); return tableSection; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java
License:Open Source License
/** * /*from w w w .j a v a 2s. co m*/ * @return */ VerticalLayout initGraph() { 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(Page.getCurrent().getBrowserWindowWidth() * 0.8f, Unit.PIXELS); graphSectionContent.setWidth("100%"); /* * final Button loadGraph = new Button("[+]"); loadGraph.setStyleName(ValoTheme.BUTTON_LINK); * loadGraph.addClickListener(new ClickListener() { * * @Override public void buttonClick(ClickEvent event) { if * (graphSectionContent.getComponentCount() == 0 || !(graphSectionContent.getComponent(0) * instanceof Image)) { ProgressBar progress = new ProgressBar(); * progress.setIndeterminate(true); Label info = new Label( * "Computing the project graph can take several seconds on big projects. Please be patient."); * info.setStyleName(ValoTheme.LABEL_SUCCESS); graphSectionContent.addComponent(info); * graphSectionContent.addComponent(progress); Worker worker = new Worker(getCurrent()); * worker.start(); UI.getCurrent().setPollInterval(500); loadGraph.setEnabled(false); } * * * } * * public void processed() { UI.getCurrent().setPollInterval(-1); loadGraph.setVisible(false); } * * class Worker extends Thread { private ProjectView projectView; * * public Worker(ProjectView current) { projectView = current; } * * @Override public void run() { projectView.updateContentGraph(); synchronized * (UI.getCurrent()) { processed(); } * * } } }); */ graphSection.addComponent(graphSectionContent); return graphSection; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.WorkflowComponent.java
License:Open Source License
void showNotification(String message) { Notification notif = new Notification(message, Type.TRAY_NOTIFICATION); // Customize it notif.setDelayMsec(60000);//from ww w . ja v a 2s . c om notif.setPosition(Position.MIDDLE_CENTER); // Show it in the page notif.show(Page.getCurrent()); }
From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java
public static void errorNotification(String caption, String description) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000);/* w ww .ja v a 2 s. c om*/ not.setPosition(Position.TOP_CENTER); not.setStyleName(ValoTheme.NOTIFICATION_FAILURE + " " + ValoTheme.NOTIFICATION_SMALL); not.show(Page.getCurrent()); }
From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java
public static void infoNotification(String caption, String description) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000);/*w w w .ja v a 2s . co m*/ not.setPosition(Position.BOTTOM_CENTER); not.show(Page.getCurrent()); }
From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java
public static void middleInforNotification(String caption, String descripton) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000);//from w ww . j a va2 s. co m not.setPosition(Position.MIDDLE_CENTER); not.show(Page.getCurrent()); }
From source file:ed.cracken.pos.ui.purchases.PurchaseItemForm.java
public void editItem(ItemTo product) { if (product == null) { product = new ItemTo(); }/*from w w w . j av a 2 s. c om*/ fieldGroup.setItemDataSource(new BeanItem<ItemTo>(product)); productId.setValidationVisible(false); description.setValidationVisible(false); price.setValidationVisible(false); discount.setValidationVisible(false); subtotal.setValidationVisible(false); productId.setReadOnly(true); description.setReadOnly(true); price.setReadOnly(true); discount.setReadOnly(true); subtotal.setReadOnly(true); String scrollScript = "window.document.getElementById('" + getId() + "').scrollTop = 0;"; Page.getCurrent().getJavaScript().execute(scrollScript); }
From source file:edu.kit.dama.ui.admin.LandingPageComponent.java
License:Apache License
public final void update(DigitalObject object, boolean privileged) { if (object == null) { UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(1, 1); builder.fill(new Label("Access to digital object not permitted."), 0, 0); mainLayout = builder.getLayout(); mainLayout.setMargin(true);/*from www .j av a 2s . c o m*/ mainLayout.setSpacing(true); mainLayout.setStyleName("landing"); HorizontalLayout hLayout = new HorizontalLayout(mainLayout); hLayout.setSizeFull(); hLayout.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(hLayout); } else { final TextField oidField = new TextField(); Button searchButton = new Button("Search"); Button metsButton = new Button("METS"); final Button dcButton = new Button("DublinCore"); Button dataButton = new Button("Download"); VerticalLayout metadataDownloadButtons = new VerticalLayout(dcButton, metsButton); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(3, 6); StreamResource metsResource = new StreamResource(() -> { try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); MetsBuilder.init(object).createMinimalMetsDocument(UserData.WORLD_USER).write(bout); return new ByteArrayInputStream(bout.toByteArray()); } catch (Exception ex) { LOGGER.error("Failed to provide METS document.", ex); UIComponentTools.showError( "Failed to initialize METS document for download. Cause: " + ex.getMessage()); return null; } }, object.getDigitalObjectIdentifier() + ".mets.xml"); StreamResource dcResource = new StreamResource(() -> { try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); DublinCoreHelper.writeDublinCoreDocument(object, UserData.WORLD_USER, bout); return new ByteArrayInputStream(bout.toByteArray()); } catch (ParserConfigurationException ex) { LOGGER.error("Failed to provide DC document.", ex); UIComponentTools .showError("Failed to initialize DC document for download. Cause: " + ex.getMessage()); return null; } }, object.getDigitalObjectIdentifier() + ".dc.xml"); StreamResource dataResource = new StreamResource(() -> { IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager(); mdm.setAuthorizationContext(AuthorizationContext.factorySystemContext()); try { IAuthorizationContext ctx = new AuthorizationContext(new UserId(Constants.WORLD_USER_ID), new GroupId(Constants.WORLD_USER_ID), Role.GUEST); if (accessGranted(object, ctx) || accessGranted(object, UIHelper.getSessionContext())) { Response response = new PublicDownloadHandler().prepareStream(object); if (response.getStatus() == Response.Status.OK.getStatusCode()) { return (InputStream) response.getEntity(); } else { LOGGER.error("Preparation of the public download for object " + object.getDigitalObjectIdentifier() + " returned status " + response.getStatus() + ". Aborting."); } } throw new IOException("Public access not available."); } catch (IOException ex) { LOGGER.error( "Failed to provide data stream for object " + object.getDigitalObjectIdentifier() + ".", ex); UIComponentTools.showError( "Failed to initialize data stream for public download. Probably, the digital object is not publicly available."); return null; } }, object.getDigitalObjectIdentifier() + ".zip"); Map<String, String> dcElementMap = new HashMap<>(); try { dcElementMap = DublinCoreHelper.createDublinCoreElementMap(object, UserData.WORLD_USER); } catch (ParserConfigurationException ex) { LOGGER.error( "Failed to create DC metadata for object with id " + object.getDigitalObjectIdentifier(), ex); } oidField.setValue(object.getDigitalObjectIdentifier()); FileDownloader metsDownloader = new FileDownloader(metsResource); metsDownloader.extend(metsButton); FileDownloader dcDownloader = new FileDownloader(dcResource); dcDownloader.extend(dcButton); FileDownloader dataDownloader = new FileDownloader(dataResource); dataDownloader.extend(dataButton); oidField.setSizeFull(); searchButton.setWidth("128px"); searchButton.addClickListener((Button.ClickEvent event) -> { String oid = oidField.getValue(); Page.getCurrent().setLocation( URI.create(UIHelper.getWebAppUrl().toString() + "?landing&oid=" + oid).toString()); }); dcButton.setWidth("128px"); metsButton.setWidth("128px"); dataButton.setWidth("128px"); metadataDownloadButtons.setComponentAlignment(dcButton, Alignment.TOP_LEFT); metadataDownloadButtons.setComponentAlignment(metsButton, Alignment.TOP_LEFT); //build layout Label oidLabel = new Label("<u>Object Id</u>", ContentMode.HTML); builder.fillRow(oidLabel, 0, 0, 1); oidLabel.addStyleName("myboldcaption"); builder.addComponent(oidField, 0, 1, 2, 1).addComponent(searchButton, 2, 1); Label dcMetadataLabel = new Label("<u>DC Metadata</u>", ContentMode.HTML); builder.fillRow(dcMetadataLabel, 0, 2, 1); dcMetadataLabel.addStyleName("myboldcaption"); Set<Map.Entry<String, String>> entries = dcElementMap.entrySet(); Table dcTable = new Table(); dcTable.setPageLength(entries.size() + 1); dcTable.addContainerProperty("dc:key", String.class, "-"); dcTable.addContainerProperty("dc:value", String.class, "-"); entries.forEach((entry) -> { Object newItemId = dcTable.addItem(); Item row1 = dcTable.getItem(newItemId); row1.getItemProperty("dc:key").setValue(entry.getKey()); row1.getItemProperty("dc:value").setValue(entry.getValue()); }); dcTable.setWidth("640px"); dcTable.addStyleName("myboldcaption"); builder.addComponent(dcTable, 0, 3, 2, 1); builder.addComponent(metadataDownloadButtons, 2, 3, 1, 1); builder.fillRow(new Label("<u>Data Access</u>", ContentMode.HTML), 0, 4, 1); long bytes = DataOrganizationUtils.getAssociatedDataSize(object.getDigitalObjectId()); String formatted = AbstractFile.formatSize(bytes); Label oidDownloadLabel = new Label( object.getDigitalObjectIdentifier() + ".zip (approx. " + formatted + ")"); oidDownloadLabel.addStyleName("myboldcaption"); builder.addComponent(oidDownloadLabel, 0, 5, 2, 1); builder.addComponent(dataButton, 2, 5, 1, 1); mainLayout = builder.getLayout(); mainLayout.setRowExpandRatio(0, .1f); mainLayout.setRowExpandRatio(1, .1f); mainLayout.setRowExpandRatio(2, .6f); mainLayout.setRowExpandRatio(3, .1f); mainLayout.setRowExpandRatio(4, .1f); mainLayout.setColumnExpandRatio(0, .1f); mainLayout.setColumnExpandRatio(1, .8f); mainLayout.setColumnExpandRatio(2, .1f); } mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("landing"); HorizontalLayout hLayout = new HorizontalLayout(mainLayout); hLayout.setSizeFull(); hLayout.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(hLayout); }