Example usage for com.vaadin.ui HorizontalLayout setCaption

List of usage examples for com.vaadin.ui HorizontalLayout setCaption

Introduction

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

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:steps.EntityStep.java

License:Open Source License

/**
 * Create a new Entity step for the wizard
 * //from w ww .  j  a va 2 s .c om
 * @param speciesMap A map of available species (codes and labels)
 * @param people
 */
public EntityStep(Map<String, String> speciesMap, Set<String> people) {
    main = new VerticalLayout();
    main.setMargin(true);
    main.setSpacing(true);
    Label header = new Label("Sample Sources");
    main.addComponent(Styles.questionize(header,
            "Sample sources are individual patients, animals or plants that are used in the experiment. "
                    + "You can input (optional) experimental variables, e.g. genotypes, that differ between different experimental groups.",
            "Sample Sources"));
    ArrayList<String> openbisSpecies = new ArrayList<String>();
    openbisSpecies.addAll(speciesMap.keySet());
    Collections.sort(openbisSpecies);
    species = new ComboBox("Species", openbisSpecies);
    species.setStyleName(Styles.boxTheme);
    species.setRequired(true);
    species.setFilteringMode(FilteringMode.CONTAINS);
    if (ProjectwizardUI.testMode)
        species.setValue("Homo Sapiens");
    speciesNum = new OpenbisInfoTextField("How many different species are there in this project?", "", "50px",
            "2");
    speciesNum.getInnerComponent().setVisible(false);
    speciesNum.getInnerComponent().setEnabled(false);
    c = new ConditionsPanel(suggestions, emptyFactor, "Species", species, true, conditionsSet,
            (TextField) speciesNum.getInnerComponent());
    expName = new TextField("Experimental Step Name");
    expName.setStyleName(Styles.fieldTheme);
    main.addComponent(expName);
    main.addComponent(c);
    main.addComponent(speciesNum.getInnerComponent());
    main.addComponent(species);

    species.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1987640360028444299L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            specialSpecies.setVisible(species.getValue().equals("Other"));
        }
    });
    specialSpecies = new TextField("Species Information");
    specialSpecies.setStyleName(Styles.fieldTheme);
    specialSpecies.setVisible(false);
    specialSpecies.setWidth("350px");
    main.addComponent(specialSpecies);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Contact Person");
    person = new ComboBox();
    person.addItems(people);
    person.setFilteringMode(FilteringMode.CONTAINS);
    person.setStyleName(Styles.boxTheme);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(person);
    persBoxH.addComponent(reloadPeople);

    main.addComponent(Styles.questionize(persBoxH, "Contact person responsible for patients or sample sources.",
            "Contact Person"));

    bioReps = new OpenbisInfoTextField(
            "How many identical biological replicates (e.g. animals) per group are there?",
            "Number of (biological) replicates for each group." + "Technical replicates are added later!",
            "50px", "1");
    main.addComponent(bioReps.getInnerComponent());
}

From source file:steps.ExtractionStep.java

License:Open Source License

/**
 * Create a new Extraction step for the wizard
 * /*from   w ww.  ja  va 2  s.  c  o  m*/
 * @param tissueMap A map of available tissues (codes and labels)
 * @param cellLinesMap
 */
