home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / INPUT / EVENT_TR.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.4 KB  |  79 lines

  1.  
  2. package sub_arctic.input;
  3.  
  4. import sub_arctic.lib.interactor;
  5.  
  6. /** 
  7.  * This is a monitor focus agent used for debugging purposes.  It does not
  8.  * actually dispatch any input, but instead prints a human readable dump
  9.  * of each event on System.err "as it goes past".  This trace can be turned
  10.  * on and off using the do_trace() method (and is by default off).
  11.  */ 
  12. public class event_trace_agent extends dispatch_agent {
  13.  
  14.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  15.  
  16.   /** Are we current doing trace output or not. */
  17.   protected boolean doing_trace;
  18.  
  19.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  20.  
  21.   /** Default constructor.  We default to tracing being off. */
  22.   public event_trace_agent()
  23.     {
  24.       doing_trace = false;
  25.     }
  26.  
  27.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  28.  
  29.   /** Turn tracing on or off.
  30.    * @param boolean on_off true means we produce trace output.
  31.    */
  32.   public void do_trace(boolean on_off)
  33.     {
  34.       doing_trace = on_off;
  35.     }
  36.  
  37.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  38.  
  39.   /** 
  40.    * "Dispatch" an event.  This agent never consumes the event.
  41.    *
  42.    * @param event      evt       event to potential display trace output for
  43.    * @param Object     user_info ignored
  44.    * @param interactor to_obj    ignored
  45.    * @param int        seq_num   ignored
  46.    * @returns boolean indication of whether event was consumed (always false).
  47.    */
  48.   public boolean dispatch_event(
  49.     event      evt,
  50.     Object     user_info,
  51.     interactor to_obj,
  52.     int        seq_num)
  53.     {
  54.       if (doing_trace) 
  55.     {
  56.       System.err.println(evt);
  57.     }
  58.       return false;
  59.     }
  60.  
  61.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  62. }
  63. /*=========================== COPYRIGHT NOTICE ===========================
  64.  
  65. This file is part of the subArctic user interface toolkit.
  66.  
  67. Copyright (c) 1996 Scott Hudson and Ian Smith
  68. All rights reserved.
  69.  
  70. The subArctic system is freely available for most uses under the terms
  71. and conditions described in 
  72.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  73. and appearing in full in the lib/interactor.java source file.
  74.  
  75. The current release and additional information about this software can be 
  76. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  77.  
  78. ========================================================================*/
  79.