Package com.vaadin.data.util

Examples of com.vaadin.data.util.IndexedContainer


                "Path to Flag", "A generated column." });
        return pagedTable;
    }

    public static IndexedContainer createContainer() {
        IndexedContainer container = new IndexedContainer();
        container.addContainerProperty(NAME, String.class, null);
        container.addContainerProperty(SHORT, String.class, null);
        container.addContainerProperty(FLAG, Resource.class, null);
        for (int i = 0; i < iso3166.length; i++) {
            String name = iso3166[i++];
            String id = iso3166[i];
            Item item = container.addItem(id);
            item.getItemProperty(NAME).setValue(name);
            item.getItemProperty(SHORT).setValue(id);
            item.getItemProperty(FLAG)
                    .setValue(
                            new ThemeResource("img/flags/" + id.toLowerCase()
                                    + ".png"));
        }
        container.sort(new Object[] { NAME }, new boolean[] { true });
        return container;
    }
View Full Code Here


    table.setSelectable(true);
        table.setMultiSelect(false);
        table.setImmediate(true);
        table.setSizeFull();
       
        dataSource = new IndexedContainer();
        LinkedList<String> showByDefault = new LinkedList<String>();
        for (ColumnDefinition column : columns) {
          dataSource.addContainerProperty(column.getId(), column.getType(), column.getDefaultValue());
          table.setColumnHeader(column.getId(), column.getTitle());
          if (column.isShowByDefault())
View Full Code Here

    ComboBox out = new ComboBox();
    out.setItemCaptionPropertyId("title");
        out.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
        out.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
        out.setNullSelectionAllowed(false); //TODO
        container = new IndexedContainer();
//        container.addContainerProperty("id", String.class, "");
        container.addContainerProperty("title", String.class, "");
        out.setContainerDataSource(container);
       
    return out;
View Full Code Here

    /**
     * Creates an empty Select. The caption is not used.
     */
    public AbstractSelect() {
        setContainerDataSource(new IndexedContainer());
    }
View Full Code Here

    /**
     * Creates an empty Select with caption.
     */
    public AbstractSelect(String caption) {
        setContainerDataSource(new IndexedContainer());
        setCaption(caption);
    }
View Full Code Here

     *            the Collection containing the options.
     */
    public AbstractSelect(String caption, Collection<?> options) {

        // Creates the options container and add given options to it
        final Container c = new IndexedContainer();
        if (options != null) {
            for (final Iterator<?> i = options.iterator(); i.hasNext();) {
                c.addItem(i.next());
            }
        }

        setCaption(caption);
        setContainerDataSource(c);
View Full Code Here

     *            the new data source.
     */
    @Override
    public void setContainerDataSource(Container newDataSource) {
        if (newDataSource == null) {
            newDataSource = new IndexedContainer();
        }

        getCaptionChangeListener().clear();

        if (items != newDataSource) {
View Full Code Here

        table.setSelectable(true);
        return table;
    }

    protected Container createContainer() {
        Container container = new IndexedContainer();
        for (int i = 0; i < PROPS; ++i) {
            container.addContainerProperty("prop" + i, String.class, null);
        }
        for (int i = 0; i < ROWS; ++i) {
            Item item = container.addItem(i);
            for (int p = 0; p < PROPS; ++p) {
                item.getItemProperty("prop" + p).setValue(
                        "property value 1234567890");
            }
        }
View Full Code Here

    @Override
    protected void setup() {
        final Log log = new Log(5);

        IndexedContainer container = new IndexedContainer();
        container.addContainerProperty(COL_A, TextField.class, null);
        container.addContainerProperty(COL_B, String.class, "");

        Item it = container.addItem("a");
        final ObjectProperty<String> valA = new ObjectProperty<String>("orgVal");
        final TextField fieldA = new TextField(valA) {
            @Override
            public void setPropertyDataSource(Property newDataSource) {
                super.setPropertyDataSource(newDataSource);
View Full Code Here

        setWidth("50em");

        m_artifactsTable = new ResourceTable();
        m_artifactsTable.setCaption("Artifacts in repository");

        final IndexedContainer dataSource = (IndexedContainer) m_artifactsTable.getContainerDataSource();

        final Table uploadedArtifacts = new ArtifactTable();
        uploadedArtifacts.setCaption("Uploaded artifacts");
        uploadedArtifacts.setSelectable(false);

        final GenericUploadHandler uploadHandler = new GenericUploadHandler(m_sessionDir) {
            @Override
            protected void artifactUploaded(File uploadedArtifact) {
                try {
                    URL artifact = uploadedArtifact.toURI().toURL();

                    Item item = uploadedArtifacts.addItem(artifact);
                    item.getItemProperty(ArtifactTable.PROPERTY_SYMBOLIC_NAME).setValue(uploadedArtifact.getName());
                    item.getItemProperty(ArtifactTable.PROPERTY_VERSION).setValue("");

                    m_uploadedArtifacts.add(uploadedArtifact);
                }
                catch (MalformedURLException e) {
                    showErrorNotification("Upload artifact processing failed", "<br />Reason: " + e.getMessage());
                    logError("Processing of " + uploadedArtifact + " failed.", e);
                }
            }

            @Override
            protected void uploadFailed(String uploadedArtifact, Throwable throwable) {
                showErrorNotification("Upload artifact failed", "File "
                    + uploadedArtifact
                    + "<br />could not be accepted on the server.<br />"
                    + "Reason: " + throwable);

                logError("Upload of " + uploadedArtifact + " failed.");
            }
        };

        final Upload uploadArtifact = new Upload("Upload Artifact", uploadHandler);
        uploadArtifact.addListener((SucceededListener) uploadHandler);
        uploadArtifact.addListener((FailedListener) uploadHandler);
        uploadArtifact.setImmediate(true);

        final DragAndDropWrapper finalUploadedArtifacts = new DragAndDropWrapper(uploadedArtifacts);
        finalUploadedArtifacts.setDropHandler(new ArtifactDropHandler(uploadHandler));

        addListener(new Window.CloseListener() {
            public void windowClose(CloseEvent e) {
                for (File artifact : m_uploadedArtifacts) {
                    artifact.delete();
                }
            }
        });

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

        final TextField searchField = new TextField();
        searchField.setImmediate(true);
        searchField.setValue("");

        m_searchButton = new Button("Search", new ClickListener() {
            public void buttonClick(ClickEvent event) {
                String searchValue = (String) searchField.getValue();

                dataSource.removeAllContainerFilters();

                if (searchValue != null && searchValue.trim().length() > 0) {
                    dataSource.addContainerFilter(ArtifactTable.PROPERTY_SYMBOLIC_NAME, searchValue,
                        true /* ignoreCase */, false /* onlyMatchPrefix */);
                }
            }
        });
        m_searchButton.setImmediate(true);
View Full Code Here

TOP

Related Classes of com.vaadin.data.util.IndexedContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.