event handling

From: Claudio Rosati (claudio.rosat..csys.it)
Date: Thu May 06 2004 - 11:44:18 EDT

  • Next message: Andrus Adamchik: "Re: event handling"

    Hello all,
     
    I've tried Cayenne with JavaGroups. I've a problem.
     
    I launch the same application on two PC. I've a GUI that show the
    properties of a Cayenne object. I modify the object on the first
    application and, after a manual update of the GUI (i.e. a repaint of the
    propertes of a previously loaded - and displayed - instance of the
    Cayenne object) I see the modified values.
     
    Now I would like to use events in order to perform an automatic GUI
    update when the same object is modified elsewhere. I have used the
    following code:
     
    dataContext = DataContext.createDataContext();
     
    DataRowStore cache = dataContext.getObjectStore().getDataRowCache();
    SnapshotEventListener customListener = new SnapshotEventListener() {
        public void snapshotsChanged ( SnapshotEvent event ) {
            System.out.println("*** Something ghanged! ***");
        }
    };
     
    EventManager.getDefaultManager().addListener(
     customListener,
     "snapshotsChanged",
     SnapshotEvent.class,
     cache.getSnapshotEventSubject(),
     cache
    );

    ... read the object and display it on the GUI ...
     
     
     
    What happened is: nothing! The listener is never called.
     
    Now the questions:
     
    1. Why? What I am missing?
    2. In which thread the snapshotsChanged method is called? The same of
    GUI (Swing/AWT) events?
     
    Thanks in advance.
     
    Claudio
     
     
     
     
     
     

                     
            

    Claudio Rosati
    Project Manager Advanced Ccomputer Systems S.p.A.
    via Della Bufalotta 378
    <http://maps.yahoo.com/py/maps.py?Pyt=Tmap&addr=00139++Roma,+RM&csz=Ital
    y&country=us>
    00139 Roma, RM
    Italy
    claudio.rosat..csys.it
    www.acsmultimedia.com <http://www.acsmultimedia.com/>
    tel: +39 06 8709 0516
            

     <http://www.plaxo.com/signature/> Powered by Plaxo
    <http://www.plaxo.com/signature/> Want a signature like this?
     





    This archive was generated by hypermail 2.0.0 : Thu May 06 2004 - 11:48:38 EDT