Example usage for com.vaadin.ui CheckBox CheckBox

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

Introduction

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

Prototype

public CheckBox(String caption) 

Source Link

Document

Creates a new checkbox with a set caption.

Usage

From source file:uicomponents.MSOptionComponent.java

License:Open Source License

public MSOptionComponent(DBVocabularies vocabs) {
    this.setCaption("MS Experiment Options");
    setSpacing(true);//  ww w .  j a  va2 s .c  o m
    proteinPooling = new CheckBox("Pool Before Protein Fractionation/Enrichment");
    measurePeptides = new CheckBox("Measure Peptides");
    shortGel = new CheckBox("Use Short Gel");
    purification = new CheckBox("Protein Purification");

    addComponent(purification);
    purificationMethods = new ComboBox("Purification Method");
    purificationMethods.setNullSelectionAllowed(false);
    purificationMethods.setStyleName(Styles.boxTheme);
    purificationMethods.setVisible(false);
    List<String> methods = new ArrayList<String>(vocabs.getProteinPurificationMethodsMap().values());
    Collections.sort(methods);
    purificationMethods.addItems(methods);
    addComponent(purificationMethods);

    purification.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            purificationMethods.setVisible(purification.getValue());
        }
    });
    addComponent(shortGel);
    addComponent(proteinPooling);
    addComponent(measurePeptides);
}

From source file:uicomponents.MSSampleMultiplicationTable.java

License:Open Source License

public MSSampleMultiplicationTable(AnalyteMultiplicationType type, DBVocabularies vocabs, boolean peptides) {
    setSpacing(true);//from  w  w w. j  a v a  2  s.  co m

    this.type = type;
    this.aboutPeptides = peptides;
    this.enzymes = vocabs.getEnzymes();
    Collections.sort(enzymes);

    setSpacing(true);

    sampleTable = new Table();
    sampleTable.setWidth("775px");
    sampleTable.setCaption("Resulting " + type + "s");
    sampleTable.setStyleName(Styles.tableTheme);
    sampleTable.addContainerProperty("Base Sample", Label.class, null);
    sampleTable.addContainerProperty(type, Label.class, null);
    sampleTable.addContainerProperty(type + " Name", TextField.class, null);
    sampleTable.addContainerProperty(type + " Lab ID", TextField.class, null);
    sampleTable.addContainerProperty("Process", Component.class, null);
    sampleTable.addContainerProperty("Enzyme", Component.class, null);

    sampleTable.setColumnWidth("Base Sample", 110);
    sampleTable.setColumnWidth(type, 65);
    sampleTable.setColumnWidth(type + " Name", 210);
    sampleTable.setColumnWidth(type + " Lab ID", 110);
    sampleTable.setColumnWidth("Process", 130);
    sampleTable.setColumnWidth("Enzyme", 135);
    if (peptides) {
        sampleTable.setColumnCollapsingAllowed(true);
        sampleTable.setColumnCollapsed("Process", true);
        sampleTable.setColumnCollapsed("Enzyme", true);
    }
    addComponent(sampleTable);

    generalFractionMSInfo = new GeneralMSInfoPanel(vocabs, type + " Measurement Details");
    generalFractionMSInfo.setVisible(false);
    addComponent(generalFractionMSInfo);

    poolSamples = new CheckBox("Pool All " + type + "s");
    String info = "Create one pool of all protein " + type
            + " per original sample. They will be digested using the enzyme selected for digestion of single "
            + type + "s (see selection below).";
    if (peptides)
        info = "Create one pool of all peptide " + type
                + " per original sample. They will be measured using the same MS properties used for each single "
                + type + " (see selection below).";
    addComponent(Styles.questionize(poolSamples, info, "Pool All " + type + "s"));

    if (!peptides) {
        // add = new Button();
        // remove = new Button();
        // Styles.iconButton(add, FontAwesome.PLUS_SQUARE);
        // Styles.iconButton(remove, FontAwesome.MINUS_SQUARE);
        initListener();

        // enzymePane = new VerticalLayout();
        // enzymePane.setCaption(type + " Digestion Enzymes");
        // enzymePane.addComponent(c);
        // enzymePane.setVisible(false);
        // addComponent(enzymePane);
        // buttonGrid = new GridLayout(2, 1);
        // buttonGrid.setSpacing(true);
        // buttonGrid.addComponent(add);
        // buttonGrid.addComponent(remove);
        // buttonGrid.setVisible(false);
        // addComponent(buttonGrid);
    }
}

From source file:uicomponents.TechChooser.java

License:Open Source License

/**
 * Creates a new condition chooser component
 * /*from  www . j a  v  a  2  s.  c o  m*/
 * @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);
}

From source file:uk.q3c.krail.testapp.view.PushView.java

License:Apache License

