Example usage for com.vaadin.ui ProgressBar ProgressBar

List of usage examples for com.vaadin.ui ProgressBar ProgressBar

Introduction

In this page you can find the example usage for com.vaadin.ui ProgressBar ProgressBar.

Prototype

public ProgressBar() 

Source Link

Document

Creates a new progress bar initially set to 0% progress.

Usage

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoadingView.java

public LoadingView() {
    setSizeFull();/*  ww  w .  j a  v  a  2  s .  c om*/
    VerticalLayout center = new VerticalLayout();
    this.addComponent(center);
    this.setComponentAlignment(center, Alignment.MIDDLE_CENTER);

    center.setHeight("180px");
    HorizontalLayout info = new HorizontalLayout();

    Label title = new Label("PFServer Dashboard");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H4);
    title.addStyleName(ValoTheme.LABEL_COLORED);
    // center.addComponent(title);
    // center.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    Label loading = new Label("Initalizing");
    loading.addStyleName(ValoTheme.LABEL_H1);
    loading.addStyleName(ValoTheme.LABEL_LIGHT);
    info.addComponent(loading);
    info.addComponent(title);
    info.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    center.addComponent(info);
    info.setComponentAlignment(loading, Alignment.MIDDLE_LEFT);
    loading.setWidth("160px");

    center.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
    // center.addComponent(loading);
    // center.setComponentAlignment(loading, Alignment.TOP_CENTER);
    ProgressBar indeterminate = new ProgressBar();
    indeterminate.setIndeterminate(true);
    center.addComponent(indeterminate);
    center.setComponentAlignment(indeterminate, Alignment.TOP_CENTER);

}

From source file:com.wintindustries.pfserver.uploads.PFUploadProgress.java

