Example usage for com.vaadin.ui ListSelect ListSelect

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

Introduction

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

Prototype

public ListSelect() 

Source Link

Document

Constructs a new ListSelect.

Usage

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.ja  v 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.unifiedviews.dpus.datasetMetadata.DatasetMetadataVaadinDialog.java

License:Creative Commons License

@Override
protected void buildDialogLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(true);/*w ww .  ja  v a 2 s  . c  om*/
    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.setInputPrompt("http://data.mydomain.com/resource/dataset/mydataset");
    tfDatasetUri.setWidth("100%");
    mainLayout.addComponent(tfDatasetUri);

    tfLanguage = new TextField();
    tfLanguage.setCaption("Original language (RDF language tag, e.g. cs):");
    tfLanguage.setInputPrompt("cs|en|sk|it");
    tfLanguage.setWidth("100%");
    mainLayout.addComponent(tfLanguage);

    tfTitle = new TextField();
    tfTitle.setCaption("Dataset title original language:");
    tfTitle.setInputPrompt("My dataset");
    tfTitle.setWidth("100%");
    mainLayout.addComponent(tfTitle);

    tfTitleEn = new TextField();
    tfTitleEn.setCaption("Dataset title in English:");
    tfTitleEn.setInputPrompt("My dataset");
    tfTitleEn.setWidth("100%");
    mainLayout.addComponent(tfTitleEn);

    tfDesc = new TextField();
    tfDesc.setCaption("Description in original language:");
    tfDesc.setInputPrompt("Longer description in original language");
    tfDesc.setWidth("100%");
    mainLayout.addComponent(tfDesc);

    tfDescEn = new TextField();
    tfDescEn.setCaption("Description in English:");
    tfDescEn.setInputPrompt("Longer description in English");
    tfDescEn.setWidth("100%");
    mainLayout.addComponent(tfDescEn);

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

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

    chkNow = new CheckBox();
    chkNow.setCaption("Use current date as modified");
    chkNow.setWidth("100%");
    chkNow.setImmediate(true);
    chkNow.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

    tfIdentifier = new TextField();
    tfIdentifier.setCaption("Identifier:");
    tfIdentifier.setInputPrompt("CTIA_1");
    tfIdentifier.setWidth("100%");
    mainLayout.addComponent(tfIdentifier);

    lsKeywords_orig = new ListSelect();
    lsKeywords_orig.setWidth("100%");
    lsKeywords_orig.setNewItemsAllowed(true);
    lsKeywords_orig.setCaption("Keywords in original language");
    lsKeywords_orig.setMultiSelect(true);
    lsKeywords_orig.setRows(3);
    mainLayout.addComponent(lsKeywords_orig);

    lsKeywords_en = new ListSelect();
    lsKeywords_en.setWidth("100%");
    lsKeywords_en.setNewItemsAllowed(true);
    lsKeywords_en.setCaption("Keywords in English");
    lsKeywords_en.setMultiSelect(true);
    lsKeywords_en.setRows(3);
    mainLayout.addComponent(lsKeywords_en);

    lsLanguages = new ListSelect();
    lsLanguages.setWidth("100%");
    lsLanguages.setNewItemsAllowed(true);
    lsLanguages.setCaption("Languages");
    lsLanguages.setMultiSelect(true);
    lsLanguages.addItems(languages);
    lsLanguages.setRows(3);
    mainLayout.addComponent(lsLanguages);

    tfContactPoint = new TextField();
    tfContactPoint.setCaption("Contact point email:");
    tfContactPoint.setInputPrompt("contact@myorganization.com");
    tfContactPoint.setWidth("100%");
    mainLayout.addComponent(tfContactPoint);

    dfTemporalStart = new DateField();
    dfTemporalStart.setCaption("Temporal coverage start:");
    dfTemporalStart.setWidth("100%");
    dfTemporalStart.setResolution(Resolution.DAY);
    mainLayout.addComponent(dfTemporalStart);

    dfTemporalEnd = new DateField();
    dfTemporalEnd.setCaption("Temporal coverage end:");
    dfTemporalEnd.setWidth("100%");
    dfTemporalEnd.setResolution(Resolution.DAY);
    mainLayout.addComponent(dfTemporalEnd);

    tfSpatial = new TextField();
    tfSpatial.setCaption("Spatial coverage URI:");
    tfSpatial.setInputPrompt("http://ruian.linked.opendata.cz/resource/adresni-mista/25958810");
    tfSpatial.setWidth("100%");
    mainLayout.addComponent(tfSpatial);

    tfPeriodicity = new TextField();
    tfPeriodicity.setCaption("Periodicity:");
    tfPeriodicity.setInputPrompt("R-P1Y");
    tfPeriodicity.setWidth("100%");
    mainLayout.addComponent(tfPeriodicity);

    tfSchema = new TextField();
    tfSchema.setCaption("Schema URL:");
    tfSchema.setInputPrompt("http://data.example.org/dataset/myschema");
    tfSchema.setWidth("100%");
    mainLayout.addComponent(tfSchema);

    tfLandingPage = new TextField();
    tfLandingPage.setCaption("Landing page URL:");
    tfLandingPage.setInputPrompt("http://data.example.org/dataset/mydataset");
    tfLandingPage.setWidth("100%");
    mainLayout.addComponent(tfLandingPage);

    lsLicenses = new ListSelect();
    lsLicenses.setWidth("100%");
    lsLicenses.setNewItemsAllowed(true);
    lsLicenses.setCaption("Licenses");
    lsLicenses.setMultiSelect(false);
    lsLicenses.setNullSelectionAllowed(false);
    lsLicenses.setRows(3);
    lsLicenses.addItems(licenses);
    mainLayout.addComponent(lsLicenses);

    lsSources = new ListSelect();
    lsSources.setWidth("100%");
    lsSources.setNewItemsAllowed(true);
    lsSources.setCaption("Sources");
    lsSources.setMultiSelect(true);
    lsSources.setRows(2);
    mainLayout.addComponent(lsSources);

    lsThemes = new ListSelect();
    lsThemes.setWidth("100%");
    lsThemes.setNewItemsAllowed(true);
    lsThemes.setCaption("Themes");
    lsThemes.setMultiSelect(true);
    lsThemes.setRows(3);
    mainLayout.addComponent(lsThemes);

    lsAuthors = new ListSelect();
    lsAuthors.setWidth("100%");
    lsAuthors.setNewItemsAllowed(true);
    lsAuthors.setCaption("Selected authors");
    lsAuthors.setMultiSelect(true);
    lsAuthors.setRows(2);
    mainLayout.addComponent(lsAuthors);

    lsPublishers = new ListSelect();
    lsPublishers.setWidth("100%");
    lsPublishers.setNewItemsAllowed(true);
    lsPublishers.setCaption("Publishers");
    lsPublishers.setMultiSelect(true);
    lsPublishers.addItems(publishers);
    lsPublishers.setRows(2);
    mainLayout.addComponent(lsPublishers);

    Panel p = new Panel();
    p.setSizeFull();
    p.setContent(mainLayout);

    setCompositionRoot(p);
}

