Thanks for the feedback from both lists, <br> To test the monitor doIt this trivial example:<br><br>| obj1 obj2 |<br><br>obj1 := VersionNumber fromString: '30'.<br>obj2 := VersionNumber fromString: '31'.<br>
obj1 when: #myEvent send: #printString to: obj2.<br>obj1 triggerEvent: #myEvent.<br>{ obj1 . obj2 } inspect<br><br>and start the event monitor. If you use code like that anytime, the monitor will show you in real-time the event table state. <br>
<br>Possible uses includes:<br><br>- As a tool for learning about weak dictionaries, used currently by the EventManager. An interesting exercise question with the above code is: when do you think the (Weak)MessageSend will be garbage collected? (try to answer first without spying possible answers :)<br>
<br>A) Closing the inspector will do it.<br>B) No, some GC thing will nil event symbols and then the weak messages will dissapear.<br>C) Anything doing #flushEvents.<br>D) Smalltalk garbageCollect.<br>E) Manually nil all the event symbols in each object's action map: <br>
<br>EventManager actionMaps associationsDo: [: assoc |<br> assoc value associationsDo: [: idAssoc | <br> idAssoc key = #getCompletionController<br> ifFalse: [ idAssoc key: nil ]<br> ] ]<br><br>F) A winner combination of the above<br>
G) None of the above.<br><br>- As a tool for observe an intensive use of SASE events, as we do in some complex UI applications using SmallFaces. <br>- As an example of a simple tool for real-time monitoring. If you want your own monitor, subclass EventMonitor, re-implement #start something like the following (an example for some morphic events) :<br>
<br>start<br> " Start monitoring events "<br> | userText |<br> <br> userText := UIManager default request: 'Type a class in the Morph hierarchy'.<br> userText isEmptyOrNil <br> ifTrue: [ self morphicClass: PasteUpMorph ]<br>
ifFalse: [ ( Smalltalk hasClassNamed: userText asSymbol )<br> ifTrue: [ self morphicClass: ( Smalltalk at: userText asSymbol ) ]<br> ifFalse: [ self error: 'Class not found ' , userText ] ].<br>
super start.<br><br>and #eventsReport according to sample your object graph. In this example:<br><br>eventsReport<br> " Answer a String with the current status of events in my domain "<br><br> | dict |<br>
<br> ^ String streamContents: [ : s | <br> counter := counter + 1.<br> s nextPutAll: '====== Samples : ';<br> print: counter; cr.<br> self morphicClass allSubInstancesDo: [: morph |<br>
( dict := morph valueOfProperty: #actionMap ) <br> ifNotNil: [ <br> s nextPutAll: 'Source : ';<br> print: morph; cr;<br> nextPutAll: ' ActionMap : '; cr. <br>
dict associationsDo: [: idAssoc | <br> s nextPutAll: ' Event : ';<br> print: idAssoc key; cr;<br> nextPutAll: ' Message : ';<br>
print: idAssoc value; cr ] ].<br> s cr ] <br> ]<br><br>Cheers<br><br>Hernán<br><br><div class="gmail_quote">2008/12/13 Stéphane Ducasse <span dir="ltr"><<a href="mailto:stephane.ducasse@inria.fr">stephane.ducasse@inria.fr</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">sounds interesting.<br>
What is the key behavior (psy unexpected dependencies?<br>
<div><div></div><div class="Wj3C7c"><br>
On Dec 13, 2008, at 6:40 AM, Hernán Morales Durand wrote:<br>
<br>
> Bonjour chers amis,<br>
> Just to let you know that I uploaded a simple real time events<br>
> monitor to the SqueakSource repository, it could be useful for those<br>
> who use the SASE protocol (#when:send:to: , #triggerEvent: and<br>
> friends).<br>
> Cheers.<br>
><br>
> Hernán<br>
><br>
> PD: Download from <a href="http://www.squeaksource.com/EventsMonitor.html" target="_blank">http://www.squeaksource.com/EventsMonitor.html</a><br>
</div></div><div><div></div><div class="Wj3C7c">> _______________________________________________<br>
> Pharo-project mailing list<br>
> <a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a><br>
> <a href="http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project" target="_blank">http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project</a><br>
<br>
<br>
_______________________________________________<br>
Pharo-project mailing list<br>
<a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a><br>
<a href="http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project" target="_blank">http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project</a><br>
</div></div></blockquote></div><br>