Example usage for com.vaadin.ui ComboBox ComboBox

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

Introduction

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

Prototype

public ComboBox() 

Source Link

Document

Constructs an empty combo box without a caption.

Usage

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void buildAppointmentStatus() {
    Label section = new Label("Estado");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    rootLayout.addComponent(section);//  ww w  .  j av  a  2 s .c  om

    status = new ComboBox();
    status.setContainerDataSource(containerStatuses);
    status.setWidth("100%");
    status.setTextInputAllowed(false);
    status.setNullSelectionAllowed(false);

    notifyChanges = new CheckBox();
    notifyChanges.setIcon(FontAwesome.BELL);
    notifyChanges.setImmediate(true);

    HorizontalLayout statusWrapper = new HorizontalLayout();
    statusWrapper.setCaption("Estado");
    statusWrapper.addComponent(status);
    statusWrapper.addComponent(notifyChanges);
    statusWrapper.setWidth("100%");
    statusWrapper.setExpandRatio(status, 1);
    rootLayout.addComponent(statusWrapper);

    statusNotes = new TextArea("Notas de estado");
    statusNotes.setWidth("100%");
    statusNotes.setInputPrompt("Anotaciones del estado...");
    rootLayout.addComponent(statusNotes);
}

From source file:com.terralcode.gestion.frontend.view.widgets.desplegable.ComponenteDesplegableView.java

private Component buildCustomerDetail() {
    GridLayout miGrid = new GridLayout(3, 2);

    ComboBox combo = new ComboBox();
    combo.addValueChangeListener(new Property.ValueChangeListener() {

        @Override//from   ww w.  j a v  a  2 s. co  m
        public void valueChange(Property.ValueChangeEvent event) {
            seleccion = (String) event.getProperty().getValue();

        }
    });
    combo.addItems("Pocino Ibrico", "Pocino Blanco", "Ovino", "Vacuno", "Avicultura", "Otros");
    //        combo.addItem(especies);
    Label informacion = new Label("datos");
    Button botonMas = new Button("+");
    botonMas.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Integer clave;
            if (valores.containsValue(seleccion)) {
                clave = 1;
                if (!valores.isEmpty()) {
                    clave = valores.size() + 1;
                }

                valores.put(clave, seleccion);
            }
            informacion.setValue(mostrarValores());
            Notification.show(seleccion + " aadido");
        }
    });
    Button botonMenos = new Button("-");
    miGrid.addComponent(informacion, 0, 0);
    miGrid.addComponent(combo, 0, 1);
    miGrid.addComponent(botonMas, 1, 1);
    miGrid.addComponent(botonMenos, 2, 1);

    return miGrid;

}

From source file:cz.opendata.linked.lodcloud.loader.LoaderDialog.java

