View Poll Results: Do you use spring to handle your events?

Voters
5. You may not vote on this poll
  • Yes

    1 20.00%
  • No

    3 60.00%
  • I don't have events.

    1 20.00%
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Springs Event framework...

  1. #11
    Join Date
    May 2005
    Posts
    394

    Default

    JMS is J(2)EE only, it's for asynchronish messaging.

    Andy: Could you describe some use cases of the event framework?
    One of the things I have problems with in spring-richclient is the following use case:
    - There are several check boxes in the form
    - When checkbox a is clicked every other fields/checkboxes become read-only (nothing goes empty)
    a is to set the record to "inactive"
    - When checkbox b is clicked the fields become disabled + empty.
    b is to make disable some fields when they don't apply

    Currently I 've done the read-only/disabled state in a refreshMetaData() method, using the ValueModel (not the Value Object directly as the form hasn't been comitted to it yet) ... which is casting hell.
    The empty-ing I cannot do in the refresh-metadata, as it's a one time thing the user can overrule later, so I do that in a regular Swing event listener.

    Any pointers on how to improve this solution?

  2. #12
    Join Date
    Aug 2004
    Location
    San Francisco
    Posts
    423

    Default

    There are conceptual similarities between the event bus idea and JMS. In fact, there's an in jvm implementation of a jms provider the author aims at exactly this problem:

    https://somnifugijms.dev.java.net/

    I've never used it though. I'm pretty sure activeMq can also be embedded and used within the jvm.

    As for use cases. To me the main use is to avoid coupling between an event publisher and a subscriber. They don't know anything about each other. This works great, for example, where mutliple views have to update their content based on an event in another window, result of a command execution etc.

    I'm not sure it fits your example or not, I don't fully follow, but you could, using elf, fire your own events on the selection change and anything that needed to update their state could then listen on these specific events. I do a similar thing all the time with table selection.

    Jonny

  3. #13
    Join Date
    Mar 2006
    Posts
    4

    Smile

    Hi, I am the developer of ELF. jwray pointed me here to see how people think about event listening in Spring Rich. I personally don't have experience with Spring Rich and the original idea of ELF is to hava a framework to facilatate component programming. The goal of ELF is actually a lot like Spring but went into a different route.
    Anyhow, a quick comment on the event dispatch provided by Spring is that you have to develop your class with Spring specific event/listener classes. With ELF, you can define yourown event/listener classes which brings more flexibility. This is particular useful when you are using third party swing/swt components cuz you don't have control over them. Another key benefit is that ELF provides better debugging/statistic function than Spring core. I personally find debugging in a fully distributed enviornment is a big hassle. Enhancing debug capacity would be my next task. (if I ever get to finish the tutorial....) For more usage of ELF, please see the tutorial at Walking with ELF

    Anyhow, comments and suggestions are very welcome. jwray has also suggested me to integrate ELF with Spring Rich. I will look into the possibility and of course, see if there is a need for it.

    BTW, JMS is too heavy/slow for a client application. Your events will have to travel to the JMS server and be picked up later by another thread of the same application. It will definately work, but probably too slow for an interactive intense client app.

  4. #14
    Join Date
    May 2005
    Posts
    394

    Default

    Chunju,
    Need someone to maven2ize ELF?
    It's a single module, shouldn't take long or a lot of effort. If it's ok, I can make you a pom.xml this weekend.

    If ELF also builds with maven 2, it's easier for us to depend on it, as we don't have to worry about transitive dependencies and it's a lot easier to upgrade to new snapshots or releases.

  5. #15
    Join Date
    Mar 2006
    Posts
    4

    Default

    Sounds good. I am not familier with Maven. Could you explain how it works and how do I maintain this pom.xml ? Thanks a lot!!

  6. #16
    Join Date
    Oct 2005
    Posts
    29

    Default

    Quote Originally Posted by jwray
    There are conceptual similarities between the event bus idea and JMS. In fact, there's an in jvm implementation of a jms provider the author aims at exactly this problem:

    https://somnifugijms.dev.java.net/

    I've never used it though. I'm pretty sure activeMq can also be embedded and used within the jvm.

    As for use cases. To me the main use is to avoid coupling between an event publisher and a subscriber. They don't know anything about each other. This works great, for example, where mutliple views have to update their content based on an event in another window, result of a command execution etc.

    I'm not sure it fits your example or not, I don't fully follow, but you could, using elf, fire your own events on the selection change and anything that needed to update their state could then listen on these specific events. I do a similar thing all the time with table selection.

    Jonny
    somnifugijms is why I belive There are conceptual similarities between them.
    I don't have much experience about SWING, my most projects are web based. But I am tring to write one now.

  7. #17

    Default

    The problem with somnofungi and other JMS or JMX implementations is that they are *too* multithreaded. Most of the time you want the message delivered on the same stack frame, if possible (click a button and the message for the button will be handled by the controller during the click). In the Swing version, you take it from any thread and consume it on the Swing EDT thread.

    JMX is also a bit more complicated. JMX is a cross-process communication layer, the EventBus is specifically in-process.

    When I say EventBus, I'm specifically referrring to my project, http://eventbus.dev.java.net, but I think ELF is similar.

  8. #18
    Join Date
    Oct 2005
    Posts
    29

    Talking

    Quote Originally Posted by chunju
    Sounds good. I am not familier with Maven. Could you explain how it works and how do I maintain this pom.xml ? Thanks a lot!!
    Maybe it is too hard to explain maven in a post.
    Basically it is a "building system" trying to solve technical problems of project management. For example, it can pull all needed jar form internet for you. It makes your project more "friendly" to others (their maven can pull you jars form internet for them)
    And it is easy to use,as long as you understand its idea.
    http://maven.apache.org/
    has more information.
    BTW, your id is interesting
    Last edited by siberian; Mar 16th, 2006 at 09:05 PM.

  9. #19
    Join Date
    Mar 2006
    Posts
    4

    Default

    siberian:
    I know maven as it's a build management but was never set up one successfully.
    why is my id interesting?

    Michael:
    Do you think we can work together on exchanging some ideas, even some implementations?

  10. #20
    Join Date
    Oct 2005
    Posts
    29

    Default

    I suppose your id is pinyin?
    If you are using eclipse, try maven's eclipse plugin
    http://maven.apache.org/eclipse-plugin.html
    A good start.They have two flash demos.
    Last edited by siberian; Mar 16th, 2006 at 09:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •