Added two convenience methods for immediately dispatching actions on a

controller.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1166 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2003-07-11 03:42:27 +00:00
parent 1c6e74747c
commit de167377c3
@@ -1,5 +1,5 @@
//
// $Id: Controller.java,v 1.15 2002/06/19 23:22:40 mdb Exp $
// $Id: Controller.java,v 1.16 2003/07/11 03:42:27 mdb Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -231,6 +231,30 @@ public abstract class Controller
}
}
/**
* A convenience method for constructing and immediately handling an
* event on this controller (via {@link #handleAction(ActionEvent)}).
*
* @return true if the controller knew how to handle the action, false
* otherwise.
*/
public boolean handleAction (Component source, String command)
{
return handleAction(new ActionEvent(source, 0, command));
}
/**
* A convenience method for constructing and immediately handling an
* event on this controller (via {@link #handleAction(ActionEvent)}).
*
* @return true if the controller knew how to handle the action, false
* otherwise.
*/
public boolean handleAction (Component source, String command, Object arg)
{
return handleAction(new CommandEvent(source, command, arg));
}
/**
* Used by {@link #handleAction} to generate arguments to the action
* handler method.