@Override
protected void buildDialogLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);//from  w  w  w.  j av a2  s  . c  o m
    mainLayout.setSizeUndefined();
    mainLayout.setWidth("100%");
    //mainLayout.setHeight("-1px");
    mainLayout.setMargin(false);
    //mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    tfRestApiUrl = new TextField();
    tfRestApiUrl.setWidth("100%");
    tfRestApiUrl.setCaption("CKAN Rest API URL");
    tfRestApiUrl.setInputPrompt("http://datahub.io/api/rest/dataset");
    mainLayout.addComponent(tfRestApiUrl);

    tfApiKey = new PasswordField();
    tfApiKey.setWidth("100%");
    tfApiKey.setCaption("CKAN API Key");
    tfApiKey.setDescription("CKAN API Key");
    tfApiKey.setInputPrompt("00000000-0000-0000-0000-000000000000");
    mainLayout.addComponent(tfApiKey);

    tfDatasetID = new TextField();
    tfDatasetID.setImmediate(true);
    tfDatasetID.setWidth("100%");
    tfDatasetID.setTextChangeEventMode(TextChangeEventMode.EAGER);
    tfDatasetID.setCaption("Dataset ID");
    tfDatasetID.setDescription("CKAN Dataset Name used in CKAN Dataset URL");
    tfDatasetID.setInputPrompt("cz-test");
    tfDatasetID.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -8684376114117545707L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            String url = "http://datahub.io/api/rest/dataset/" + tfDatasetID.getValue();
            lblRestApiUrl.setValue("<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>");
        }
    });
    mainLayout.addComponent(tfDatasetID);

    lblRestApiUrl = new Label();
    lblRestApiUrl.setContentMode(ContentMode.HTML);
    mainLayout.addComponent(lblRestApiUrl);

    tfOwnerOrg = new TextField();
    tfOwnerOrg.setWidth("100%");
    tfOwnerOrg.setCaption("Owner CKAN organization ID");
    tfOwnerOrg.setInputPrompt("00000000-0000-0000-0000-000000000000");
    mainLayout.addComponent(tfOwnerOrg);

    tfShortName = new TextField();
    tfShortName.setWidth("100%");
    tfShortName.setCaption("Dataset short name - for LOD cloud circle label");
    tfShortName.setInputPrompt("CZ IC");
    mainLayout.addComponent(tfShortName);

    cbTopic = new ComboBox();
    cbTopic.setWidth("100%");
    cbTopic.setCaption("Topic");
    cbTopic.setDescription("Topic is used for coloring of the LOD cloud");
    for (LoaderConfig.Topics topic : LoaderConfig.Topics.values()) {
        cbTopic.addItem(topic);
    }
    cbTopic.setInvalidAllowed(false);
    cbTopic.setNullSelectionAllowed(false);
    cbTopic.setTextInputAllowed(false);
    mainLayout.addComponent(cbTopic);

    tfMaintainerName = new TextField();
    tfMaintainerName.setWidth("100%");
    tfMaintainerName.setCaption("Maintainer name");
    tfMaintainerName.setInputPrompt("Jakub Klmek");
    mainLayout.addComponent(tfMaintainerName);

    tfMaintainerEmail = new TextField();
    tfMaintainerEmail.setWidth("100%");
    tfMaintainerEmail.setCaption("Maintainer email");
    tfMaintainerEmail.setInputPrompt("klimek@opendata.cz");
    mainLayout.addComponent(tfMaintainerEmail);

    tfAuthorName = new TextField();
    tfAuthorName.setWidth("100%");
    tfAuthorName.setCaption("Author name");
    tfAuthorName.setInputPrompt("Jakub Klmek");
    mainLayout.addComponent(tfAuthorName);

    tfAuthorEmail = new TextField();
    tfAuthorEmail.setWidth("100%");
    tfAuthorEmail.setCaption("Author email");
    tfAuthorEmail.setInputPrompt("klimek@opendata.cz");
    mainLayout.addComponent(tfAuthorEmail);

    tfVersion = new TextField();
    tfVersion.setWidth("100%");
    tfVersion.setCaption("Version");
    tfVersion.setInputPrompt("2014-03-01");
    mainLayout.addComponent(tfVersion);

    chkGenerateVersion = new CheckBox();
    chkGenerateVersion.setCaption("Generate Version as current date");
    chkGenerateVersion.setImmediate(true);
    chkGenerateVersion.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 7348068985822592639L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            tfVersion.setEnabled(!chkGenerateVersion.getValue());
        }
    });
    mainLayout.addComponent(chkGenerateVersion);

    cbLicense = new ComboBox();
    cbLicense.setWidth("100%");
    cbLicense.setCaption("License");
    cbLicense.setDescription("License displayed in CKAN");
    for (LoaderConfig.Licenses license : LoaderConfig.Licenses.values()) {
        cbLicense.addItem(license);
    }
    cbLicense.setImmediate(true);
    cbLicense.setInvalidAllowed(false);
    cbLicense.setTextInputAllowed(false);
    cbLicense.setNullSelectionAllowed(false);
    cbLicense.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -5553056221069512526L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            LoaderConfig.Licenses l = (Licenses) cbLicense.getValue();
            boolean enabled = false;
            enabled = enabled || l == LoaderConfig.Licenses.otherat;
            enabled = enabled || l == LoaderConfig.Licenses.otherclosed;
            enabled = enabled || l == LoaderConfig.Licenses.othernc;
            enabled = enabled || l == LoaderConfig.Licenses.otheropen;
            enabled = enabled || l == LoaderConfig.Licenses.otherpd;
        }
    });

    mainLayout.addComponent(cbLicense);

    tfSPARQLName = new TextField();
    tfSPARQLName.setWidth("100%");
    tfSPARQLName.setCaption("SPARQL Endpoint name");
    tfSPARQLName.setInputPrompt("Opendata.cz SPARQL Endpoint");
    mainLayout.addComponent(tfSPARQLName);

    tfSPARQLDescription = new TextField();
    tfSPARQLDescription.setWidth("100%");
    tfSPARQLDescription.setCaption("SPARQL Endpoint description");
    tfSPARQLDescription.setInputPrompt("Running Virtuoso 7");
    mainLayout.addComponent(tfSPARQLDescription);

    tfNamespace = new TextField();
    tfNamespace.setWidth("100%");
    tfNamespace.setCaption("RDF namespace");
    tfNamespace.setInputPrompt("http://linked.opendata.cz/resource/");
    mainLayout.addComponent(tfNamespace);

    lsLicenseMetadataTag = new ListSelect();
    lsLicenseMetadataTag.setWidth("100%");
    lsLicenseMetadataTag.setCaption("License metadata");
    lsLicenseMetadataTag.setDescription("Switches between license-metadata and no-license-metadata tags");
    for (LoaderConfig.LicenseMetadataTags lmdTag : LoaderConfig.LicenseMetadataTags.values()) {
        lsLicenseMetadataTag.addItem(lmdTag);
    }
    lsLicenseMetadataTag.setNewItemsAllowed(false);
    lsLicenseMetadataTag.setMultiSelect(false);
    lsLicenseMetadataTag.setNullSelectionAllowed(false);
    lsLicenseMetadataTag.setRows(LoaderConfig.LicenseMetadataTags.values().length);
    mainLayout.addComponent(lsLicenseMetadataTag);

    lsProvenanceMetadataTag = new ListSelect();
    lsProvenanceMetadataTag.setWidth("100%");
    lsProvenanceMetadataTag.setCaption("Provenance metadata");
    lsProvenanceMetadataTag
            .setDescription("Switches between provenance-metadata and no-provenance-metadata tags");
    for (LoaderConfig.ProvenanceMetadataTags pmdTag : LoaderConfig.ProvenanceMetadataTags.values()) {
        lsProvenanceMetadataTag.addItem(pmdTag);
    }
    lsProvenanceMetadataTag.setNewItemsAllowed(false);
    lsProvenanceMetadataTag.setMultiSelect(false);
    lsProvenanceMetadataTag.setNullSelectionAllowed(false);
    lsProvenanceMetadataTag.setRows(LoaderConfig.ProvenanceMetadataTags.values().length);
    mainLayout.addComponent(lsProvenanceMetadataTag);

    lsPublishedTag = new ListSelect();
    lsPublishedTag.setWidth("100%");
    lsPublishedTag.setCaption("Publised by");
    lsPublishedTag.setDescription("Switches between published-by-producer and published-by-third-party tags");
    for (LoaderConfig.PublishedTags pTag : LoaderConfig.PublishedTags.values()) {
        lsPublishedTag.addItem(pTag);
    }
    lsPublishedTag.setNewItemsAllowed(false);
    lsPublishedTag.setMultiSelect(false);
    lsPublishedTag.setNullSelectionAllowed(false);
    lsPublishedTag.setRows(LoaderConfig.PublishedTags.values().length);
    mainLayout.addComponent(lsPublishedTag);

    lsVocabTag = new ListSelect();
    lsVocabTag.setWidth("100%");
    lsVocabTag.setCaption("Proprietary vocabulary");
    lsVocabTag.setDescription("Switches among no-proprietary-vocab deref-vocab and no-deref-vocab tags");
    for (LoaderConfig.VocabTags vTag : LoaderConfig.VocabTags.values()) {
        lsVocabTag.addItem(vTag);
    }
    lsVocabTag.setNewItemsAllowed(false);
    lsVocabTag.setImmediate(true);
    lsVocabTag.setMultiSelect(false);
    lsVocabTag.setNullSelectionAllowed(false);
    lsVocabTag.setRows(LoaderConfig.VocabTags.values().length);

    mainLayout.addComponent(lsVocabTag);

    lsVocabMappingsTag = new ListSelect();
    lsVocabMappingsTag.setWidth("100%");
    lsVocabMappingsTag.setCaption("Vocabulary mapping");
    lsVocabMappingsTag.setDescription(
            "Only valid when using proprietary vocabulary. Switches between vocab-mappings and no-vocab-mappings tags");
    for (LoaderConfig.VocabMappingsTags vmTag : LoaderConfig.VocabMappingsTags.values()) {
        lsVocabMappingsTag.addItem(vmTag);
    }
    lsVocabMappingsTag.setNewItemsAllowed(false);
    lsVocabMappingsTag.setMultiSelect(false);
    lsVocabMappingsTag.setNullSelectionAllowed(false);
    lsVocabMappingsTag.setRows(LoaderConfig.VocabMappingsTags.values().length);
    mainLayout.addComponent(lsVocabMappingsTag);

    lsAdditionalTags = new ListSelect();
    lsAdditionalTags.setRows(4);
    lsAdditionalTags.setWidth("100%");
    lsAdditionalTags.setCaption("Additional CKAN tags");
    lsAdditionalTags.setDescription("Custom CKAN tags in addition to the ones required for the LODCloud");
    lsAdditionalTags.setNewItemsAllowed(true);
    lsAdditionalTags.setNullSelectionAllowed(false);
    lsAdditionalTags.setMultiSelect(true);
    mainLayout.addComponent(lsAdditionalTags);

    chkLodcloudNolinks = new CheckBox();
    chkLodcloudNolinks.setCaption("Data set has no external RDF links to other datasets.");
    mainLayout.addComponent(chkLodcloudNolinks);

    chkLodcloudUnconnected = new CheckBox();
    chkLodcloudUnconnected.setCaption("Data set has no external RDF links to or from other datasets.");
    mainLayout.addComponent(chkLodcloudUnconnected);

    chkLodcloudNeedsFixing = new CheckBox();
    chkLodcloudNeedsFixing.setCaption("The dataset is currently broken.");
    mainLayout.addComponent(chkLodcloudNeedsFixing);

    chkLodcloudNeedsInfo = new CheckBox();
    chkLodcloudNeedsInfo
            .setCaption("The data provider or data set homepage do not provide mininum information.");
    mainLayout.addComponent(chkLodcloudNeedsInfo);

    chkLimitedSparql = new CheckBox();
    chkLimitedSparql.setCaption("Indicates whether the SPARQL endpoint is not serving the whole data set.");
    mainLayout.addComponent(chkLimitedSparql);

    lsVocabularies = new ListSelect();
    lsVocabularies.setRows(4);
    lsVocabularies.setWidth("100%");
    lsVocabularies.setCaption("Standard prefixes of vocabularies used");
    lsVocabularies.setDescription("Tags the dataset with used vocabulary prefixes. Lookup: http://prefix.cc");
    lsVocabularies.setNewItemsAllowed(true);
    lsVocabularies.setNullSelectionAllowed(false);
    lsVocabularies.setMultiSelect(true);
    mainLayout.addComponent(lsVocabularies);

    gtLinkCounts = new ComponentTable<LoaderConfig.LinkCount>(LoaderConfig.LinkCount.class,
            new ComponentTable.ColumnInfo("targetDataset", "Target CKAN dataset name", null, 0.4f),
            new ComponentTable.ColumnInfo("linkCount", "Link count", null, 0.1f));

    gtLinkCounts.setPolicy(new ComponentTable.Policy<LoaderConfig.LinkCount>() {

        @Override
        public boolean isSet(LoaderConfig.LinkCount value) {
            return !value.getTargetDataset().isEmpty();
        }

    });
    mainLayout.addComponent(gtLinkCounts);

    gtMappingFiles = new ComponentTable<LoaderConfig.MappingFile>(LoaderConfig.MappingFile.class,
            new ComponentTable.ColumnInfo("mappingFormat", "Mapping format", null, 0.1f),
            new ComponentTable.ColumnInfo("mappingFile", "Link to mapping file", null, 0.4f));

    gtMappingFiles.setPolicy(new ComponentTable.Policy<LoaderConfig.MappingFile>() {

        @Override
        public boolean isSet(LoaderConfig.MappingFile value) {
            return !value.getMappingFile().isEmpty();
        }

    });
    mainLayout.addComponent(gtMappingFiles);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.setContent(mainLayout);
    setCompositionRoot(panel);
}

