Package com.vaadin.data.util

Examples of com.vaadin.data.util.IndexedContainer


    @SuppressWarnings("unchecked")
    static Container generateContainer(final int size,
            final boolean hierarchical) {
        TestIcon testIcon = new TestIcon(90);
        IndexedContainer container = hierarchical ? new HierarchicalContainer()
                : new IndexedContainer();
        StringGenerator sg = new StringGenerator();
        container.addContainerProperty(CAPTION_PROPERTY, String.class, null);
        container.addContainerProperty(ICON_PROPERTY, Resource.class, null);
        container.addContainerProperty(INDEX_PROPERTY, Integer.class, null);
        container
                .addContainerProperty(DESCRIPTION_PROPERTY, String.class, null);
        for (int i = 1; i < size + 1; i++) {
            Item item = container.addItem(i);
            item.getItemProperty(CAPTION_PROPERTY).setValue(
                    sg.nextString(true) + " " + sg.nextString(false));
            item.getItemProperty(INDEX_PROPERTY).setValue(i);
            item.getItemProperty(DESCRIPTION_PROPERTY).setValue(
                    sg.nextString(true) + " " + sg.nextString(false) + " "
                            + sg.nextString(false));
            item.getItemProperty(ICON_PROPERTY).setValue(testIcon.get());
        }
        container.getItem(container.getIdByIndex(0))
                .getItemProperty(ICON_PROPERTY).setValue(testIcon.get());

        if (hierarchical) {
            for (int i = 1; i < size + 1; i++) {
                for (int j = 1; j < 5; j++) {
                    String id = i + " -> " + j;
                    Item child = container.addItem(id);
                    child.getItemProperty(CAPTION_PROPERTY).setValue(
                            sg.nextString(true) + " " + sg.nextString(false));
                    child.getItemProperty(ICON_PROPERTY).setValue(
                            testIcon.get());
                    ((Hierarchical) container).setParent(id, i);

                    for (int k = 1; k < 6; k++) {
                        String id2 = id + " -> " + k;
                        child = container.addItem(id2);
                        child.getItemProperty(CAPTION_PROPERTY).setValue(
                                sg.nextString(true) + " "
                                        + sg.nextString(false));
                        child.getItemProperty(ICON_PROPERTY).setValue(
                                testIcon.get());
                        ((Hierarchical) container).setParent(id2, id);

                        for (int l = 1; l < 5; l++) {
                            String id3 = id2 + " -> " + l;
                            child = container.addItem(id3);
                            child.getItemProperty(CAPTION_PROPERTY).setValue(
                                    sg.nextString(true) + " "
                                            + sg.nextString(false));
                            child.getItemProperty(ICON_PROPERTY).setValue(
                                    testIcon.get());
View Full Code Here


        final LegacyWindow mainWin = new LegacyWindow();
        setMainWindow(mainWin);

        Table t = new Table();

        IndexedContainer c = new IndexedContainer();

        c.addItem("foo");

        c.addContainerProperty("testcol1", Integer.class, new Integer(7));
        c.addContainerProperty("testcol2", String.class, "str");
        c.addContainerProperty("testcol3", String.class, null);

        c.addItem("bar");

        t.setContainerDataSource(c);

        t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
View Full Code Here

    private Table table;

    @Override
    protected void setup(VaadinRequest request) {
        table = new Table();
        IndexedContainer ic = new IndexedContainer();
        populate(ic);
        table.setContainerDataSource(ic);
        table.setPageLength(20);
        table.setSelectable(true);
        table.setImmediate(true);
View Full Code Here

    Table tbl = new Table();
    static final int COLS = 15;
    static final int ROWS = 2000;

    private void addRows() {
        IndexedContainer idx = new IndexedContainer();
        for (int i = 0; i < COLS; i++) {
            idx.addContainerProperty("name " + i, String.class, "value");
        }
        for (int i = 0; i < ROWS; i++) {
            idx.addItem("item" + i);
        }
        tbl.setContainerDataSource(idx);
        addComponent(tbl);
    }
View Full Code Here

        return 5414;
    }

    @SuppressWarnings("unchecked")
    private Container createContainer(boolean description) {
        IndexedContainer container = new IndexedContainer();
        container.addContainerProperty(TEXT_PROPERTY_ID, String.class, "");
        container.addContainerProperty(WIDGET_PROPERTY_ID, Component.class,
                null);

        for (int i = 0; i < 5; i++) {
            Item item = container.addItem("item " + i);
            item.getItemProperty(TEXT_PROPERTY_ID).setValue("Text " + i);
            Button b = new Button("Button " + i);
            if (description) {
                b.setDescription("Button " + i + " description");
            }
View Full Code Here

    @Override
    public void init() {
        setMainWindow(main);

        final IndexedContainer container1 = new IndexedContainer();
        container1.addContainerProperty("text", Component.class, null);
        final IndexedContainer container2 = new IndexedContainer();

        // Case #2 Try to comment the following line for another type of strange
        // behaviour
        container2.addContainerProperty("text", Component.class, null);

        for (int i = 0; i < 100; i++) {
            Item item = container1.addItem(i);
            item.getItemProperty("text").setValue(new Label("Test " + i));
        }
View Full Code Here

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

        Collection<Object> generated;
        if (columnGenerators != null) {
            generated = columnGenerators.keySet();
View Full Code Here

            Collection<?> visibleIds) {

        disableContentRefreshing();

        if (newDataSource == null) {
            newDataSource = new IndexedContainer();
        }
        if (visibleIds == null) {
            visibleIds = new ArrayList<Object>();
        }
View Full Code Here

        layout.addComponent(t);
    }

    private IndexedContainer createContainer() {
        IndexedContainer ic = new IndexedContainer();
        ic.addContainerProperty("a", String.class, null);

        for (String s : new String[] { "Lorem", "ipsum", "dolor", "sit",
                "amet", "consectetuer" }) {
            Item item = ic.addItem(s);
            item.getItemProperty("a").setValue(s);

        }

        return ic;
View Full Code Here

        String property3 = "property3";
        String property4 = "property4";

        private void createContainers() {

            containerA = new IndexedContainer();
            containerA.addContainerProperty(property1, String.class, "");
            containerA.addContainerProperty(property2, String.class, "");
            containerA.addContainerProperty(property3, String.class, "");

            Item itemA = containerA.addItem(new Object());
            itemA.getItemProperty(property1).setValue("value1");
            itemA.getItemProperty(property2).setValue("value2");
            itemA.getItemProperty(property3).setValue("value3");

            containerB = new IndexedContainer();
            containerB.addContainerProperty(property4, String.class, "");
            containerB.addContainerProperty(property3, String.class, "");
            containerB.addContainerProperty(property2, String.class, "");

            Item itemB = containerB.addItem(new Object());
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.