Events

13 views
Skip to first unread message

Imp Inc

unread,
Jul 27, 2013, 3:09:53 PM7/27/13
to alternate-java-bridg...@googlegroups.com
I've been thinking about this for a whlie now. While the current event system will stay in place, I want to incorporate a more "advanced" version. The event dispatcher can kind of become a log jam of events if you have a lot going on in your Form, especially sensors which can throw events very quickly.

My idea is to add interfaces to the Events class for each event. Each component would allow you to use this interface, rather than the current event system to handle events. This makes it much more modular. Each component would handle it's own events (instead of going through the global system, and having to check the eventName, component, etc).

This is already possible with a couple of classes now, but it is undocumented, and hasn't really followed any guidelines.

I'm thinking something like this:

Button button = new Button(this, R.id.myButton);
button.setClickEvent(new Events.Click() {
              @Override
              public void Clicked() {
                    // Handle the event here
              });

You could also split it out into your own class:

Button button = new Button(this, R.id.myButton);
button.setClickEvent(new MyClickEvent());

...

private class MyClickEvent implements Events.Click {
      @Override
      public void Clicked() {
            // Handle the event here
      }
}


Ryan

Steve Marcus

unread,
Jul 28, 2013, 8:39:18 AM7/28/13
to alternate-java-bridg...@googlegroups.com
Sounds good to me.
Reply all
Reply to author
Forward
0 new messages