From source file:cz.opendata.linked.metadata.form.ExtractorDialog.java

private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(true);//from w ww. j  a  v a  2 s.  com
    mainLayout.setWidth("100%");
    mainLayout.setHeight(null);
    mainLayout.setMargin(false);
    //mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    tfDatasetUri = new TextField();
    tfDatasetUri.setCaption("Dataset URI:");
    tfDatasetUri.setWidth("100%");
    mainLayout.addComponent(tfDatasetUri);

    tfDistributionUri = new TextField();
    tfDistributionUri.setCaption("Distribution URI:");
    tfDistributionUri.setWidth("100%");
    mainLayout.addComponent(tfDistributionUri);

    tfDataDumpUrl = new TextField();
    tfDataDumpUrl.setCaption("Data dump URL:");
    tfDataDumpUrl.setWidth("100%");
    mainLayout.addComponent(tfDataDumpUrl);

    cbMime = new ComboBox();
    cbMime.setCaption("Media Type:");
    cbMime.setNewItemsAllowed(false);
    cbMime.setNullSelectionAllowed(false);
    cbMime.setWidth("100%");
    for (String u : mimes)
        cbMime.addItem(u);
    mainLayout.addComponent(cbMime);

    tfSparqlEndpointUrl = new TextField();
    tfSparqlEndpointUrl.setCaption("Sparql Endpoint URI:");
    tfSparqlEndpointUrl.setWidth("100%");
    mainLayout.addComponent(tfSparqlEndpointUrl);

    tfContactPoint = new TextField();
    tfContactPoint.setCaption("Contact Point URL:");
    tfContactPoint.setWidth("100%");
    mainLayout.addComponent(tfContactPoint);

    tfTitleCs = new TextField();
    tfTitleCs.setCaption("Title (cs):");
    tfTitleCs.setWidth("100%");
    mainLayout.addComponent(tfTitleCs);

    tfTitleEn = new TextField();
    tfTitleEn.setCaption("Title (en):");
    tfTitleEn.setWidth("100%");
    mainLayout.addComponent(tfTitleEn);

    tfDescCs = new TextField();
    tfDescCs.setCaption("Description (cs):");
    tfDescCs.setWidth("100%");
    mainLayout.addComponent(tfDescCs);

    tfDescEn = new TextField();
    tfDescEn.setCaption("Description (en):");
    tfDescEn.setWidth("100%");
    mainLayout.addComponent(tfDescEn);

    chkQb = new CheckBox();
    chkQb.setCaption("Dataset is RDF Data Cube");
    chkQb.setWidth("100%");
    mainLayout.addComponent(chkQb);

    dfModified = new DateField();
    dfModified.setCaption("Modified:");
    dfModified.setWidth("100%");
    dfModified.setResolution(Resolution.DAY);
    mainLayout.addComponent(dfModified);

    chkNow = new CheckBox();
    chkNow.setCaption("Always use current date instead");
    chkNow.setWidth("100%");
    mainLayout.addComponent(chkNow);

    cbPeriodicity = new ComboBox();
    cbPeriodicity.setCaption("Periodicity:");
    cbPeriodicity.setNewItemsAllowed(false);
    cbPeriodicity.setNullSelectionAllowed(false);
    cbPeriodicity.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
    cbPeriodicity.setWidth("100%");
    for (URLandCaption u : periodicities) {
        cbPeriodicity.addItem(u.url.toString());
        cbPeriodicity.setItemCaption(u.url.toString(), u.caption);
    }
    mainLayout.addComponent(cbPeriodicity);

    tcsLicenses = new TwinColSelect();
    tcsLicenses.setWidth("97%");
    tcsLicenses.setNewItemsAllowed(true);
    tcsLicenses.setLeftColumnCaption("Available licenses");
    tcsLicenses.setRightColumnCaption("Selected licenses");
    mainLayout.addComponent(tcsLicenses);

    tcsExamples = new TwinColSelect();
    tcsExamples.setWidth("97%");
    tcsExamples.setNewItemsAllowed(true);
    tcsExamples.setLeftColumnCaption("Available example resources");
    tcsExamples.setRightColumnCaption("Selected example resources");
    mainLayout.addComponent(tcsExamples);

    tcsSources = new TwinColSelect();
    tcsSources.setWidth("97%");
    tcsSources.setNewItemsAllowed(true);
    tcsSources.setLeftColumnCaption("Available sources");
    tcsSources.setRightColumnCaption("Selected sources");
    mainLayout.addComponent(tcsSources);

    tcsKeywords = new TwinColSelect();
    tcsKeywords.setWidth("97%");
    tcsKeywords.setNewItemsAllowed(true);
    tcsKeywords.setLeftColumnCaption("Available keywords");
    tcsKeywords.setRightColumnCaption("Selected keywords");
    mainLayout.addComponent(tcsKeywords);

    tcsThemes = new TwinColSelect();
    tcsThemes.setWidth("97%");
    tcsThemes.setNewItemsAllowed(true);
    tcsThemes.setLeftColumnCaption("Available themes");
    tcsThemes.setRightColumnCaption("Selected themes");
    mainLayout.addComponent(tcsThemes);

    tcsLanguages = new TwinColSelect();
    tcsLanguages.setWidth("97%");
    tcsLanguages.setLeftColumnCaption("Available languages");
    tcsLanguages.setRightColumnCaption("Selected languages");
    mainLayout.addComponent(tcsLanguages);

    tcsAuthors = new TwinColSelect();
    tcsAuthors.setWidth("97%");
    tcsAuthors.setNewItemsAllowed(true);
    tcsAuthors.setLeftColumnCaption("Available authors");
    tcsAuthors.setRightColumnCaption("Selected authors");
    mainLayout.addComponent(tcsAuthors);

    tcsPublishers = new TwinColSelect();
    tcsPublishers.setWidth("97%");
    tcsPublishers.setNewItemsAllowed(true);
    tcsPublishers.setLeftColumnCaption("Available publishers");
    tcsPublishers.setRightColumnCaption("Selected publishers");
    mainLayout.addComponent(tcsPublishers);

    return mainLayout;
}