From source file:cz.opendata.unifiedviews.dpus.distributionMetadata.DistributionMetadataVaadinDialog.java

License:Creative Commons License

@Override
protected void buildDialogLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(true);//from   ww w  .  j  a v a2s.co m
    mainLayout.setWidth("100%");
    mainLayout.setHeight(null);
    mainLayout.setMargin(false);
    //mainLayout.setSpacing(true);

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

    tfDownloadURL = new TextField();
    tfDownloadURL.setCaption("Download URL:");
    tfDownloadURL.setInputPrompt("http://data.mydomain.com/dumps/dataset.ttl");
    tfDownloadURL.setWidth("100%");
    mainLayout.addComponent(tfDownloadURL);

    tfMediaType = new TextField();
    tfMediaType.setCaption("Media (MIME) type:");
    tfMediaType.setInputPrompt("text/turtle|text/csv");
    tfMediaType.setWidth("100%");
    mainLayout.addComponent(tfMediaType);

    tfAccessURL = new TextField();
    tfAccessURL.setCaption("Access URL:");
    tfAccessURL.setInputPrompt("http://data.mydomain.com/dataset/dataset");
    tfAccessURL.setWidth("100%");
    mainLayout.addComponent(tfAccessURL);

    lsExampleResources = new ListSelect();
    lsExampleResources.setWidth("100%");
    lsExampleResources.setNewItemsAllowed(true);
    lsExampleResources.setCaption("Example resources");
    lsExampleResources.setMultiSelect(true);
    lsExampleResources.setRows(3);
    mainLayout.addComponent(lsExampleResources);

    tfSPARQLEndpointURL = new TextField();
    tfSPARQLEndpointURL.setCaption("SPARQL Endpoint URL:");
    tfSPARQLEndpointURL.setInputPrompt("http://linked.opendata.cz/sparql");
    tfSPARQLEndpointURL.setWidth("100%");
    mainLayout.addComponent(tfSPARQLEndpointURL);

    tfSchemaType = new TextField();
    tfSchemaType.setCaption("Schema MIME type:");
    tfSchemaType.setInputPrompt("text/csv");
    tfSchemaType.setWidth("100%");
    mainLayout.addComponent(tfSchemaType);

    chkSchemaFromInput = new CheckBox();
    chkSchemaFromInput.setCaption("Use schema from dataset");
    chkSchemaFromInput.setWidth("100%");
    chkSchemaFromInput.setImmediate(true);
    chkSchemaFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

    tfSchema = new TextField();
    tfSchema.setCaption("Schema URL:");
    tfSchema.setInputPrompt("http://data.example.org/dataset/myschema");
    tfSchema.setWidth("100%");
    mainLayout.addComponent(tfSchema);

    chkDatasetURIFromInput = new CheckBox();
    chkDatasetURIFromInput.setCaption("Get dataset URI from dataset");
    chkDatasetURIFromInput.setWidth("100%");
    chkDatasetURIFromInput.setImmediate(true);
    chkDatasetURIFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

    tfDatasetURI = new TextField();
    tfDatasetURI.setCaption("Dataset URI:");
    tfDatasetURI.setInputPrompt("http://data.mydomain.com/resource/dataset/mydataset");
    tfDatasetURI.setWidth("100%");
    mainLayout.addComponent(tfDatasetURI);

    chkGenerateDistroURIFromDataset = new CheckBox();
    chkGenerateDistroURIFromDataset.setCaption("Generate distribution URI from dataset (+\"/distribution\")");
    chkGenerateDistroURIFromDataset.setWidth("100%");
    chkGenerateDistroURIFromDataset.setImmediate(true);
    chkGenerateDistroURIFromDataset.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

    tfDistributionURI = new TextField();
    tfDistributionURI.setCaption("Distribution URI:");
    tfDistributionURI.setInputPrompt("http://data.mydomain.com/resource/dataset/mydataset/distribution/rdf");
    tfDistributionURI.setWidth("100%");
    mainLayout.addComponent(tfDistributionURI);

    chkLanguageFromInput = new CheckBox();
    chkLanguageFromInput.setCaption("Get original language from dataset");
    chkLanguageFromInput.setWidth("100%");
    chkLanguageFromInput.setImmediate(true);
    chkLanguageFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

    tfLanguage = new TextField();
    tfLanguage.setCaption("Original language (RDF language tag, e.g. cs):");
    tfLanguage.setInputPrompt("cs|en|sk|it");
    tfLanguage.setWidth("100%");
    mainLayout.addComponent(tfLanguage);

    chkTitleFromInput = new CheckBox();
    chkTitleFromInput.setCaption("Get title from dataset");
    chkTitleFromInput.setWidth("100%");
    chkTitleFromInput.setImmediate(true);
    chkTitleFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            tfTitle.setEnabled(!chkTitleFromInput.getValue());
            tfTitleEn.setEnabled(!chkTitleFromInput.getValue());
        }
    });
    mainLayout.addComponent(chkTitleFromInput);

    tfTitle = new TextField();
    tfTitle.setCaption("Dataset title in original language:");
    tfTitle.setInputPrompt("My dataset");
    tfTitle.setWidth("100%");
    mainLayout.addComponent(tfTitle);

    tfTitleEn = new TextField();
    tfTitleEn.setCaption("Dataset title in English:");
    tfTitleEn.setInputPrompt("My dataset");
    tfTitleEn.setWidth("100%");
    mainLayout.addComponent(tfTitleEn);

    chkDescriptionFromInput = new CheckBox();
    chkDescriptionFromInput.setCaption("Get description from dataset");
    chkDescriptionFromInput.setWidth("100%");
    chkDescriptionFromInput.setImmediate(true);
    chkDescriptionFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            tfDesc.setEnabled(!chkDescriptionFromInput.getValue());
            tfDescEn.setEnabled(!chkDescriptionFromInput.getValue());
        }
    });
    mainLayout.addComponent(chkDescriptionFromInput);

    tfDesc = new TextField();
    tfDesc.setCaption("Description in original language:");
    tfDesc.setInputPrompt("Longer description in original language");
    tfDesc.setWidth("100%");
    mainLayout.addComponent(tfDesc);

    tfDescEn = new TextField();
    tfDescEn.setCaption("Description in English:");
    tfDescEn.setInputPrompt("Longer description in English");
    tfDescEn.setWidth("100%");
    mainLayout.addComponent(tfDescEn);

    chkIssuedFromInput = new CheckBox();
    chkIssuedFromInput.setCaption("Use issued date from dataset");
    chkIssuedFromInput.setWidth("100%");
    chkIssuedFromInput.setImmediate(true);
    chkIssuedFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

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

    chkNow = new CheckBox();
    chkNow.setCaption("Use current date as modified");
    chkNow.setWidth("100%");
    chkNow.setImmediate(true);
    chkNow.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

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

    chkTemporalFromInput = new CheckBox();
    chkTemporalFromInput.setCaption("Use temporal coverage from dataset");
    chkTemporalFromInput.setWidth("100%");
    chkTemporalFromInput.setImmediate(true);
    chkTemporalFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            dfTemporalStart.setEnabled(!chkTemporalFromInput.getValue());
            dfTemporalEnd.setEnabled(!chkTemporalFromInput.getValue());
        }
    });
    mainLayout.addComponent(chkTemporalFromInput);

    dfTemporalStart = new DateField();
    dfTemporalStart.setCaption("Temporal coverage start:");
    dfTemporalStart.setWidth("100%");
    dfTemporalStart.setResolution(Resolution.DAY);
    mainLayout.addComponent(dfTemporalStart);

    dfTemporalEnd = new DateField();
    dfTemporalEnd.setCaption("Temporal coverage end:");
    dfTemporalEnd.setWidth("100%");
    dfTemporalEnd.setResolution(Resolution.DAY);
    mainLayout.addComponent(dfTemporalEnd);

    chkSpatialFromInput = new CheckBox();
    chkSpatialFromInput.setCaption("Use spatial coverage from dataset");
    chkSpatialFromInput.setWidth("100%");
    chkSpatialFromInput.setImmediate(true);
    chkSpatialFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

    tfSpatial = new TextField();
    tfSpatial.setCaption("Spatial coverage URI:");
    tfSpatial.setInputPrompt("http://ruian.linked.opendata.cz/resource/adresni-mista/25958810");
    tfSpatial.setWidth("100%");
    mainLayout.addComponent(tfSpatial);

    chkLicensesFromInput = new CheckBox();
    chkLicensesFromInput.setCaption("Use license from dataset");
    chkLicensesFromInput.setWidth("100%");
    chkLicensesFromInput.setImmediate(true);
    chkLicensesFromInput.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -6135328311357043784L;

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

    lsLicenses = new ListSelect();
    lsLicenses.setWidth("100%");
    lsLicenses.setNewItemsAllowed(true);
    lsLicenses.setCaption("License");
    lsLicenses.setMultiSelect(false);
    lsLicenses.setNullSelectionAllowed(false);
    lsLicenses.setRows(3);
    lsLicenses.addItems(licenses);
    mainLayout.addComponent(lsLicenses);

    Panel p = new Panel();
    p.setSizeFull();
    p.setContent(mainLayout);

    setCompositionRoot(p);
}

