Package org.rococoa.cocoa.foundation

Examples of org.rococoa.cocoa.foundation.NSNotificationCenter


        Foundation.sendReturnsVoid(proxy2.id(), "testTakesIDReturnsID:", ID.fromLong(43));
        assertEquals(ID.fromLong(43), implementor2.arg);       
    }   
   
    @Test public void testNotifications() {
        NSNotificationCenter notificationCentre = NSNotificationCenter.CLASS.defaultCenter();
        final ID observer = proxy.id();
        notificationCentre.addObserver_selector_name_object(
                observer,
                Foundation.selector("notify:"),
                "MyNotification",
                null);

        NSNotification notification = NSNotification.CLASS.notificationWithName_object("MyNotification", null);
       
        assertNull(implementor.arg);
        notificationCentre.postNotification(notification);            
        assertEquals(notification, implementor.arg);
        notificationCentre.removeObserver(observer);
    }
View Full Code Here


        notificationCentre.removeObserver(observer);
    }
   
    @Test public void testMemoryManagement() {
        // we were autorelease'ing the proxy - so that this failed
        NSNotificationCenter notificationCentre = NSNotificationCenter.CLASS.defaultCenter();
        final ID observer = proxy.id();
        notificationCentre.addObserver_selector_name_object(
                observer,
                Foundation.selector("notify:"),
                "MyNotification",
                null);
        pool.drain();
        pool = NSAutoreleasePool.new_();

        NSNotification notification = NSNotification.CLASS.notificationWithName_object("MyNotification", null);       
        notificationCentre.postNotification(notification);
        notificationCentre.removeObserver(observer);
    }
View Full Code Here

TOP

Related Classes of org.rococoa.cocoa.foundation.NSNotificationCenter

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.