public PFUploadProgress() {
    progressbar = new ProgressBar();
    progressState = kUPLOADPROGRESS_UNDEFINED;
    Caption = "";
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java

License:Open Source License

/**
 * Method to get Bean from either openbis identifier or openbis object. Does NOT check if
 * corresponding bean is already stored in datahandler map. Should be used if project instance has
 * been modified from session/*from w  w w .  j  av a2 s  .c  o  m*/
 * 
 * @param
 * @return
 */
public ProjectBean getProjectFromDB(String projectIdentifier) {
    List<Experiment> experiments = this.getOpenBisClient().getExperimentsForProject2(projectIdentifier);

    float projectStatus = this.getOpenBisClient().computeProjectStatus(experiments);

    Project project = getOpenBisClient().getProjectByIdentifier(projectIdentifier);
    dtoProjects.put(projectIdentifier, project);

    ProjectBean newProjectBean = new ProjectBean();

    ProgressBar progressBar = new ProgressBar();
    progressBar.setValue(projectStatus);

    Date registrationDate = project.getRegistrationDetails().getRegistrationDate();

    // String pi = getDatabaseManager().getInvestigatorDetailsForProject(project.getCode());
    String pi = getDatabaseManager().getPersonDetailsForProject(project.getIdentifier(), "PI");
    String cp = getDatabaseManager().getPersonDetailsForProject(project.getIdentifier(), "Contact");
    // String manager = getDatabaseManager().getPersonDetailsForProject(project.getIdentifier(),
    // "Manager");//TODO
    String manager = "";
    String longDesc = getDatabaseManager().getLongProjectDescription(project.getIdentifier());

    if (pi.equals("")) {
        newProjectBean.setPrincipalInvestigator("n/a");
    } else {
        newProjectBean.setPrincipalInvestigator(pi);
    }

    if (cp.equals("")) {
        newProjectBean.setContactPerson("n/a");
    } else {
        newProjectBean.setContactPerson(cp);
    }

    if (manager.equals("")) {
        newProjectBean.setProjectManager("n/a");
    } else {
        newProjectBean.setProjectManager(manager);
    }

    String secondaryName = getDatabaseManager().getProjectName(projectIdentifier);
    if (secondaryName == null || secondaryName.isEmpty())
        secondaryName = "n/a";
    newProjectBean.setSecondaryName(secondaryName);

    if (longDesc == null)
        longDesc = "";

    newProjectBean.setId(project.getIdentifier());
    newProjectBean.setCode(project.getCode());
    String desc = project.getDescription();
    if (desc == null)
        desc = "";
    newProjectBean.setDescription(desc);
    newProjectBean.setRegistrationDate(registrationDate);
    newProjectBean.setProgress(progressBar);
    newProjectBean.setRegistrator(project.getRegistrationDetails().getUserId());
    newProjectBean.setContact(project.getRegistrationDetails().getUserEmail());

    BeanItemContainer<ExperimentBean> experimentBeans = new BeanItemContainer<ExperimentBean>(
            ExperimentBean.class);

    for (Experiment experiment : experiments) {
        ExperimentBean newExperimentBean = new ExperimentBean();
        String status = "";

        Map<String, String> assignedProperties = experiment.getProperties();

        if (assignedProperties.keySet().contains("Q_CURRENT_STATUS")) {
            status = assignedProperties.get("Q_CURRENT_STATUS");
        }

        else if (assignedProperties.keySet().contains("Q_WF_STATUS")) {
            status = assignedProperties.get("Q_WF_STATUS");
        }

        // Image statusColor = new Image(status, this.setExperimentStatusColor(status));
        // statusColor.setWidth("15px");
        // statusColor.setHeight("15px");
        // statusColor.setCaption(status);

        newExperimentBean.setId(experiment.getIdentifier());
        newExperimentBean.setCode(experiment.getCode());
        newExperimentBean.setType(experiment.getExperimentTypeCode());
        newExperimentBean.setStatus(status);
        newExperimentBean.setRegistrator(experiment.getRegistrationDetails().getUserId());
        newExperimentBean.setRegistrationDate(experiment.getRegistrationDetails().getRegistrationDate());
        experimentBeans.addBean(newExperimentBean);
    }

    newProjectBean.setLongDescription(longDesc);

    List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> projectData = this.getOpenBisClient()
            .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier);

    Boolean containsData = false;
    Boolean containsResults = false;
    Boolean attachmentResult = false;
    // Boolean containsAttachments = false;

    for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : projectData) {
        attachmentResult = false;
        if (ds.getDataSetTypeCode().equals("Q_PROJECT_DATA")) {
            attachmentResult = ds.getProperties().get("Q_ATTACHMENT_TYPE").equals("RESULT");
        }

        if (!(ds.getDataSetTypeCode().equals("Q_PROJECT_DATA"))
                && !(ds.getDataSetTypeCode().contains("RESULTS"))) {
            containsData = true;
        } else if (ds.getDataSetTypeCode().contains("RESULTS") || attachmentResult) {
            containsResults = true;
        } // else if (ds.getDataSetTypeCode() == "Q_PROJECT_DATA") {
          // containsAttachments = true;
          // }
    }

    newProjectBean.setContainsData(containsData);
    newProjectBean.setContainsResults(containsResults);

    newProjectBean.setExperiments(experimentBeans);
    newProjectBean.setMembers(new HashSet<String>());
    return newProjectBean;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java

License:Open Source License

/**
 * Method to get Bean from either openbis identifier or openbis object. Checks if corresponding
 * bean is already stored in datahandler map.
 * /*from w w  w  .  j a  v  a2  s  .co  m*/
 * @param
 * @return
 */