From source file:de.escidoc.admintool.view.context.ContextAddView.java

License:Open Source License

private void addOrgUnitList() {
    orgUnitList = new ListSelect();
    orgUnitList.setRows(5);/*w  w w. j a v  a  2 s. c  om*/
    orgUnitList.setWidth("350px");
    orgUnitList.setNullSelectionAllowed(true);
    orgUnitList.setMultiSelect(true);
    orgUnitList.setImmediate(false);

    addOrgUnitToTheList.using(orgUnitList);
}

From source file:de.escidoc.admintool.view.context.ContextEditForm.java

License:Open Source License

private void createOrgUnitList() {
    orgUnitList = new ListSelect();
    orgUnitList.setRows(5);//from  w  w w . j a  v a  2  s  .c  om
    orgUnitList.setWidth(ViewConstants.FIELD_WIDTH);
    orgUnitList.setNullSelectionAllowed(true);
    orgUnitList.setMultiSelect(true);
    orgUnitList.setWriteThrough(false);
}

From source file:de.escidoc.admintool.view.util.LayoutHelper.java

License:Open Source License

/**
 * @param className/*  w  w  w.  j a  va 2 s .com*/
 * @param item
 * @param readOnly
 * @param propertyName
 * @return AbstractComponent
 */
public static synchronized AbstractComponent createListElement(final String className, final POJOItem<?> item,
        final boolean readOnly, final String propertyName) {
    final AbstractComponent comp = new ListSelect();
    ((ListSelect) comp).setReadOnly(readOnly);
    ((ListSelect) comp).setPropertyDataSource(item.getItemProperty(propertyName));
    ((ListSelect) comp).setWriteThrough(false);
    List<Field> attachedFields = ATTACHED_FIELD_MAP.get(className);
    if (attachedFields == null) {
        attachedFields = new ArrayList<Field>();
        ATTACHED_FIELD_MAP.put(className, attachedFields);
    }
    attachedFields.add((Field) comp);
    return comp;
}

