home *** CD-ROM | disk | FTP | other *** search
- package sub_arctic.input;
-
- import sub_arctic.lib.interactor;
- import sub_arctic.lib.sub_arctic_error;
- import sub_arctic.anim.animatable;
- import sub_arctic.anim.trajectory;
- import sub_arctic.anim.transition;
-
- /**
- * This is the abstract base class for all dispatch agents in all
- * policies. This API provides methods for reporting whether the agent
- * is interested in a particular type of event, for actually dispatching
- * the event.
- *
- * @author Scott Hudson
- */
- public abstract class dispatch_agent {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Construct a dispatch agent.
- */
- public dispatch_agent()
- {
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Indicate whether the given event might be dispatchable by this
- * agent. Events will not be delivered to the agent unless they pass this
- * test. Here in the base class we accept everything.
- *
- * @param event evt the event to be tested for usefulness
- * @return boolean true if the event is one this agent is interested in
- */
- public boolean event_is_useful(event evt)
- {
- /* by default we take anything */
- return true;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Attempt to dispatch an event to an object via this agent. The
- * event is passed in all cases. For some policies (e.g.,the positional
- * policy), an object to dispatch to and a bit of user supplied information
- * (typically this was returned by the object at the time it was picked)
- * can be given. In other cases null is passed for these to parameters.<P>
- *
- * In addition, for agents which may be passed the same event more than
- * once (targeted towards different objects), a sequence number is
- * also passed. This number is guaranteed to be different for each
- * different event being dispatched (this allows the agent to know when
- * to clear its cache or advance within its state machine controller
- * in certain cases). <p>
- *
- * @param event evt the event to dispatch
- * @param Object user_info policy defined user information
- * @param interactor to_obj the object to (possibly)send the event to
- * @param int seq_num the sequence number of this event
- */
- public abstract boolean dispatch_event(
- event evt,
- Object user_info,
- interactor to_obj,
- int seq_num);
-
- // had:
- //* @exception general the agent might need to throw any exception
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This method is called by some policies (most notably the
- * positional policy) to dispatch events which did not meet the
- * selection criteria of the policy itself. This is necessary
- * for some agents, as they have state machines that depend
- * on knowing when the "next" event occurs, even if that
- * event is not over any object on the interface. <P>
- *
- * The most common use of this is to remove status displays
- * when the pointer leaves the area of an application via
- * an agent like pointable. <P>
- *
- * The default implementation of this function is to simply return
- * false.<p>
- *
- * @param event evt the event to dispatch
- * @return boolean true is returned if the event is dispatched
- */
- public boolean dispatch_unused_event(event evt) {
- return false;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This method is called by the manager after an event is
- * dispatched on all agents which have registered interest
- * in becoming aware of this fact. You can register for
- * interest using manager.add_to_after_dispatch_list(). <P>
- *
- * Note that there is no return value from the function,
- * because it is not possible to affect the event -- it
- * has already been dispatched (or not dispatched)
- * when this function is called.<P>
-
- * By default this function does nothing.<P>
- *
- * @param event evt the event which was dispatched (or not)
- * @param boolean dispatched true if the event was handled by some agent
- *
- */
- public void after_dispatch_notify(event evt, boolean dispatched) {
- return;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-