public ExtractionStep(Map<String, String> tissueMap, Map<String, String> cellLinesMap, Set<String> people) {
    main = new VerticalLayout();
    main.setMargin(true);
    main.setSpacing(true);
    Label header = new Label("Sample Extracts");
    main.addComponent(Styles.questionize(header,
            "Extracts are individual tissue or other samples taken from organisms and used in the experiment. "
                    + "You can input (optional) experimental variables, e.g. extraction times or treatments, that differ between different groups "
                    + "of extracts.",
            "Sample Extracts"));

    ArrayList<String> tissues = new ArrayList<String>();
    tissues.addAll(tissueMap.keySet());
    Collections.sort(tissues);
    tissue = new ComboBox("Tissue", tissues);
    tissue.setRequired(true);
    tissue.setStyleName(Styles.boxTheme);
    tissue.setFilteringMode(FilteringMode.CONTAINS);
    if (ProjectwizardUI.testMode)
        tissue.setValue("Blood");
    tissueNum = new OpenbisInfoTextField("How many different tissue types are there in this sample extraction?",
            "", "50px", "2");
    tissueNum.getInnerComponent().setVisible(false);
    tissueNum.getInnerComponent().setEnabled(false);

    expName = new TextField("Experimental Step Name");
    expName.setStyleName(Styles.fieldTheme);
    main.addComponent(expName);

    c = new ConditionsPanel(suggestions, emptyFactor, "Tissue", tissue, true, conditionsSet,
            (TextField) tissueNum.getInnerComponent());
    main.addComponent(c);

    isotopes = new CheckBox("Isotope Labeling");
    isotopes.setImmediate(true);
    main.addComponent(Styles.questionize(isotopes,
            "Are extracted cells labeled by isotope labeling (e.g. for Mass Spectrometry)?",
            "Isotope Labeling"));

    labelingMethods = initLabelingMethods();

    isotopeTypes = new ComboBox();
    isotopeTypes.setVisible(false);
    isotopeTypes.setImmediate(true);
    isotopeTypes.setStyleName(Styles.boxTheme);
    isotopeTypes.setNullSelectionAllowed(false);
    for (LabelingMethod l : labelingMethods)
        isotopeTypes.addItem(l.getName());
    main.addComponent(isotopeTypes);

    isotopes.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 6993706766195224898L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            isotopeTypes.setVisible(isotopes.getValue());
        }
    });
    main.addComponent(tissueNum.getInnerComponent());
    main.addComponent(tissue);

    tissue.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1987640360028444299L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            cellLine.setVisible(tissue.getValue().equals("Cell Line"));
            otherTissue.setVisible(tissue.getValue().equals("Other"));
        }
    });
    ArrayList<String> cellLines = new ArrayList<String>();
    cellLines.addAll(cellLinesMap.keySet());
    Collections.sort(cellLines);
    cellLine = new ComboBox("Cell Line", cellLines);
    cellLine.setStyleName(Styles.boxTheme);
    cellLine.setImmediate(true);
    cellLine.setVisible(false);
    cellLine.setFilteringMode(FilteringMode.CONTAINS);
    main.addComponent(cellLine);
    otherTissue = new TextField("Tissue Information");
    otherTissue.setWidth("350px");
    otherTissue.setStyleName(Styles.fieldTheme);
    otherTissue.setVisible(false);
    main.addComponent(otherTissue);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Contact Person");
    person = new ComboBox();
    person.addItems(people);
    person.setFilteringMode(FilteringMode.CONTAINS);
    person.setStyleName(Styles.boxTheme);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(person);
    persBoxH.addComponent(reloadPeople);

    main.addComponent(Styles.questionize(persBoxH, "Contact person responsible for tissue extraction.",
            "Contact Person"));

    extractReps = new OpenbisInfoTextField(
            "Extracted replicates per patient/animal/plant per experimental variable.",
            "Number of extractions per individual defined in the last step. "
                    + "Technical replicates are added later!",
            "50px", "1");
    main.addComponent(extractReps.getInnerComponent());
}

From source file:uicomponents.PoolingTable.java

License:Open Source License

public PoolingTable(String name, TabSheet selectionTables, Map<Integer, Integer> usedTimes,
        List<String> factorLabels) {
    this.selectionTables = selectionTables;
    all = (Table) selectionTables.getTab(0).getComponent();
    used = (Table) selectionTables.getTab(1).getComponent();
    labels = factorLabels;/*  ww  w .ja v a 2  s  .co  m*/

    this.usedTimes = usedTimes;
    setSpacing(true);

    HorizontalLayout tableButtonComponent = new HorizontalLayout();
    tableButtonComponent.setCaption("Sample Pool");
    tableButtonComponent.setSpacing(true);
    secondaryName = new StandardTextField("Secondary Name");
    secondaryName.setValue(name);
    secondaryName.setStyleName(Styles.fieldTheme);
    moveLeft = new Button();
    Styles.iconButton(moveLeft, FontAwesome.ARROW_CIRCLE_LEFT);

    moveLeft.addStyleName("large_font_awesome");
    addComponent(secondaryName);
    poolIDs = new HashSet<Integer>();
    poolTable = new Table();
    initTable();
    tableButtonComponent.addComponent(poolTable);
    tableButtonComponent.addComponent(moveLeft);
    addComponent(Styles.questionize(tableButtonComponent,
            "You can add samples to the active pool by " + "selecting them from the right and clicking "
                    + FontAwesome.ARROW_CIRCLE_LEFT.getHtml() + " or by dragging them over with your mouse.",
            "Adding Samples to Pools"));

    initDragAndDrop(new Or(new SourceIs(all), new SourceIs(used)));
    initButtonMover(all, used);
}

From source file:uicomponents.ProjectInformationComponent.java

License:Open Source License