From source file:de.uni_leipzig.informatik.pcai042.boa.gui.goldstandard.GoldstandardGUI.java

License:Open Source License

@SuppressWarnings("deprecation")
@AutoGenerated/*from   ww  w  .jav  a  2 s .c om*/
private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setCaption("close XML");
    mainLayout.setImmediate(false);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

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

    // buttonNext
    buttonNext = new Button();
    buttonNext.setCaption("next");
    buttonNext.setImmediate(true);
    buttonNext.setWidth("-1px");
    buttonNext.setHeight("-1px");
    mainLayout.addComponent(buttonNext, "top:0.0px;left:81.0px;");

    // buttonDiscard
    buttonDiscard = new Button();
    buttonDiscard.setCaption("discard");
    buttonDiscard.setImmediate(true);
    buttonDiscard.setWidth("-1px");
    buttonDiscard.setHeight("-1px");
    mainLayout.addComponent(buttonDiscard, "top:0.0px;left:431.0px;");

    // buttonAddAnno
    buttonAddAnno = new Button();
    buttonAddAnno.setCaption("add");
    buttonAddAnno.setImmediate(true);
    buttonAddAnno.setWidth("-1px");
    buttonAddAnno.setHeight("-1px");
    mainLayout.addComponent(buttonAddAnno, "top:180.0px;left:160.0px;");

    // buttonDelAnno
    buttonDelAnno = new Button();
    buttonDelAnno.setCaption("delete");
    buttonDelAnno.setImmediate(true);
    buttonDelAnno.setWidth("-1px");
    buttonDelAnno.setHeight("-1px");
    mainLayout.addComponent(buttonDelAnno, "top:180.0px;left:439.0px;");

    // comboBoxTypes
    comboBoxTypes = new ComboBox();
    comboBoxTypes.setImmediate(false);
    comboBoxTypes.setWidth("210px");
    comboBoxTypes.setHeight("-1px");
    mainLayout.addComponent(comboBoxTypes, "top:269.0px;left:0.0px;");

    // textFieldLabel
    textFieldLabel = new TextField();
    textFieldLabel.setImmediate(false);
    textFieldLabel.setWidth("210px");
    textFieldLabel.setHeight("-1px");
    textFieldLabel.setSecret(false);
    mainLayout.addComponent(textFieldLabel, "top:206.0px;left:0.0px;");

    // labelLabel
    labelLabel = new Label();
    labelLabel.setImmediate(false);
    labelLabel.setWidth("-1px");
    labelLabel.setHeight("-1px");
    labelLabel.setValue("Label:");
    mainLayout.addComponent(labelLabel, "top:182.0px;left:1.0px;");

    // labelType
    labelType = new Label();
    labelType.setImmediate(false);
    labelType.setWidth("-1px");
    labelType.setHeight("-1px");
    labelType.setValue("Type:");
    mainLayout.addComponent(labelType, "top:242.0px;left:0.0px;");

    // panelTokens
    panelTokens = buildPanelTokens();
    mainLayout.addComponent(panelTokens, "top:30.0px;left:0.0px;");

    // listSelectAnnotations
    listSelectAnnotations = new ListSelect();
    listSelectAnnotations.setImmediate(false);
    listSelectAnnotations.setWidth("271px");
    listSelectAnnotations.setHeight("87px");
    mainLayout.addComponent(listSelectAnnotations, "top:206.0px;left:230.0px;");

    // labelSentence
    labelSentence = new Label();
    labelSentence.setImmediate(false);
    labelSentence.setWidth("-1px");
    labelSentence.setHeight("-1px");
    labelSentence.setValue("Sentence:");
    mainLayout.addComponent(labelSentence, "top:2.0px;left:0.0px;");

    // labelAnnotations
    labelAnnotations = new Label();
    labelAnnotations.setImmediate(false);
    labelAnnotations.setWidth("-1px");
    labelAnnotations.setHeight("-1px");
    labelAnnotations.setValue("Annotations:");
    mainLayout.addComponent(labelAnnotations, "top:182.0px;left:230.0px;");

    return mainLayout;
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.AddAuthorDialog.java