public ProjectBean getProject2(String projectIdentifier) {
    List<Experiment> experiments = this.getOpenBisClient().getExperimentsForProject3(projectIdentifier);// TODO changed this
                                                                                                        // from
                                                                                                        // getExperimentsForProject2

    float projectStatus = this.getOpenBisClient().computeProjectStatus(experiments);

    Project project = getOpenbisDtoProject(projectIdentifier);
    if (project == null) {
        project = getOpenBisClient().getProjectByIdentifier(projectIdentifier);
        addOpenbisDtoProject(project);
    }
    ProjectBean newProjectBean = new ProjectBean();

    ProgressBar progressBar = new ProgressBar();
    progressBar.setValue(projectStatus);

    Date registrationDate = project.getRegistrationDetails().getRegistrationDate();

    // String pi = getDatabaseManager().getInvestigatorDetailsForProject(project.getCode());
    String pi = getDatabaseManager().getPersonDetailsForProject(project.getIdentifier(), "PI");
    String cp = getDatabaseManager().getPersonDetailsForProject(project.getIdentifier(), "Contact");
    String manager = getDatabaseManager().getPersonDetailsForProject(project.getIdentifier(), "Manager");

    String longDesc = getDatabaseManager().getLongProjectDescription(project.getIdentifier());

    if (pi.equals("")) {
        newProjectBean.setPrincipalInvestigator("n/a");
    } else {
        newProjectBean.setPrincipalInvestigator(pi);
    }

    if (cp.equals("")) {
        newProjectBean.setContactPerson("n/a");
    } else {
        newProjectBean.setContactPerson(cp);
    }

    if (manager.equals("")) {
        newProjectBean.setProjectManager("n/a");
    } else {
        newProjectBean.setProjectManager(manager);
    }

    if (longDesc == null)
        longDesc = "";

    newProjectBean.setLongDescription(longDesc);

    newProjectBean.setId(project.getIdentifier());
    newProjectBean.setCode(project.getCode());
    String desc = project.getDescription();
    if (desc == null)
        desc = "";
    newProjectBean.setDescription(desc);
    newProjectBean.setRegistrationDate(registrationDate);
    newProjectBean.setProgress(progressBar);
    newProjectBean.setRegistrator(project.getRegistrationDetails().getUserId());
    newProjectBean.setContact(project.getRegistrationDetails().getUserEmail());

    // Create sample Beans (or fetch them) for samples of experiments
    List<Sample> allSamples = this.getOpenBisClient()
            .getSamplesWithParentsAndChildrenOfProjectBySearchService(projectIdentifier);

    BeanItemContainer<ExperimentBean> experimentBeans = new BeanItemContainer<ExperimentBean>(
            ExperimentBean.class);

    AlternativeSecondaryNameCreator altNameCreator = new AlternativeSecondaryNameCreator(
            openBisClient.getVocabCodesAndLabelsForVocab("Q_NCBI_TAXONOMY"));
    for (Experiment experiment : experiments) {
        ExperimentBean newExperimentBean = new ExperimentBean();

        // TODO doesn't work with getExperimentsForProject2
        Map<String, String> assignedProperties = experiment.getProperties();

        String status = "";

        if (assignedProperties.keySet().contains("Q_CURRENT_STATUS")) {
            status = assignedProperties.get("Q_CURRENT_STATUS");
        }

        else if (assignedProperties.keySet().contains("Q_WF_STATUS")) {
            status = assignedProperties.get("Q_WF_STATUS");
        }

        List<Sample> samples = new ArrayList<Sample>();
        for (Sample s : allSamples) {
            if (s.getExperimentIdentifierOrNull().equals(experiment.getIdentifier()))
                samples.add(s);
        }
        BeanItemContainer<SampleBean> sampleBeans = new BeanItemContainer<SampleBean>(SampleBean.class);
        for (Sample sample : samples) {
            SampleBean sbean = new SampleBean();
            sbean.setId(sample.getIdentifier());
            sbean.setCode(sample.getCode());
            sbean.setType(sample.getSampleTypeCode());
            sbean.setProperties(sample.getProperties());
            sampleBeans.addBean(sbean);
        }
        newExperimentBean.setSamples(sampleBeans);

        newExperimentBean.setAltNameCreator(altNameCreator);
        newExperimentBean.setProperties(assignedProperties);
        newExperimentBean.setSecondaryName(assignedProperties.get("Q_SECONDARY_NAME"));
        newExperimentBean.setId(experiment.getIdentifier());
        newExperimentBean.setCode(experiment.getCode());
        newExperimentBean.setType(experiment.getExperimentTypeCode());
        newExperimentBean.setRegistrator(experiment.getRegistrationDetails().getUserId());
        newExperimentBean.setRegistrationDate(experiment.getRegistrationDetails().getRegistrationDate());
        newExperimentBean.setStatus(status);
        experimentBeans.addBean(newExperimentBean);
    }

    List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> projectData = this.getOpenBisClient()
            .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier);

    Boolean containsData = false;
    Boolean containsResults = false;
    Boolean attachmentResult = false;
    // Boolean containsAttachments = false;

    for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : projectData) {
        attachmentResult = false;
        if (ds.getDataSetTypeCode().equals("Q_PROJECT_DATA")) {
            attachmentResult = ds.getProperties().get("Q_ATTACHMENT_TYPE").equals("RESULT");
        }

        if (!(ds.getDataSetTypeCode().equals("Q_PROJECT_DATA"))
                && !(ds.getDataSetTypeCode().contains("RESULTS"))) {
            containsData = true;
        } else if (ds.getDataSetTypeCode().contains("RESULTS") || attachmentResult) {
            containsResults = true;
        } // else if (ds.getDataSetTypeCode() == "Q_PROJECT_DATA") {
          // containsAttachments = true;
          // }
    }

    newProjectBean.setContainsData(containsData);
    newProjectBean.setContainsResults(containsResults);
    // newProjectBean.setContainsAttachments(containsAttachments);

    newProjectBean.setExperiments(experimentBeans);
    newProjectBean.setMembers(new HashSet<String>());

    String secondaryName = getDatabaseManager().getProjectName(projectIdentifier);
    if (secondaryName == null || secondaryName.isEmpty())
        secondaryName = "n/a";

    newProjectBean.setSecondaryName(secondaryName);
    return newProjectBean;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java