public ProjectInformationComponent(List<String> spaces, Set<String> people) {
    setSpacing(true);//from  ww  w.j  a v a 2  s. co  m
    setSizeUndefined();

    Collections.sort(spaces);
    spaceBox = new ComboBox("Project", spaces);
    spaceBox.setStyleName(Styles.boxTheme);
    spaceBox.setNullSelectionAllowed(false);
    spaceBox.setImmediate(true);
    spaceBox.setFilteringMode(FilteringMode.CONTAINS);
    addComponent(Styles.questionize(spaceBox, "Name of the project", "Project Name"));

    ComboBox prBox = new ComboBox("Sub-Project");
    prBox.setStyleName(Styles.boxTheme);
    projectBox = new CustomVisibilityComponent(prBox);
    projectBox.setStyleName(Styles.boxTheme);
    projectBox.setImmediate(true);
    addComponent(Styles.questionize(projectBox, "QBiC 5 letter project code", "Project"));

    project = new StandardTextField();
    project.setStyleName(Styles.fieldTheme);
    project.setMaxLength(5);
    project.setWidth("90px");
    project.setEnabled(false);
    project.setValidationVisible(true);

    reloadProjects = new Button();
    Styles.iconButton(reloadProjects, FontAwesome.REFRESH);

    HorizontalLayout proj = new HorizontalLayout();
    proj.setCaption("New Sub-Project");
    proj.addComponent(project);
    proj.addComponent(reloadProjects);
    CustomVisibilityComponent newProj = new CustomVisibilityComponent(proj);

    addComponent(Styles.questionize(newProj,
            "Automatically create an unused QBiC project code or fill in your own. "
                    + "The code consists of 5 characters, must start with Q and not contain Y or Z. You can create a random unused code by clicking "
                    + FontAwesome.REFRESH.getHtml() + ".",
            "New Sub-Project"));
    expName = new StandardTextField("Short name");
    expName.setWidth("200px");
    // expName.setRequired(true);
    expName.setVisible(false);
    expName.setInputPrompt("Name of sub project");
    addComponent(expName);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Principal Investigator");
    VerticalLayout persBox = new VerticalLayout();

    piBox = new ComboBox();
    piBox.addItems(people);
    piBox.setFilteringMode(FilteringMode.CONTAINS);
    piBox.setStyleName(Styles.boxTheme);
    contactBox = new ComboBox("Contact Person", people);
    contactBox.setFilteringMode(FilteringMode.CONTAINS);
    contactBox.setStyleName(Styles.boxTheme);
    managerBox = new ComboBox("Project Manager", people);
    managerBox.setFilteringMode(FilteringMode.CONTAINS);
    managerBox.setStyleName(Styles.boxTheme);
    persBox.addComponent(piBox);
    persBox.addComponent(contactBox);
    persBox.addComponent(managerBox);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(persBox);
    persBoxH.addComponent(reloadPeople);

    personBox = new CustomVisibilityComponent(persBoxH);
    personBox.setVisible(false);
    addComponent(Styles.questionize(personBox,
            "Investigator and contact person of this project. Please contact us if additional people need to be added. Press refresh button to show newly added people.",
            "Contacts"));

    projectDescription = new TextArea("Description");
    projectDescription.setRequired(true);
    projectDescription.setStyleName(Styles.fieldTheme);
    projectDescription.setInputPrompt("Sub-Project description, maximum of 2000 symbols.");
    projectDescription.setWidth("100%");
    projectDescription.setHeight("110px");
    projectDescription.setVisible(false);
    StringLengthValidator lv = new StringLengthValidator(
            "Description is only allowed to contain a maximum of 2000 letters.", 0, 2000, true);
    projectDescription.addValidator(lv);
    projectDescription.setImmediate(true);
    projectDescription.setValidationVisible(true);
    addComponent(projectDescription);
}

From source file:uicomponents.TechChooser.java

License:Open Source License

/**
 * Creates a new condition chooser component
 * //from   w w w.jav a2s.com
 * @param options List of different possible conditions
 * @param other Name of the "other" condition, which when selected will enable an input field for
 *        free text
 * @param special Name of a "special" condition like species for the entity input, which when
 *        selected will disable the normal species input because there is more than one instance
 * @param nullSelectionAllowed true, if the conditions may be empty
 */
public TechChooser(List<String> options, Set<String> persons) {
    chooser = new ComboBox("Analyte", options);
    chooser.setStyleName(Styles.boxTheme);

    replicates = new OpenbisInfoTextField("Replicates", "", "50px", "1");
    pool = new CheckBox("Pool/Multiplex Samples");
    setSpacing(true);
    helpers = new ArrayList<HorizontalLayout>();
    HorizontalLayout help1 = Styles.questionize(chooser, "Choose the analyte that is measured.", "Analytes");
    addComponent(help1);
    HorizontalLayout help2 = Styles.questionize(replicates.getInnerComponent(),
            "Number of prepared replicates (1 means no replicates) of this analyte", "Replicates");
    addComponent(help2);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Contact Person");
    person = new ComboBox();
    person.addItems(persons);
    person.setFilteringMode(FilteringMode.CONTAINS);
    person.setStyleName(Styles.boxTheme);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(person);
    persBoxH.addComponent(reloadPeople);

    HorizontalLayout help3 = Styles.questionize(persBoxH, "Person responsible for this part of the experiment",
            "Contact Person");
    addComponent(help3);
    HorizontalLayout help4 = Styles.questionize(pool,
            "Select if multiple samples are pooled into a single " + "sample before measurement.", "Pooling");

    chooser.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (chooser.getValue() != null) {
                help4.setVisible(!chooser.getValue().equals("PROTEINS"));
            }
        }
    });

    addComponent(help4);
    helpers.add(help1);
    helpers.add(help2);
    helpers.add(help3);
    helpers.add(help4);
}