License:Open Source License

@SuppressWarnings("serial")
public AddAuthorDialog(Collection<User> currentlySelectedNames, boolean removeExisting) {
    setCaption("Invite Players to be Authors");
    setClosable(false); // no x in corner
    setWidth("300px");
    setHeight("400px");
    VerticalLayout mainVL = new VerticalLayout();
    mainVL.setSpacing(true);/*www  . j  a va  2 s .  co m*/
    mainVL.setMargin(true);
    mainVL.setSizeFull();
    setContent(mainVL);

    mainVL.addComponent(infoLabel);
    userList = new ListSelect();
    userList.addStyleName("m-greyborder");

    List<QuickUser> qlis = AppMaster.instance().getMcache().getUsersQuickList();
    BeanItemContainer<QuickUser> beanContainerQ = new BeanItemContainer<QuickUser>(QuickUser.class, qlis);

    userList.setContainerDataSource(beanContainerQ);
    userList.setItemCaptionMode(ListSelect.ItemCaptionMode.PROPERTY); // works!
    userList.setItemCaptionPropertyId("uname");
    userList.setNewItemsAllowed(false);

    mainVL.addComponent(userList);
    userList.setSizeFull();
    mainVL.setExpandRatio(userList, 1.0f);
    userList.setRows(15);
    userList.setImmediate(true);
    setMultiSelect(true); //userList.setMultiSelect(true);
    userList.setNullSelectionAllowed(false);

    if (currentlySelectedNames != null)
        for (User selU : currentlySelectedNames) {
            Collection<?> all = userList.getItemIds();
            for (Object o : all) {
                QuickUser qu = (QuickUser) o;
                if (selU.getId() == qu.getId()) {
                    if (removeExisting)
                        userList.removeItem(o);
                    else
                        userList.select(o);
                    break;
                }
            }
        }

    buttHL = new HorizontalLayout();
    buttHL.setSpacing(true);
    mainVL.addComponent(buttHL);
    buttHL.setWidth("100%");
    Label spacer;
    buttHL.addComponent(spacer = new Label());
    spacer.setWidth("1px");
    buttHL.setExpandRatio(spacer, 1.0f);

    buttHL.addComponent(addButt = new Button("Select"));
    buttHL.addComponent(cancelButt = new Button("Cancel"));

    cancelButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            selected = null;
            addClicked = false;
            UI.getCurrent().removeWindow(AddAuthorDialog.this);//getParent().removeWindow(AddAuthorDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });
    addButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            selected = userList.getValue();

            addClicked = true;
            UI.getCurrent().removeWindow(AddAuthorDialog.this);//getParent().removeWindow(AddAuthorDialog.this);        
            if (closer != null)
                closer.windowClose(null);
        }
    });
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.InstallImageDialog.java

