Take the bus yourself!!

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

Comentarios:

the code seems to be quite incomplete...all sorts of errors, can't compile. ...if i can i will work on it and submit it somewhere.

Enviado por codecraig en septiembre 23, 2005 a las 01:01 PM CEST #

doh!...that's what happens when u have to sdk's...it was trying to use 1.4.x :)

Enviado por codecraig en septiembre 23, 2005 a las 01:03 PM CEST #

i have a working demo...has a button which opens a "file viewer" (aka jfilechooser)...when a file is selected it fires an event and a status bar is updated. i will post it online later, busy weekend coming so may be on saturday or sunday.

Enviado por codecraig en septiembre 23, 2005 a las 01:34 PM CEST #

I posted the demo jar at www.codecraig.com/v2.0/coding/sourcecode/ui_topics_demo.jar ...the jar includes the source...you will find a Main.java file..run that to see the demo run. This requires java 5. i am in the process of moving, so if u email me it may be some time before i reply.

Enviado por codecraig en septiembre 24, 2005 a las 12:02 AM CEST #

Hi!!

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 10:52 AM CEST #

Enviar un comentario:
Los comentarios han sido deshabilitados.
About

swinger

Search

Archives
« abril 2014
lunmarmiéjueviesábdom
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Hoy