Package ca.odell.glazedlists

Examples of ca.odell.glazedlists.BasicEventList


            System.out.println("Usage: LCS <alpha> <beta>");
            return;
        }

        String alpha = args[ 0 ];
        EventList alphaList = new BasicEventList();
        for (int c = 0; c < alpha.length(); c++) {
            alphaList.add(new Character(alpha.charAt(c)));
        }

        String beta = args[ 1 ];
        List betaList = new ArrayList();
        for (int c = 0; c < beta.length(); c++) {
View Full Code Here


     * Tests to verify that the SubList views a segment of a list while
     * that segment changes.
     */
    public void testSubListChanges() {
        // create a source list of values, from 0,1,2...49,100,101..149
        BasicEventList eventList = new BasicEventList();
        for(int i = 0; i < 50; i++) {
            eventList.add(new Integer(i));
        }
        for(int i = 0; i < 50; i++) {
            eventList.add(new Integer(i + 100));
        }

        // get the sublist
        EventList subListBefore = (EventList)eventList.subList(25, 75);
        ListConsistencyListener.install(subListBefore);

        // change the source list to be 0,1,2,3,...49,50,51,..99,100,101...149
        for(int i = 0; i < 50; i++) {
            eventList.add(50+i, new Integer(50+i));
        }

        // ensure the sublist took the change
        EventList subListAfter = (EventList)eventList.subList(25, 125);
        assertEquals(subListBefore, subListAfter);

        // change the lists again, deleting all odd numbered entries
        for(Iterator i = eventList.iterator(); i.hasNext(); ) {
            Integer current = (Integer)i.next();
            if(current.intValue() % 2 == 1) i.remove();
        }

        // ensure the sublists took the change
        subListAfter = (EventList)eventList.subList(13, 63);
        assertEquals(subListBefore, subListAfter);
       
        // make some set calls
        eventList.set(15, "Fifteen");
        eventList.set(18, "Eighteen");
        eventList.set(21, "Twenty-One");
        eventList.set(24, "Twenty-Four");
        assertEquals("Fifteen", subListAfter.get(2));
        assertEquals("Eighteen", subListAfter.get(5));
        subListBefore.set(14, "Twenty-Seven");
        assertEquals("Twenty-Seven", eventList.get(27));
        assertEquals(subListAfter, subListBefore);
    }
View Full Code Here

        new BeanConnector(JComponent.class, "addPropertyChangeListener", "removePropertyChangeListener");
    }

    public void testListenerCascade() {
        final CountingObservableElementList list = new CountingObservableElementList(new BasicEventList(), GlazedLists.beanConnector(JComponent.class));
        final JLabel listElement = new JLabel();
        list.add(listElement);
        assertEquals(0, list.elementChangeCount);

        listElement.setText("booblah");
View Full Code Here

    /**
     * Create a {@link FileList} that stores its data in the specified file.
     */
    public FileList(File file, ByteCoder byteCoder) throws IOException {
        super(new BasicEventList());
        this.file = file;
        this.byteCoder = byteCoder;

        // store the updates in a persistent map
        storage = new PersistentMap(file);
View Full Code Here

    /**
     * Verifies that conflicting threads are resolved intelligently.
     */
    public void guiTestConflictingThreads_FixMe() {
        EventList labelsList = new BasicEventList();
        labelsList.add(new JLabel("7-up"));
        labelsList.add(new JLabel("Pepsi"));
        labelsList.add(new JLabel("Dr. Pepper"));

        String[] properties = new String[] { "text", "toolTipText" };
        String[] headers = new String[] { "Text", "Tool Tip" };
        boolean[] editable = new boolean[] { true, true };
        TableFormat labelsTableFormat = GlazedLists.tableFormat(JLabel.class, properties, headers, editable);

        EventTableModel labelsTable = new EventTableModel(labelsList, labelsTableFormat);

        doBackgroundTask(new ClearListRunnable(labelsList), true);

        labelsList.getReadWriteLock().writeLock().lock();
        assertEquals(0, labelsList.size());
        labelsList.add(new JLabel("Coca-Cola"));
        labelsList.getReadWriteLock().writeLock().unlock();

        // This fails. We know it fails. Do not fix this!
        //
        // The problem is that changes pending on an EventList are invisible to
        // the EDT if those changes happened before the current dispatch but
View Full Code Here

      reader_min_pause_ms = Long.parseLong(args[4]);
      reader_max_pause_ms = Long.parseLong(args[5]);
    }

    // Setup
    EventList list = new BasicEventList();
    list.add("one");
    list.add("two");
    list.add("three");

    System.out.println("ReadWriteLock class: " +
      LockFactory.DEFAULT.createReadWriteLock().getClass().getName());

    System.out.print("Starting threads...");
View Full Code Here

    }
   
    /** {@inheritDoc} */
    public EventList createEventList() {
        final ListInfo info = getListInfo();
        return new BasicEventList(info.publisher, info.lock);
    }
View Full Code Here

    }

    /** {@inheritDoc} */
    public EventList createEventList(int initalCapacity) {
        final ListInfo info = getListInfo();
        return new BasicEventList(initalCapacity, info.publisher, info.lock);
    }
View Full Code Here

*/
final class DefaultFactory implements EventListFactory {

    /** {@inheritDoc} */
    public EventList createEventList() {
        return new BasicEventList();
    }
View Full Code Here

        return new BasicEventList();
    }

    /** {@inheritDoc} */
    public EventList createEventList(int initalCapacity) {
        return new BasicEventList(initalCapacity);
    }
View Full Code Here

TOP

Related Classes of ca.odell.glazedlists.BasicEventList

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.