|
So you may want to take the bus yourself and see how well it goes.
Note that this is an alpha version and I'm still experimenting with it (I'm working out a demo). I'd suggest you generating javadoc.
It's just six classes, but don't panic! Of those six just two are public (and one of them is not a class but an annotation).
This is one of my Type I aggregators:
public class StatusMessagesMediator
{
private Statusbar statusbar;
public StatusMessagesMediator( Statusbar aStatusbar )
{
statusbar = aStatusbar;
}
@TopicListener( topicName="filesystem.events" )
public void onFilesystemEvent( TopicManager aTopicManager, FilesystemEvent anEvent )
{
switch( anEvent.getEventType() )
{
case FilesystemEvent.SELECTION_TYPE:
statusbar.setStatusMessage( anEvent.getFile().getName() );
}
}
}
To attach the mediator (aggregator) to the bus just write:
StatusMessagesMediator mediator = new StatusMessagesMediator();
topicManager.addTopicListener( mediator );
To attach a macro-component to the bus just write:
FilesystemViewer viewer = new FilesystemViewer();
topicManager.addEventSource( "filesystem.events", viewer, FilesystemEventListener.class,
ActionListener.class, (any other EventListener class here)... );
(Note that you specify listener types and not events, sorry).
I decided to post it here just because the java.net project is still under approval (maybe they're surprised it's just six classes ;-) )
During this weekend (if time permits) I'll think about building a Type II aggregator using a Type I aggregator. (Hint: split the aggregator above into two ones. One with instances and another without instances, change topic names, done?)
Sorry for the short post (I'm in a hurry now). Enjoy it. Have a good weekend. Keep Swinging,
Antonio
|
Enviado por codecraig en septiembre 23, 2005 a las 08:01 PM CEST #
Enviado por codecraig en septiembre 23, 2005 a las 08:03 PM CEST #
Enviado por codecraig en septiembre 23, 2005 a las 08:34 PM CEST #
Enviado por codecraig en septiembre 24, 2005 a las 07:02 AM CEST #
I've seen the demo. Cool!! Good job!. I'm glad to see you've seen this is just for JDK 5.0.
I'm sort of busy now. Just some time to reorganize, recategorize and tidy up a little bit the blog. That's part of my weekend assignments :-(
Cheers,
Antonio
Enviado por Antonio en septiembre 24, 2005 a las 05:52 PM CEST #