Package nextapp.echo2.app.list

Examples of nextapp.echo2.app.list.DefaultListModel


       
        controlsColumn.addButton("Empty ListModel", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setModel(new DefaultListModel());
                    }
                });
            }
        });
       
        controlsColumn.addButton("Set ListModel = Numbers", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setModel(new DefaultListModel(NUMBERS));
                    }
                });
            }
        });
        controlsColumn.addButton("Focus SelectField1", new ActionListener() {
View Full Code Here


            ex.printStackTrace();
        }
    }

    private void doRefresh() {
        DefaultListModel listModel = (DefaultListModel) listBox.getModel();
        listModel.removeAll();
        Enumeration enumeration = getSession().getAttributeNames();
        while (enumeration.hasMoreElements()) {
            String sessionKey = (String) enumeration.nextElement();
            listModel.add(sessionKey);
        }
    }
View Full Code Here

            removeEvent = e;
        }
    }
   
    public void testAddAtEnd() {
        DefaultListModel listModel = new DefaultListModel(new Object[]{"alpha", "bravo", "charlie"});
        TestListDataListener testListener = new TestListDataListener();
        listModel.addListDataListener(testListener);
        listModel.add("delta");
        assertEquals(4, listModel.size());
        assertEquals("alpha", listModel.get(0));
        assertEquals("bravo", listModel.get(1));
        assertEquals("charlie", listModel.get(2));
        assertEquals("delta", listModel.get(3));
        assertNull(testListener.changeEvent);
        assertNull(testListener.removeEvent);
        assertNotNull(testListener.addEvent);
        assertEquals(listModel, testListener.addEvent.getSource());
        assertEquals(3, testListener.addEvent.getIndex0());
View Full Code Here

        assertEquals(3, testListener.addEvent.getIndex1());
        assertEquals(ListDataEvent.INTERVAL_ADDED, testListener.addEvent.getType());
    }

    public void testAddAtIndex() {
        DefaultListModel listModel = new DefaultListModel(new Object[]{"alpha", "bravo", "charlie"});
        TestListDataListener testListener = new TestListDataListener();
        listModel.addListDataListener(testListener);
        listModel.add(2, "delta");
        assertEquals(4, listModel.size());
        assertEquals("alpha", listModel.get(0));
        assertEquals("bravo", listModel.get(1));
        assertEquals("delta", listModel.get(2));
        assertEquals("charlie", listModel.get(3));
        assertNull(testListener.changeEvent);
        assertNull(testListener.removeEvent);
        assertNotNull(testListener.addEvent);
        assertEquals(listModel, testListener.addEvent.getSource());
        assertEquals(2, testListener.addEvent.getIndex0());
View Full Code Here

        assertEquals(2, testListener.addEvent.getIndex1());
        assertEquals(ListDataEvent.INTERVAL_ADDED, testListener.addEvent.getType());
    }
   
    public void testBasic() {
        DefaultListModel listModel = new DefaultListModel(new Object[]{"alpha", "bravo", "charlie"});
        assertEquals(3, listModel.size());
        assertEquals("alpha", listModel.get(0));
        assertEquals("bravo", listModel.get(1));
        assertEquals("charlie", listModel.get(2));
        assertEquals(1, listModel.indexOf("bravo"));
    }
View Full Code Here

        listModel.removeListDataListener(testListener);
        assertEquals(0, listModel.getEventListenerCount());
    }
   
    public void testRemoveByIndex() {
        DefaultListModel listModel = new DefaultListModel(new Object[]{"alpha", "bravo", "charlie"});
        TestListDataListener testListener = new TestListDataListener();
        listModel.addListDataListener(testListener);
        listModel.remove(1);
        assertEquals(2, listModel.size());
        assertEquals("alpha", listModel.get(0));
        assertEquals("charlie", listModel.get(1));
        assertNull(testListener.changeEvent);
        assertNull(testListener.addEvent);
        assertNotNull(testListener.removeEvent);
        assertEquals(listModel, testListener.removeEvent.getSource());
        assertEquals(1, testListener.removeEvent.getIndex0());
View Full Code Here

        assertEquals(1, testListener.removeEvent.getIndex1());
        assertEquals(ListDataEvent.INTERVAL_REMOVED, testListener.removeEvent.getType());
    }
   
    public void testRemoveByItem() {
        DefaultListModel listModel = new DefaultListModel(new Object[]{"alpha", "bravo", "charlie"});
        TestListDataListener testListener = new TestListDataListener();
        listModel.addListDataListener(testListener);
        listModel.remove("bravo");
        assertEquals(2, listModel.size());
        assertEquals("alpha", listModel.get(0));
        assertEquals("charlie", listModel.get(1));
        assertNull(testListener.changeEvent);
        assertNull(testListener.addEvent);
        assertNotNull(testListener.removeEvent);
        assertEquals(listModel, testListener.removeEvent.getSource());
        assertEquals(1, testListener.removeEvent.getIndex0());
View Full Code Here

     *
     * @param items the items the <code>SelectField</code> will initially
     *        contain
     */
    public SelectField(Object[] items) {
        this(new DefaultListModel(items));
    }
View Full Code Here

     *
     * @param itemArray an array of items that will initially populate
     *        this <code>ListBox</code>
     */
    public ListBox(Object[] itemArray) {
        super(new DefaultListModel(itemArray), null);
    }
View Full Code Here

        //If nor group is found then create a new one:
        if (newColumn == null) {
            newColumn = new Column();
            newColumn.setId(groupName);
            newColumn.setStyleName("Default");
            AccordionPaneLayoutData layoutData = new AccordionPaneLayoutData();
            layoutData.setTitle(groupTitle);
            newColumn.setLayoutData(layoutData);
            this.add(newColumn);
        }
        return newColumn;
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.list.DefaultListModel

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.