From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPostsFilter.java

/**
 * Constructor// w  w w .j av  a  2 s  . c o m
 *
 * @param postsWrapper postsWrapper reference
 * @param postPaginator postPaginator reference
 */
public ComponentPostsFilter(VerticalLayout postsWrapper, ComponentPostPaginator postPaginator) {
    this.postsWrapper = postsWrapper;

    filterBy = new ComboBox();
    filterBy.setNullSelectionAllowed(false);

    filter = new ComboBox();
    filter.setFilteringMode(FilteringMode.CONTAINS);

    filter.setNullSelectionAllowed(false);
    this.addComponent(filterBy);
    this.addComponent(filter);

    this.setSpacing(true);
    this.postPaginator = postPaginator;
}

From source file:cz.zcu.pia.social.network.frontend.components.profile.friends.ComponentFriends.java

/**
 * Constructor/*from  w w w  .  j av a 2 s. com*/
 */
public ComponentFriends() {
    filter = new ComboBox();
    filter.setNullSelectionAllowed(false);
    table = new Table();
    table.setWidth(400, Unit.PIXELS);
    table.setPageLength(10);
}

From source file:cz.zcu.pia.social.network.helpers.Visibility.java

/**
 * Gets visibility combobox/*from www  .  ja  va  2 s . c  o  m*/
 * @return visibility combobox
 */