License:Open Source License

/**
 * Method create ProjectBean for project object
 * /*from w ww  . j  av  a  2s. c  o  m*/
 * @param Project project
 * @return ProjectBean for corresponding project
 */

@Deprecated
ProjectBean createProjectBean(Project project) {

    ProjectBean newProjectBean = new ProjectBean();

    List<Experiment> experiments = this.getOpenBisClient()
            .getExperimentsOfProjectByIdentifier(project.getIdentifier());

    ProgressBar progressBar = new ProgressBar();
    progressBar.setValue(this.getOpenBisClient().computeProjectStatus(project));

    Date registrationDate = project.getRegistrationDetails().getRegistrationDate();

    newProjectBean.setId(project.getIdentifier());
    newProjectBean.setCode(project.getCode());
    String desc = project.getDescription();
    if (desc == null)
        desc = "";
    newProjectBean.setDescription(desc);
    newProjectBean.setRegistrationDate(registrationDate);
    newProjectBean.setProgress(progressBar);
    newProjectBean.setRegistrator(project.getRegistrationDetails().getUserId());
    newProjectBean.setContact(project.getRegistrationDetails().getUserEmail());

    BeanItemContainer<ExperimentBean> experimentBeans = new BeanItemContainer<ExperimentBean>(
            ExperimentBean.class);

    List<String> experiment_identifiers = new ArrayList<String>();

    for (Experiment experiment : experiments) {
        experimentBeans.addBean(this.getExperiment(experiment));
        experiment_identifiers.add(experiment.getIdentifier());
    }
    List<DataSet> datasets = (experiment_identifiers.size() > 0)
            ? getOpenBisClient().getFacade().listDataSetsForExperiments(experiment_identifiers)
            : new ArrayList<DataSet>();
    newProjectBean.setContainsData(datasets.size() != 0);

    newProjectBean.setExperiments(experimentBeans);
    newProjectBean.setMembers(this.getOpenBisClient().getSpaceMembers(project.getSpaceCode()));

    return newProjectBean;
}

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  w w  . ja  v  a 2 s. c o  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.HomeView.java

