net.sf.jga.swing
Class GenericItemListener

java.lang.Object
  extended by net.sf.jga.swing.GenericItemListener
All Implemented Interfaces:
java.awt.event.ItemListener, java.util.EventListener

public class GenericItemListener
extends java.lang.Object
implements java.awt.event.ItemListener

Listener that will execute a given functor on every item event.

Copyright © 2004-2005 David A. Hall

Author:
David A. Hall

Constructor Summary
GenericItemListener(UnaryFunctor<java.awt.event.ItemEvent,?> fn)
          Builds an item listener that executes the given functor for every item event it receives.
 
Method Summary
static
<T> GenericItemListener
buildEventListener(java.lang.Class<T> type, T object, java.lang.String methodName)
          Builds a listener that passes each item event it receives to the given method.
static
<T> GenericItemListener
buildListener(java.lang.Class<T> type, T object, java.lang.String methodName)
          Builds a listener invokes the given no-arg method every time an item event fires.
 void itemStateChanged(java.awt.event.ItemEvent evt)
          Passes the item event to the functor given at construction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericItemListener

public GenericItemListener(UnaryFunctor<java.awt.event.ItemEvent,?> fn)
Builds an item listener that executes the given functor for every item event it receives.

Method Detail

buildListener

public static <T> GenericItemListener buildListener(java.lang.Class<T> type,
                                                    T object,
                                                    java.lang.String methodName)
Builds a listener invokes the given no-arg method every time an item event fires.


buildEventListener

public static <T> GenericItemListener buildEventListener(java.lang.Class<T> type,
                                                         T object,
                                                         java.lang.String methodName)
Builds a listener that passes each item event it receives to the given method.


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent evt)
Passes the item event to the functor given at construction. The result of the functor, if any, is discareded.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener


Copyright © 2002-2006 David A. Hall. All Rights Reserved.