Example usage for com.vaadin.ui Panel setContent

List of usage examples for com.vaadin.ui Panel setContent

Introduction

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

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:com.squadd.UI.MessageLayout.java

private void configureLayout() {
    VerticalLayout all = new VerticalLayout();
    HorizontalLayout dates = new HorizontalLayout(when);
    dates.setSpacing(true);/*from w  w w.  j  a v  a 2s  .c o  m*/
    when.setSizeUndefined();
    Panel panel = new Panel();
    panel.setWidth(Display.width * 0.3 + "px");
    panel.setContent(text);
    groupPhoto.setWidth(Display.width * 0.05 + "px");
    groupPhoto.setHeight(Display.height * 0.05 + "px");
    HorizontalLayout other = new HorizontalLayout(groupPhoto, panel);
    all.addComponents(dates, other);
    Panel wrap = new Panel();
    wrap.setContent(all);
    addComponent(wrap);
}

From source file:com.squadd.UI.OneParticipant.java

private void buildLayout() {
    image.setWidth(0.04 * Display.width + "px");
    image.setHeight(0.04 * Display.height + "px");

    userName.setWidth(0.2 * Display.width + "px");

    Panel forPic = new Panel();
    forPic.setContent(image);
    Panel userN = new Panel(userName);

    addComponents(forPic, userN);//from w  w  w  .j av  a  2s. c  om
}

From source file:com.squadd.views.ChatView.java

@Override
protected Panel fillContentPanel(Layout layout) {
    Panel result = new Panel();
    result.setContent(configureMainPageLayout());
    return result;
}

From source file:com.studiodojo.qwikinvoice.QwikInvoiceApplication.java

License:Apache License