License:Open Source License

/**
 * refresh all openbis project for current user. Basically currentBean is overwritten
 *///from   www  .  ja va2s . c om
public void loadProjects() {
    // this.includePatientCreation = false;
    final SpaceBean homeSpaceBean = new SpaceBean("homeSpace", "", false, null, null, null, null, null, null);
    BeanItemContainer<ProjectBean> projectContainer = new BeanItemContainer<ProjectBean>(ProjectBean.class);

    LOGGER.info("Loading projects...");
    List<Project> projects = datahandler.getOpenBisClient().getOpenbisInfoService()
            .listProjectsOnBehalfOfUser(datahandler.getOpenBisClient().getSessionToken(), user);
    LOGGER.info("Loading projects...done.");

    for (Project project : projects) {
        String projectIdentifier = project.getIdentifier();
        String projectCode = project.getCode();
        String desc = project.getDescription();
        if (desc == null) {
            desc = "";
        } else if (desc.length() > 0) {
            desc = desc.substring(0, Math.min(desc.length(), 100));
            if (desc.length() == 100) {
                desc += "...";
            }
        }

        // TODO isn't this slow in this fashion? what about SELECT * and creating a map?
        String secondaryName = datahandler.getDatabaseManager().getProjectName(projectIdentifier);
        if (secondaryName.isEmpty() || secondaryName == null)
            secondaryName = "n/a";

        ProjectBean newProjectBean = new ProjectBean(projectIdentifier, projectCode, secondaryName, desc,
                project.getSpaceCode(), new BeanItemContainer<ExperimentBean>(ExperimentBean.class),
                new ProgressBar(), new Date(), "", "", null, false, false, false, "");

        // TODO isn't this slow in this fashion? what about SELECT * and creating a map?
        String pi = datahandler.getDatabaseManager().getInvestigatorForProject(projectIdentifier);

        if (pi.equals("")) {
            newProjectBean.setPrincipalInvestigator("n/a");
        } else {
            newProjectBean.setPrincipalInvestigator(pi);
        }

        projectContainer.addBean(newProjectBean);
    }

    homeSpaceBean.setProjects(projectContainer);
    if (homeSpaceBean.getProjects().size() > 0) {
        this.setContainerDataSource(homeSpaceBean, caption);
    }
}

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);/* w  w w. ja 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.PatientStatusComponent.java

License:Open Source License

public void updateUI(final ProjectBean currentBean) {
    BeanItemContainer<ExperimentStatusBean> experimentstatusBeans = datahandler
            .computeIvacPatientStatus(currentBean);

    int finishedExperiments = 0;
    status.removeAllComponents();//  ww  w  . j a  v  a2 s  .  co  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

/**
 * /*from   ww  w .  j  ava 2 s .  c  om*/
 * @param list
 * @return
 */
private Component getMembersComponent() {
    membersLayout = new HorizontalLayout();
    // membersLayout.setIcon(FontAwesome.USERS);
    // membersLayout.setCaption("Members");
    membersLayout.setWidth("100%");

    // final Button loadMembers = new Button("[+]");
    // membersLayout.addComponent(loadMembers);
    // loadMembers.setStyleName(ValoTheme.BUTTON_LINK);
    // loadMembers.addClickListener(new ClickListener() {

    // @Override
    // public void buttonClick(ClickEvent event) {
    ProgressBar progress = new ProgressBar();
    progress.setIndeterminate(true);
    Label info = new Label(
            "Searching for members. Can take several seconds on big projects. Please be patient.");
    info.setStyleName(ValoTheme.LABEL_SUCCESS);
    // membersLayout.addComponent(info);
    membersLayout.addComponent(progress);
    MemberWorker worker = new MemberWorker();
    worker.start();
    UI.getCurrent().setPollInterval(500);
    // loadMembers.setEnabled(false);

    return membersLayout;
}