Package org.mcarthur.sandy.gwt.table.client

Examples of org.mcarthur.sandy.gwt.table.client.ObjectListTable$ObjectListTableBodyGroup


        super.tearDown();
    }

    public void testCallbacksCalledWhenAppropriate() {
        final List expected = new ArrayList();
        final ObjectListTable olt;

        // Nothing is rendered until needed now
        olt = new ObjectListTable(new AttachPersonRenderer(events), people);
        assertEquals(expected, events);

        // attaching to browser's document causes the headers/footers to be rendered and rows to be attached
        RootPanel.get().add(olt);
        expected.add("renderHeader");
View Full Code Here


    }


    public void testCallbacksCalledWhenAppropriate() {
        final List expected = new ArrayList();
        final ObjectListTable olt;

        // Nothing is rendered until needed now
        olt = new ObjectListTable(new PersonRenderer(events), people);
        assertEquals(expected, events);

        //atcching to browser's document causes the headers/footers to be rendered and rows to be attached
        RootPanel.get().add(olt);
        expected.add("renderHeader");
View Full Code Here

    public PropertyTable(final PropertyTableModel ptm) {
        initWidget(vp);

        this.ptm = ptm;
        ptel = new PropertyTableEventList(ptm.getElements());
        olt = new ObjectListTable(new PropertyRenderer(), ptel);

        vp.add(hp);
        vp.add(olt);
    }
View Full Code Here

        } else if (Table.FLEX_TABLE.equals(type)) {
            table = new FlexTable();

        } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
            table = new ObjectListTable(new NumberRenderer());
        }
    }
View Full Code Here

        } else if (Table.FLEX_TABLE.equals(type)) {
            table = new FlexTable();

        } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
            table = new ObjectListTable(new NumberRenderer());
        }
    }
View Full Code Here

                flexTable.setWidget(i, 0, makeLabel(num));
            }


        } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
            final ObjectListTable olt = (ObjectListTable)table;
            for (int i=0; i < rows; i++) {
                final Number num = new Integer(i);
                olt.getObjects().add(num);
            }
        }
    }
View Full Code Here

                flexTable.insertRow(0);
                flexTable.setWidget(0, 0, makeLabel(num));
            }

        } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
            final ObjectListTable olt = (ObjectListTable)table;

            for (int i=0; i < rows; i++) {
                final Number num = new Integer(i);
                olt.getObjects().add(0, num);
            }
        }
    }
View Full Code Here

        EventList el = true ? new ObservingEventList() : EventLists.eventList(); this.el = el;
        sel = EventLists.sortedEventList(el); el = sel;
        fel = EventLists.filteredEventList(el); el = fel;
        rel = EventLists.rangedEventList(el, 4); el = rel;
        //rel = EventLists.steadyRangedEventList(el, 4); el = rel;
        ot = new ObjectListTable(new OLTR(), el);
        ot.setWidth("100%");
        RootPanel.get("log").add(vp);

        db.setText("ObjectListTable in a DialogBox");
        db.setPopupPosition(100, 100);

        final List objects = ot.getObjects();

        objects.add(new Person("Sandy", 28));
        objects.add(0, new Person("Keebz", 25));
        objects.add(new Person("Bill", 33));
        objects.add(new Person("Ted", 55));

        if (!false) {
            final List l = new ArrayList();
            l.add(objects.get(0));
            l.add(objects.get(1));
            l.add(objects.get(3));
            objects.retainAll(l);
        } else {
            objects.remove(1);
        }

        RootPanel.get("tableDiv").add(ot);

        final FlowPanel fp = new FlowPanel();
        final Button remove2 = new Button("Remove 2");
        remove2.setTitle("Removes the first and last Person from the list.");
        remove2.addClickListener(new ClickListener() {
            public void onClick(final Widget sender) {
                if (objects.size() > 0) {
                    final List two = new ArrayList();
                    if (objects.size() > 1) two.add(objects.get(objects.size() - 1));
                    two.add(objects.get(0));
                    objects.removeAll(two);
                }
            }
        });
        fp.add(remove2);

        final Button addPerson = new Button("Add Person");
        addPerson.setTitle("Add a Person instance to the List.");
        addPerson.addClickListener(new ClickListener() {
            public void onClick(final Widget sender) {
                objects.add(new Person("Person " + (pCount++), (int)(Math.random() * 100)));
            }
        });
        fp.add(addPerson);

        if (sel == null) {
            final Button transpose = new Button("Transpose");
            transpose.setTitle("Switch two Person instances in the List");
            transpose.addClickListener(new ClickListener() {
                public void onClick(final Widget sender) {
                    final int a = (int)(Math.random() * objects.size());
                    int b;
                    do {
                        b = (int)(Math.random() * objects.size());
                    } while (a == b);
                    final Object oa = objects.get(a);
                    final Object ob = objects.get(b);

                    objects.set(b, oa);
                    objects.set(a, ob);
                }
            });
            fp.add(transpose);
        }

        final int instances = 500;
        final Button oneK = new Button("" + instances);
        oneK.setTitle("Add " + instances + " Person instances");
        oneK.addClickListener(new ClickListener() {
            public void onClick(final Widget sender) {
                final List l = new ArrayList();
                for (int i=0; i < instances; i++) {
                    l.add(new Person("Person " + (pCount++), (int)(Math.random() * 100)));
                }
                final long start = System.currentTimeMillis();
                DeferredCommand.addCommand(new Command() {
                    public void execute() {
                        final long end = System.currentTimeMillis();
                        vp.add(new Label("addAll took: " + (end - start)));
                        Window.setTitle("addAll took: " + (end - start));
                    }
                });
                objects.addAll(l);
            }
        });
        fp.add(oneK);

        final Button clear = new Button("Clear");
        clear.setTitle("Calls clear() on the backing EventList.");
        clear.addClickListener(new ClickListener() {
            public void onClick(final Widget sender) {
                TestObjectListTable.this.el.clear();
            }
        });
        fp.add(clear);

        final Button attach = new Button("Detach");
        attach.addClickListener(new ClickListener() {
            public void onClick(final Widget sender) {
                final Button attach = (Button)sender;
                final long start = System.currentTimeMillis();
                DeferredCommand.addCommand(new Command() {
                    public void execute() {
                        final long end = System.currentTimeMillis();
                        vp.add(new Label("Attach/Detach took: " + (end - start)));
                        Window.setTitle("Attach/Detach took: " + (end - start));
                    }
                });
                if (ot.isAttached()) {
                    // detach
                    RootPanel.get("tableDiv").remove(ot);
                    attach.setText("Attach");
                } else {
                    // attach
                    RootPanel.get("tableDiv").add(ot);
                    attach.setText("Detach");
                }
            }
        });
        fp.add(attach);

        final Button dbb = new Button("DialogBox");
        dbb.addClickListener(new ClickListener() {
            public void onClick(final Widget sender) {
                Widget w = db.getWidget();
                if (w instanceof HTMLTable) {
                    w = ((HTMLTable)w).getWidget(1,0);
                }
                if (w == null) {
                    db.setWidget(new ObjectListTable(new OLTR(), ot.getObjects()));
                }

                db.show();
            }
        });
View Full Code Here

TOP

Related Classes of org.mcarthur.sandy.gwt.table.client.ObjectListTable$ObjectListTableBodyGroup

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.