@Override
public void doBuild() {
    super.doBuild();
    groupInput = new TextField("Group");
    groupInput.setWidth("100px");
    messageInput = new TextField("Message");

    sendButton = new Button("Send message");
    sendButton.addClickListener(new ClickListener() {

        @Override/* w w  w. j  a v  a  2 s .com*/
        public void buttonClick(ClickEvent event) {
            broadcaster.broadcast(groupInput.getValue(), messageInput.getValue(), getRootComponent());
        }
    });

    inputLayout = new HorizontalLayout(groupInput, messageInput, sendButton);
    inputLayout.setComponentAlignment(sendButton, Alignment.BOTTOM_CENTER);

    pushEnabled = new CheckBox("Push enabled");
    pushEnabled.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {

        @Override
        public void valueChange(HasValue.ValueChangeEvent event) {
            //                applicationConfiguration.setProperty(PushModule.SERVER_PUSH_ENABLED, event.getValue());
        }

    });
    pushEnabled.setValue(Boolean.TRUE);

    infoArea = new Label();
    infoArea.setContentMode(ContentMode.HTML);
    infoArea.setSizeFull();
    infoArea.setValue("Test using multiple browser tabs or instances");

    setTopCentreCell(pushEnabled);
    setCentreCell(inputLayout);
    setTopLeftCell(infoArea);
    setBottomCentreCell(messageLog);
    setMiddleLeftCell(newTab);

    getGrid().setComponentAlignment(pushEnabled, Alignment.MIDDLE_CENTER);
    getGrid().setComponentAlignment(inputLayout, Alignment.MIDDLE_CENTER);

    prepareTabOpener();
}

From source file:views.PersonInput.java

License:Open Source License

public PersonInput(List<String> titles, Map<String, Integer> affiliations, List<String> roles,
        AffiliationInput affiInput) {/* w w w  .jav a2  s  . c  om*/
    left = new FormLayout();
    left.setMargin(true);

    affiliationMap = affiliations;
    this.affiInput = affiInput;
    this.affiInput.hideRegisterButton();
    this.affiInput.setVisible(false);

    userName = new TextField("Username");
    // userName.setRequired(true);
    userName.addValidator(new RegexpValidator(Helpers.VALID_USERNAME_REGEX, "Please input a valid username."));
    left.addComponent(Styles.questionize(userName,
            "University Tbingen user name or user name provided by QBiC. If left empty a dummy user name is chosen "
                    + "which cannot be used to log in until a real name is added. Person information can still be added to "
                    + "projects or experiments in that case.",
            "User Name"));

    title = new ComboBox("Title", titles);
    title.setRequired(true);
    title.setStyleName(ValoTheme.COMBOBOX_SMALL);
    title.setNullSelectionAllowed(false);
    left.addComponent(title);

    first = new TextField("First Name");
    first.setRequired(true);
    first.addValidator(new RegexpValidator(Helpers.VALID_NAME_REGEX, "Please input a valid name."));
    left.addComponent(first);

    last = new TextField("Last Name");
    last.setRequired(true);
    last.addValidator(new RegexpValidator(Helpers.VALID_NAME_REGEX, "Please input a valid name."));
    left.addComponent(last);

    eMail = new TextField("E-Mail");
    eMail.setRequired(true);
    eMail.addValidator(
            new RegexpValidator(Helpers.VALID_EMAIL_ADDRESS_REGEX, "Please input a valid e-mail address."));
    left.addComponent(eMail);

    phone = new TextField("Phone");
    left.addComponent(phone);

    affiliation = new ComboBox("Affiliation", affiliations.keySet());
    // affiliation.setNullSelectionAllowed(false);
    affiliation.setRequired(true);
    affiliation.setFilteringMode(FilteringMode.CONTAINS);
    affiliation.setStyleName(ValoTheme.COMBOBOX_SMALL);
    left.addComponent(Styles.questionize(affiliation,
            "Work group or organization this person is part of. If it does not exist in the system "
                    + "a \"New Affiliation\" has to be created first. Additional Affiliations and roles can be set in the next Tab.",
            "Affiliation"));

    newAffiliation = new CheckBox("New Affiliation");
    left.addComponent(newAffiliation);
    newAffiliation.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            enableAffiliationInput(newAffiliation.getValue());
            affiliation.select(affiliation.getNullSelectionItemId());
            affiliation.setEnabled(!newAffiliation.getValue());
        }
    });

    role = new ComboBox("Role", roles);
    role.setRequired(true);
    role.setStyleName(ValoTheme.COMBOBOX_SMALL);
    role.setNullSelectionAllowed(false);
    left.addComponent(role);

    commit = new Button("Save New User");
    left.addComponent(commit);

    addComponent(left);
    addComponent(affiInput);
}