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

  1.  
  2. package sub_arctic.lib;
  3.  
  4. import sub_arctic.output.drawable;
  5. import java.awt.Rectangle;
  6.  
  7. /** 
  8.  * Traversal transformer (see base_interactor.traverse_and_collect) that takes 
  9.  * a sem_draw_context and transforms it into a child object's coordinates.  
  10.  * This involves modifying the translation on the drawable surface of the 
  11.  * sem_draw_context, so that it matches the local coordinates of the child 
  12.  * object.
  13.  *  
  14.  * @see sub_arctic.lib.base_interactor#traverse_and_collect
  15.  * @see sub_arctic.lib.sem_draw_context
  16.  * @author Scott Hudson
  17.  */
  18. public class sem_draw_to_child implements traversal_xform {
  19.   /** Perform the transformation.
  20.    *  
  21.    *  @param parent_parameters a sem_draw_context object set up in parent coords
  22.    *  @param child_obj         the child object 
  23.    *  @return a sem_draw_context object set up in child coordinates
  24.    */
  25.   public Object xform(
  26.     Object     parent_parameters, 
  27.     interactor child_obj, 
  28.     int        child_index) 
  29.     {
  30.       sem_draw_context parent_context, result;
  31.  
  32.       if (!(parent_parameters instanceof sem_draw_context))
  33.     throw new sub_arctic_error(
  34.       "sem_draw_context object was expected, but not found");
  35.  
  36.       /* extract the parent context */
  37.       parent_context = (sem_draw_context)parent_parameters;
  38.  
  39.       /* copy the context and apply transformation to get to child coords */
  40.       result = new sem_draw_context(parent_context);
  41.       result.surface.translate(child_obj.x(), child_obj.y());
  42.  
  43.       return result;
  44.     }
  45.  
  46.    //had:
  47.    //* @exception sub_arctic.exception.bad_value thrown if the parent_parameters 
  48.    //*  parameter is not a sem_draw_context.
  49. };
  50. /*=========================== COPYRIGHT NOTICE ===========================
  51.  
  52. This file is part of the subArctic user interface toolkit.
  53.  
  54. Copyright (c) 1996 Scott Hudson and Ian Smith
  55. All rights reserved.
  56.  
  57. The subArctic system is freely available for most uses under the terms
  58. and conditions described in 
  59.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  60. and appearing in full in the lib/interactor.java source file.
  61.  
  62. The current release and additional information about this software can be 
  63. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  64.  
  65. ========================================================================*/
  66.