List of usage examples for com.vaadin.ui ProgressBar setWidth
@Override public void setWidth(float width, Unit unit)
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();/*from w w w. j a v a 2s .c om*/ 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();/* ww w . j a v a2 s. com*/ 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:org.hip.vif.admin.admin.ui.UpgradeView.java
License:Open Source License
/** UpgradeView constructor. * * @param inVersionInstance String the instance's version (i.e. the version of the tables) * @param inVersionSoftware String the version according to the installed version * @param inThread {@link UpgradeTask} the thread managing the upgrade */ public UpgradeView(final String inVersionInstance, final String inVersionSoftware, final UpgradeThread inThread) { final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "admin.menu.upgrade"); //$NON-NLS-1$ final Label lFeedbackMsg = new Label( String.format(TMPL_FEEDBACK, lMessages.getMessage("admin.upgrade.feedback.failure")), //$NON-NLS-1$ ContentMode.HTML);//from w ww .ja v a2s . com lFeedbackMsg.setVisible(false); lLayout.addComponent(lFeedbackMsg); final Label lFailures = new Label("", ContentMode.HTML); //$NON-NLS-1$ lLayout.addComponent(lFailures); lFailures.setVisible(false); final LabelValueTable lTable = new LabelValueTable(); lTable.addRow(lMessages.getMessage("admin.upgrade.version.instance"), inVersionInstance); //$NON-NLS-1$ lTable.addRow(lMessages.getMessage("admin.upgrade.version.app"), inVersionSoftware); //$NON-NLS-1$ lLayout.addComponent(lTable); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lUpgrade = new Button(lMessages.getMessage("admin.menu.upgrade")); //$NON-NLS-1$ lLayout.addComponent(lUpgrade); lLayout.addComponent(RiplaViewHelper.createSpacer()); final ProgressBar lProgress = new ProgressBar(new Float(0.0)); lProgress.setWidth(200, Unit.PIXELS); lProgress.setVisible(false); lLayout.addComponent(lProgress); lUpgrade.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { lProgress.setVisible(true); lProgress.setEnabled(true); lUpgrade.setEnabled(false); UI.getCurrent().setPollInterval(POLL_RUN); final Collection<IVIFUpgrade> lFailed = inThread.upgrade(inVersionInstance, inVersionSoftware, lProgress); lProgress.setVisible(false); if (lFailed.isEmpty()) { lFeedbackMsg.setVisible(false); lFailures.setVisible(false); } else { lFeedbackMsg.setVisible(true); lFailures.setPropertyDataSource( new ObjectProperty<String>(renderFailures(lFailed), String.class)); lFailures.setVisible(true); } lUpgrade.setEnabled(true); } }); }