public ComboBox getVisibilityComboBox() {
    ComboBox cb = new ComboBox();
    cb.addItem(this.getPublicValue());
    cb.addItem(this.getFriendsValue());
    cb.setValue(this.getPublicValue());
    cb.setNullSelectionAllowed(false);
    cb.setFilteringMode(FilteringMode.OFF);
    cb.setDescription(this.getPublicValue());
    return cb;
}

From source file:de.decidr.ui.view.SearchPanel.java

License:Apache License

/**
 * This method initializes the components of the {@link SearchPanel}
 * component.//from w w  w  .  j a v a2s.  c om
 */
@SuppressWarnings("serial")
private void init(Table table) {
    searchHorizontalLayout = new HorizontalLayout();

    searchTextField = new SuperImmediateTextField();
    searchTextField.setInputPrompt("Enter search term");
    searchTextField.setImmediate(true);
    searchTextField.addListener(this);
    searchTextField.addListener(new KeyPressListener() {
        @Override
        public void keyPressed(KeyPressEvent event) {
            valueChange(null);
        }
    });

    searchModeSelector = new ComboBox();

    searchAction = new SearchAction(table, searchTextField, searchModeSelector);
    //        searchButton = new Button("Search", searchAction);

    /* Set up combo box so that its items have the table's
     * column property ids as index and the column name as caption.
     */
    String[] headers = table.getColumnHeaders();
    Object[] properties = table.getVisibleColumns();
    for (int i = 0; i < headers.length; i++) {
        searchModeSelector.addItem(properties[i]);
        searchModeSelector.setItemCaption(properties[i], headers[i]);
    }
    searchModeSelector.setNullSelectionAllowed(false);
    searchModeSelector.setValue(properties[0]);
    searchModeSelector.setImmediate(true);
    searchModeSelector.addListener(this);

    addComponent(searchHorizontalLayout);

    searchHorizontalLayout.setSpacing(true);
    searchHorizontalLayout.addComponent(searchTextField);
    //        searchHorizontalLayout.addComponent(searchButton);
    searchHorizontalLayout.addComponent(searchModeSelector);
}