License:Open Source License

@SuppressWarnings("serial")
private InstallImageDialog(String topText, InstallImageResultListener lis, boolean showExisting,
        String nameFilter) {/*from w ww  .  java 2s. c om*/
    Object sessKey = HSess.checkInit();
    listener = lis;

    setCaption(showExisting ? "Choose Existing or Upload New Image" : "Upload New Image");
    setModal(true);
    setWidth("350px");
    VerticalLayout vl;

    VerticalLayout vLay = new VerticalLayout();
    setContent(vLay);
    vLay.setMargin(true);
    vLay.setSpacing(true);

    if (topText != null && topText.length() > 0) {
        HtmlLabel lab = new HtmlLabel(topText);
        lab.setWidth("100%");
        vLay.addComponent(lab);
    }

    if (showExisting) { // put the existing selector in the dialog

        Criteria crit = HSess.get().createCriteria(Media.class)
                .add(Restrictions.eq("source", Media.Source.DATABASE)).addOrder(Order.asc("url"));

        if (nameFilter != null)
            crit.add(Restrictions.like("handle", nameFilter, MatchMode.ANYWHERE));

        @SuppressWarnings({ "unchecked" })
        List<Media> mlis = crit.list();

        BeanItemContainer<Media> beanContainer = new BeanItemContainer<Media>(Media.class, mlis);

        vLay.addComponent(existingCB = new CheckBox("Choose from existing images", true));

        vLay.addComponent(vl = new VerticalLayout());
        vl.addStyleName("m-greyborder");
        vl.addStyleName("m-greybackground");
        vl.setMargin(true);
        vl.setSpacing(true);

        vl.addComponent(sel = new ListSelect());
        sel.setWidth("100%");
        sel.setNullSelectionAllowed(false);
        sel.setContainerDataSource(beanContainer);
        sel.setItemCaptionPropertyId("url");

        vl.addComponent(saveExistingButt = new NativeButton("Return selected image", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                HSess.init();
                mediaImage = new MediaImage((Media) sel.getValue(), null);
                doneHereTL();
                HSess.close();
            }
        }));
        vLay.addComponent(newCB = new CheckBox("Upload new image", false));
    }

    // Here for the file chooser
    vLay.addComponent(vl = new VerticalLayout());
    vl.addStyleName("m-greyborder");
    vl.addStyleName("m-greybackground");
    vl.setSpacing(true);
    vl.setMargin(true);

    ImgReceiver rec;
    uploadFileWidget = new Upload();// "Image name", rec = new ImgReceiver());
    uploadFileWidget.setReceiver(rec = new ImgReceiver());
    uploadFileWidget.setButtonCaption("Browse");
    uploadFileWidget.setImmediate(true);
    uploadFileWidget.addFailedListener(rec);
    uploadFileWidget.addFinishedListener(rec);
    uploadFileWidget.setEnabled(showExisting ? false : true);
    vl.addComponent(uploadFileWidget);
    vl.addComponent(fileNameTF = new TextField());
    fileNameTF.setWidth("100%");
    fileNameTF.setEnabled(showExisting ? false : true);
    fileNameTFState = false;
    HorizontalLayout hLay;
    vl.addComponent(hLay = new HorizontalLayout());
    hLay.setSpacing(true);
    hLay.addComponent(saveImageButt = new NativeButton("Save image with above name", rec));
    // hLay.addComponent(savedLab = new HtmlLabel("<i>saved</i>"));

    saveImageButt.setImmediate(true);
    saveImageButt.addClickListener(rec);
    saveImageButt.setEnabled(false);
    saveImageButtState = false;

    vLay.addComponent(new NativeButton("Close", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            HSess.init();
            doneHereTL();
            HSess.close();
        }
    }));

    if (showExisting) {
        existingCB.addValueChangeListener(new CheckBoxListener(existingCB));
        newCB.addValueChangeListener(new CheckBoxListener(newCB));
    }

    HSess.checkClose(sessKey);
}

