001 package com.sptci.echo2;
002
003 import java.io.Serializable;
004 import java.util.logging.Logger;
005
006 import nextapp.echo2.app.event.ActionListener;
007
008 /**
009 * An abstract base class for action listeners that use {@link
010 * Controller} to interact with the view components.
011 *
012 * <p>Copyright 2006 Sans Pareil Technologies, Inc.</p>
013 * @author Rakesh Vidyadharan 2006-11-23
014 * @version $Id: Listener.java 3215 2007-05-06 11:54:24Z rakesh $
015 */
016 public abstract class Listener<C extends Controller>
017 implements ActionListener, Serializable
018 {
019 /**
020 * The {@link Controller} instance that is used to gain access
021 * to the various view components.
022 */
023 protected final C controller;
024
025 /**
026 * The logger to use to log errors/messages to.
027 */
028 protected static final Logger logger =
029 Logger.getLogger( Listener.class.getName() );
030
031 /**
032 * Create a new instance of the listener with the specified controller.
033 *
034 * @param controller The {@link #controller} to use.
035 */
036 protected Listener( C controller )
037 {
038 this.controller = controller;
039 }
040
041 /**
042 * Returns {@link #controller}.
043 *
044 * @return C The value/reference of/to controller.
045 */
046 public C getController()
047 {
048 return controller;
049 }
050 }