From source file:de.fzi.fhemapi.view.vaadin.ui.DeviceDetailsPanel.java

License:Apache License

@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    VerticalLayout layout = new VerticalLayout();
    layout.setImmediate(false);//from ww w .java2s .  c  o  m
    layout.setWidth("100.0%");
    layout.setHeight("-1");
    layout.setMargin(false);

    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setImmediate(false);
    titleLayout.setWidth("-1");
    titleLayout.setHeight("50");
    titleLayout.setMargin(false);
    layout.addComponent(titleLayout);
    layout.setComponentAlignment(titleLayout, Alignment.TOP_CENTER);

    // deviceTitle
    deviceTitle = new TextField();
    deviceTitle.setImmediate(true);
    deviceTitle.setWidth("100%");
    deviceTitle.setHeight("-1px");
    deviceTitle.setValue(device.getName());
    deviceTitle.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (((String) event.getProperty().getValue()).length() > 1) {
                device.rename((String) event.getProperty().getValue());
                parent.reloadTree();
            }
        }
    });
    titleLayout.addComponent(deviceTitle);
    titleLayout.setComponentAlignment(deviceTitle, Alignment.TOP_CENTER);

    ComboBox combobox = new ComboBox();
    String[] classes = DeviceFactory.getAvailableDevicetypes();
    for (String name : classes) {
        combobox.addItem(name);
    }
    combobox.select(device.getClass().getSimpleName());
    combobox.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            setDeviceType((String) event.getProperty().getValue());
        }
    });
    combobox.setImmediate(true);

    deviceTypeHoriLayout = UIHelper.buildAttributePanel("Device Type", combobox);
    layout.addComponent(deviceTypeHoriLayout);
    layout.setComponentAlignment(deviceTypeHoriLayout, Alignment.TOP_CENTER);
    layout.setExpandRatio(deviceTypeHoriLayout, 1);

    ioDevHoriLayout = buildAttributePanel("IO Device", device.getType());
    layout.addComponent(ioDevHoriLayout);
    layout.setComponentAlignment(ioDevHoriLayout, Alignment.TOP_CENTER);
    layout.setExpandRatio(ioDevHoriLayout, 1);

    addDeviceDetails(DevicePanelManager.getDeviceDetails(device, this), layout);

    return layout;
}