From source file:fi.semantum.strategia.Utils.java

License:Open Source License

public static void saveCurrentState(final Main main) {

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/* w  w w .j  ava  2s  . co m*/

    HorizontalLayout hl1 = new HorizontalLayout();
    hl1.setSpacing(true);
    hl1.setWidth("100%");

    final Map<String, UIState> stateMap = new HashMap<String, UIState>();
    for (UIState s : main.account.uiStates)
        stateMap.put(s.name, s);

    final TextField tf = new TextField();

    final Button save = new Button("Tallenna nkym", new Button.ClickListener() {

        private static final long serialVersionUID = 2449606920686729881L;

        public void buttonClick(ClickEvent event) {

            if (!tf.isValid())
                return;

            String name = tf.getValue();

            Page.getCurrent().getJavaScript().execute("doSaveBrowserState('" + name + "');");

        }

    });

    tf.setWidth("100%");
    tf.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    tf.setCaption("Tallenna nykyinen nkym nimell:");
    tf.setValue("Uusi nkym");
    tf.setCursorPosition(tf.getValue().length());
    tf.setValidationVisible(true);
    tf.setInvalidCommitted(true);
    tf.setImmediate(true);
    tf.addTextChangeListener(new TextChangeListener() {

        private static final long serialVersionUID = -8274588731607481635L;

        @Override
        public void textChange(TextChangeEvent event) {
            tf.setValue(event.getText());
            try {
                tf.validate();
            } catch (InvalidValueException e) {
                save.setEnabled(false);
                return;
            }
            save.setEnabled(true);
        }

    });
    tf.addValidator(new Validator() {

        private static final long serialVersionUID = -4779239111120669168L;

        @Override
        public void validate(Object value) throws InvalidValueException {
            String s = (String) value;
            if (s.isEmpty())
                throw new InvalidValueException("Nimi ei saa olla tyhj");
            if (stateMap.containsKey(s))
                throw new InvalidValueException("Nimi on jo kytss");
        }

    });
    if (!tf.isValid())
        save.setEnabled(false);

    hl1.addComponent(tf);
    hl1.setExpandRatio(tf, 1.0f);

    hl1.addComponent(save);
    hl1.setExpandRatio(save, 0.0f);
    hl1.setComponentAlignment(save, Alignment.BOTTOM_CENTER);

    content.addComponent(hl1);
    content.setExpandRatio(hl1, 0.0f);

    final ListSelect table = new ListSelect();
    table.setWidth("100%");
    table.setHeight("100%");
    table.setNullSelectionAllowed(true);
    table.setMultiSelect(true);
    table.setCaption("Tallennetut nkymt");
    for (UIState state : main.account.uiStates) {
        table.addItem(state.name);
    }
    content.addComponent(table);
    content.setExpandRatio(table, 1.0f);

    final Button remove = new Button("Poista valitut nkymt");

    table.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 6439090862804667322L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            Object selection = table.getValue();
            Collection<?> selected = (Collection<?>) selection;
            if (!selected.isEmpty()) {
                remove.setEnabled(true);
            } else {
                remove.setEnabled(false);
            }

        }

    });

    remove.setEnabled(false);

    content.addComponent(remove);
    content.setComponentAlignment(remove, Alignment.MIDDLE_LEFT);
    content.setExpandRatio(remove, 0.0f);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(false);

    final Window dialog = Dialogs.makeDialog(main, "Nkymien hallinta", "Sulje", content, buttons);

    remove.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -4680588998085550908L;

        public void buttonClick(ClickEvent event) {

            Object selection = table.getValue();
            Collection<?> selected = (Collection<?>) selection;

            if (!selected.isEmpty()) {

                for (Object o : selected) {
                    UIState state = stateMap.get(o);
                    if (state != null)
                        main.account.uiStates.remove(state);
                }
                Updates.update(main, true);
            }

            main.removeWindow(dialog);

        }

    });

}