Package ca.odell.glazedlists.matchers

Examples of ca.odell.glazedlists.matchers.CountingMatcherEditorListener


    public void testAddRemoveListener() {
        final TextMatcherEditor<String> textMatcherEditor = new TextMatcherEditor<String>();
        MatcherEditor<String> weakMatcherEditor = Matchers.weakReferenceProxy(textMatcherEditor);

        final CountingMatcherEditorListener counter = new CountingMatcherEditorListener();
        weakMatcherEditor.addMatcherEditorListener(counter);
        counter.assertCounterState(0, 0, 0, 0, 0);

        textMatcherEditor.setFilterText(new String[] {"booblah"});
        counter.assertCounterState(0, 0, 0, 1, 0);

        weakMatcherEditor.removeMatcherEditorListener(counter);
        textMatcherEditor.setFilterText(new String[] {"bibbety"});
        counter.assertCounterState(0, 0, 0, 1, 0);
    }
View Full Code Here


    public void testGarbageCollectWeakListener() {
        final TextMatcherEditor<String> textMatcherEditor = new TextMatcherEditor<String>();
        MatcherEditor<String> weakMatcherEditor = Matchers.weakReferenceProxy(textMatcherEditor);

        CountingMatcherEditorListener counter = new CountingMatcherEditorListener();
        final WeakReference<CountingMatcherEditorListener> weakRef = new WeakReference<CountingMatcherEditorListener>(counter);

        weakMatcherEditor.addMatcherEditorListener(counter);
        counter.assertCounterState(0, 0, 0, 0, 0);

        textMatcherEditor.setFilterText(new String[] {"booblah"});
        counter.assertCounterState(0, 0, 0, 1, 0);

        // removing the only hard reference to counter should make it gc'able
        counter = null;
        System.gc();
View Full Code Here

    public void testGarbageCollectWeakReferenceProxy() {
        final TextMatcherEditor<String> textMatcherEditor = new TextMatcherEditor<String>();
        MatcherEditor<String> weakMatcherEditor = Matchers.weakReferenceProxy(textMatcherEditor);

        final CountingMatcherEditorListener counter = new CountingMatcherEditorListener();
        weakMatcherEditor.addMatcherEditorListener(counter);
        counter.assertCounterState(0, 0, 0, 0, 0);

        textMatcherEditor.setFilterText(new String[] {"booblah"});
        counter.assertCounterState(0, 0, 0, 1, 0);

        // removing the only hard reference to weakMatcherEditor should make it gc'able
        weakMatcherEditor = null;
        System.gc();

        textMatcherEditor.setFilterText(new String[] {"bibbety"});
        counter.assertCounterState(0, 0, 0, 1, 0);
    }
View Full Code Here

TOP

Related Classes of ca.odell.glazedlists.matchers.CountingMatcherEditorListener

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.