Example usage for com.vaadin.ui TwinColSelect TwinColSelect

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

Introduction

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

Prototype

public TwinColSelect(String caption) 

Source Link

Document

Constructs a new TwinColSelect with the given caption.

Usage

From source file:org.geant.sat.ui.ScheduleSurveyViewer.java

License:BSD License

/**
 * Creates a subwindow for editing survey details of entity.
 * //from ww  w.j ava  2  s  .c  om
 * @param details
 *            entity
 */
private void editSurveys(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editsids.title"));
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    TwinColSelect<String> selectSids = new TwinColSelect<>(getString("lang.window.newentity.editsids.sids"));
    selectSids.setData(details);
    ListAllSurveysResponse resp = getMainUI().getSatApiClient().getSurveys();
    if (!verifySuccess(resp)) {
        return;
    }
    List<SurveyDetails> surveyDetails = resp.getSurveys();
    // parse active sids
    List<String> activeSurveyDetails = new ArrayList<String>();
    for (SurveyDetails surveyDetail : surveyDetails) {
        if (surveyDetail.getActive()) {
            activeSurveyDetails.add(surveyDetail.getSid());
        }
    }
    selectSids.setItems(activeSurveyDetails);
    // set current sids as selection
    selectSids.updateSelection(details.getSids(), new HashSet<String>());
    subContent.addComponent(selectSids, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedSurveys);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditSurveys);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}

From source file:org.geant.sat.ui.ScheduleSurveyViewer.java

License:BSD License

/**
 * Creates a subwindow for editing assessor details of entity.
 * //from   w w  w.  ja v  a2 s .c  om
 * @param details
 *            entity
 */
private void editAssessors(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editassessors.title"));
    subWindowNewEntity.setWidth("80%");
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    subContent.setWidth("100%");
    TwinColSelect<AssessorDetails> selectAssessors = new TwinColSelect<>(
            getString("lang.window.newentity.editassessors.assessors"));
    selectAssessors.setItemCaptionGenerator(new AssessorDetailsHelper());
    selectAssessors.setWidth("100%");
    selectAssessors.setData(details);
    ListAssessorsResponse resp = getMainUI().getSatApiClient().getAssessors();
    if (!verifySuccess(resp)) {
        return;
    }
    List<AssessorDetails> assessorDetails = resp.getAssessors();
    selectAssessors.setItems(assessorDetails);
    selectAssessors.updateSelection(
            AssessorDetailsHelper.selectionToSet(assessorDetails, details.getAssessors()),
            new HashSet<AssessorDetails>());
    subContent.addComponent(selectAssessors, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedAssessors);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditAssessors);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}

From source file:org.investovator.ui.nngaming.config.ParameterSelectView.java

License:Open Source License

public ParameterSelectView() {

    parameterSelectList = new TwinColSelect("Select Analysis Parameters for Game");
    parameterSelectList.setHeight(28, Sizeable.Unit.MM);
    parameterSelectList.setNullSelectionAllowed(false);

    parameterSelectList.addValueChangeListener(new Property.ValueChangeListener() {
        @Override// w  w w.  j ava  2 s.  co  m
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {

            Set<String> results = (Set<String>) valueChangeEvent.getProperty().getValue();

            selectedParameters = new ArrayList<>();

            for (Iterator<String> iterator = results.iterator(); iterator.hasNext();) {
                String next = iterator.next();
                selectedParameters.add(next.substring(0, next.indexOf(" ")));
            }

        }
    });

    content = new VerticalLayout();
    content.addComponents(parameterSelectList);
    content.setComponentAlignment(parameterSelectList, Alignment.MIDDLE_CENTER);
    content.setMargin(true);
}

From source file:org.investovator.ui.nngaming.config.StockSelectView.java

License:Open Source License

public StockSelectView() {

    stockSelectList = new TwinColSelect("Select Stocks for Game");

    stockSelectList.setHeight(28, Sizeable.Unit.MM);

    stockSelectList.setNullSelectionAllowed(false);

    stockSelectList.addValueChangeListener(new Property.ValueChangeListener() {
        @Override//from   w ww  .  j a  va  2 s .co m
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {

            Set<String> results = (Set<String>) valueChangeEvent.getProperty().getValue();

            selectedStocks = new ArrayList<>();

            for (Iterator<String> iterator = results.iterator(); iterator.hasNext();) {
                String next = iterator.next();
                selectedStocks.add(next);
            }
        }
    });

    content = new VerticalLayout();
    content.addComponent(stockSelectList);
    content.setComponentAlignment(stockSelectList, Alignment.MIDDLE_CENTER);
    content.setMargin(true);
}

From source file:qbic.vaadincomponents.GroupSpecificParameterComponent.java

License:Open Source License

private FormLayout initParameters() {
    // select the type
    FormLayout parameterLayout = new FormLayout();

    labelfreequant = new CheckBox();
    labelfreequant.setCaption("Label-Free Quantification");
    parameterLayout.addComponent(labelfreequant);

    typeSelect = new NativeSelect();
    typeSelect.setCaption("Type");
    typeSelect.addItem("Standard");
    typeSelect.addItem("Reporter Ion");
    // add it/*  www .  j av  a 2s  .  co  m*/
    parameterLayout.addComponent(typeSelect);
    // select multiplicity.
    multiplicitySelect = new NativeSelect();
    multiplicitySelect.setCaption("Multiplicity");
    multiplicitySelect.addItem("1 - label-free quantification");
    multiplicitySelect.addItem("2 - light and heavy labels");
    multiplicitySelect.addItem("3 - light, medium, and heavy lables");
    multiplicitySelect.setNullSelectionAllowed(false);
    parameterLayout.addComponent(multiplicitySelect);
    // add labels
    labels = new QuantificationLabelComponent();
    parameterLayout.addComponent(labels);
    multiplicitySelect.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 2788813707970284834L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            String multiplicity = (String) event.getProperty().getValue();
            if (multiplicity.startsWith("1")) {
                labels.noLables();
            } else if (multiplicity.startsWith("2")) {
                labels.lightAndHeavyLabels();
            } else if (multiplicity.startsWith("3")) {
                labels.lightMediumAndHeavyLabels();
            }

        }
    });
    parameterLayout.addComponent(labels);

    // variable modifications
    variableModifications = new TwinColSelect("Variable Modifications");

    variableModifications.addItems("Acetyl (Protein N-term)", "Acetyl (K)", "Oxidation (M)", "Ala->Arg");
    parameterLayout.addComponent(variableModifications);
    // digestion mode
    digestionMode = new NativeSelect("Digestion mode");
    digestionMode.addItem("Specific");
    parameterLayout.addComponent(digestionMode);
    // enzyme
    enzyme = new TwinColSelect("Enzyme");
    enzyme.addItems("Trypsin/P", "ArgC", "Trypsin", "GluN");
    parameterLayout.addComponent(enzyme);
    // missed cleavage
    missedcleavage = new TextField("Max Missed Cleavage");
    parameterLayout.addComponent(missedcleavage);
    matchType = new NativeSelect("Match type");
    matchType.addItem("MatchFromAndTo");
    parameterLayout.addComponent(matchType);
    return parameterLayout;
}