@Override
public void init() {
    this.mainWindow = new Window(
            "QwikInvoice CRM Tools - Developed by StudioDojo. Engineered by Vaadin. Powered by Google.");
    setMainWindow(mainWindow);/*from  w  w  w . j  av  a 2 s .c  om*/
    //
    // Check if a user is logged in
    //
    UserService us = UserServiceFactory.getUserService();
    this.logoutURL = us.createLogoutURL(super.getURL().toExternalForm());
    if (us.getCurrentUser() == null || us.getCurrentUser().getEmail() == null) {
        super.setLogoutURL(logoutURL);
        super.close();
        return;
    }
    String login = us.getCurrentUser().getEmail();
    this.userKey = KeyFactory.createKey(TokenBean.class.getSimpleName(), us.getCurrentUser().getEmail());
    //
    Key ucKey = KeyFactory.createKey(UserCompanyBean.class.getSimpleName(), us.getCurrentUser().getEmail());
    UserCompanyBean ucBean = UserDAO.getUserCompanyBean(us.getCurrentUser().getEmail());

    this.theSession = new SessionBean(login, ucBean);
    //
    // SETUP WORKING AREA
    //
    HorizontalLayout appLayout = new HorizontalLayout();
    appLayout.setSizeFull();
    // The Main Layout
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setWidth(APP_WIDTH);
    mainLayout.setHeight(APP_HEIGHT);
    appLayout.addComponent(mainLayout);
    appLayout.setComponentAlignment(mainLayout, Alignment.TOP_CENTER);
    appLayout.setExpandRatio(mainLayout, 2);
    //
    // Setup Header (Welcome Message)
    //
    Label welcome = new Label(
            "<h1>QWIK!NVOICE</h1> You are " + (us.isUserLoggedIn() ? "logged in" : "logged out") + " as <b>"
                    + us.getCurrentUser().getNickname() + "</b>",
            Label.CONTENT_XHTML);
    mainLayout.addComponent(welcome);
    mainLayout.setComponentAlignment(welcome, Alignment.TOP_LEFT);
    //
    // Menu Bar
    //
    MenuBar menuBar = new MenuBar();
    menuBar.setWidth(APP_WIDTH);
    MenuBar.MenuItem fileMenuItem = menuBar.addItem("File", null, null);
    MenuItem newMenuItem = fileMenuItem.addItem("New...", null, null);
    newMenuItem.addItem("Invoice/Quote", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(InvoiceApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading panel", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    newMenuItem.addItem("Order", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(FFOrderApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading panel", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    /** SAVE */
    fileMenuItem.addItem("Save", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                TokenBean userTokenBean = TokenStore.getToken(QwikInvoiceApplication.this.userKey);
                // User must have an OAuth AUTH Token to access Google Doc service
                if (userTokenBean != null) {
                    /*
                    GDocFileWindow saveWindow = new GDocFileWindow("Save As...");
                    saveWindow.init(QwikInvoiceApplication.this, PdfWriter.getFilename(QwikInvoiceApplication.this.theSession));
                    QwikInvoiceApplication.this.mainWindow.addWindow(saveWindow);
                    */
                    QwikInvoiceApplication.this.activePanel.validate();
                    QwikInvoiceApplication.this.activePanel.onSave();
                } else {
                    AuthSubWindow authsubWindow = new AuthSubWindow("Service Authorization Required");
                    authsubWindow.init(QwikInvoiceApplication.this.userKey);
                    QwikInvoiceApplication.this.mainWindow.addWindow(authsubWindow);
                }
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Saving file", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    /**
     * SETTINGS
     */
    fileMenuItem.addSeparator();
    MenuItem settingsMenuItem = fileMenuItem.addItem("Settings...", null, null);
    settingsMenuItem.addItem("Profile", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                UserCompanySetupWindow aWindow = new UserCompanySetupWindow();
                aWindow.init(QwikInvoiceApplication.this);
                QwikInvoiceApplication.this.mainWindow.addWindow(aWindow);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Saving Profile", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    fileMenuItem.addSeparator();

    fileMenuItem.addItem("Logout", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            QwikInvoiceApplication.this.setLogoutURL(logoutURL);
            QwikInvoiceApplication.this.close();

        }
    });
    /**
     * Products
     */
    MenuBar.MenuItem productsMenuItem = menuBar.addItem("Products", null, null);
    productsMenuItem.addItem("Products", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(ProductApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading products", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    productsMenuItem.addItem("Categories", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                ProductCategorySettingsWindow window = new ProductCategorySettingsWindow();
                window.setCaption("Product Category");
                window.init(QwikInvoiceApplication.this.theSession, QwikInvoiceApplication.this);
                QwikInvoiceApplication.this.mainWindow.addWindow(window);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Loading Products", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    productsMenuItem.addItem("Catalogs", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(CatalogApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading catalogs", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    /**
     * Help
     */
    MenuBar.MenuItem helpMenuItem = menuBar.addItem("Help", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            AboutWindow aboutWindow = new AboutWindow();
            aboutWindow.init();
            QwikInvoiceApplication.this.mainWindow.addWindow(aboutWindow);
        }
    });
    helpMenuItem.addItem("About...", null, null);
    mainLayout.addComponent(menuBar);
    mainLayout.setComponentAlignment(menuBar, Alignment.TOP_CENTER);
    //
    // Load Main Panel
    //
    IApplicationPanel invoiceApplicationPanel = (IApplicationPanel) this.map.get(InvoiceApplicationPanel.class);
    try {
        invoiceApplicationPanel.init(this.theSession, this);
        mainLayout.addComponent((Component) invoiceApplicationPanel);
        mainLayout.setComponentAlignment((Component) invoiceApplicationPanel, Alignment.TOP_CENTER);
        this.activePanel = invoiceApplicationPanel;
    } catch (Exception e) {
    }
    //
    // Setup Footer
    //
    //Label footerMessage = new Label("QwikInvoice <b>version "+_VERSION_+"</b>. This service is provided as is. E&O accepted. Developed by <a href='mailto:public@studiodojo.com?subject=QwikInvoice' target='_blank'>StudioDojo</a>. Engineered by Vaadin. Powered by Google. Apache License 2.0", Label.CONTENT_XHTML);
    //mainLayout.addComponent(footerMessage);
    //mainLayout.setComponentAlignment(footerMessage, Alignment.TOP_CENTER);
    Panel mainPanel = new Panel();
    mainPanel.setScrollable(true);
    mainPanel.setContent(appLayout);
    this.mainWindow.setContent(mainPanel);
}

From source file:com.terralcode.gestion.frontend.view.panel.employee.EmployeeView.java

private void builtBody() throws Exception {

    Panel panel = new Panel();

    panel.setContent(builtEmployeeTable());
    addComponent(panel);/*from w w  w .  j a v  a2s. co  m*/
}

From source file:customcomponent.CustomcomponentUI.java

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//from   w  ww .  j ava  2  s .c om
    setContent(layout);

    Label terms = new Label("You agree with us on everything.");

    Panel panel = new Panel("LICENSE TERMS:");
    panel.setContent(terms);
    layout.addComponent(panel);

    AcceptTermsButton button = new AcceptTermsButton("Yeah right. I do accept that.", "Install");

    button.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Notification.show("Software installed.");
        }
    });

    layout.addComponent(button);
}

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 ww w  .j  a 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.linked.metadata.form.ExtractorDialog.java

public ExtractorDialog() {
    super(ExtractorConfig.class);
    try {/*from  w  ww .  j  av a 2s .  co  m*/
        periodicities
                .add(new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-A"), "Annual"));
        periodicities.add(new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-B"),
                "Daily - business week"));
        periodicities
                .add(new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-D"), "Daily"));
        periodicities.add(
                new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-M"), "Monthly"));
        periodicities.add(
                new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-N"), "Minutely"));
        periodicities.add(
                new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-Q"), "Quarterly"));
        periodicities.add(new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-S"),
                "Half Yearly, semester"));
        periodicities
                .add(new URLandCaption(new URL("http://purl.org/linked-data/sdmx/2009/code#freq-W"), "Weekly"));
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    buildMainLayout();

    Panel p = new Panel();

    p.setSizeFull();
    p.setContent(mainLayout);

    setCompositionRoot(p);
}

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);/*from  ww w .  j a  v a2s  . 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.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);/* w  ww  .  j  a  va 2 s.  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);
}