From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java

License:Apache License

@AutoGenerated
private VerticalLayout buildMainLayout() {
    VerticalLayout layout = new VerticalLayout();

    HorizontalLayout titleLabel = getTitlePanel();
    layout.addComponent(titleLabel);/* www . ja  v  a  2  s .  c  o m*/
    layout.setComponentAlignment(titleLabel, Alignment.TOP_CENTER);

    nameField = new TextField();
    HorizontalLayout nameLayout = UIHelper.buildAttributePanel("Name", nameField);
    layout.addComponent(nameLayout);
    layout.setComponentAlignment(nameLayout, Alignment.TOP_CENTER);

    typeComboBox = new ComboBox();
    for (String name : DeviceFactory.getAvailableDevicetypes()) {
        typeComboBox.addItem(name);
    }

    HorizontalLayout typelayout = UIHelper.buildAttributePanel("Typ", typeComboBox);
    layout.addComponent(typelayout);
    layout.setComponentAlignment(typelayout, Alignment.TOP_CENTER);

    parameterType = new ComboBox();
    String[] manufacturers = ManufacturerManager.getClassNames();
    for (String name : manufacturers) {
        parameterType.addItem(name);
    }

    parameterType.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            fillManufacturerDetails((String) event.getProperty().getValue());
        }
    });
    parameterType.setImmediate(true);

    HorizontalLayout parameterTypeLayout = UIHelper.buildAttributePanel("Hersteller", parameterType);
    layout.addComponent(parameterTypeLayout);
    layout.setComponentAlignment(parameterTypeLayout, Alignment.TOP_CENTER);

    manufacturerLayout = new VerticalLayout();
    layout.addComponent(manufacturerLayout);
    layout.setComponentAlignment(manufacturerLayout, Alignment.TOP_CENTER);

    Button saveButton = new Button("Speichern");
    layout.addComponent(saveButton);
    layout.setComponentAlignment(saveButton, Alignment.TOP_CENTER);
    saveButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (allParametersMatches()) {
                String[] parameters = new String[currentManufacturerTextFields.size() + 1];
                parameters[0] = (String) nameField.getValue();
                for (int i = 1; i < parameters.length; i++) {
                    parameters[i] = (String) currentManufacturerTextFields.get(i - 1).getValue();
                }

                ActuatorParameters params = ParameterExtractor
                        .getJavaParameters((String) parameterType.getValue(), parameters);

                MessageResponse response = parent.server.getDeviceManager().createNewActuatorAsMessage(params);
                getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION);
                parent.server.getDeviceManager().update();
                parent.server.getDeviceManager().getDevice(params.get(FHEMParameters.NAME))
                        .setDeviceType((String) typeComboBox.getValue());
                parent.reloadTree();
            }
        }
    });
    return layout;
}