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

  1.  
  2. package sub_arctic.lib;
  3.  
  4. import sub_arctic.input.pick_collector;
  5. import sub_arctic.input.event;
  6. import sub_arctic.input.focus_dispatch_agent;
  7. import sub_arctic.input.move_drag_filter;
  8.  
  9. import sub_arctic.constraints.std_encoding_consts;
  10. import sub_arctic.constraints.std_constraint_consts;
  11. import sub_arctic.constraints.std_constraint_impl;
  12. import sub_arctic.constraints.std_constraint;
  13. import sub_arctic.constraints.std_function;
  14. import sub_arctic.constraints.std_ext_constraint;
  15. import sub_arctic.constraints.constraint;
  16. import sub_arctic.constraints.value_consumer;
  17. import sub_arctic.constraints.value_provider;
  18. import sub_arctic.constraints.consumer_part_ref;
  19. import sub_arctic.constraints.provider_part_ref;
  20.  
  21. import sub_arctic.output.drawable;
  22.  
  23. import java.util.Vector;
  24. import java.awt.Component;
  25. import java.awt.Point;
  26. import java.awt.Dimension;
  27. import java.awt.Rectangle;
  28.  
  29. /** 
  30.  * This class provides the basic implementation for interactor objects.
  31.  * Although it is possible to build interactor objects without inheriting
  32.  * from this class (since interactor itself is an interface) all interactor 
  33.  * objects currently in the system inherit from this class.  <p>
  34.  * 
  35.  * This class provides basic capabilities in 12 areas: 
  36.  * <ul>
  37.  * <li> constructor and initialization support, 
  38.  * <li> geometry management, 
  39.  * <li> coordinate system 
  40.  * <li> transformations, 
  41.  * <li> hierarchy management, 
  42.  * <li> traversal support, 
  43.  * <li> layout, 
  44.  * <li> picking, 
  45.  * <li> object status, 
  46.  * <li> output, 
  47.  * <li> support for common input protocols, 
  48.  * <li> user information, and 
  49.  * <li>debugging support.  
  50.  * </ul>
  51.  * Each of these areas has a section in the source code.  See the user's 
  52.  * manual for conceptual material related to each area (each of these areas 
  53.  * is covered by a sub-section of the user's manual) and see the methods 
  54.  * below for the details of each supported routine.<p>
  55.  * 
  56.  * Note: due to limitations on some (most?) platforms that do not allow for
  57.  * protected methods in interfaces, a number of routines here (and in the 
  58.  * interactor interface) that should be protected, are currently public.
  59.  * These are marked by comments in the code, and will be reverted to protected
  60.  * as soon as enough platforms allow.<p>
  61.  *
  62.  * By convention (here and throughout the system) instance variables are all 
  63.  * protected and begin with an underscore ('_').  When access methods are 
  64.  * provide, the read method has the same name but without the underscore 
  65.  * (e.g., x()), while the write method begins with 'set_' followed by the 
  66.  * base name (e.g., set_x()).<p>
  67.  *
  68.  * @author Scott Hudson
  69.  */
  70. public class base_interactor extends min_interactor implements move_drag_filter{
  71.  
  72.   /*---------------------------------------------------------------------*/
  73.   /* Instance variables */
  74.   /*---------------------------------------------------------------------*/
  75.  
  76.   /* By convention instance variables are all protected and begin with 
  77.    * an underscore ('_').  When access methods are provide, the read 
  78.    * method has the same name but without the underscore (e.g., x()), 
  79.    * while the write method begins with 'set_' followed by the base name
  80.    * (e.g., set_x()).
  81.    */
  82.  
  83.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  84.  
  85.   /** 
  86.    * X position of the object's top-left corner in parent's coordinate 
  87.    * system.  Like all instance variables of this class, this variable 
  88.    * should probably never be accessed directly -- use the public access
  89.    * methods instead.
  90.    * @see #x
  91.    * @see #set_x
  92.    */
  93.   protected int _x;
  94.  
  95.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  96.  
  97.   /** 
  98.    * Y position of the object's top-left corner in parent's coordinate 
  99.    * system. Like all instance variables of this class, this variable 
  100.    * should probably never be accessed directly -- use the public access
  101.    * methods instead.
  102.    * @see #y
  103.    * @see #set_y
  104.    */
  105.   protected int _y;
  106.  
  107.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  108.  
  109.   /** 
  110.    * Width of the object.  Like all instance variables of this class, this 
  111.    * variable should probably never be accessed directly -- use the public 
  112.    * access methods instead.
  113.    * @see #w
  114.    * @see #set_w
  115.    */
  116.   protected int _w;
  117.  
  118.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  119.  
  120.   /** 
  121.    * Height of the object.  Like all instance variables of this class, this 
  122.    * variable should probably never be accessed directly -- use the public 
  123.    * access methods instead.
  124.    * @see #h
  125.    * @see #set_h
  126.    */
  127.   protected int _h;
  128.  
  129.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  130.  
  131.   /** 
  132.    * Encoding of constraint on x.  This instance variable should never be
  133.    * set directly.   
  134.    * @see sub_arctic.constraints.constraint
  135.    * @see #x_constraint
  136.    * @see #set_x_constraint
  137.    */
  138.   protected int _x_constraint;
  139.  
  140.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  141.  
  142.   /** 
  143.    * Encoding of constraint on y.  This instance variable should never be
  144.    * set directly.   
  145.    * @see sub_arctic.constraints.constraint
  146.    * @see #y_constraint
  147.    * @see #set_y_constraint
  148.    */
  149.   protected int _y_constraint;
  150.  
  151.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  152.  
  153.   /** 
  154.    * Encoding of constraint on w.  This instance variable should never be
  155.    * set directly.   
  156.    * @see sub_arctic.constraints.constraint
  157.    * @see #w_constraint
  158.    * @see #set_w_constraint
  159.    */
  160.   protected int _w_constraint;
  161.  
  162.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  163.  
  164.   /** 
  165.    * Encoding of constraint on h.  This instance variable should never be
  166.    * set directly.   
  167.    * @see sub_arctic.constraints.constraint
  168.    * @see #h_constraint
  169.    * @see #set_h_constraint
  170.    */
  171.   protected int _h_constraint;
  172.  
  173.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  174.  
  175.   /** 
  176.    * Encoding of constraint on visible.  This instance variable should never be
  177.    * set directly.   
  178.    * @see sub_arctic.constraints.constraint
  179.    * @see #visible_constraint
  180.    * @see #set_visible_constraint
  181.    */
  182.   protected int _visible_constraint;
  183.  
  184.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  185.  
  186.   /** 
  187.    * Encoding of constraint on enabled.  This instance variable should never be
  188.    * set directly.   
  189.    * @see sub_arctic.constraints.constraint
  190.    * @see #enabled_constraint
  191.    * @see #set_enabled_constraint
  192.    */
  193.   protected int _enabled_constraint;
  194.  
  195.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  196.  
  197.   /** 
  198.    * Encoding of constraint on part_a.  This instance variable should never be
  199.    * set directly.   
  200.    * @see sub_arctic.constraints.constraint
  201.    * @see #part_a_constraint
  202.    * @see #set_part_a_constraint
  203.    */
  204.   protected int _part_a_constraint;
  205.  
  206.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  207.  
  208.   /** 
  209.    * Encoding of constraint on part_b.  This instance variable should never be
  210.    * set directly.   
  211.    * @see sub_arctic.constraints.constraint
  212.    * @see #part_b_constraint
  213.    * @see #set_part_b_constraint
  214.    */
  215.   protected int _part_b_constraint;
  216.  
  217.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  218.  
  219.   /** 
  220.    * Parent of this object.  Can be null if object is not currently installed
  221.    * in an interactor tree, or if this is a top_level interactor.  This 
  222.    * instance variable should never be set directly.
  223.    * @see #parent
  224.    * @see #set_parent
  225.    */
  226.   protected interactor _parent;
  227.  
  228.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  229.  
  230.   /** 
  231.    * Index of this object within the parent's child list. This instance 
  232.    * variable should never be set directly.  
  233.    * @see #child_index
  234.    * @see #set_child_index
  235.    */
  236.   protected int _child_index;
  237.  
  238.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  239.  
  240.   /** 
  241.    * Child interactors of this object.  _child_list will be null for 
  242.    * interactor classes that do not support children (in that case, the 
  243.    * SUPPORTS_CHILDREN bit in _flags should also be 0).  Interactor 
  244.    * classes with FIXED_CHILDREN set to 1 will always have the same 
  245.    * number of children and attempting to assign outside that range will 
  246.    * cause an error.  In general, entries may be null.  
  247.    *
  248.    * @see #num_children
  249.    * @see #child
  250.    * @see #set_child
  251.    * @see #add_child
  252.    * @see #insert_child
  253.    * @see #remove_child
  254.    * @see #find_child
  255.    * @see #move_child_to_top
  256.    * @see #move_child_to_bottom
  257.    * @see #move_child_upward
  258.    * @see #move_child_downward
  259.    */
  260.   protected Vector _child_list;
  261.  
  262.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  263.  
  264.   /** 
  265.    * Small bitset of flags indicating facts about this interactor.  See 
  266.    * interactor_consts.java for possible values and their meaning.  Flag
  267.    * values are normally tested and set by flag_is_set(), set_flag_bit(),
  268.    * and clear_flag_bit().
  269.    *
  270.    * @see sub_arctic.lib.interactor_consts
  271.    * @see #flag_is_set
  272.    * @see #set_flag_bit
  273.    * @see #clear_flag_bit
  274.    */
  275.   protected int _flags = 0;
  276.  
  277.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  278.  
  279.   /** 
  280.    * Small bitset of flags indicating facts about the constraints of this 
  281.    * interactor.  See interactor_consts.java for possible values and their 
  282.    * meaning.  Flag values are normally tested and set by 
  283.    * constraint_flag_is_set(),  set_constraint_flag_bit(), and 
  284.    * clear_constraint_flag_bit().
  285.    *
  286.    * @see sub_arctic.lib.interactor_consts
  287.    * @see #constraint_flag_is_set
  288.    * @see #set_constraint_flag_bit
  289.    * @see #clear_constraint_flag_bit
  290.    */
  291.   protected int _constraint_flags = 0;
  292.  
  293.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  294.  
  295.   /** 
  296.    * Information we are holding for the user or application.  This object
  297.    * is attached to the interactor, but otherwise the toolkit itself does
  298.    * not touch it.  This allows for example, callback objects to retrieve 
  299.    * application specific information related to this object.  
  300.    *
  301.    * @see #user_info
  302.    * @see #set_user_info
  303.    */
  304.   protected Object _user_info;
  305.   
  306.   /*---------------------------------------------------------------------*/
  307.   /* Constructors and init routines */
  308.   /*---------------------------------------------------------------------*/
  309.  
  310.   /** 
  311.    * Full constructor.
  312.    * 
  313.    * @param int x_v  x position of this interactor within its parent's 
  314.    *                 coordinate system.
  315.    * @param int y_v  y position of this interactor within its parent's 
  316.    *                 coordinate system.
  317.    * @param int w_v  width of this interactor.
  318.    * @param int h_v  height of this interactor.
  319.    */
  320.   public base_interactor(int x_v, int y_v, int w_v, int h_v)
  321.     {
  322.       _parent     = null;
  323.       _child_list = null;
  324.       _x          = x_v;
  325.       _y          = y_v;
  326.       _w          = w_v;
  327.       _h          = h_v;
  328.       _x_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  329.       _y_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  330.       _w_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  331.       _h_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  332.       _visible_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  333.       _enabled_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  334.       _part_a_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  335.       _part_b_constraint = std_constraint_consts.NO_CONSTRAINT.encoding();
  336.       _flags = IS_VISIBLE | IS_ENABLED | DAMAGED;
  337.       _constraint_flags = 0;
  338.     }
  339.  
  340.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  341.  
  342.   /** 
  343.    * Constructor that assumes a (temporary) default size. 
  344.    *
  345.    * @param int x_v  x position of this interactor within its parent's 
  346.    *                 coordinate system.
  347.    * @param int y_v  y position of this interactor within its parent's 
  348.    *                 coordinate system.
  349.    */
  350.   public base_interactor(int x_v, int y_v) 
  351. {
  352.       /* Choose a small size we are unlikely to get otherwise by accident */
  353.       this(x_v, y_v, 13, 17);
  354.     }
  355.  
  356.    //had:
  357.    //* @exception general
  358.  
  359.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  360.  
  361.   /** 
  362.    * Constructor that assumes a position of 0,0, and a (temporary) default 
  363.    * size.
  364.    */
  365.   public base_interactor() 
  366. {
  367.       this(0, 0);
  368.     }
  369.    //had:
  370.    //* @exception general
  371.  
  372.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  373.  
  374.   /** 
  375.    * Helper method to set up object to support an expandable set of children.
  376.    * This will normally be called from the constructor of a subclass that 
  377.    * wants to support children (by default, base_interactor does not).  The 
  378.    * size_hint indicates how much storage to initially allocate in the child 
  379.    * list Vector (however, num_children() initially returns 0 regardless of 
  380.    * what is given here).
  381.    *
  382.    * @param int size_hint hint for initial size allocation for the child vector.
  383.    */
  384.   protected void setup_for_children(int size_hint)
  385.     {
  386.       _flags |= SUPPORTS_CHILDREN;
  387.       _child_list = new Vector(size_hint);
  388.     }
  389.  
  390.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  391.  
  392.   /** Default initial allocation for child lists */
  393.   protected static final int default_child_hint = 3;
  394.  
  395.   /** Helper method to set up object to support children.  This will normally
  396.    *  be called from the constructor of a subclass that wants to support 
  397.    *  children (by default, base_interactor does not).  
  398.    */
  399.   protected void setup_for_children()
  400.     {
  401.       setup_for_children(default_child_hint);
  402.     }
  403.  
  404.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  405.  
  406.   /** 
  407.    * Helper method to set up object to support a fixed set of children.
  408.    * This will normally be called from the constructor of a subclass that
  409.    * wants to support children (by default base_interactor does not), but 
  410.    * which either assigns specific meanings/roles to specific children, or for 
  411.    * some other reason limits the number of  children it will support.  This
  412.    * method allocates the given number of slots for children and sets them
  413.    * each to null.
  414.    * 
  415.    * int number the number of children this object will have.
  416.    */
  417.   protected void setup_for_fixed_children(int number)
  418.     {
  419.       _flags |= SUPPORTS_CHILDREN | FIXED_CHILDREN;
  420.       _child_list = new Vector(number);
  421.       _child_list.setSize(number);
  422.     }
  423.  
  424.   /*---------------------------------------------------------------------*/
  425.   /* Basic object geometry */
  426.   /*---------------------------------------------------------------------*/
  427.  
  428.   /** 
  429.    * Position of the top-left corner of this object in the parent coordinate
  430.    * system.  If either coordinate is controlled by a constraint, it will be
  431.    * brought up to date before this value is returned.
  432.    * @return Point the position of the object.
  433.    */
  434.   public Point pos() {return new Point(x(), y());}
  435.  
  436.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  437.  
  438.   /** 
  439.    * X position of the top-left corner of this object in the parent coordinate
  440.    * system.  If this coordinate is controlled by a constraint, it will be
  441.    * brought up to date before this value is returned.
  442.    * @return int the x position of the object.
  443.    */
  444.   public int x() 
  445.     {
  446.       /* make sure its up to date, then return it */
  447.       eval_x();
  448.       return _x;
  449.     }
  450.  
  451.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  452.  
  453.   /** 
  454.    * Y position of the top-left corner of this object in the parent coordinate
  455.    * system.  If this coordinate is controlled by a constraint, it will be
  456.    * brought up to date before this value is returned.
  457.    * @return int the y position of the object.
  458.    */
  459.   public int y() 
  460.     {
  461.       /* make sure its up to date, then return it */
  462.       eval_y();
  463.       return _y;
  464.     }
  465.  
  466.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  467.  
  468.   /** 
  469.    * Size of the object.  If either the width or height of the object is
  470.    * controlled by a constraint, it will be brought up to date before this
  471.    * value is returned.
  472.    * @return Dimension the size of the object.
  473.    */
  474.   public Dimension size() {return new Dimension(w(),h());};
  475.  
  476.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  477.  
  478.   /** 
  479.    * Width of the object.  If this value is controlled by a constraint, it will
  480.    * be brought up to date before being returned.
  481.    * @return int the width of the object.
  482.    */
  483.   public int w() 
  484.     {
  485.       /* make sure its up to date, then return it */
  486.       eval_w();
  487.       return _w;
  488.     }
  489.  
  490.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  491.  
  492.   /** 
  493.    * Height of the object.  If this value is controlled by a constraint, it
  494.    * will be brought up to date before being returned.
  495.    * @return int the height of the object.
  496.    */
  497.   public int h() 
  498.     {
  499.       /* make sure its up to date, then return it */
  500.       eval_h();
  501.       return _h;
  502.     }
  503.  
  504.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  505.  
  506.   /** 
  507.    * Bounding rectangle of the object (in parent's coordinate system). 
  508.    * @return Rectangle the bounding rectangle of the object.
  509.    */
  510.   public Rectangle bound() 
  511.     { 
  512.       return new Rectangle(x(), y(), w(), h());
  513.     }
  514.  
  515.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  516.  
  517.   /** 
  518.    * Get the specified component (X, Y, W, or H) or of object's geometry. This
  519.    * also now works for VISIBLE, ENABLED, PART_A, and PART_B. 
  520.    * @param what_code part number whose value is being requested.
  521.    * @return int the value of the requested part (after brining any attached 
  522.    *             constraints up-to-date).
  523.    */
  524.   public int get_part(int what_code) 
  525. {
  526.       switch (what_code)
  527.     {
  528.       case X:       return x();
  529.       case Y:       return y();
  530.       case W:       return w();
  531.       case H:       return h();
  532.       case VISIBLE: return visible()?1:0 ;
  533.       case ENABLED: return enabled()?1:0;
  534.       case PART_A:   return part_a();
  535.       case PART_B:   return part_b();
  536.       default: 
  537.         throw new sub_arctic_error("Unrecognized part code " + what_code + 
  538.                     " passed to get_part()");
  539.     }
  540.     }
  541.  
  542.    //had:
  543.    //* @exception bad_value if the given part number is unknown to this object.
  544.  
  545.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  546.  
  547.   /** 
  548.    * Set position of this object in parent coordinate system.  
  549.    * 
  550.    * @param int yv y coordinate of the position.
  551.    * @param int xv x coordinate of the position.
  552.    */
  553.   public void set_pos(int xv, int yv) 
  554. {
  555.       set_x(xv); 
  556.       set_y(yv);
  557.     }
  558.  
  559.    //had:
  560.    //* @exception cannot_assign if either the x or y coordinate of the object 
  561.    //*                          is constrained.
  562.    //* @exception general
  563.  
  564.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  565.  
  566.   /** 
  567.    * Set position of this object in parent coordinate system.  
  568.    * 
  569.    * @param Point p the new position.
  570.    */
  571.   public void set_pos(Point p) 
  572. {
  573.       set_x(p.x); 
  574.       set_y(p.y);
  575.     }
  576.  
  577.    //had:
  578.    //* @exception cannot_assign if either the x or y coordinate of the object 
  579.    //*                          is constrained.
  580.    //* @exception general
  581.  
  582.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  583.  
  584.   /** 
  585.    * Set x value directly bypassing the constraint system (but doing movement
  586.    * damage).  This should normally only be done by the constraint system 
  587.    * or some other part of the system which takes care of marking things 
  588.    * out-of-date, etc. itself. 
  589.    *
  590.    * @param int v the new value for x.
  591.    */
  592.   protected void set_raw_x(int v) 
  593. {
  594.       /* don't do anything unless this is a change */
  595.       if (v != _x)
  596.     {
  597.           /* damage our old position */
  598.           damage_self();  
  599.  
  600.           /* move */
  601.           _x = v;
  602.  
  603.           /* damage our new position */
  604.           damage_self();
  605.     }
  606.     }
  607.  
  608.    //had:
  609.    //* @exception general
  610.  
  611.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  612.  
  613.   /** 
  614.    * Set x component of position in parent coordinate system.  
  615.    * @param int v the new value for x.
  616.    */
  617.   public void set_x(int v) 
  618. {
  619.       /* if this has a constraint throw an exception */
  620.       if ((active_constraints() & X) != 0)
  621.         throw new sub_arctic_error(
  622.       "Attempt to assign value to constrained x coordinate");
  623.  
  624.       /* don't do anything unless this is a change */
  625.       if (v != _x)
  626.     {
  627.       set_raw_x(v);
  628.       mark_x_ood();
  629.     }
  630.     }
  631.  
  632.    //had:
  633.    //* @exception cannot_assign if a constraint is attached to this coordinate. 
  634.    //* @exception general
  635.  
  636.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  637.  
  638.   /** 
  639.    * Set y value directly bypassing the constraint system (but doing movement
  640.    * damage).  This should normally only be done by the constraint system 
  641.    * or some other part of the system which takes care of marking things 
  642.    * out-of-date, etc. itself. 
  643.    *
  644.    * @param int v the new value for y.
  645.    */
  646.   protected void set_raw_y(int v) 
  647. {
  648.       /* don't do anything unless this is a change */
  649.       if (v != _y)
  650.     {
  651.           /* damage our old position */
  652.           damage_self();  
  653.  
  654.           /* move */
  655.           _y = v;
  656.  
  657.           /* damage our new position */
  658.           damage_self();
  659.     }
  660.     }
  661.  
  662.    //had:
  663.    //* @exception general
  664.  
  665.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  666.  
  667.   /** 
  668.    * Set y component of position in parent coordinate system.  
  669.    * @param int v the new value for y.
  670.    */
  671.   public void set_y(int v) 
  672. {
  673.       /* if this has a constraint throw an exception */
  674.       if ((active_constraints() & Y) != 0)
  675.         throw new sub_arctic_error(
  676.       "Attempt to assign value to constrained y coordinate");
  677.  
  678.       /* don't do anything unless this is a change */
  679.       if (v != _y)
  680.     {
  681.       set_raw_y(v);
  682.       mark_y_ood();
  683.     }
  684.     }
  685.  
  686.    //had:
  687.    //* @exception cannot_assign if a constraint is attached to this coordinate. 
  688.    //* @exception general
  689.  
  690.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  691.  
  692.   /** 
  693.    * Set the size of the object.  
  694.    * @param int wv the new value for w.
  695.    * @param int hv the new value for h.
  696.    */
  697.   public void set_size(int wv, int hv) 
  698. {
  699.       set_w(wv);
  700.       set_h(hv);
  701.     }
  702.  
  703.    //had:
  704.    //* @exception cannot_assign if a constraint is attached to either coordinate. 
  705.    //* @exception general
  706.  
  707.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  708.  
  709.   /** 
  710.    * Set intrinsic size.  This method is called by subclasses to establish or
  711.    * change the size of the interactor when its size is considered to be 
  712.    * intrinsically constrained.  This method marks values out of date, but
  713.    * does not declare damage for the object.
  714.    * 
  715.    * @param int wv the new value for w.
  716.    * @param int hv the new value for h.
  717.    */
  718.   protected void set_intrinsic_size(int wv, int hv) 
  719. {
  720.       set_intrinsic_w(wv);
  721.       set_intrinsic_h(hv);
  722.     }
  723.  
  724.    //had:
  725.    //* @exception general
  726.  
  727.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  728.  
  729.   /** Set w value directly bypassing the constraint system (but doing movement
  730.    *  damage).  This should normally only be done by the constraint system 
  731.    *  or some other part of the system which takes care of marking things 
  732.    *  out-of-date, etc. itself. 
  733.    *
  734.    * @param int v the new value for w.
  735.    */
  736.   protected void set_raw_w(int v) 
  737. {
  738.       /* don't do anything unless this is a change */
  739.       if (v != _w)
  740.     {
  741.           /* damage our old position */
  742.           damage_self();  
  743.  
  744.           /* move */
  745.           _w = v;
  746.  
  747.           /* damage our new position */
  748.           damage_self();
  749.     }
  750.     }
  751.  
  752.    //had:
  753.    //* @exception general
  754.  
  755.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  756.  
  757.    /** 
  758.     * Set width of object.  
  759.     * @param int v the new value for y.
  760.     */
  761.    public void set_w(int v) 
  762.       /* if this has a constraint throw an exception */
  763.       if ((active_constraints() & W) != 0)
  764.         throw new sub_arctic_error(
  765.       "Attempt to assign value to constrained width");
  766.  
  767.       /* don't do anything unless this is a change */
  768.       if (v != _w)
  769.     {
  770.       set_raw_w(v);
  771.       mark_w_ood();
  772.     }
  773.     }
  774.  
  775.     //had:
  776.     //* @exception cannot_assign if a constraint is attached to this coordinate. 
  777.     //* @exception general
  778.  
  779.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  780.  
  781.   /** 
  782.    * Set intrinsic width.  This method is called by subclasses to establish or
  783.    * change the width of the interactor when its width is considered to be 
  784.    * intrinsically constrained.  This method marks values out of date, but
  785.    * does not declare damage for the object.
  786.    *
  787.    * @param int wv new value for w.
  788.    */
  789.   protected void set_intrinsic_w(int wv) 
  790. {
  791.       /* if the width is not declared as intrinsic, throw an exception */
  792.       if ((W & intrinsic_constraints()) == 0)
  793.     throw new sub_arctic_error("Value is not intrinsically constrained");
  794.  
  795.       if (wv != _w)
  796.     {
  797.       set_raw_w(wv);
  798.       mark_w_ood();
  799.     }
  800.     }
  801.  
  802.    //had:
  803.    //* @exception cannot_assign if the width is not intrinsically constrained.
  804.    //* @exception general
  805.  
  806.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  807.  
  808.   /** 
  809.    * Set h value directly bypassing the constraint system (but doing movement
  810.    * damage).  This should normally only be done by the constraint system 
  811.    * or some other part of the system which takes care of marking things 
  812.    * out-of-date, etc. itself. 
  813.    *
  814.    * @param int v the new value for the height.
  815.    */
  816.   protected void set_raw_h(int v) 
  817. {
  818.       /* don't do anything unless this is a change */
  819.       if (v != _h)
  820.     {
  821.           /* damage our old position */
  822.           damage_self();  
  823.  
  824.           /* move */
  825.           _h = v;
  826.  
  827.           /* damage our new position */
  828.           damage_self();
  829.     }
  830.     }
  831.  
  832.    //had:
  833.    //* @exception general
  834.  
  835.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  836.  
  837.   /** 
  838.    * Set height of object.  
  839.    * @param int v the new value for the height.
  840.    */
  841.   public void set_h(int v) 
  842. {
  843.       /* if this has a constraint throw an exception */
  844.       if ((active_constraints() & H) != 0)
  845.         throw new sub_arctic_error(
  846.       "Attempt to assign value to constrained height");
  847.  
  848.       /* don't do anything unless this is a change */
  849.       if (v != _h)
  850.     {
  851.       set_raw_h(v);
  852.       mark_h_ood();
  853.     }
  854.     }
  855.  
  856.    //had:
  857.    //* @exception cannot_assign if the height is controlled by a constraint.
  858.  
  859.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  860.  
  861.   /** 
  862.    * Set intrinsic height.  This method is called by subclasses to establish or
  863.    * change the height of the interactor when its width is considered to be 
  864.    * intrinsically constrained.  This method marks values out of date, but
  865.    * does not declare damage for the object.
  866.    *
  867.    * @param int hv the new value for the height.
  868.    */
  869.   protected void set_intrinsic_h(int hv) 
  870. {
  871.       /* if the height is not declared as intrinsic, throw an exception */
  872.       if ((H & intrinsic_constraints()) == 0)
  873.     throw new sub_arctic_error("Value is not intrinsically constrained");
  874.  
  875.       if (hv != _h)
  876.     {
  877.       set_raw_h(hv);
  878.       mark_h_ood();
  879.     }
  880.     }
  881.  
  882.    //had:
  883.    //* @exception cannot_assign if the height is not intrinsically constrained.
  884.    //* @exception general 
  885.  
  886.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  887.  
  888.   /** 
  889.    * Indicate if the object considers itself visible.  If a constraint is 
  890.    * attached the value will be brought up-to-date with respect to the 
  891.    * constraint first.
  892.    * @return boolean the visibility status of the object
  893.    */
  894.   public boolean visible() 
  895.     {
  896.       /* make sure its up to date, then return the value */
  897.       eval_visible();
  898.       return flag_is_set(IS_VISIBLE);
  899.      }
  900.  
  901.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  902.  
  903.   /** 
  904.    * Set visible value directly bypassing the constraint system (but doing 
  905.    * screen damage).  This should normally only be done by the constraint 
  906.    * system or some other part of the system which takes care of marking 
  907.    * things out-of-date, etc. itself. 
  908.    *
  909.    * @param boolean v the new visibility status.
  910.    */
  911.   protected void set_raw_visible(boolean v) 
  912. {
  913.       /* don't do anything unless this is a change */
  914.       if (v != flag_is_set(IS_VISIBLE))
  915.     {
  916.           /* change */
  917.           set_flag_bit(IS_VISIBLE, v);
  918.  
  919.           /* damage our image */
  920.           damage_self();
  921.     }
  922.     }
  923.  
  924.    //had:
  925.    //* @exception general
  926.  
  927.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  928.  
  929.   /** 
  930.    * Set the visibility of the interactor. 
  931.    * @param boolean v the new visibility status.
  932.    */
  933.   public void set_visible(boolean v) 
  934. {
  935.       /* if this has a constraint throw an exception */
  936.       if ((active_constraints() & VISIBLE) != 0)
  937.         throw new sub_arctic_error(
  938.       "Attempt to assign value to constrained visible coordinate");
  939.  
  940.       if (v != flag_is_set(IS_VISIBLE)) 
  941.     {
  942.       set_raw_visible(v);
  943.       mark_visible_ood();
  944.     }
  945.     }
  946.  
  947.    //had:
  948.    //* @exception general
  949.  
  950.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  951.  
  952.   /** 
  953.    * Indicate if object is enabled. If a constraint is attached the value 
  954.    * will be brought up-to-date with respect to the constraint first.<p>
  955.    *
  956.    * Note: currently setting an object disabled will keep it from being
  957.    * picked by the normal picking mechanism.  This will (normally) disable 
  958.    * positional inputs and as a side effect most focus based input (unless the
  959.    * the object is already the focus).  However, since enabled status was 
  960.    * added after many of the core interactor classes were created, for the 
  961.    * most part the interactors in the library do not yet properly reflect the 
  962.    * enable/disable status in their visual appearance.  This is an important
  963.    * deficiency which we hope to correct in future releases.
  964.    *
  965.    * @return boolean the enable status of the interactor.
  966.    */
  967.   public boolean enabled() 
  968.     {
  969.       /* make sure its up to date, then return the value */
  970.       eval_enabled();
  971.       return flag_is_set(IS_ENABLED);
  972.     }
  973.  
  974.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  975.  
  976.   /** 
  977.    * Set enabled value directly bypassing the constraint system (but doing 
  978.    * screen damage).  This should normally only be done by the constraint 
  979.    * system or some other part of the system which takes care of marking 
  980.    * things out-of-date, etc. itself. 
  981.    *
  982.    * @param boolean v the new enable status.
  983.    */
  984.   protected void set_raw_enabled(boolean v) 
  985. {
  986.       /* don't do anything unless this is a change */
  987.       if (v != flag_is_set(IS_ENABLED))
  988.     {
  989.           /* change */
  990.           set_flag_bit(IS_ENABLED, v);
  991.  
  992.           /* damage our image */
  993.           damage_self();
  994.     }
  995.     }
  996.  
  997.    //had:
  998.    //* @exception general
  999.  
  1000.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1001.  
  1002.   /** 
  1003.    * Set the enabled status of the interactor. 
  1004.    * @param boolean v new value of enabled.
  1005.    */
  1006.   public void set_enabled(boolean v) 
  1007. {
  1008.       /* if this has a constraint throw an exception */
  1009.       if ((active_constraints() & ENABLED) != 0)
  1010.         throw new sub_arctic_error(
  1011.       "Attempt to assign value to constrained enabled coordinate");
  1012.  
  1013.       if (v != enabled()) 
  1014.     {
  1015.       set_raw_enabled(v);
  1016.       mark_enabled_ood();
  1017.     }
  1018.     }
  1019.  
  1020.    //had:
  1021.    //* @exception general
  1022.  
  1023.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1024.  
  1025.   /** 
  1026.    * Return the value of part_a.  Part_a is a generic value that may be 
  1027.    * maintained by an interactor to represent some specific semantically
  1028.    * meaningful part of its state that it wants to make available for use
  1029.    * in the (lightweight) constraint system.  For example, sliders make
  1030.    * their "thumb value" available as part_a. Here in the base class, 
  1031.    * part_a is not implemented (it is intrinsically constrained to 0).
  1032.    * see the commented out sample code in the source for details of how 
  1033.    * to implement a custom part_a for interactor subclasses.  Alternately,
  1034.    * you can inherit from the interactor_with_parts or parent_with_parts
  1035.    * classes rather than base_interactor. 
  1036.    *
  1037.    * @see sub_arctic.lib.interactor_with_parts
  1038.    * @see sub_arctic.lib.parent_with_parts
  1039.    * @return int the value of part_a (after constraint evaluation if necessary).
  1040.    */
  1041.   public int part_a() 
  1042.     { 
  1043.       return 0; 
  1044.  
  1045.       /* in a typical subclass you would want to do something like this 
  1046.        * (substituting the actual storage location for _part_a below). */
  1047.       // eval_part_a();
  1048.       // return _part_a;
  1049.     }
  1050.  
  1051.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1052.  
  1053.   /** 
  1054.    * Set part_a value directly bypassing the constraint system. This should 
  1055.    * normally only be done by the constraint system or some other part of 
  1056.    * the system which takes care of marking things out-of-date, etc. itself.<p>
  1057.    * 
  1058.    * Here in the base class we have not implemented part_a, so this has no
  1059.    * effect.  In subclasses, this should first test if this is a change. 
  1060.    * if it is, then this should modify the value and (in most cases) call 
  1061.    * damage_self().  See the commented out sample code in the source for 
  1062.    * complete details.  Better yet you can just inherit an implementation 
  1063.    * from interactor_with_parts or parent_with_parts.
  1064.    *
  1065.    * @see sub_arctic.lib.interactor_with_parts
  1066.    * @see sub_arctic.lib.parent_with_parts
  1067.    * @param int v the new value for part_a
  1068.    */
  1069.   protected void set_raw_part_a(int v) 
  1070. {
  1071.       /* here we do nothing */
  1072.  
  1073.       /* in a typical subclass you would want to do something like this 
  1074.        * (substituting the actual storage location for _part_a below). */
  1075.  
  1076.       // /* don't do anything unless this is a change */
  1077.       // if (v != _part_a)
  1078.       //   {
  1079.       //     /* change the value and damage our image */
  1080.       //     _part_a = v;
  1081.       //     damage_self();
  1082.       //   }
  1083.     }
  1084.  
  1085.    //had:
  1086.    //* @exception general
  1087.  
  1088.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1089.  
  1090.   /** 
  1091.    * Set part_a of object.  If part is controlled by a constraint, an
  1092.    * exception is thrown.  Here in the base class this is always the case.<p>  
  1093.    *
  1094.    * For subclasses implementing part_a see the commented out sample code
  1095.    * in the source or inherit from interactor_with_parts or parent_with_parts.
  1096.    *
  1097.    * @param int v the new value for part_a
  1098.    */
  1099.   public void set_part_a(int v) 
  1100. {
  1101.       /* here we just throw the exception */
  1102.       throw new sub_arctic_error(
  1103.                "Attempt to assign value to constrained part_a");
  1104.  
  1105.       /* in a typical subclass you would want to do something like this 
  1106.        * (substituting the actual storage location for _part_a below). */
  1107.  
  1108.       // /* if this has a constraint throw an exception */
  1109.       // if ((active_constraints() & PART_A) != 0)
  1110.       //   throw new sub_arctic_error(
  1111.       //     "Attempt to assign value to constrained part_a");
  1112.       //
  1113.       // /* don't do anything unless this is a change */
  1114.       // if (v != _part_a)
  1115.       // {
  1116.       //   set_raw_part_a(v);
  1117.       //   mark_part_a_ood();
  1118.       // }
  1119.     }
  1120.  
  1121.    //had:
  1122.    //* @exception cannot_assign if part_a is constrained.
  1123.    //* @exception general
  1124.  
  1125.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1126.  
  1127.   /** 
  1128.    * Return the value of part_b.  Part_b is a generic value that may be 
  1129.    * maintained by an interactor to represent some specific semantically
  1130.    * meaningful part of its state that it wants to make available for use
  1131.    * in the (lightweight) constraint system.  For example, sliders make
  1132.    * their "thumb value" available as part_b. Here in the base class, 
  1133.    * part_b is not implemented (it is intrinsically constrained to 0).
  1134.    * see the commented out sample code in the source for details of how 
  1135.    * to implement a custom part_b for interactor subclasses.  Alternately,
  1136.    * you can inherit from the interactor_with_parts or parent_with_parts
  1137.    * classes rather than base_interactor. 
  1138.    *
  1139.    * @see sub_arctic.lib.interactor_with_parts
  1140.    * @see sub_arctic.lib.parent_with_parts
  1141.    * @return int the value of part_b (after constraint evaluation if necessary).
  1142.    */
  1143.   public int part_b() 
  1144.     { 
  1145.       return 0; 
  1146.  
  1147.       /* in a typical subclass you would want to do something like this 
  1148.        * (substituting the actual storage location for _part_b below). */
  1149.       // eval_part_b();
  1150.       // return _part_b;
  1151.      }
  1152.  
  1153.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1154.  
  1155.   /** 
  1156.    * Set part_b value directly bypassing the constraint system. This should 
  1157.    * normally only be done by the constraint system or some other part of 
  1158.    * the system which takes care of marking things out-of-date, etc. itself.<p>
  1159.    * 
  1160.    * Here in the base class we have not implemented part_b, so this has no
  1161.    * effect.  In subclasses, this should first test if this is a change. 
  1162.    * if it is, then this should modify the value and (in most cases) call 
  1163.    * damage_self().  See the commented out sample code in the source for 
  1164.    * complete details.  Better yet you can just inherit an implementation 
  1165.    * from interactor_with_parts or parent_with_parts.
  1166.    *
  1167.    * @see sub_arctic.lib.interactor_with_parts
  1168.    * @see sub_arctic.lib.parent_with_parts
  1169.    * @param int v the new value for part_b
  1170.    */
  1171.   protected void set_raw_part_b(int v) 
  1172. {
  1173.       /* here we do nothing */
  1174.  
  1175.       /* in a typical subclass you would want to do something like this 
  1176.        * (substituting the actual storage location for _part_b below). */
  1177.  
  1178.       // /* don't do anything unless this is a change */
  1179.       // if (v != _part_b)
  1180.       //   {
  1181.       //     /* change the value and damage our image */
  1182.       //     _part_b = v;
  1183.       //     damage_self();
  1184.       //   }
  1185.     }
  1186.  
  1187.    //had:
  1188.    //* @exception general
  1189.  
  1190.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1191.  
  1192.   /** 
  1193.    * Set part_b of object.  If part is controlled by a constraint, an
  1194.    * exception is thrown.  Here in the base class this is always the case.<p>  
  1195.    *
  1196.    * For subclasses implementing part_b see the commented out sample code
  1197.    * in the source or inherit from interactor_with_parts or parent_with_parts.
  1198.    *
  1199.    * @param int v the new value for part_b
  1200.    */
  1201.   public void set_part_b(int v) 
  1202. {
  1203.       /* here we just throw the exception */
  1204.       throw new sub_arctic_error(
  1205.                "Attempt to assign value to constrained part_b");
  1206.  
  1207.       /* in a typical subclass you would want to do something like this 
  1208.        * (substituting the actual storage location for _part_b below). */
  1209.  
  1210.       // /* if this has a constraint throw an exception */
  1211.       // if ((active_constraints() & PART_B) != 0)
  1212.       //   throw new sub_arctic_error(
  1213.       //     "Attempt to assign value to constrained part_b");
  1214.       //
  1215.       // /* don't do anything unless this is a change */
  1216.       // if (v != _part_b)
  1217.       // {
  1218.       //   set_raw_part_b(v);
  1219.       //   mark_part_b_ood();
  1220.       // }
  1221.     }
  1222.  
  1223.    //had:
  1224.    //* @exception cannot_assign if part_b is constrained.
  1225.    //* @exception general
  1226.  
  1227.   /*---------------------------------------------------------------------*/
  1228.   /* Coordinate system transformations */
  1229.   /*---------------------------------------------------------------------*/
  1230.  
  1231.   /** 
  1232.    * Transform a point in the local coordinate space into the global space 
  1233.    * (that is the coordinate system of the top_level object which roots the
  1234.    * interactor tree this object is in). 
  1235.    *
  1236.    * @param int xv x coordinate of point to transform.
  1237.    * @param int yv y coordinate of point to transform.
  1238.    * @return Point resulting point.
  1239.    */
  1240.   public Point local_to_global(int xv, int yv)
  1241.     {
  1242.       Point result = new Point(xv, yv);
  1243.  
  1244.       /* walk up the parent chain applying translations */
  1245.       for (interactor i = this; i != null; i = i.parent())
  1246.     result = i.into_parent(result);
  1247.       return result;
  1248.     }
  1249.  
  1250.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1251.  
  1252.   /** 
  1253.    * Transform a point in the local coordinate space into the global space 
  1254.    * (that is the coordinate system of the top_level object which roots the
  1255.    * interactor tree this object is in). 
  1256.    *
  1257.    * @param Point local_pt point to transform.
  1258.    * @return Point resulting point.
  1259.    */
  1260.   public Point local_to_global(Point local_pt)
  1261.     {
  1262.       Point result = new Point(local_pt.x, local_pt.y);
  1263.  
  1264.       /* walk up the parent chain applying translations */
  1265.       for (interactor i = this; i != null; i = i.parent())
  1266.     result = i.into_parent(result);
  1267.       return result;
  1268.     }
  1269.  
  1270.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1271.  
  1272.   /** 
  1273.    * Transform a point in global coordinate space (that is the coordinate 
  1274.    * system of the top_level object which roots the interactor tree this 
  1275.    * object is in) into the local space of the object. 
  1276.    *
  1277.    * @param int xv x coordinate of point to transform.
  1278.    * @param int yv y coordinate of point to transform.
  1279.    * @return Point resulting point.
  1280.    */
  1281.   public Point global_to_local(int xv, int yv)
  1282.     {
  1283.       /* if we are the tool then local is global */
  1284.       interactor p = parent();
  1285.       if (p == null)
  1286.     return new Point(xv, yv);
  1287.       else
  1288.     /* recursively convert into parent's coords, then into ours */
  1289.     return into_local(p.global_to_local(new Point(xv,yv)));
  1290.     }
  1291.  
  1292.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1293.  
  1294.   /** 
  1295.    * Transform a point in global coordinate space (that is the coordinate 
  1296.    * system of the top_level object which roots the interactor tree this 
  1297.    * object is in) into the local space of the object. 
  1298.    *
  1299.    * @param Point global_pt point to transform.
  1300.    * @return Point resulting point.
  1301.    */
  1302.   public Point global_to_local(Point global_pt)
  1303.     {
  1304.       /* if we are the tool then local is global */
  1305.       interactor p = parent();
  1306.       if (p == null)
  1307.     return new Point(global_pt.x, global_pt.y);
  1308.       else
  1309.     /* recursively convert into parent's coords, then into ours */
  1310.     return into_local(p.global_to_local(global_pt));
  1311.     }
  1312.  
  1313.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1314.  
  1315.   /** 
  1316.    * Transform a point from parent's coordinate space to local coordinates of
  1317.    * this object. 
  1318.    *
  1319.    * @param int xv x coordinate of point to transform.
  1320.    * @param int yv y coordinate of point to transform.
  1321.    * @return Point resulting point.
  1322.    */
  1323.   public Point into_local(int xv, int yv)
  1324.     {
  1325.       Point result = new Point(xv, yv);
  1326.       result.x = result.x - x();
  1327.       result.y = result.y - y();
  1328.       return result;
  1329.     }
  1330.  
  1331.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1332.  
  1333.   /** 
  1334.    * Transform a point from parent's coordinate space to local coordinates of
  1335.    * this object. 
  1336.    *
  1337.    * @param Point parent_pt point to transform.
  1338.    * @return Point resulting point.
  1339.    */
  1340.   public Point into_local(Point parent_pt)
  1341.     {
  1342.       Point result = new Point(parent_pt.x, parent_pt.y);
  1343.       result.x = result.x - x();
  1344.       result.y = result.y - y();
  1345.       return result;
  1346.     }
  1347.  
  1348.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1349.  
  1350.   /** 
  1351.    * Transform an x value from parent's coordinate space to local coords. 
  1352.    *
  1353.    * @param int xv x coordinate of to transform.
  1354.    * @return int resulting x coordinate.
  1355.    */
  1356.   public int x_into_local(int xv)
  1357.     {
  1358.       return xv - x();
  1359.     }
  1360.  
  1361.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1362.  
  1363.   /** 
  1364.    * Transform an y value from parent's coordinate space to local coords. 
  1365.    *
  1366.    * @param int yv y coordinate of to transform.
  1367.    * @return int resulting y coordinate.
  1368.    */
  1369.   public int y_into_local(int yv)
  1370.     {
  1371.       return yv - y();
  1372.     }
  1373.  
  1374.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1375.  
  1376.   /** 
  1377.    * Transform a local point into the parent's coordinate space. 
  1378.    *
  1379.    * @param int xv x coordinate of point to transform.
  1380.    * @param int yv y coordinate of point to transform.
  1381.    * @return Point resulting point.
  1382.    */
  1383.   public Point into_parent(int xv, int yv)
  1384.     {
  1385.       Point result = new Point(xv, yv);
  1386.       result.x = result.x + x();
  1387.       result.y = result.y + y();
  1388.       return result;
  1389.     }
  1390.  
  1391.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1392.  
  1393.   /** 
  1394.    * Transform a local point into the parent's coordinate space. 
  1395.    *
  1396.    * @param Point local_pt point to transform.
  1397.    * @return Point resulting point.
  1398.    */
  1399.   public Point into_parent(Point local_pt)
  1400.     {
  1401.       Point result = new Point(local_pt.x, local_pt.y);
  1402.       result.x = result.x + x();
  1403.       result.y = result.y + y();
  1404.       return result;
  1405.     }
  1406.  
  1407.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1408.  
  1409.   /** 
  1410.    * Transform an x value form local coordinates into the parent's coordinate 
  1411.    * space. 
  1412.    *
  1413.    * @param int xv x coordinate of to transform.
  1414.    * @return int resulting x coordinate.
  1415.    */
  1416.   public int x_into_parent(int xv)
  1417.     {
  1418.       return xv + x();
  1419.     }
  1420.  
  1421.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1422.  
  1423.   /** 
  1424.    * Transform an y value form local coordinates into the parent's coordinate 
  1425.    * space. 
  1426.    *
  1427.    * @param int yv y coordinate of to transform.
  1428.    * @return int resulting y coordinate.
  1429.    */
  1430.   public int y_into_parent(int yv)
  1431.     {
  1432.       return yv + y();
  1433.     }
  1434.  
  1435.   /*---------------------------------------------------------------------*/
  1436.   /* Hierarchy management */
  1437.   /*---------------------------------------------------------------------*/
  1438.  
  1439.   /** 
  1440.    * Return the parent of this interactor. 
  1441.    * @return interactor the parent of this interactor or null if this object
  1442.    *                    is an orphan or is a top_level (root) interactor.
  1443.    */
  1444.   public interactor parent() {return _parent;}
  1445.  
  1446.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1447.  
  1448.   /** 
  1449.    * Set the parent of this interactor. <p>
  1450.    *
  1451.    * <b>Warning</b>: this method should be protected (but isn't since various
  1452.    * implementations don't allow protected in interfaces).  This method should
  1453.    * not be invoked from "outside the system".  Always use the normal child 
  1454.    * manipulation routines instead.<p>
  1455.    *
  1456.    * @param interactor par new parent for this object.
  1457.    */
  1458.   public void set_parent(interactor par) 
  1459. {
  1460.       /* if we are actually changing something */
  1461.       if (par != _parent)
  1462.     {
  1463.       /* set our new parent and damage our bound so we get drawn right */
  1464.           _parent = par;
  1465.           damage_self();
  1466.     }
  1467.      }
  1468.  
  1469.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1470.  
  1471.   /** 
  1472.    * Retrieve the top_level interactor (if any) that this object is installed
  1473.    * (perhaps several levels down) under.  This top_level interactor provides 
  1474.    * the "global" coordinate space for this interactor.  Null is returned if
  1475.    * this object is not currently installed somewhere under a top_level 
  1476.    * interactor.<p>
  1477.    * 
  1478.    * @return top_level the top_level object we are installed under or null if
  1479.    *                   there is no such object.
  1480.    */
  1481.   public top_level get_top_level()
  1482.     {
  1483.       interactor parnt;
  1484.  
  1485.       /* walk up the parent tree till we get to the top */
  1486.       for (parnt = this; parnt.parent() != null; parnt = parnt.parent())
  1487.     /* keep walking up */;
  1488.  
  1489.       /* if we got to a top_level interactor then use that */
  1490.       if (parnt instanceof top_level)
  1491.     return (top_level)parnt;
  1492.       else
  1493.     return null;
  1494.     }
  1495.  
  1496.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1497.  
  1498.   /** 
  1499.    * Retrieve the AWT component that this sub_arctic object is drawn within.
  1500.    * If this object is not part of an active interface, null will be returned.
  1501.    * <p>
  1502.    * @result Component the AWT component that this sub_arctic object is drawn
  1503.    *                   within or null if the object is "floating".
  1504.    */
  1505.   public Component get_awt_component()
  1506.     {
  1507.       top_level top = get_top_level();
  1508.       if (top != null) 
  1509.         return top.awt_parent();
  1510.       else
  1511.     return null;
  1512.     }
  1513.  
  1514.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1515.  
  1516.   /** 
  1517.    * Return the child index of this interactor (within its parent). 
  1518.    * This value is obviously not going to be correct for orphan objects.
  1519.    * @return int index of this interactor within its parent's child list.
  1520.    */
  1521.   public int child_index() { return _child_index; }
  1522.  
  1523.  
  1524.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1525.  
  1526.   /** 
  1527.    * Set the child index of this interactor (within its parent). <p>
  1528.    *
  1529.    * <b>Warning</b>: this method should be protected (but isn't since various
  1530.    * implementations don't allow protected in interfaces).  This method should
  1531.    * not be invoked except from the within the normal child manipulation 
  1532.    * routines.Always use those routines instead.<p>
  1533.    *
  1534.    * @param int indx the new index of the child.
  1535.    */
  1536.   public void set_child_index(int indx) {_child_index = indx;}
  1537.  
  1538.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1539.  
  1540.   /** 
  1541.    * Return the previous sibling of this object (or null if there is none). 
  1542.    * @return interactor the child before this one in its parent's child list or
  1543.    *                    null if there is no such object.
  1544.    */ 
  1545.   public interactor prev_sibling()
  1546.     {
  1547.       if (parent() == null || child_index() == 0) 
  1548.     return null;
  1549.       else
  1550.     return parent().child(child_index()-1);
  1551.     }
  1552.  
  1553.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1554.  
  1555.   /** 
  1556.    * Return the next sibling of this object (or null if there is none). 
  1557.    * @return interactor the child after this one in its parent's child list or
  1558.    *                    null if there is no such object.
  1559.    */ 
  1560.   public interactor next_sibling()
  1561.     {
  1562.       if (parent() == null || child_index() == parent().num_children()-1)
  1563.     return null;
  1564.       else
  1565.     return parent().child(child_index()+1);
  1566.     }
  1567.  
  1568.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1569.  
  1570.   /** 
  1571.    * Indicate whether this interactor supports children.  Interactors that
  1572.    * support children will have their SUPPORTS_CHILDREN flag set.  
  1573.    * @return boolean indicating whether this object supports children.
  1574.    */
  1575.   public boolean supports_children()  
  1576.     {
  1577.       return flag_is_set(SUPPORTS_CHILDREN);
  1578.     }
  1579.  
  1580.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1581.  
  1582.   /** 
  1583.    * Indicate whether this interactor uses a fixed set of children.  This is
  1584.    * done if the interactor assigns fixed roles/meanings to particular
  1585.    * children, or for some other reason limits its total number of children.
  1586.    * If this is not set, then the child list is expandable and the system
  1587.    * will move entries over to fill in null children (although you cannot rely
  1588.    * on this behavior since it is possible to explicitly set a child at a
  1589.    * given index to null and sneak nulls into the child list in other ways).
  1590.    *  If this is set, then removed children will be set to null, and the child
  1591.    * list will not be otherwise modified.  In addition, if this is set, then
  1592.    * operations that would normally reorder children throw an exception 
  1593.    * instead.  An object which uses fixed children will have its 
  1594.    * FIXED_CHILDREN flag set.
  1595.    *
  1596.    * @return boolean indicating whether this object supports fixed children.
  1597.    */
  1598.   public boolean fixed_children()
  1599.     {
  1600.       return flag_is_set(FIXED_CHILDREN);
  1601.     }
  1602.  
  1603.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1604.  
  1605.   /** 
  1606.    * Indicate the number of children this interactor currently has.  For 
  1607.    * interactors with fixed children, the interactor will always have this
  1608.    * this number, hence it is also the maximum number of children.  
  1609.    * Interactors that do not support children always return 0.  Note: there
  1610.    * may be null children in the child list but they are counted as children 
  1611.    * here.
  1612.    * 
  1613.    * @return int number of slots in this object's child list.
  1614.    */
  1615.   public int num_children() 
  1616.     {
  1617.       if (supports_children()) 
  1618.     return _child_list.size();
  1619.       else
  1620.         return 0;
  1621.      }
  1622.  
  1623.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1624.  
  1625.   /** 
  1626.    * Return the child at the given index int the child list (whose first 
  1627.    * element is at index 0).  If the index given is beyond the range of the 
  1628.    * current child list, or the interactor does not support children, then 
  1629.    * null is returned.  Requests for negative children cause an exception.  
  1630.    * Note that child lists may contain null children.
  1631.    *
  1632.    * @param int i the index of the requested child.
  1633.    * @return interactor the child object at the requested index.
  1634.    */
  1635.   public interactor child(int i) 
  1636. {
  1637.       if (i < 0) throw new sub_arctic_error("Negative index passed to child()");
  1638.       if (i < num_children())
  1639.     return (interactor)_child_list.elementAt(i);
  1640.       else 
  1641.     return null;
  1642.     }
  1643.  
  1644.    //had:
  1645.    //* @exception index_bounds if a negative child index is supplied.
  1646.    //* @exception general
  1647.  
  1648.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1649.  
  1650.   /** 
  1651.    * Set the child at the given index replacing any child that was previously
  1652.    * there.  The child list will be expanded as necessary to accommodate the
  1653.    * given child.  If the child list is expanded, missing children will be 
  1654.    * set to null.
  1655.    *
  1656.    * @param int        at_indx   position in the child list to replace.
  1657.    * @param interactor chld      the child object to place at that position.
  1658.    */
  1659.   public void set_child(int at_indx, interactor chld) 
  1660. {
  1661.       /* if we don't support children, throw an exception */
  1662.       if (!supports_children())
  1663.         throw new sub_arctic_error("This object does not support children");
  1664.  
  1665.       /* if they already have a parent, remove them from it */
  1666.       if (chld != null && chld.parent() != null) 
  1667.     chld.parent().remove_child(chld);
  1668.  
  1669.       /* make sure we have space for the child in our list */
  1670.       if (at_indx >= _child_list.size() && !fixed_children())
  1671.     _child_list.setSize(at_indx+1);
  1672.  
  1673.       /* set the child */
  1674.       _child_list.setElementAt(chld, at_indx);
  1675.  
  1676.       if (chld != null) 
  1677.     {
  1678.       /* set childs notion of its index */
  1679.       chld.set_child_index(at_indx);
  1680.  
  1681.           /* set us as its parent and mark out of date */
  1682.           chld.set_parent(this);
  1683.           chld.mark_reparented_ood();
  1684.     }
  1685.  
  1686.       // note: child list never gets smaller, may want to address this later
  1687.       // instead of an explicit test of supports_children(), just do it but
  1688.       // catch the null pointer exception and rethrow it as an error
  1689.     }
  1690.  
  1691.    //has:
  1692.    //* @exception op_not_supported if this operation is invoked on an object 
  1693.    //*                             which does not support children or which 
  1694.    //*                             would require expanding the child list of an 
  1695.    //*                             object which has fixed children.
  1696.    //* @exception general
  1697.  
  1698.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1699.  
  1700.   /** 
  1701.    * Add a child to the end of the child list. 
  1702.    * @param interactor chld the child to add.
  1703.    */
  1704.   public void add_child(interactor chld) 
  1705. {
  1706.       /* adding null is a no-op */
  1707.       if (chld == null) return;
  1708.  
  1709.       /* if we don't support children, throw an exception */
  1710.       if (!supports_children())
  1711.         throw new sub_arctic_error("This object does not support children");
  1712.  
  1713.       /* don't allow add_child for fixed children (must use set_child()) */
  1714.       if (fixed_children())
  1715.     throw new sub_arctic_error( "This object has fixed children and " + 
  1716.             "does not support add_child (use set_child() instead).");
  1717.  
  1718.       /* if they already have a parent, remove them from it */
  1719.       if (chld.parent() != null) chld.parent().remove_child(chld);
  1720.  
  1721.       /* add the child and set its index */
  1722.       _child_list.addElement(chld);
  1723.       chld.set_child_index(_child_list.size()-1);
  1724.  
  1725.       /* set us as its parent and mark out-of-date */
  1726.       chld.set_parent(this);
  1727.       chld.mark_reparented_ood();
  1728.     }
  1729.  
  1730.    //has:
  1731.    //* @exception op_not_supported if the object does not support children or
  1732.    //*                             supports only fixed children.
  1733.    //* @exception general
  1734.  
  1735.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1736.  
  1737.   /** 
  1738.    * Insert a child at the given location, moving current children at or
  1739.    * after that index further down in the list. 
  1740.    */
  1741.   public void insert_child(int at_indx, interactor chld) 
  1742. {
  1743.       interactor a_child;
  1744.  
  1745.       /* inserting null is a no-op */
  1746.       if (chld == null) return;
  1747.  
  1748.       /* if we don't support children, throw an exception */
  1749.       if (!supports_children())
  1750.         throw new sub_arctic_error("This object does not support children");
  1751.  
  1752.       /* if we only support fixed children, throw an exception */
  1753.       if (fixed_children())
  1754.         throw new sub_arctic_error(
  1755.            "This object has fixed children and does not support child insert");
  1756.  
  1757.       /* insert the child */
  1758.       _child_list.insertElementAt(chld, at_indx);
  1759.  
  1760.       /* set us as its parent */
  1761.       chld.set_parent(this);
  1762.  
  1763.       /* renumber the trailing children */
  1764.       for (int i = at_indx; i < _child_list.size(); i++)
  1765.     {
  1766.       a_child = (interactor)_child_list.elementAt(i);
  1767.       if (a_child != null) a_child.set_child_index(i);
  1768.     }
  1769.  
  1770.       /* mark out-of-date */
  1771.       chld.mark_reparented_ood();
  1772.     }
  1773.  
  1774.    //has:
  1775.    //* @exception op_not_supported if the object does not support children or
  1776.    //*                             supports only fixed children.
  1777.    //* @exception general
  1778.  
  1779.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1780.  
  1781.   /** Remove the child found at the given index and return it.  For 
  1782.    *  interactors with fixed children, the child slot at the index is set 
  1783.    *  to null.  For other interactors, later children are moved over in the 
  1784.    *  list to fill in the gap.
  1785.    *
  1786.    * @param int at_indx the index to remove the child from.
  1787.    */
  1788.   public interactor remove_child(int at_indx) 
  1789. {
  1790.       interactor chld;
  1791.  
  1792.       /* if we don't support children, throw an exception */
  1793.       if (!supports_children())
  1794.         throw new sub_arctic_error("This object does not support children");
  1795.  
  1796.       /* if the child is out of bounds just return */ 
  1797.       if (at_indx < 0 || at_indx >= _child_list.size()) return null;
  1798.  
  1799.       /* get the result interactor */
  1800.       interactor result = (interactor)_child_list.elementAt(at_indx);
  1801.  
  1802.       if (result != null) 
  1803.     {
  1804.           /* damage it to account for the screen area of our soon to be 
  1805.            * missing child */
  1806.         result.damage_self();
  1807.  
  1808.           /* mark out-of-date for the same reason */
  1809.           result.mark_reparented_ood();
  1810.     }
  1811.  
  1812.       /* remove the child and renumber if needed */
  1813.       if (fixed_children())
  1814.         _child_list.setElementAt(null, at_indx);
  1815.       else
  1816.     {
  1817.           _child_list.removeElementAt(at_indx);
  1818.           for (int i = at_indx; i < _child_list.size(); i++)
  1819.         {
  1820.           chld = ((interactor)_child_list.elementAt(i));
  1821.           if (chld != null) chld.set_child_index(i);
  1822.         }
  1823.     }
  1824.  
  1825.       /* set its parent to null */
  1826.       if (result != null) result.set_parent(null);
  1827.  
  1828.       return result;
  1829.     }
  1830.  
  1831.    //had:
  1832.    //* @exception op_not_supported if the object does not support children.
  1833.    //* @exception general
  1834.  
  1835.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1836.  
  1837.   /** 
  1838.    * Remove the given child from the child list.  For interactors with 
  1839.    * fixed children, the child slot is set to null.  For other interactors, 
  1840.    * later children are moved up in the list to fill in the gap.  If the
  1841.    * child is not in the child list, nothing happens.
  1842.    *
  1843.    * @param interactor the_child the child to be removed.
  1844.    */
  1845.   public void remove_child(interactor the_child) 
  1846. {
  1847.       /* if we don't support children, throw an exception */
  1848.       if (!supports_children())
  1849.         throw new sub_arctic_error("This object does not support children");
  1850.  
  1851.       /* find the element's index and remove it using that */
  1852.       int indx = find_child(the_child);
  1853.       if (indx >= 0) remove_child(indx);
  1854.     }
  1855.  
  1856.    //had:
  1857.    //* @exception op_not_supported if the object does not support children.
  1858.    //* @exception general
  1859.  
  1860.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1861.  
  1862.   /** 
  1863.    * Find the given child in the child list and return its index.  If the 
  1864.    * child is no in the child list -1 is returned.
  1865.    *
  1866.    * @param interactor the_child the child we are searching for.
  1867.    * @return int the index of that child in the child list or -1 if the child
  1868.    *             is not found.
  1869.    */
  1870.   public int find_child(interactor the_child) 
  1871. {
  1872.       if (!supports_children())
  1873.         throw new sub_arctic_error("This object does not support children");
  1874.       return _child_list.indexOf(the_child);
  1875.     }
  1876.  
  1877.    //has:
  1878.    //* @exception op_not_supported if this object does not support children.
  1879.    //* @exception general
  1880.  
  1881.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1882.  
  1883.   /** 
  1884.    * Move the child currently at the given index in the child list to the 
  1885.    * top in drawing order (which is last in the list).
  1886.    *
  1887.    * @param int chld_indx the index of the child to move.
  1888.    */
  1889.   public void move_child_to_top(int chld_indx) 
  1890. {
  1891.       interactor the_child, chld;
  1892.  
  1893.       if (!supports_children())
  1894.         throw new sub_arctic_error("This object does not support children");
  1895.  
  1896.       if (flag_is_set(FIXED_CHILDREN)) 
  1897.         throw new sub_arctic_error(
  1898.       "This object does not support reordering children");
  1899.  
  1900.       if (chld_indx >= 0 && chld_indx < _child_list.size()-1)
  1901.     {
  1902.       /* damage our screen extent */
  1903.       damage_self();
  1904.  
  1905.       /* extract the child and mark it out-of-date so we hit old siblings */
  1906.       the_child = (interactor)_child_list.elementAt(chld_indx);
  1907.       if (the_child != null) the_child.mark_reparented_ood();
  1908.  
  1909.       /* move the child */
  1910.       _child_list.removeElementAt(chld_indx);
  1911.       _child_list.addElement(the_child);
  1912.  
  1913.       /* renumber everyone */
  1914.           for (int i = 0; i < _child_list.size(); i++)
  1915.         {
  1916.           chld = ((interactor)_child_list.elementAt(i));
  1917.           if (chld != null) chld.set_child_index(i);
  1918.         }
  1919.  
  1920.       /* inform the new siblings about the change */
  1921.       if (the_child != null) the_child.mark_reparented_ood();
  1922.     }
  1923.     }
  1924.  
  1925.    //had:
  1926.    //* @exception op_not_supported if the object does not support children or 
  1927.    //*                             supports only fixed children.
  1928.    //* @exception general
  1929.  
  1930.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1931.  
  1932.   /** Move the given child to the top of the child list in drawing order 
  1933.    *  (which is last in the list).  If the child is not in the list, nothing
  1934.    *  happens.
  1935.    *
  1936.    * @param interactor the_child the child to move.
  1937.    */
  1938.   public void move_child_to_top(interactor the_child) 
  1939. {
  1940.       int indx = find_child(the_child);
  1941.       if (indx >= 0) move_child_to_top(indx);
  1942.     }
  1943.  
  1944.    //had:
  1945.    //* @exception op_not_supported if the object does not support children or 
  1946.    //*                             supports only fixed children.
  1947.    //* @exception general
  1948.  
  1949.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1950.  
  1951.   /**
  1952.    * Move the child currently at the given index in the child list to the 
  1953.    * bottom in drawing order (which is first in the list).
  1954.    *
  1955.    * @param int chld_indx the index of the child to move.
  1956.    */
  1957.   public void move_child_to_bottom(int chld_indx) 
  1958. {
  1959.       interactor the_child, chld;
  1960.  
  1961.       if (!supports_children())
  1962.     throw new sub_arctic_error("This object does not support children");
  1963.  
  1964.       if (flag_is_set(FIXED_CHILDREN)) 
  1965.         throw new sub_arctic_error(
  1966.       "This object does not support reordering children");
  1967.  
  1968.       if (chld_indx > 0 && chld_indx < _child_list.size())
  1969.     {
  1970.       /* damage our screen extent */
  1971.       damage_self();
  1972.  
  1973.       /* extract the child and mark it out-of-date so we hit old siblings */
  1974.       the_child = (interactor)_child_list.elementAt(chld_indx);
  1975.       if (the_child != null) the_child.mark_reparented_ood();
  1976.  
  1977.       /* move the child */
  1978.       _child_list.removeElementAt(chld_indx);
  1979.       _child_list.insertElementAt(the_child,0);
  1980.  
  1981.       /* renumber everyone */
  1982.           for (int i = 0; i < _child_list.size(); i++)
  1983.         {
  1984.           chld = ((interactor)_child_list.elementAt(i));
  1985.           if (chld != null) chld.set_child_index(i);
  1986.         }
  1987.  
  1988.       /* inform the new siblings about the change */
  1989.       if (the_child != null) the_child.mark_reparented_ood();
  1990.     }
  1991.     }
  1992.  
  1993.    //had:
  1994.    //* @exception op_not_supported if the object does not support children or 
  1995.    //*                             supports only fixed children.
  1996.    //* @exception general
  1997.  
  1998.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  1999.  
  2000.   /** 
  2001.    * Move the given child to the bottom of the child list in drawing order 
  2002.    * (which is first in the list).  If the child is not in the list, nothing
  2003.    * happens.
  2004.    *
  2005.    * @param interactor the_child the child to move.
  2006.    */
  2007.   public void move_child_to_bottom(interactor the_child) 
  2008. {
  2009.       int indx = find_child(the_child);
  2010.       if (indx >= 0) move_child_to_bottom(indx);
  2011.     }
  2012.  
  2013.    //had:
  2014.    //* @exception op_not_supported if the object does not support children or 
  2015.    //*                             supports only fixed children.
  2016.    //* @exception general
  2017.  
  2018.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2019.  
  2020.   /** 
  2021.    * Move the child currently at the given index in the child list up one 
  2022.    * position in drawing order (which is one position further into the list).
  2023.    *
  2024.    * @param int chld_indx the index of the child to move.
  2025.    */
  2026.   public void move_child_upward(int chld_indx) 
  2027. {
  2028.       interactor the_child, chld;
  2029.  
  2030.       if (!supports_children())
  2031.     throw new sub_arctic_error("This object does not support children");
  2032.  
  2033.       if (flag_is_set(FIXED_CHILDREN)) 
  2034.         throw new sub_arctic_error(
  2035.       "This object does not support reordering children");
  2036.  
  2037.       if (chld_indx >= 0 && chld_indx < _child_list.size()-1)
  2038.     {
  2039.       /* damage our screen extent */
  2040.       damage_self();
  2041.  
  2042.       /* extract the child and mark it out-of-date so we hit old siblings */
  2043.           the_child = (interactor)_child_list.elementAt(chld_indx);
  2044.       if (the_child != null) the_child.mark_reparented_ood();
  2045.  
  2046.       /* move the child */
  2047.       _child_list.removeElementAt(chld_indx);
  2048.       _child_list.insertElementAt(the_child, chld_indx+1);
  2049.  
  2050.       /* renumber everyone */
  2051.           for (int i = 0; i < _child_list.size(); i++)
  2052.         {
  2053.           chld = ((interactor)_child_list.elementAt(i));
  2054.           if (chld != null) chld.set_child_index(i);
  2055.         }
  2056.  
  2057.       /* inform the new siblings about the change */
  2058.       if (the_child != null) the_child.mark_reparented_ood();
  2059.     }
  2060.     }
  2061.  
  2062.    //had:
  2063.    //* @exception op_not_supported if the object does not support children or 
  2064.    //*                             supports only fixed children.
  2065.    //* @exception general
  2066.  
  2067.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2068.  
  2069.   /**
  2070.    * Move the given child up one position in drawing order of the child list 
  2071.    * (which is later in the list).  If the child is not in the list, nothing
  2072.    * happens.
  2073.    *
  2074.    * @param interactor the_child the child to move.
  2075.    */
  2076.   public void move_child_upward(interactor the_child) 
  2077. {
  2078.       int indx = find_child(the_child);
  2079.       if (indx > 0) move_child_upward(indx);
  2080.     }
  2081.  
  2082.    //had:
  2083.    //* @exception op_not_supported if the object does not support children or 
  2084.    //*                             supports only fixed children.
  2085.    //* @exception general
  2086.  
  2087.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2088.  
  2089.   /** 
  2090.    * Move the child currently at the given index in the child list down one 
  2091.    * position in drawing order (which is one position earlier in the list).
  2092.    *
  2093.    * @param int chld_indx the index of the child to move.
  2094.    */
  2095.   public void move_child_downward(int chld_indx) 
  2096. {
  2097.       interactor the_child, chld;
  2098.  
  2099.       if (!supports_children())
  2100.     throw new sub_arctic_error("This object does not support children");
  2101.  
  2102.       if (fixed_children()) 
  2103.         throw new sub_arctic_error(
  2104.       "This object does not support reordering children");
  2105.  
  2106.       if (chld_indx > 0 && chld_indx < _child_list.size())
  2107.     {
  2108.       /* damage our screen extent */
  2109.       damage_self();
  2110.  
  2111.       /* extract the child and mark it out-of-date so we hit old siblings */
  2112.           the_child = (interactor)_child_list.elementAt(chld_indx);
  2113.       if (the_child != null) the_child.mark_reparented_ood();
  2114.  
  2115.       /* move the child */
  2116.       _child_list.removeElementAt(chld_indx);
  2117.       _child_list.insertElementAt(the_child, chld_indx-1);
  2118.  
  2119.       /* renumber everyone */
  2120.           for (int i = 0; i < _child_list.size(); i++)
  2121.         {
  2122.           chld = ((interactor)_child_list.elementAt(i));
  2123.           if (chld != null) chld.set_child_index(i);
  2124.         }
  2125.  
  2126.       /* inform the new siblings about the change */
  2127.       if (the_child != null) the_child.mark_reparented_ood();
  2128.     }
  2129.     }
  2130.  
  2131.    //had:
  2132.    //* @exception op_not_supported if the object does not support children or 
  2133.    //*                             supports only fixed children.
  2134.    //* @exception general
  2135.  
  2136.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2137.  
  2138.   /** 
  2139.    * Move the given child down one position in drawing order of the child list 
  2140.    * (which is earlier in the list).  If the child is not in the list, nothing
  2141.    * happens.
  2142.    * 
  2143.    * @param interactor the_child the child to move.
  2144.    */
  2145.   public void move_child_downward(interactor the_child) 
  2146. {
  2147.       int indx = find_child(the_child);
  2148.       if (indx > 0) move_child_downward(indx);
  2149.     }
  2150.  
  2151.    //had:
  2152.    //* @exception op_not_supported if the object does not support children or 
  2153.    //*                             supports only fixed children.
  2154.    //* @exception general
  2155.  
  2156.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2157.  
  2158.   /** 
  2159.    * Move this object to the top of its parent's drawing order (last in 
  2160.    * its child list). 
  2161.    */
  2162.   public void move_to_top() 
  2163. {
  2164.       if (parent() != null) parent().move_child_to_top(this);
  2165.     }
  2166.  
  2167.    //had:
  2168.    //* @exception general
  2169.  
  2170.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2171.  
  2172.   /** 
  2173.    * Move this object to the bottom of its parent's drawing order (first in 
  2174.    * its child list). 
  2175.    */
  2176.   public void move_to_bottom() 
  2177. {
  2178.       if (parent() != null) parent().move_child_to_bottom(this);
  2179.     }
  2180.  
  2181.    //had:
  2182.    //* @exception general
  2183.  
  2184.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2185.  
  2186.   /** 
  2187.    * Move this object one position higher in its parent's drawing order 
  2188.    * (which is one position further into its child list). 
  2189.    */
  2190.   public void move_upward() 
  2191. {
  2192.       if (parent() != null) parent().move_child_upward(this);
  2193.     }
  2194.  
  2195.    //had:
  2196.    //* @exception general
  2197.  
  2198.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2199.  
  2200.   /** 
  2201.    * Move this object one position lower in its parent's drawing order 
  2202.    * (which is one position earlier in its child list). 
  2203.    */
  2204.   public void move_downward() 
  2205. {
  2206.       if (parent() != null) parent().move_child_downward(this);
  2207.     }
  2208.  
  2209.    //had:
  2210.    //* @exception general
  2211.  
  2212.   /*---------------------------------------------------------------------*/
  2213.   /* Layout */
  2214.   /*---------------------------------------------------------------------*/
  2215.  
  2216.   /** 
  2217.    * Indicate which parts (coordinates/sizes/values) of this object are 
  2218.    * intrinsically constrained by the internals of the object.  For, example 
  2219.    * an icon object with a fixed size image would intrinsically constrain 
  2220.    * its width and height. The result is reported as an integer formed from 
  2221.    * or-ing together zero or more of the constants:  X, Y, W, H, VISIBLE, 
  2222.    * ENABLED, PART_A or PART_B (for the icon described above that would be 
  2223.    * W | H).
  2224.    *
  2225.    * @return int bitset indicating which parts of the object are intrinsically
  2226.    *             constrained.
  2227.    */
  2228.   public int intrinsic_constraints()
  2229.     {
  2230.       /* by default PART_A and PART_B are constrained to be 0 */
  2231.       return PART_A | PART_B;
  2232.     }
  2233.  
  2234.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2235.  
  2236.   /** 
  2237.    * Indicate which parts (coordinates/sizes/values) of this object are 
  2238.    * currently constrained.  This always includes the intrinsic constraints, 
  2239.    * but  may also indicate other constraints that have been applied to the 
  2240.    * object.  The result is reported as an integer formed from or-ing 
  2241.    * together zero or more of the constants: X, Y, W, H, VISIBLE, ENABLED,
  2242.    * PART_A and PART_B.  Values that are constrained may not be assigned to 
  2243.    * directly (an exception will be thrown).
  2244.    * 
  2245.    * @param int bitset indicating which parts of the object are constrained.
  2246.    */
  2247.   public int active_constraints()
  2248.     {
  2249.       int result = intrinsic_constraints();
  2250.  
  2251.       /* figure out which constraints are active */
  2252.       if (!std_constraint_impl.the_impl().is_none(_x_constraint)) result |= X;
  2253.       if (!std_constraint_impl.the_impl().is_none(_y_constraint)) result |= Y;
  2254.       if (!std_constraint_impl.the_impl().is_none(_w_constraint)) result |= W;
  2255.       if (!std_constraint_impl.the_impl().is_none(_h_constraint)) result |= H;
  2256.       if (!std_constraint_impl.the_impl().is_none(_visible_constraint)) 
  2257.     result |= VISIBLE;
  2258.       if (!std_constraint_impl.the_impl().is_none(_enabled_constraint)) 
  2259.     result |= ENABLED;
  2260.       if (!std_constraint_impl.the_impl().is_none(_part_a_constraint)) 
  2261.     result |= PART_A;
  2262.       if (!std_constraint_impl.the_impl().is_none(_part_b_constraint)) 
  2263.     result |= PART_B;
  2264.       return result;
  2265.  
  2266.       // later might want to consider burning a few flag bits to cache this
  2267.     }
  2268.  
  2269.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2270.  
  2271.   /** 
  2272.    * Indicate whether a specific part is currently constrained.  The query 
  2273.    * argument should be one of the constants: X, Y, W, H, VISIBLE, ENABLED,
  2274.    * PART_A, or PART_B.  Values that are constrained may not be assigned to 
  2275.    * (an exception will be thrown).
  2276.    * 
  2277.    * @param int coord_code the object part we are enquiring about.
  2278.    * @return boolean indicating whether it is constrained.
  2279.    */
  2280.   public boolean is_constrained(int coord_code)
  2281.     {
  2282.       switch (coord_code)
  2283.     {
  2284.       case X: return !std_constraint_impl.the_impl().is_none(_x_constraint);
  2285.       case Y: return !std_constraint_impl.the_impl().is_none(_y_constraint);
  2286.       case W: return !std_constraint_impl.the_impl().is_none(_w_constraint);
  2287.       case H: return !std_constraint_impl.the_impl().is_none(_h_constraint);
  2288.       case VISIBLE: 
  2289.         return !std_constraint_impl.the_impl().is_none(_visible_constraint);
  2290.       case ENABLED: 
  2291.         return !std_constraint_impl.the_impl().is_none(_enabled_constraint);
  2292.       case PART_A: 
  2293.         return !std_constraint_impl.the_impl().is_none(_part_a_constraint);
  2294.       case PART_B: 
  2295.         return !std_constraint_impl.the_impl().is_none(_part_b_constraint);
  2296.       default: return false;
  2297.     }
  2298.     }
  2299.  
  2300.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2301.  
  2302.   /** 
  2303.    * Return a constraint object representing the constraint (if any) attached
  2304.    * to the specified part (X, Y, W, H, VISIBLE, ENABLED, PART_A, or PART_B).
  2305.    * @param int coord_code the code for the object part in question.
  2306.    * @return constraint the constraint attached to the given part.
  2307.    */
  2308.   public constraint constraint_on(int coord_code) 
  2309. {
  2310.       switch (coord_code)
  2311.     {
  2312.       case X: return x_constraint(); 
  2313.       case Y: return y_constraint();
  2314.       case W: return w_constraint();
  2315.       case H: return h_constraint();
  2316.       case VISIBLE: return visible_constraint();
  2317.       case ENABLED: return enabled_constraint();
  2318.       case PART_A:  return part_a_constraint();
  2319.       case PART_B:  return part_b_constraint();
  2320.       default:
  2321.         throw new sub_arctic_error(
  2322.           "Unrecognized coordinate code " + coord_code + 
  2323.           "passed to constraint_on()");
  2324.     }
  2325.     }
  2326.  
  2327.    //had:
  2328.    //* @exception bad_value if an unrecognized part code is given.
  2329.  
  2330.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2331.  
  2332.   /** 
  2333.    * Return a constraint object representing the constraint (if any) attached
  2334.    * to x. 
  2335.    * @return constraint the constraint attached to x.
  2336.    */
  2337.   public constraint x_constraint()
  2338.     {
  2339.       return new std_constraint(_x_constraint, std_encoding_consts.HORIZONTAL);
  2340.     }
  2341.  
  2342.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2343.  
  2344.   /** 
  2345.    * Return a constraint object representing the constraint (if any) attached
  2346.    * to y. 
  2347.    * @return constraint the constraint attached to x.
  2348.    */
  2349.   public constraint y_constraint()
  2350.     {
  2351.       return new std_constraint(_y_constraint, std_encoding_consts.VERTICAL);
  2352.     }
  2353.  
  2354.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2355.  
  2356.   /** 
  2357.    * Return a constraint object representing the constraint (if any) attached
  2358.    * to w. 
  2359.    * @return constraint the constraint attached to w.
  2360.    */
  2361.   public constraint w_constraint()
  2362.     {
  2363.       return new std_constraint(_w_constraint, std_encoding_consts.HORIZONTAL);
  2364.     }
  2365.  
  2366.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2367.  
  2368.   /** 
  2369.    * Return a constraint object representing the constraint (if any) attached
  2370.    * to h. 
  2371.    * @return constraint the constraint attached to h.
  2372.    */
  2373.   public constraint h_constraint()
  2374.     {
  2375.       return new std_constraint(_h_constraint, std_encoding_consts.VERTICAL);
  2376.     }
  2377.  
  2378.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2379.  
  2380.   /** 
  2381.    * Return a constraint object representing the constraint (if any) attached
  2382.    * to visible. 
  2383.    * @return constraint the constraint attached to visible.
  2384.    */
  2385.   public constraint visible_constraint()
  2386.     {
  2387.       return new std_constraint(_visible_constraint, 
  2388.     ((_constraint_flags & VISIBLE_IS_HORIZONTAL)!= 0)? 
  2389.     std_encoding_consts.HORIZONTAL : std_encoding_consts.VERTICAL);
  2390.     }
  2391.  
  2392.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2393.  
  2394.   /** 
  2395.    * Return a constraint object representing the constraint (if any) attached
  2396.    * to enabled. 
  2397.    * @return constraint the constraint attached to enabled.
  2398.    */
  2399.   public constraint enabled_constraint()
  2400.     {
  2401.       return new std_constraint(_enabled_constraint, 
  2402.     ((_constraint_flags & ENABLED_IS_HORIZONTAL)!= 0)? 
  2403.     std_encoding_consts.HORIZONTAL : std_encoding_consts.VERTICAL);
  2404.     }
  2405.  
  2406.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2407.  
  2408.   /** 
  2409.    * Return a constraint object representing the constraint (if any) attached
  2410.    * to part_a. 
  2411.    * @return constraint the constraint attached to part_a.
  2412.    */
  2413.   public constraint part_a_constraint()
  2414.     {
  2415.       return new std_constraint(_part_a_constraint, 
  2416.     ((_constraint_flags & PART_A_IS_HORIZONTAL) != 0)? 
  2417.     std_encoding_consts.HORIZONTAL : std_encoding_consts.VERTICAL);
  2418.     }
  2419.  
  2420.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2421.  
  2422.   /** 
  2423.    * Return a constraint object representing the constraint (if any) attached
  2424.    * to part_b. 
  2425.    * @return constraint the constraint attached to part_a.
  2426.    */
  2427.   public constraint part_b_constraint()
  2428.     {
  2429.       return new std_constraint(_part_b_constraint, 
  2430.     ((_constraint_flags & PART_B_IS_HORIZONTAL) != 0)? 
  2431.     std_encoding_consts.HORIZONTAL : std_encoding_consts.VERTICAL);
  2432.     }
  2433.  
  2434.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2435.  
  2436.   /** 
  2437.    * Establish a constraint on the given value (one of X, Y, W, H, VISIBLE,
  2438.    * ENABLED, PART_A, or PART_B).  This replaces any constraint currently in 
  2439.    * place.  However, an attempt to replace an intrinsic constraint will 
  2440.    * result in an exception.  
  2441.    * 
  2442.    * @param int        coord_code   code for the part whose constraint we 
  2443.    *                                replace.
  2444.    * @param constraint a_constraint the constraint to replace it with.
  2445.    */
  2446.   public void set_constraint(int coord_code, constraint a_constraint) 
  2447. {
  2448.       switch (coord_code)
  2449.     {
  2450.       case X: set_x_constraint(a_constraint); break;
  2451.       case Y: set_y_constraint(a_constraint); break;
  2452.       case W: set_w_constraint(a_constraint); break;
  2453.       case H: set_h_constraint(a_constraint); break;
  2454.       case VISIBLE: set_visible_constraint(a_constraint); break;
  2455.       case ENABLED: set_enabled_constraint(a_constraint); break;
  2456.       case PART_A:  set_part_a_constraint(a_constraint); break;
  2457.       case PART_B:  set_part_b_constraint(a_constraint); break;
  2458.       default:
  2459.         throw new sub_arctic_error("Unrecognized coordinate code " + 
  2460.                        coord_code + "passed to set_constraint()");
  2461.     }
  2462.     }
  2463.  
  2464.    //had:
  2465.    //* @exception cannot_constrain if the given part is intrinsically constrained
  2466.    //* @exception bad_value        if an unrecognized part code is given.
  2467.  
  2468.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2469.  
  2470.   /** 
  2471.    * Establish an "external" or "heavyweight" constraint on the given value (one
  2472.    * of X, Y, W, H, VISIBLE, ENABLED, PART_A, PART_B).  This replaces any 
  2473.    * constraint currently in place.  However, an attempt to replace an 
  2474.    * intrinsic constraint will result in an exception.  
  2475.    *
  2476.    * @param int        coord_code   code for the part whose constraint we 
  2477.    *                                replace.
  2478.    * @param constraint a_constraint the constraint to replace it with.
  2479.    */
  2480.   public void set_constraint(int code, value_provider ext_obj, int ext_part) 
  2481. {
  2482.       switch (code)
  2483.     {
  2484.       case X: set_x_constraint(ext_obj, ext_part); break;
  2485.       case Y: set_y_constraint(ext_obj, ext_part); break;
  2486.       case W: set_w_constraint(ext_obj, ext_part); break;
  2487.       case H: set_h_constraint(ext_obj, ext_part); break;
  2488.       case VISIBLE: set_visible_constraint(ext_obj, ext_part); break;
  2489.       case ENABLED: set_enabled_constraint(ext_obj, ext_part); break;
  2490.       case PART_A:  set_part_a_constraint(ext_obj, ext_part); break;
  2491.       case PART_B:  set_part_b_constraint(ext_obj, ext_part); break;
  2492.       default:
  2493.         throw new sub_arctic_error("Unrecognized coordinate code " + code + 
  2494.                 "passed to set_constraint()");
  2495.     }
  2496.     }
  2497.  
  2498.    //had:
  2499.    //* @exception cannot_constrain if the given part is intrinsically constrained
  2500.    //* @exception bad_value        if an unrecognized part code is given.
  2501.  
  2502.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2503.  
  2504.   /** 
  2505.    * Establish a constraint on the x value of this object.  This 
  2506.    * replaces any constraint currently in place.  However, an attempt to 
  2507.    * replace an intrinsic constraint will result in an exception.  Only
  2508.    * horizontally oriented constraints can be attached to x (if a vertically
  2509.    * oriented value is need, use an external constraint).
  2510.    *
  2511.    * @param constraint a_constraint the constraint to replace it with.
  2512.    */
  2513.   public void set_x_constraint(constraint a_constraint) 
  2514. {
  2515.       /* if its intrinsic throw an exception */
  2516.       if ((X & intrinsic_constraints()) != 0)
  2517.     throw new sub_arctic_error(
  2518.               "Attempt to override an intrinsic constraint on x");
  2519.  
  2520.       /* if its the wrong orientation, throw an exception */
  2521.       if ((a_constraint.orientation() & std_encoding_consts.VERTICAL) != 0)
  2522.     throw new sub_arctic_error("Can't attach vertically oriented constraint to x");
  2523.  
  2524.       /* if we have an existing external constraint, drop it */
  2525.       if (x_constraint().is_external())
  2526.     manager.drop_extern_constraint(this, X);
  2527.  
  2528.       /* assign to the constraint encoding, then mark the value out-of-date */
  2529.       _x_constraint = a_constraint.encoding();
  2530.       if (!a_constraint.is_none())
  2531.         mark_x_ood();
  2532.     }
  2533.  
  2534.    //had:
  2535.    //* @exception cannot_constrain if x is intrinsically constrained
  2536.    //* @exception bad_value        if a vertically oriented constraint is used.
  2537.  
  2538.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2539.  
  2540.   /** 
  2541.    * Establish an "external" or "heavyweight" constraint on the x value of 
  2542.    * this object.  This attaches a value exported by a particular part of 
  2543.    * some value_provider object and replaces any constraint currently in 
  2544.    * place.  However, an  attempt to replace an intrinsic constraint will 
  2545.    * result in an exception.  
  2546.    *
  2547.    * @param value_provider ext_obj  the external object providing the value.
  2548.    * @param int            ext_part the part number of the part of that object 
  2549.    *                                providing the value.
  2550.    */
  2551.   public void set_x_constraint(value_provider ext_obj, int ext_part) 
  2552. {
  2553.       if (ext_obj == null)
  2554.     throw new sub_arctic_error("Null external constraint passed to " + 
  2555.                                "set_x_constraint()");
  2556.  
  2557.       /* set the constraint encoding */
  2558.       set_x_constraint(std_function.external());
  2559.  
  2560.       /* establish an association with the external provider */
  2561.       manager.establish_extern_constraint(this,X, ext_obj,ext_part);
  2562.  
  2563.       /* mark the value out-of-date */
  2564.       mark_x_ood();
  2565.     }
  2566.  
  2567.    //had:
  2568.    //* @exception cannot_constrain if x is intrinsically constrained.
  2569.    //* @exception general
  2570.  
  2571.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2572.  
  2573.   /** 
  2574.    * Establish a standard external constraint on the x value of this object.  
  2575.    * This replaces any constraint currently in place.  However, an attempt to 
  2576.    * replace an intrinsic constraint will result in an exception.  
  2577.    *
  2578.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  2579.    */
  2580.   public void set_x_constraint(std_ext_constraint ext_cnstr) 
  2581. {
  2582.       /* use arbitrary extern API with part 0, then set us up as self */
  2583.       set_x_constraint(ext_cnstr, 0);
  2584.       ext_cnstr.set_self_obj(this);
  2585.       ext_cnstr.set_orientation(std_encoding_consts.HORIZONTAL);
  2586.     }
  2587.  
  2588.    //had:
  2589.    //* @exception cannot_constrain if x is intrinsically constrained.
  2590.    //* @exception general
  2591.  
  2592.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2593.  
  2594.   /** 
  2595.    * Establish a constraint on the y value of this object.  This 
  2596.    * replaces any constraint currently in place.  However, an attempt to 
  2597.    * replace an intrinsic constraint will result in an exception.  Only
  2598.    * vertically oriented constraints can be attached to y (if a horizontally
  2599.    * oriented value is need, use an external constraint).
  2600.    *
  2601.    * @param constraint a_constraint the constraint to replace it with.
  2602.    */
  2603.   public void set_y_constraint(constraint a_constraint) 
  2604. {
  2605.       /* if its intrinsic throw an exception */
  2606.       if ((Y & intrinsic_constraints()) != 0)
  2607.     throw new sub_arctic_error(
  2608.               "Attempt to override an intrinsic constraint on y");
  2609.  
  2610.       /* if its the wrong orientation, throw an exception */
  2611.       if ((a_constraint.orientation() & std_encoding_consts.HORIZONTAL) != 0)
  2612.     throw new sub_arctic_error(
  2613.                  "Can't attach horizontally oriented constraint to y");
  2614.  
  2615.       /* if we have an existing external constraint, drop it */
  2616.       if (y_constraint().is_external())
  2617.     manager.drop_extern_constraint(this, Y);
  2618.  
  2619.       /* assign to the constraint encoding, then mark the value out-of-date */
  2620.       _y_constraint = a_constraint.encoding();
  2621.       if (!a_constraint.is_none())
  2622.         mark_y_ood();
  2623.     }
  2624.  
  2625.    //had:
  2626.    //* @exception cannot_constrain if y is intrinsically constrained
  2627.    //* @exception bad_value        if a horizontally oriented constraint is used.
  2628.  
  2629.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2630.  
  2631.   /** 
  2632.    * Establish an "external" or "heavyweight" constraint on the y value of 
  2633.    * this object.  This attaches a value exported by a particular part of 
  2634.    * some value_provider object and replaces any constraint currently in 
  2635.    * place.  However, an  attempt to replace an intrinsic constraint will 
  2636.    * result in an exception.  
  2637.    *
  2638.    * @param value_provider ext_obj  the external object providing the value.
  2639.    * @param int            ext_part the part number of the part of that object 
  2640.    *                                providing the value.
  2641.    */
  2642.   public void set_y_constraint(value_provider ext_obj, int ext_part) 
  2643. {
  2644.       if (ext_obj == null)
  2645.     throw new sub_arctic_error("Null external constraint passed to " + 
  2646.                                "set_y_constraint()");
  2647.  
  2648.       /* set the constraint encoding */
  2649.       set_y_constraint(std_function.external());
  2650.  
  2651.       /* establish an association with the external provider */
  2652.       manager.establish_extern_constraint(this,Y, ext_obj,ext_part);
  2653.  
  2654.       /* mark the value out-of-date */
  2655.       mark_y_ood();
  2656.     }
  2657.  
  2658.    //had:
  2659.    //* @exception cannot_constrain if y is intrinsically constrained.
  2660.    //* @exception general
  2661.  
  2662.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2663.  
  2664.   /** 
  2665.    * Establish a standard external constraint on the y value of this object.  
  2666.    * This replaces any constraint currently in place.  However, an attempt to 
  2667.    * replace an intrinsic constraint will result in an exception.  
  2668.    *
  2669.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  2670.    */
  2671.   public void set_y_constraint(std_ext_constraint ext_cnstr) 
  2672. {
  2673.       /* use arbitrary extern API with part 0, then set us up as self */
  2674.       set_y_constraint(ext_cnstr, 0);
  2675.       ext_cnstr.set_self_obj(this);
  2676.       ext_cnstr.set_orientation(std_encoding_consts.VERTICAL);
  2677.     }
  2678.  
  2679.    //had:
  2680.    //* @exception cannot_constrain if y is intrinsically constrained.
  2681.    //* @exception general
  2682.  
  2683.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2684.  
  2685.   /** 
  2686.    * Establish a constraint on the w value of this object.  This 
  2687.    * replaces any constraint currently in place.  However, an attempt to 
  2688.    * replace an intrinsic constraint will result in an exception.  Only
  2689.    * horizontally oriented constraints can be attached to w (if a vertically
  2690.    * oriented value is need, use an external constraint).
  2691.    *
  2692.    * @param constraint a_constraint the constraint to replace it with.
  2693.    */
  2694.   public void set_w_constraint(constraint a_constraint) 
  2695. {
  2696.       /* if its intrinsic throw an exception */
  2697.       if ((W & intrinsic_constraints()) != 0)
  2698.     throw new sub_arctic_error(
  2699.               "Attempt to override an intrinsic constraint on w");
  2700.  
  2701.       /* if its the wrong orientation, throw an exception */
  2702.       if ((a_constraint.orientation() & std_encoding_consts.VERTICAL) != 0)
  2703.     throw new sub_arctic_error(
  2704.                  "Can't attach vertically oriented constraint to w");
  2705.  
  2706.       /* if we have an existing external constraint, drop it */
  2707.       if (w_constraint().is_external())
  2708.     manager.drop_extern_constraint(this, W);
  2709.  
  2710.       /* assign to the constraint encoding, then mark the value out-of-date */
  2711.       _w_constraint = a_constraint.encoding();
  2712.       if (!a_constraint.is_none())
  2713.         mark_w_ood();
  2714.     }
  2715.  
  2716.    //had:
  2717.    //* @exception cannot_constrain if w is intrinsically constrained
  2718.    //* @exception bad_value        if a vertically oriented constraint is used.
  2719.  
  2720.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2721.  
  2722.   /** 
  2723.    * Establish an "external" or "heavyweight" constraint on the w value of 
  2724.    * this object.  This attaches a value exported by a particular part of 
  2725.    * some value_provider object and replaces any constraint currently in 
  2726.    * place.  However, an  attempt to replace an intrinsic constraint will 
  2727.    * result in an exception.  
  2728.    *
  2729.    * @param value_provider ext_obj  the external object providing the value.
  2730.    * @param int            ext_part the part number of the part of that object 
  2731.    *                                providing the value.
  2732.    */
  2733.   public void set_w_constraint(value_provider ext_obj, int ext_part) 
  2734. {
  2735.       if (ext_obj == null)
  2736.     throw new sub_arctic_error("Null external constraint passed to " + 
  2737.                                "set_w_constraint()");
  2738.  
  2739.       /* set the constraint encoding */
  2740.       set_w_constraint(std_function.external());
  2741.  
  2742.       /* establish an association with the external provider */
  2743.       manager.establish_extern_constraint(this,W, ext_obj,ext_part);
  2744.  
  2745.       /* mark the value out-of-date */
  2746.       mark_w_ood();
  2747.     }
  2748.  
  2749.    //had:
  2750.    //* @exception cannot_constrain if w is intrinsically constrained.
  2751.    //* @exception general
  2752.  
  2753.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2754.  
  2755.   /** 
  2756.    * Establish a standard external constraint on the w value of this object.  
  2757.    * This replaces any constraint currently in place.  However, an attempt to 
  2758.    * replace an intrinsic constraint will result in an exception.  
  2759.    *
  2760.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  2761.    */
  2762.   public void set_w_constraint(std_ext_constraint ext_cnstr) 
  2763. {
  2764.       /* use arbitrary extern API with part 0, then set us up as self */
  2765.       set_w_constraint(ext_cnstr, 0);
  2766.       ext_cnstr.set_self_obj(this);
  2767.       ext_cnstr.set_orientation(std_encoding_consts.HORIZONTAL);
  2768.     }
  2769.  
  2770.    //had:
  2771.    //* @exception cannot_constrain if w is intrinsically constrained.
  2772.    //* @exception general
  2773.  
  2774.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2775.  
  2776.   /** 
  2777.    * Establish a constraint on the h value of this object.  This 
  2778.    * replaces any constraint currently in place.  However, an attempt to 
  2779.    * replace an intrinsic constraint will result in an exception.  Only
  2780.    * vertically oriented constraints can be attached to h (if a horizontally
  2781.    * oriented value is need, use an external constraint).
  2782.    *
  2783.    * @param constraint a_constraint the constraint to replace it with.
  2784.    */
  2785.   public void set_h_constraint(constraint a_constraint) 
  2786. {
  2787.       /* if its intrinsic throw an exception */
  2788.       if ((H & intrinsic_constraints()) != 0)
  2789.     throw new sub_arctic_error(
  2790.               "Attempt to override an intrinsic constraint on h");
  2791.  
  2792.       /* if its the wrong orientation, throw an exception */
  2793.       if ((a_constraint.orientation() & std_encoding_consts.HORIZONTAL) != 0)
  2794.     throw new sub_arctic_error(
  2795.                  "Can't attach horizontally oriented constraint to h");
  2796.  
  2797.       /* if we have an existing external constraint, drop it */
  2798.       if (h_constraint().is_external())
  2799.     manager.drop_extern_constraint(this, H);
  2800.  
  2801.       /* assign to the constraint encoding, then mark the value out-of-date */
  2802.       _h_constraint = a_constraint.encoding();
  2803.       if (!a_constraint.is_none())
  2804.         mark_h_ood();
  2805.     }
  2806.  
  2807.    //had:
  2808.    //* @exception cannot_constrain if h is intrinsically constrained
  2809.    //* @exception bad_value        if a horizontally oriented constraint is used.
  2810.  
  2811.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2812.  
  2813.   /** 
  2814.    * Establish an "external" or "heavyweight" constraint on the h value of 
  2815.    * this object.  This attaches a value exported by a particular part of 
  2816.    * some value_provider object and replaces any constraint currently in 
  2817.    * place.  However, an  attempt to replace an intrinsic constraint will 
  2818.    * result in an exception.  
  2819.    *
  2820.    * @param value_provider ext_obj  the external object providing the value.
  2821.    * @param int            ext_part the part number of the part of that object 
  2822.    *                                providing the value.
  2823.    */
  2824.   public void set_h_constraint(value_provider ext_obj, int ext_part) 
  2825. {
  2826.       if (ext_obj == null)
  2827.     throw new sub_arctic_error("Null external constraint passed to " + 
  2828.                                "set_h_constraint()");
  2829.  
  2830.       /* set the constraint encoding */
  2831.       set_h_constraint(std_function.external());
  2832.  
  2833.       /* establish an association with the external provider */
  2834.       manager.establish_extern_constraint(this,H, ext_obj,ext_part);
  2835.  
  2836.       /* mark the value out-of-date */
  2837.       mark_h_ood();
  2838.     }
  2839.  
  2840.    //had:
  2841.    //* @exception cannot_constrain if h is intrinsically constrained.
  2842.    //* @exception general
  2843.  
  2844.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2845.  
  2846.   /** 
  2847.    * Establish a standard external constraint on the h value of this object.  
  2848.    * This replaces any constraint currently in place.  However, an attempt to 
  2849.    * replace an intrinsic constraint will result in an exception.  
  2850.    *
  2851.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  2852.    */
  2853.   public void set_h_constraint(std_ext_constraint ext_cnstr) 
  2854. {
  2855.       /* use arbitrary extern API with part 0, then set us up as self */
  2856.       set_h_constraint(ext_cnstr, 0);
  2857.       ext_cnstr.set_self_obj(this);
  2858.       ext_cnstr.set_orientation(std_encoding_consts.VERTICAL);
  2859.     }
  2860.  
  2861.    //had:
  2862.    //* @exception cannot_constrain if h is intrinsically constrained.
  2863.    //* @exception general
  2864.  
  2865.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2866.  
  2867.   /** 
  2868.    * Establish a constraint on the visible value of this object.  This 
  2869.    * replaces any constraint currently in place.  However, an attempt to 
  2870.    * replace an intrinsic constraint will result in an exception.  
  2871.    *
  2872.    * @param constraint a_constraint the constraint to replace it with.
  2873.    */
  2874.   public void set_visible_constraint(constraint a_constraint) 
  2875. {
  2876.       /* if its intrinsic throw an exception */
  2877.       if ((VISIBLE & intrinsic_constraints()) != 0)
  2878.     throw new sub_arctic_error(
  2879.           "Attempt to override an intrinsic constraint on visible");
  2880.  
  2881.       /* if we have an existing external constraint, drop it */
  2882.       if (visible_constraint().is_external())
  2883.     manager.drop_extern_constraint(this, VISIBLE);
  2884.  
  2885.       /* assign to the constraint encoding, then mark the value out-of-date */
  2886.       _visible_constraint = a_constraint.encoding();
  2887.       if ((a_constraint.orientation() & std_encoding_consts.HORIZONTAL) != 0)
  2888.     _constraint_flags |= VISIBLE_IS_HORIZONTAL;
  2889.       else
  2890.     _constraint_flags &= ~VISIBLE_IS_HORIZONTAL;
  2891.       if (!a_constraint.is_none())
  2892.         mark_visible_ood();
  2893.     }
  2894.  
  2895.    //had:
  2896.    //* @exception cannot_constrain if visible is intrinsically constrained
  2897.    //* @exception bad_value        
  2898.  
  2899.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2900.  
  2901.   /** 
  2902.    * Establish an "external" or "heavyweight" constraint on the visible value 
  2903.    * of this object.  This attaches a value exported by a particular part of 
  2904.    * some value_provider object and replaces any constraint currently in 
  2905.    * place.  However, an  attempt to replace an intrinsic constraint will 
  2906.    * result in an exception.  
  2907.    *
  2908.    * @param value_provider ext_obj  the external object providing the value.
  2909.    * @param int            ext_part the part number of the part of that object 
  2910.    *                                providing the value.
  2911.    */
  2912.   public void set_visible_constraint(value_provider ext_obj, int ext_part) 
  2913. {
  2914.       if (ext_obj == null)
  2915.     throw new sub_arctic_error("Null external constraint passed to " + 
  2916.                            "set_visible_constraint()");
  2917.  
  2918.       /* set the constraint encoding */
  2919.       set_visible_constraint(std_function.external());
  2920.  
  2921.       /* establish an association with the external provider */
  2922.       manager.establish_extern_constraint(this,VISIBLE, ext_obj,ext_part);
  2923.  
  2924.       /* mark the value out-of-date */
  2925.       mark_visible_ood();
  2926.     }
  2927.  
  2928.    //had:
  2929.    //* @exception cannot_constrain if visible is intrinsically constrained.
  2930.    //* @exception general
  2931.  
  2932.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2933.  
  2934.   /** 
  2935.    * Establish a standard external constraint on the visible value of this 
  2936.    * object.  This replaces any constraint currently in place.  However, an 
  2937.    * attempt to replace an intrinsic constraint will result in an exception.  
  2938.    *
  2939.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  2940.    */
  2941.   public void set_visible_constraint(std_ext_constraint ext_cnstr) 
  2942. {
  2943.       /* use arbitrary extern API with part 0, then set us up as self */
  2944.       set_visible_constraint(ext_cnstr, 0);
  2945.       ext_cnstr.set_self_obj(this);
  2946.     }
  2947.  
  2948.    //had:
  2949.    //* @exception cannot_constrain if visible is intrinsically constrained.
  2950.    //* @exception general
  2951.  
  2952.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2953.  
  2954.   /** 
  2955.    * Establish a constraint on the enabled value of this object.  This 
  2956.    * replaces any constraint currently in place.  However, an attempt to 
  2957.    * replace an intrinsic constraint will result in an exception.  
  2958.    *
  2959.    * @param constraint a_constraint the constraint to replace it with.
  2960.    */
  2961.   public void set_enabled_constraint(constraint a_constraint) 
  2962. {
  2963.       /* if its intrinsic throw an exception */
  2964.       if ((ENABLED & intrinsic_constraints()) != 0)
  2965.     throw new sub_arctic_error(
  2966.           "Attempt to override an intrinsic constraint on enabled");
  2967.  
  2968.       /* if we have an existing external constraint, drop it */
  2969.       if (enabled_constraint().is_external())
  2970.     manager.drop_extern_constraint(this, ENABLED);
  2971.  
  2972.       /* assign to the constraint encoding, then mark the value out-of-date */
  2973.       _enabled_constraint = a_constraint.encoding();
  2974.       if ((a_constraint.orientation() & std_encoding_consts.HORIZONTAL) != 0)
  2975.     _constraint_flags |= ENABLED_IS_HORIZONTAL;
  2976.       else
  2977.     _constraint_flags &= ~ENABLED_IS_HORIZONTAL;
  2978.       if (!a_constraint.is_none())
  2979.         mark_enabled_ood();
  2980.     }
  2981.  
  2982.    //had:
  2983.    //* @exception cannot_constrain if enabled is intrinsically constrained
  2984.    //* @exception bad_value        
  2985.  
  2986.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  2987.  
  2988.   /** 
  2989.    * Establish an "external" or "heavyweight" constraint on the enabled value 
  2990.    * of this object.  This attaches a value exported by a particular part of 
  2991.    * some value_provider object and replaces any constraint currently in 
  2992.    * place.  However, an  attempt to replace an intrinsic constraint will 
  2993.    * result in an exception.  
  2994.    *
  2995.    * @param value_provider ext_obj  the external object providing the value.
  2996.    * @param int            ext_part the part number of the part of that object 
  2997.    *                                providing the value.
  2998.    */
  2999.   public void set_enabled_constraint(value_provider ext_obj, int ext_part) 
  3000. {
  3001.       if (ext_obj == null)
  3002.     throw new sub_arctic_error("Null external constraint passed to " + 
  3003.                            "set_enabled_constraint()");
  3004.  
  3005.       /* set the constraint encoding */
  3006.       set_enabled_constraint(std_function.external());
  3007.  
  3008.       /* establish an association with the external provider */
  3009.       manager.establish_extern_constraint(this,ENABLED, ext_obj,ext_part);
  3010.  
  3011.       /* mark the value out-of-date */
  3012.       mark_enabled_ood();
  3013.     }
  3014.  
  3015.    //had:
  3016.    //* @exception cannot_constrain if enabled is intrinsically constrained.
  3017.    //* @exception general
  3018.  
  3019.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3020.  
  3021.   /** 
  3022.    * Establish a standard external constraint on the enabled value of this 
  3023.    * object.  This replaces any constraint currently in place.  However, an 
  3024.    * attempt to replace an intrinsic constraint will result in an exception.  
  3025.    *
  3026.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  3027.    */
  3028.   public void set_enabled_constraint(std_ext_constraint ext_cnstr) 
  3029. {
  3030.       /* use arbitrary extern API with part 0, then set us up as self */
  3031.       set_enabled_constraint(ext_cnstr, 0);
  3032.       ext_cnstr.set_self_obj(this);
  3033.     }
  3034.  
  3035.    //had:
  3036.    //* @exception cannot_constrain if enabled is intrinsically constrained.
  3037.    //* @exception general
  3038.  
  3039.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3040.  
  3041.   /** 
  3042.    * Establish a constraint on the part_a value of this object.  This 
  3043.    * replaces any constraint currently in place.  However, an attempt to 
  3044.    * replace an intrinsic constraint will result in an exception.  
  3045.    *
  3046.    * @param constraint a_constraint the constraint to replace it with.
  3047.    */
  3048.   public void set_part_a_constraint(constraint a_constraint) 
  3049. {
  3050.       /* if its intrinsic throw an exception */
  3051.       if ((PART_A & intrinsic_constraints()) != 0)
  3052.     throw new sub_arctic_error(
  3053.           "Attempt to override an intrinsic constraint on part_a");
  3054.  
  3055.       /* if we have an existing external constraint, drop it */
  3056.       if (part_a_constraint().is_external())
  3057.     manager.drop_extern_constraint(this, PART_A);
  3058.  
  3059.       /* assign to the constraint encoding, then mark the value out-of-date */
  3060.       _part_a_constraint = a_constraint.encoding();
  3061.       if ((a_constraint.orientation() & std_encoding_consts.HORIZONTAL) != 0)
  3062.     _constraint_flags |= PART_A_IS_HORIZONTAL;
  3063.       else
  3064.     _constraint_flags &= ~PART_A_IS_HORIZONTAL;
  3065.       if (!a_constraint.is_none())
  3066.         mark_part_a_ood();
  3067.     }
  3068.  
  3069.    //had:
  3070.    //* @exception cannot_constrain if part_a is intrinsically constrained
  3071.    //* @exception bad_value        
  3072.  
  3073.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3074.  
  3075.   /** 
  3076.    * Establish an "external" or "heavyweight" constraint on the part_a value of 
  3077.    * this object.  This attaches a value exported by a particular part of 
  3078.    * some value_provider object and replaces any constraint currently in 
  3079.    * place.  However, an  attempt to replace an intrinsic constraint will 
  3080.    * result in an exception.  
  3081.    *
  3082.    * @param value_provider ext_obj  the external object providing the value.
  3083.    * @param int            ext_part the part number of the part of that object 
  3084.    *                                providing the value.
  3085.    */
  3086.   public void set_part_a_constraint(value_provider ext_obj, int ext_part) 
  3087. {
  3088.       if (ext_obj == null)
  3089.     throw new sub_arctic_error("Null external constraint passed to " + 
  3090.                            "set_part_a_constraint()");
  3091.  
  3092.       /* set the constraint encoding */
  3093.       set_part_a_constraint(std_function.external());
  3094.  
  3095.       /* establish an association with the external provider */
  3096.       manager.establish_extern_constraint(this,PART_A, ext_obj,ext_part);
  3097.  
  3098.       /* mark the value out-of-date */
  3099.       mark_part_a_ood();
  3100.     }
  3101.  
  3102.    //had:
  3103.    //* @exception cannot_constrain if part_a is intrinsically constrained.
  3104.    //* @exception general
  3105.  
  3106.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3107.  
  3108.   /** 
  3109.    * Establish a standard external constraint on the part_a value of this 
  3110.    * object.  This replaces any constraint currently in place.  However, an 
  3111.    * attempt to replace an intrinsic constraint will result in an exception.  
  3112.    *
  3113.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  3114.    */
  3115.   public void set_part_a_constraint(std_ext_constraint ext_cnstr) 
  3116. {
  3117.       /* use arbitrary extern API with part 0, then set us up as self */
  3118.       set_part_a_constraint(ext_cnstr, 0);
  3119.       ext_cnstr.set_self_obj(this);
  3120.     }
  3121.  
  3122.    //had:
  3123.    //* @exception cannot_constrain if part_a is intrinsically constrained.
  3124.    //* @exception general
  3125.  
  3126.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3127.  
  3128.   /** 
  3129.    * Establish a constraint on the part_b value of this object.  This 
  3130.    * replaces any constraint currently in place.  However, an attempt to 
  3131.    * replace an intrinsic constraint will result in an exception.  
  3132.    *
  3133.    * @param constraint a_constraint the constraint to replace it with.
  3134.    */
  3135.   public void set_part_b_constraint(constraint a_constraint) 
  3136. {
  3137.       /* if its intrinsic throw an exception */
  3138.       if ((PART_B & intrinsic_constraints()) != 0)
  3139.     throw new sub_arctic_error(
  3140.           "Attempt to override an intrinsic constraint on part_b");
  3141.  
  3142.       /* if we have an existing external constraint, drop it */
  3143.       if (part_b_constraint().is_external())
  3144.     manager.drop_extern_constraint(this, PART_B);
  3145.  
  3146.       /* assign to the constraint encoding, then mark the value out-of-date */
  3147.       _part_b_constraint = a_constraint.encoding();
  3148.       if ((a_constraint.orientation() & std_encoding_consts.HORIZONTAL) != 0)
  3149.     _constraint_flags |= PART_B_IS_HORIZONTAL;
  3150.       else
  3151.     _constraint_flags &= ~PART_B_IS_HORIZONTAL;
  3152.       if (!a_constraint.is_none())
  3153.         mark_part_b_ood();
  3154.     }
  3155.  
  3156.    //had:
  3157.    //* @exception cannot_constrain if part_b is intrinsically constrained
  3158.    //* @exception bad_value        
  3159.  
  3160.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3161.  
  3162.   /** 
  3163.    * Establish an "external" or "heavyweight" constraint on the part_b value of 
  3164.    * this object.  This attaches a value exported by a particular part of 
  3165.    * some value_provider object and replaces any constraint currently in 
  3166.    * place.  However, an  attempt to replace an intrinsic constraint will 
  3167.    * result in an exception.  
  3168.    *
  3169.    * @param value_provider ext_obj  the external object providing the value.
  3170.    * @param int            ext_part the part number of the part of that object 
  3171.    *                                providing the value.
  3172.    */
  3173.   public void set_part_b_constraint(value_provider ext_obj, int ext_part) 
  3174. {
  3175.       if (ext_obj == null)
  3176.     throw new sub_arctic_error("Null external constraint passed to " + 
  3177.                            "set_part_b_constraint()");
  3178.  
  3179.       /* set the constraint encoding */
  3180.       set_part_b_constraint(std_function.external());
  3181.  
  3182.       /* establish an association with the external provider */
  3183.       manager.establish_extern_constraint(this,PART_B, ext_obj,ext_part);
  3184.  
  3185.       /* mark the value out-of-date */
  3186.       mark_part_b_ood();
  3187.     }
  3188.  
  3189.    //had:
  3190.    //* @exception cannot_constrain if part_b is intrinsically constrained.
  3191.    //* @exception general
  3192.  
  3193.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3194.  
  3195.   /** 
  3196.    * Establish a standard external constraint on the part_b value of this 
  3197.    * object.  This replaces any constraint currently in place.  However, an 
  3198.    * attempt to replace an intrinsic constraint will result in an exception.  
  3199.    *
  3200.    * @param std_ext_constraint ext_cnstr the constraint to attach.
  3201.    */
  3202.   public void set_part_b_constraint(std_ext_constraint ext_cnstr) 
  3203. {
  3204.       /* use arbitrary extern API with part 0, then set us up as self */
  3205.       set_part_b_constraint(ext_cnstr, 0);
  3206.       ext_cnstr.set_self_obj(this);
  3207.     }
  3208.  
  3209.    //had:
  3210.    //* @exception cannot_constrain if part_b is intrinsically constrained.
  3211.    //* @exception general
  3212.  
  3213.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3214.  
  3215.   /** 
  3216.    * Indicate which values are currently marked as potentially out of
  3217.    * date with respect to their constraints.  Typically this information
  3218.    * is needed only by the constraint system, since values are generally
  3219.    * brought up to date whenever they are requested.  <p>
  3220.    *
  3221.    * @returns int a bitset indicating the parts of this object which are 
  3222.    *              currently marked out-of-date.
  3223.    */
  3224.   public int marked_ood()
  3225.     {
  3226.       return _constraint_flags & OOD_BITS;
  3227.     }
  3228.  
  3229.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3230.  
  3231.   /** 
  3232.    * Mark the given value as out of date.  This will recursively mark
  3233.    * anything that directly or indirectly depends on the given value. This
  3234.    * should normally only be called by the constraint system, since setting 
  3235.    * values via set_*() will automatically call this routine.  
  3236.    *
  3237.    * @param int the part to mark out-of-date.  This should be one of the 
  3238.    *            values: X, Y, W, H, ENABLED, PART_A, or PART_B.
  3239.    */
  3240.   public void mark_ood(int coord_code) 
  3241. {
  3242.       switch (coord_code)
  3243.     {
  3244.       case X:       mark_x_ood(); break;
  3245.       case Y:       mark_y_ood(); break;
  3246.       case W:       mark_w_ood(); break;
  3247.       case H:       mark_h_ood(); break;
  3248.       case VISIBLE: mark_visible_ood(); break;
  3249.       case ENABLED: mark_enabled_ood(); break;
  3250.       case PART_A:  mark_part_a_ood(); break;
  3251.       case PART_B:  mark_part_a_ood(); break;
  3252.       default:
  3253.         throw new sub_arctic_error("Unrecognized coordinate code " + 
  3254.                                    coord_code + "passed to mark_ood()");
  3255.     }
  3256.     }
  3257.  
  3258.    //had:
  3259.    //* @exception bad_value if an unrecognized part code is given.
  3260.  
  3261.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3262.  
  3263.   /** 
  3264.    * Mark all geometric parts of this object out of date.  This happens for 
  3265.    * example when we reparent it.  
  3266.    */
  3267.   public void mark_all_ood() 
  3268.     {
  3269.       mark_x_ood(); mark_y_ood();
  3270.       mark_w_ood(); mark_h_ood();
  3271.       mark_visible_ood(); 
  3272.       mark_enabled_ood();
  3273.       mark_part_a_ood();
  3274.       mark_part_b_ood();
  3275.     }
  3276.  
  3277.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3278.  
  3279.   /** 
  3280.    * Mark x value and anything that directly or indirectly depends on it as
  3281.    * out-of-date.
  3282.    */
  3283.   public void mark_x_ood()
  3284.     {
  3285.       /* Don't mark twice */
  3286.       if ((_constraint_flags & X_OOD) != 0) return;
  3287.  
  3288.       /* mark the value */
  3289.       _constraint_flags |= X_OOD;
  3290.  
  3291.       /* inform things that might depend on it that this is out-of-date */
  3292.       ood_inform_all(X);
  3293.     }
  3294.  
  3295.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3296.  
  3297.   /** 
  3298.    * Mark y value and anything that directly or indirectly depends on it as
  3299.    * out-of-date.
  3300.    */
  3301.   public void mark_y_ood()
  3302.     {
  3303.       /* Don't mark twice */
  3304.       if ((_constraint_flags & Y_OOD) != 0) return;
  3305.  
  3306.       /* mark the value */
  3307.       _constraint_flags |= Y_OOD;
  3308.  
  3309.       /* inform things that might depend on it that this is out-of-date */
  3310.       ood_inform_all(Y);
  3311.     }
  3312.  
  3313.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3314.  
  3315.   /** 
  3316.    * Mark w value and anything that directly or indirectly depends on it as
  3317.    * out-of-date.
  3318.    */
  3319.   public void mark_w_ood()
  3320.     {
  3321.       /* Don't mark twice */
  3322.       if ((_constraint_flags & W_OOD) != 0) return;
  3323.  
  3324.       /* mark the value */
  3325.       _constraint_flags |= W_OOD;
  3326.  
  3327.       /* inform things that might depend on it that this is out-of-date */
  3328.       ood_inform_all(W);
  3329.     }
  3330.  
  3331.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3332.  
  3333.   /** 
  3334.    * Mark h value and anything that directly or indirectly depends on it as
  3335.    * out-of-date.
  3336.    */
  3337.   public void mark_h_ood()
  3338.     {
  3339.       /* Don't mark twice */
  3340.       if ((_constraint_flags & H_OOD) != 0) return;
  3341.  
  3342.       /* mark the value */
  3343.       _constraint_flags |= H_OOD;
  3344.  
  3345.       /* inform things that might depend on it that this is out-of-date */
  3346.       ood_inform_all(H);
  3347.     }
  3348.  
  3349.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3350.  
  3351.   /** 
  3352.    * Mark visible value and anything that directly or indirectly depends on 
  3353.    * it as out-of-date.
  3354.    */
  3355.   public void mark_visible_ood()
  3356.     {
  3357.       /* Don't mark twice */
  3358.       if ((_constraint_flags & VISIBLE_OOD) != 0) return;
  3359.  
  3360.       /* mark the value */
  3361.       _constraint_flags |= VISIBLE_OOD;
  3362.  
  3363.       /* inform things that might depend on it that this is out-of-date */
  3364.       ood_inform_all(VISIBLE);
  3365.     }
  3366.  
  3367.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3368.  
  3369.   /** 
  3370.    * Mark enabled value and anything that directly or indirectly depends on 
  3371.    * it as out-of-date.
  3372.    */
  3373.   public void mark_enabled_ood()
  3374.     {
  3375.       /* Don't mark twice */
  3376.       if ((_constraint_flags & ENABLED_OOD) != 0) return;
  3377.  
  3378.       /* mark the value */
  3379.       _constraint_flags |= ENABLED_OOD;
  3380.  
  3381.       /* inform things that might depend on it that this is out-of-date */
  3382.       ood_inform_all(ENABLED);
  3383.     }
  3384.  
  3385.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3386.  
  3387.   /** 
  3388.    * Mark part_a value and anything that directly or indirectly depends on it 
  3389.    * as out-of-date.
  3390.    */
  3391.   public void mark_part_a_ood()
  3392.     {
  3393.       /* Don't mark twice */
  3394.       if ((_constraint_flags & PART_A_OOD) != 0) return;
  3395.  
  3396.       /* mark the value */
  3397.       _constraint_flags |= PART_A_OOD;
  3398.  
  3399.       /* inform things that might depend on it that this is out-of-date */
  3400.       ood_inform_all(PART_A);
  3401.     }
  3402.  
  3403.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3404.  
  3405.   /** 
  3406.    * Mark part_b value and anything that directly or indirectly depends on it 
  3407.    * as out-of-date.
  3408.    */
  3409.   public void mark_part_b_ood()
  3410.     {
  3411.       /* Don't mark twice */
  3412.       if ((_constraint_flags & PART_B_OOD) != 0) return;
  3413.  
  3414.       /* mark the value */
  3415.       _constraint_flags |= PART_B_OOD;
  3416.  
  3417.       /* inform things that might depend on it that this is out-of-date */
  3418.       ood_inform_all(PART_B);
  3419.     }
  3420.  
  3421.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3422.  
  3423.   /** 
  3424.    * Tell all potentially dependent objects about an out of date part.  This is
  3425.    * used by the lightweight constraint system to infer dependency edges that
  3426.    * are not explicitly stored.  Basically we tell everyone that might have a
  3427.    * dependency edge from us (all the local neighborhood) and they work out
  3428.    * whether they have the edge or not based on the attached constraint.  If
  3429.    * they do have the edge they mark themselves out-of-date, otherwise they
  3430.    * ignore this.
  3431.    *
  3432.    * @param int which_part the code of the part of this object which is 
  3433.    *                       informing all the others that it is out-of-date. 
  3434.    */
  3435.   protected void ood_inform_all(int which_part)
  3436.     {
  3437.       interactor        ch;
  3438.       boolean           have_ext = false;
  3439.       Vector            notify_list;
  3440.       consumer_part_ref notif;
  3441.  
  3442.       /* tell other parts of same object */
  3443.       inform_ood(std_encoding_consts.OBJCODE_SELF, which_part, 0);
  3444.  
  3445.       /* tell the parent */
  3446.       if (parent() != null) 
  3447.     parent().inform_ood(std_encoding_consts.OBJCODE_SOME_CHILD,
  3448.                 which_part, child_index());
  3449.  
  3450.       /* tell the next and previous siblings */
  3451.       if (next_sibling() != null)
  3452.     next_sibling().inform_ood(std_encoding_consts.OBJCODE_PREV_SIBLING, 
  3453.                   which_part,0);
  3454.       if (prev_sibling() != null)
  3455.     prev_sibling().inform_ood(std_encoding_consts.OBJCODE_NEXT_SIBLING, 
  3456.                   which_part,0);
  3457.  
  3458.       /* tell the children */
  3459.       for (int i=0; i<num_children(); i++)
  3460.     {
  3461.       ch = child(i);
  3462.       if (ch != null) 
  3463.         ch.inform_ood(std_encoding_consts.OBJCODE_PARENT,which_part, 0);
  3464.     }
  3465.  
  3466.     /* determine if we need to tell an external object */
  3467.       switch (which_part)
  3468.     {
  3469.     case X: have_ext = constraint_flag_is_set(X_HAS_EXT_NOTIFY); break;
  3470.     case Y: have_ext = constraint_flag_is_set(Y_HAS_EXT_NOTIFY); break;
  3471.     case W: have_ext = constraint_flag_is_set(W_HAS_EXT_NOTIFY); break;
  3472.     case H: have_ext = constraint_flag_is_set(H_HAS_EXT_NOTIFY); break;
  3473.     case VISIBLE: 
  3474.       have_ext = constraint_flag_is_set(VISIBLE_HAS_EXT_NOTIFY); 
  3475.       break;
  3476.     case ENABLED: 
  3477.       have_ext = constraint_flag_is_set(ENABLED_HAS_EXT_NOTIFY); 
  3478.       break;
  3479.     case PART_A: 
  3480.       have_ext = constraint_flag_is_set(PART_A_HAS_EXT_NOTIFY);
  3481.       break;
  3482.     case PART_B: 
  3483.       have_ext = constraint_flag_is_set(PART_B_HAS_EXT_NOTIFY);
  3484.       break;
  3485.     }
  3486.       
  3487.       /* if we do, talk to the manager to get our notify list */
  3488.       if (have_ext)
  3489.     {
  3490.       /* get the list */
  3491.       notify_list = manager.get_ood_notify(this, which_part);
  3492.       if (notify_list != null)
  3493.         {
  3494.           /* walk down the list and notify everyone who wants to hear */
  3495.           for (int i = 0; i < notify_list.size(); i++)
  3496.         {
  3497.           notif = (consumer_part_ref)notify_list.elementAt(i);
  3498.           notif.obj.value_ood(notif.part_num, this, which_part);
  3499.         }
  3500.         }
  3501.     }
  3502.     }
  3503.  
  3504.  
  3505.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3506.  
  3507.   /** 
  3508.    * Mark all our geometric parts out-of-date and tell all potentially 
  3509.    * dependent objects that all our parts are out-of-date (this gets done 
  3510.    * when we move around in the hierarchy).  This affects, x, y, w, and h,
  3511.    * but not visible, enabled, part_a, or part_b.
  3512.    */
  3513.   public void mark_reparented_ood()
  3514.     {
  3515.       /* make sure we propagate past even if we are already marked */
  3516.       if ((marked_ood() & X) != 0) ood_inform_all(X); else mark_x_ood();
  3517.       if ((marked_ood() & Y) != 0) ood_inform_all(Y); else mark_y_ood();
  3518.       if ((marked_ood() & W) != 0) ood_inform_all(W); else mark_w_ood();
  3519.       if ((marked_ood() & H) != 0) ood_inform_all(H); else mark_h_ood();
  3520.     }
  3521.  
  3522.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3523.  
  3524.   /** 
  3525.    * Inform the object that the indicated part of a potentially related object 
  3526.    * is out-of-date (this is called from ood_inform_all()).  The related 
  3527.    * object can be one of OBJCODE_SELF, OBJCODE_PARENT, OBJCODE_SOME_CHILD,  
  3528.    * OBJCODE_NEXT_SIBLING, or OBJCODE_PREV_SIBLING, and the indicated part 
  3529.    * can  be X, Y, W, H, VISIBLE, ENABLED, PART_A, or PART_B. <p>
  3530.    * 
  3531.    * The nth_child parameter is used only if OBJCODE_SOME_CHILD is passed,
  3532.    * in which case it indicates the index of the child in question.
  3533.    * If parts of this object are actually dependent upon the given part they 
  3534.    * are marked out-of-date and the mark out-of-date traversal is continued 
  3535.    * recursively from them.  If not, we do nothing.
  3536.    *
  3537.    * @see #ood_inform_all
  3538.    * @param int from_type the type of object we are being informed by (must be
  3539.    *                      one of OBJCODE_SELF, OBJCODE_PARENT, 
  3540.    *                      OBJCODE_SOME_CHILD,  OBJCODE_NEXT_SIBLING, or 
  3541.    *                      OBJCODE_PREV_SIBLING).
  3542.    * @param int from_part the part code of the part of that object which is 
  3543.    *                      informing us that it is out-of-date.
  3544.    * @param int nth_child if from_type is OBJCODE_SOME_CHILD, this parameter
  3545.    *                      indicates which child it is (otherwise it is ignored).
  3546.    */
  3547.   public void inform_ood(
  3548.     int from_type, 
  3549.     int from_part,
  3550.     int nth_child) 
  3551. {
  3552.  
  3553.        /* only need to inform components with matching h/v orientation */
  3554.        if (from_part == X || from_part == W)
  3555.      {
  3556.        /* if x depends on that part, mark it */
  3557.            if (std_constraint_impl.the_impl().depends_on(
  3558.                          _x_constraint, this, from_type, from_part, 
  3559.                  nth_child, std_encoding_consts.HORIZONTAL))
  3560.          mark_x_ood();
  3561.  
  3562.        /* if w depends on that part, mark it */
  3563.            if (std_constraint_impl.the_impl().depends_on(
  3564.                  _w_constraint, this, from_type, from_part, 
  3565.                  nth_child, std_encoding_consts.HORIZONTAL))
  3566.          mark_w_ood();
  3567.  
  3568.        /* if visible is horizontal and depends on that part, mark it */
  3569.            if ((_constraint_flags & VISIBLE_IS_HORIZONTAL) != 0 &&
  3570.             std_constraint_impl.the_impl().depends_on(
  3571.                  _visible_constraint, this, from_type, from_part, 
  3572.                  nth_child, std_encoding_consts.HORIZONTAL))
  3573.          mark_visible_ood();
  3574.  
  3575.        /* if enabled is horizontal and depends on that part, mark it */
  3576.            if ((_constraint_flags & ENABLED_IS_HORIZONTAL) != 0 &&
  3577.             std_constraint_impl.the_impl().depends_on(
  3578.                  _enabled_constraint, this, from_type, from_part, 
  3579.                  nth_child, std_encoding_consts.HORIZONTAL))
  3580.          mark_enabled_ood();
  3581.  
  3582.        /* if part_a is horizontal and depends on that part, mark it */
  3583.            if ((_constraint_flags & PART_A_IS_HORIZONTAL) != 0 &&
  3584.             std_constraint_impl.the_impl().depends_on(
  3585.                  _part_a_constraint, this, from_type, from_part, 
  3586.                  nth_child, std_encoding_consts.HORIZONTAL))
  3587.          mark_part_a_ood();
  3588.  
  3589.        /* if part_b is horizontal and depends on that part, mark it */
  3590.            if ((_constraint_flags & PART_B_IS_HORIZONTAL) != 0 &&
  3591.             std_constraint_impl.the_impl().depends_on(
  3592.                  _part_b_constraint, this, from_type, from_part, 
  3593.                  nth_child, std_encoding_consts.HORIZONTAL))
  3594.          mark_part_b_ood();
  3595.      }
  3596.        else if (from_part == Y || from_part == H)
  3597.      {
  3598.        /* if y depends on that part, mark it */
  3599.            if (std_constraint_impl.the_impl().depends_on(
  3600.                  _y_constraint, this, from_type, from_part, 
  3601.                  nth_child, std_encoding_consts.VERTICAL))
  3602.          mark_y_ood();
  3603.  
  3604.        /* if h depends on that part, mark it */
  3605.            if (std_constraint_impl.the_impl().depends_on(
  3606.                  _h_constraint, this, from_type, from_part, 
  3607.                  nth_child, std_encoding_consts.VERTICAL))
  3608.          mark_h_ood();
  3609.  
  3610.        /* if visible is vertical and depends on that part, mark it */
  3611.            if ((_constraint_flags & VISIBLE_IS_HORIZONTAL) == 0 &&
  3612.             std_constraint_impl.the_impl().depends_on(
  3613.                  _visible_constraint, this, from_type, from_part, 
  3614.                  nth_child, std_encoding_consts.VERTICAL))
  3615.          mark_visible_ood();
  3616.  
  3617.        /* if enabled is vertical and depends on that part, mark it */
  3618.            if ((_constraint_flags & ENABLED_IS_HORIZONTAL) == 0 &&
  3619.             std_constraint_impl.the_impl().depends_on(
  3620.                  _enabled_constraint, this, from_type, from_part, 
  3621.                  nth_child, std_encoding_consts.VERTICAL))
  3622.          mark_enabled_ood();
  3623.  
  3624.        /* if part_a is vertical and depends on that part, mark it */
  3625.            if ((_constraint_flags & PART_A_IS_HORIZONTAL) == 0 &&
  3626.             std_constraint_impl.the_impl().depends_on(
  3627.                  _part_a_constraint, this, from_type, from_part, 
  3628.                  nth_child, std_encoding_consts.VERTICAL))
  3629.          mark_part_a_ood();
  3630.  
  3631.        /* if part_b is vertical and depends on that part, mark it */
  3632.            if ((_constraint_flags & PART_B_IS_HORIZONTAL) == 0 &&
  3633.             std_constraint_impl.the_impl().depends_on(
  3634.                  _part_b_constraint, this, from_type, from_part, 
  3635.                  nth_child, std_encoding_consts.VERTICAL))
  3636.          mark_part_b_ood();
  3637.      }
  3638.        else /* not oriented */
  3639.      {
  3640.        /* if x depends on that part, mark it */
  3641.            if (std_constraint_impl.the_impl().depends_on(
  3642.                          _x_constraint, this, from_type, from_part, 
  3643.                  nth_child, std_encoding_consts.HORIZONTAL))
  3644.          mark_x_ood();
  3645.  
  3646.        /* if w depends on that part, mark it */
  3647.            if (std_constraint_impl.the_impl().depends_on(
  3648.                  _w_constraint, this, from_type, from_part, 
  3649.                  nth_child, std_encoding_consts.HORIZONTAL))
  3650.          mark_w_ood();
  3651.  
  3652.        /* if y depends on that part, mark it */
  3653.            if (std_constraint_impl.the_impl().depends_on(
  3654.                  _y_constraint, this, from_type, from_part, 
  3655.                  nth_child, std_encoding_consts.VERTICAL))
  3656.          mark_y_ood();
  3657.  
  3658.        /* if h depends on that part, mark it */
  3659.            if (std_constraint_impl.the_impl().depends_on(
  3660.                  _h_constraint, this, from_type, from_part, 
  3661.                  nth_child, std_encoding_consts.VERTICAL))
  3662.          mark_h_ood();
  3663.  
  3664.        /* if visible depends on that part, mark it */
  3665.            if (std_constraint_impl.the_impl().depends_on(
  3666.                  _visible_constraint, this, from_type, from_part, 
  3667.                  nth_child, 0))
  3668.          mark_visible_ood();
  3669.  
  3670.        /* if enabled depends on that part, mark it */
  3671.            if (std_constraint_impl.the_impl().depends_on(
  3672.                  _enabled_constraint, this, from_type, from_part, 
  3673.                  nth_child, 0))
  3674.          mark_enabled_ood();
  3675.  
  3676.        /* if part_a depends on that part, mark it */
  3677.            if (std_constraint_impl.the_impl().depends_on(
  3678.                  _part_a_constraint, this, from_type, from_part, 
  3679.                  nth_child, 0))
  3680.          mark_part_a_ood();
  3681.  
  3682.        /* if part_b depends on that part, mark it */
  3683.            if (std_constraint_impl.the_impl().depends_on(
  3684.                  _part_b_constraint, this, from_type, from_part, 
  3685.                  nth_child, 0))
  3686.          mark_part_b_ood();
  3687.      }
  3688.      }
  3689.  
  3690.    //had:
  3691.    //* @exception bad_value if an unrecognized or illegal type or part code is 
  3692.    //*                      passed.
  3693.  
  3694.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3695.  
  3696.   /** 
  3697.    * Handle a cycle detected in constraints on a given part of this object.
  3698.    * If this routine returns true, then evaluation proceeds.  If this returns
  3699.    * false then, the current value of the attribute (which may have been set 
  3700.    * by this routine) is left in place but marked up-to-date.  By default, we 
  3701.    * call manager.handle_cycle() which provides a global policy for handling 
  3702.    * cycles (manager.handle_cycle() defaults to ignoring the cycle, which 
  3703.    * amounts to breaking the cycle "once-around", its also possible to print 
  3704.    * a debugging message, or a stack trace and/or force an error exit).
  3705.    *
  3706.    * @see sub_arctic.lib.manager#handle_cycle
  3707.    * @param int part_code the part of this object that involves a cycle.
  3708.    * @return boolean indicating whether we should proceed with evaluation.
  3709.    */
  3710.   public boolean handle_cycle(int part_code)
  3711.     {
  3712.       /* by default, we pass this off to the manager to apply the global 
  3713.        * handling policy.
  3714.        */
  3715.       return manager.handle_cycle(this, part_code);
  3716.     }
  3717.  
  3718.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3719.  
  3720.   /** 
  3721.    * Bring the indicated value up to date with respect to any defining 
  3722.    * constraints.  This routine does not typically need to be called 
  3723.    * explicitly since normal requests for values do evaluations before 
  3724.    * returning.
  3725.    *
  3726.    * @param int coord_code the part whose value should be evaluated.
  3727.    */
  3728.   public void eval(int coord_code) 
  3729. {
  3730.       switch (coord_code)
  3731.     {
  3732.       case X: eval_x(); break;
  3733.       case Y: eval_y(); break;
  3734.       case W: eval_w(); break;
  3735.       case H: eval_h(); break;
  3736.       case VISIBLE: eval_visible(); break;
  3737.       case ENABLED: eval_enabled(); break;
  3738.       case PART_A:  eval_part_a(); break;
  3739.       case PART_B:   eval_part_b(); break;
  3740.       default:
  3741.         throw new sub_arctic_error("Unrecognized coordinate code " + 
  3742.                                          coord_code + "passed to eval()");
  3743.     }
  3744.     }
  3745.  
  3746.    //had:
  3747.    //* @exception bad_value if an unrecognized part code is provided.
  3748.  
  3749.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3750.  
  3751.   /** Bring x up to date with respect to any defining constraint. */
  3752.   public void eval_x()
  3753.     {
  3754.       int v;
  3755.  
  3756.       /* if we are already in process, we have a cycle. invoke the cycle
  3757.        *  handler and if it returns true, we press on, otherwise, we clean 
  3758.        *  up and bail out */
  3759.       if ((_constraint_flags & X_IN_PROCESS) != 0) 
  3760.     {
  3761.       /* no longer in process once this is done (do this here so if 
  3762.        * handle_cycle() inadvertently evals across the same cycle
  3763.        * we don't get into an infinite loop).
  3764.        */
  3765.       _constraint_flags &= ~X_IN_PROCESS;
  3766.  
  3767.       /* use our local cycle handler -- if it returns false, bail out*/
  3768.       if (!handle_cycle(X))
  3769.         {
  3770.           _constraint_flags &= ~X_OOD;
  3771.           return;
  3772.         }
  3773.     }
  3774.  
  3775.       /* if its already up to date we are done */
  3776.       if ((_constraint_flags & X_OOD) == 0) return;
  3777.  
  3778.       /* value will be up to date after this */
  3779.       _constraint_flags &= ~X_OOD;
  3780.  
  3781.       /* if we have a constraint, do the evaluation */
  3782.       if (!std_constraint_impl.the_impl().is_none(_x_constraint))
  3783.     /* we are in process until we get back from evaluation */
  3784.     _constraint_flags |= X_IN_PROCESS;
  3785.  
  3786.       /* do the evaluation */
  3787.       v = std_constraint_impl.the_impl().eval(_x_constraint, this, X, 
  3788.                         std_encoding_consts.HORIZONTAL);
  3789.  
  3790.       /* we are no longer in process */
  3791.       _constraint_flags &= ~X_IN_PROCESS;
  3792.  
  3793.       /* actually set the value */
  3794.       set_raw_x(v);
  3795.     }
  3796.  
  3797.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3798.  
  3799.   /** Bring y up to date with respect to any defining constraint. */
  3800.   public void eval_y()
  3801.     {
  3802.       int v;
  3803.  
  3804.       /* if we are already in process, we have a cycle. invoke the cycle
  3805.        *  handler and if it returns true, we press on, otherwise, we clean 
  3806.        *  up and bail out */
  3807.       if ((_constraint_flags & Y_IN_PROCESS) != 0) 
  3808.     {
  3809.       /* no longer in process once this is done (do this here so if 
  3810.        * handle_cycle() inadvertently evals across the same cycle
  3811.        * we don't get into an infinite loop).
  3812.        */
  3813.       _constraint_flags &= ~Y_IN_PROCESS;
  3814.  
  3815.       /* use our local cycle handler -- if it returns false, bail out*/
  3816.       if (!handle_cycle(Y))
  3817.         {
  3818.           _constraint_flags &= ~Y_OOD;
  3819.           return;
  3820.         }
  3821.     }
  3822.  
  3823.       /* if its already up to date we are done */
  3824.       if ((_constraint_flags & Y_OOD) == 0) return;
  3825.  
  3826.       /* value will be up to date after this */
  3827.       _constraint_flags &= ~Y_OOD;
  3828.  
  3829.       /* if we have a constraint, do the evaluation */
  3830.       if (!std_constraint_impl.the_impl().is_none(_y_constraint))
  3831.     /* we are in process until we get back from evaluation */
  3832.     _constraint_flags |= Y_IN_PROCESS;
  3833.  
  3834.       /* do the evaluation */
  3835.       v = std_constraint_impl.the_impl().eval(_y_constraint, this, Y, 
  3836.                         std_encoding_consts.VERTICAL);
  3837.  
  3838.       /* we are no longer in process */
  3839.       _constraint_flags &= ~Y_IN_PROCESS;
  3840.  
  3841.       /* actually set the value */
  3842.       set_raw_y(v);
  3843.     }
  3844.  
  3845.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3846.  
  3847.   /** Bring w up to date with respect to any defining constraint. */
  3848.   public void eval_w()
  3849.     {
  3850.       int v;
  3851.  
  3852.       /* if we are already in process, we have a cycle. invoke the cycle
  3853.        *  handler and if it returns true, we press on, otherwise, we clean 
  3854.        *  up and bail out */
  3855.       if ((_constraint_flags & W_IN_PROCESS) != 0) 
  3856.     {
  3857.       /* no longer in process once this is done (do this here so if 
  3858.        * handle_cycle() inadvertently evals across the same cycle
  3859.        * we don't get into an infinite loop).
  3860.        */
  3861.       _constraint_flags &= ~W_IN_PROCESS;
  3862.  
  3863.       /* use our local cycle handler -- if it returns false, bail out*/
  3864.       if (!handle_cycle(W))
  3865.         {
  3866.           _constraint_flags &= ~W_OOD;
  3867.           return;
  3868.         }
  3869.     }
  3870.  
  3871.       /* if its already up to date we are done */
  3872.       if ((_constraint_flags & W_OOD) == 0) return;
  3873.  
  3874.       /* value will be up to date after this */
  3875.       _constraint_flags &= ~W_OOD;
  3876.  
  3877.       /* if we have a constraint, do the evaluation */
  3878.       if (!std_constraint_impl.the_impl().is_none(_w_constraint))
  3879.     /* we are in process until we get back from evaluation */
  3880.     _constraint_flags |= W_IN_PROCESS;
  3881.  
  3882.       /* do the evaluation */
  3883.       v = std_constraint_impl.the_impl().eval(_w_constraint, this, W, 
  3884.                         std_encoding_consts.HORIZONTAL);
  3885.  
  3886.       /* we are no longer in process */
  3887.       _constraint_flags &= ~W_IN_PROCESS;
  3888.  
  3889.       /* actually set the value */
  3890.       set_raw_w(v);
  3891.     }
  3892.  
  3893.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3894.  
  3895.   /** Bring h up to date with respect to any defining constraint. */
  3896.   public void eval_h()
  3897.     {
  3898.       int v;
  3899.  
  3900.       /* if we are already in process, we have a cycle. invoke the cycle
  3901.        *  handler and if it returns true, we press on, otherwise, we clean 
  3902.        *  up and bail out */
  3903.       if ((_constraint_flags & H_IN_PROCESS) != 0) 
  3904.     {
  3905.       /* no longer in process once this is done (do this here so if 
  3906.        * handle_cycle() inadvertently evals across the same cycle
  3907.        * we don't get into an infinite loop).
  3908.        */
  3909.       _constraint_flags &= ~H_IN_PROCESS;
  3910.  
  3911.       /* use our local cycle handler -- if it returns false, bail out*/
  3912.       if (!handle_cycle(H))
  3913.         {
  3914.           _constraint_flags &= ~H_OOD;
  3915.           return;
  3916.         }
  3917.     }
  3918.  
  3919.       /* if its already up to date we are done */
  3920.       if ((_constraint_flags & H_OOD) == 0) return;
  3921.  
  3922.       /* value will be up to date after this */
  3923.       _constraint_flags &= ~H_OOD;
  3924.  
  3925.       /* if we have a constraint, do the evaluation */
  3926.       if (!std_constraint_impl.the_impl().is_none(_h_constraint))
  3927.     /* we are in process until we get back from evaluation */
  3928.     _constraint_flags |= H_IN_PROCESS;
  3929.  
  3930.       /* do the evaluation */
  3931.       v = std_constraint_impl.the_impl().eval(_h_constraint, this, H, 
  3932.                         std_encoding_consts.VERTICAL);
  3933.  
  3934.       /* we are no longer in process */
  3935.       _constraint_flags &= ~H_IN_PROCESS;
  3936.  
  3937.       /* actually set the value */
  3938.       set_raw_h(v);
  3939.     }
  3940.  
  3941.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3942.  
  3943.   /** Bring visible up to date with respect to any defining constraint. */
  3944.   public void eval_visible()
  3945.     {
  3946.       int hv;
  3947.       boolean val;
  3948.  
  3949.       /* if we are already in process, we have a cycle. invoke the cycle
  3950.        *  handler and if it returns true, we press on, otherwise, we clean 
  3951.        *  up and bail out */
  3952.       if ((_constraint_flags & VISIBLE_IN_PROCESS) != 0) 
  3953.     {
  3954.       /* no longer in process once this is done (do this here so if 
  3955.        * handle_cycle() inadvertently evals across the same cycle
  3956.        * we don't get into an infinite loop).
  3957.        */
  3958.       _constraint_flags &= ~VISIBLE_IN_PROCESS;
  3959.  
  3960.       /* use our local cycle handler -- if it returns false, bail out*/
  3961.       if (!handle_cycle(VISIBLE))
  3962.         {
  3963.           _constraint_flags &= ~VISIBLE_OOD;
  3964.           return;
  3965.         }
  3966.     }
  3967.  
  3968.       /* if its already up to date we are done */
  3969.       if ((_constraint_flags & VISIBLE_OOD) == 0) return;
  3970.  
  3971.       /* value will be up to date after this */
  3972.       _constraint_flags &= ~VISIBLE_OOD;
  3973.  
  3974.       /* if we have a constraint, do the evaluation */
  3975.       if (!std_constraint_impl.the_impl().is_none(_visible_constraint))
  3976.     /* we are in process until we get back from evaluation */
  3977.     _constraint_flags |= VISIBLE_IN_PROCESS;
  3978.  
  3979.       /* do the evaluation */
  3980.       if ((_constraint_flags & VISIBLE_IS_HORIZONTAL) != 0)
  3981.     hv =  std_encoding_consts.HORIZONTAL;
  3982.       else
  3983.     hv =  std_encoding_consts.VERTICAL;
  3984.       val = std_constraint_impl.the_impl().eval(
  3985.                   _visible_constraint, this, VISIBLE, hv) != 0; 
  3986.  
  3987.       /* we are no longer in process */
  3988.       _constraint_flags &= ~VISIBLE_IN_PROCESS;
  3989.  
  3990.       /* actally set the value */
  3991.       set_raw_visible(val);
  3992.     }
  3993.  
  3994.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  3995.  
  3996.   /** Bring enabled up to date with respect to any defining constraint. */
  3997.   public void eval_enabled()
  3998.     {
  3999.       int hv;
  4000.       boolean val;
  4001.  
  4002.       /* if we are already in process, we have a cycle. invoke the cycle
  4003.        *  handler and if it returns true, we press on, otherwise, we clean 
  4004.        *  up and bail out */
  4005.       if ((_constraint_flags & ENABLED_IN_PROCESS) != 0) 
  4006.     {
  4007.       /* no longer in process once this is done (do this here so if 
  4008.        * handle_cycle() inadvertently evals across the same cycle
  4009.        * we don't get into an infinite loop).
  4010.        */
  4011.       _constraint_flags &= ~ENABLED_IN_PROCESS;
  4012.  
  4013.       /* use our local cycle handler -- if it returns false, bail out*/
  4014.       if (!handle_cycle(ENABLED))
  4015.         {
  4016.           _constraint_flags &= ~ENABLED_OOD;
  4017.           return;
  4018.         }
  4019.     }
  4020.  
  4021.       /* if its already up to date we are done */
  4022.       if ((_constraint_flags & ENABLED_OOD) == 0) return;
  4023.  
  4024.       /* value will be up to date after this */
  4025.       _constraint_flags &= ~ENABLED_OOD;
  4026.  
  4027.       /* if we have a constraint, do the evaluation */
  4028.       if (!std_constraint_impl.the_impl().is_none(_enabled_constraint))
  4029.     /* we are in process until we get back from evaluation */
  4030.     _constraint_flags |= ENABLED_IN_PROCESS;
  4031.  
  4032.       /* do the evaluation */
  4033.       if ((_constraint_flags & ENABLED_IS_HORIZONTAL) != 0)
  4034.     hv =  std_encoding_consts.HORIZONTAL;
  4035.       else
  4036.     hv =  std_encoding_consts.VERTICAL;
  4037.       val = std_constraint_impl.the_impl().eval(
  4038.                   _enabled_constraint, this, ENABLED, hv) != 0; 
  4039.  
  4040.       /* we are no longer in process */
  4041.       _constraint_flags &= ~ENABLED_IN_PROCESS;
  4042.  
  4043.       /* actually set the value */
  4044.       set_raw_enabled(val);
  4045.     }
  4046.  
  4047.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4048.  
  4049.   /** Bring part_a up to date with respect to any defining constraint. */
  4050.   public void eval_part_a()
  4051.     {
  4052.       int hv, val;
  4053.  
  4054.       /* if we are already in process, we have a cycle. invoke the cycle
  4055.        *  handler and if it returns true, we press on, otherwise, we clean 
  4056.        *  up and bail out */
  4057.       if ((_constraint_flags & PART_A_IN_PROCESS) != 0) 
  4058.     {
  4059.       /* no longer in process once this is done (do this here so if 
  4060.        * handle_cycle() inadvertently evals across the same cycle
  4061.        * we don't get into an infinite loop).
  4062.        */
  4063.       _constraint_flags &= ~PART_A_IN_PROCESS;
  4064.  
  4065.       /* use our local cycle handler -- if it returns false, bail out*/
  4066.       if (!handle_cycle(PART_A))
  4067.         {
  4068.           _constraint_flags &= ~PART_A_OOD;
  4069.           return;
  4070.         }
  4071.     }
  4072.  
  4073.       /* if its already up to date we are done */
  4074.       if ((_constraint_flags & PART_A_OOD) == 0) return;
  4075.  
  4076.       /* value will be up to date after this */
  4077.       _constraint_flags &= ~PART_A_OOD;
  4078.  
  4079.       /* if we have a constraint, do the evaluation */
  4080.       if (!std_constraint_impl.the_impl().is_none(_part_a_constraint))
  4081.     /* we are in process until we get back from evaluation */
  4082.     _constraint_flags |= PART_A_IN_PROCESS;
  4083.  
  4084.       /* do the evaluation */
  4085.       if ((_constraint_flags & PART_A_IS_HORIZONTAL) != 0)
  4086.     hv =  std_encoding_consts.HORIZONTAL;
  4087.       else
  4088.     hv =  std_encoding_consts.VERTICAL;
  4089.       val = std_constraint_impl.the_impl().eval(
  4090.                      _part_a_constraint, this, PART_A, hv); 
  4091.  
  4092.       /* we are no longer in process */
  4093.       _constraint_flags &= ~PART_A_IN_PROCESS;
  4094.  
  4095.       /* actually set the value */
  4096.       set_raw_part_a(val);
  4097.     }
  4098.  
  4099.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4100.  
  4101.   /** Bring part_b up to date with respect to any defining constraint. */
  4102.   public void eval_part_b()
  4103.     {
  4104.       int hv, val;
  4105.  
  4106.       /* if we are already in process, we have a cycle. invoke the cycle
  4107.        *  handler and if it returns true, we press on, otherwise, we clean 
  4108.        *  up and bail out */
  4109.       if ((_constraint_flags & PART_B_IN_PROCESS) != 0) 
  4110.     {
  4111.       /* no longer in process once this is done (do this here so if 
  4112.        * handle_cycle() inadvertently evals across the same cycle
  4113.        * we don't get into an infinite loop).
  4114.        */
  4115.       _constraint_flags &= ~PART_B_IN_PROCESS;
  4116.  
  4117.       /* use our local cycle handler -- if it returns false, bail out*/
  4118.       if (!handle_cycle(PART_B))
  4119.         {
  4120.           _constraint_flags &= ~PART_B_OOD;
  4121.           return;
  4122.         }
  4123.     }
  4124.  
  4125.       /* if its already up to date we are done */
  4126.       if ((_constraint_flags & PART_B_OOD) == 0) return;
  4127.  
  4128.       /* value will be up to date after this */
  4129.       _constraint_flags &= ~PART_B_OOD;
  4130.  
  4131.       /* if we have a constraint, do the evaluation */
  4132.       if (!std_constraint_impl.the_impl().is_none(_part_b_constraint))
  4133.     /* we are in process until we get back from evaluation */
  4134.     _constraint_flags |= PART_B_IN_PROCESS;
  4135.  
  4136.       /* do the evaluation */
  4137.       if ((_constraint_flags & PART_B_IS_HORIZONTAL) != 0)
  4138.     hv =  std_encoding_consts.HORIZONTAL;
  4139.       else
  4140.     hv =  std_encoding_consts.VERTICAL;
  4141.       val = std_constraint_impl.the_impl().eval(
  4142.                      _part_b_constraint, this, PART_B, hv); 
  4143.  
  4144.       /* we are no longer in process */
  4145.       _constraint_flags &= ~PART_B_IN_PROCESS;;
  4146.  
  4147.       /* actually set the value */
  4148.       set_raw_part_b(val);
  4149.     }
  4150.  
  4151.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4152.  
  4153.   /** 
  4154.    * Get the external value provider (if any) associated with the given
  4155.    * part value (X, Y, W, H, VISIBLE, ENABLED, PART_A, or PART_B).  Returns 
  4156.    * null if there is no external provider.
  4157.    * 
  4158.    * @param int for_part the part we are asking about.
  4159.    * @return provider_part_ref the external value provider associated with that
  4160.    *                           part, or null if there is none.
  4161.    */
  4162.   public provider_part_ref get_external_constraint(int for_part)
  4163.     {
  4164.       /* the manager maintains associations, ask them */
  4165.       return manager.find_extern_constraint(this, for_part);
  4166.     }
  4167.  
  4168.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4169.  
  4170.   /** Get an up-to-date copy of a particular part value(X, Y, W, H, VISIBLE,
  4171.    *  ENABLED, PART_A, or PART_B).  An Integer object will be returned. 
  4172.    *
  4173.    * @param int part_number the part being requested.
  4174.    * @return Object an Integer object containing the value of the requested 
  4175.    *                part.
  4176.    */
  4177.    public Object get_value(int part_number) 
  4178. {
  4179.        switch (part_number)
  4180.      {
  4181.        case X: return new Integer(x());
  4182.        case Y: return new Integer(y());
  4183.        case W: return new Integer(w());
  4184.        case H: return new Integer(h());
  4185.        case VISIBLE: return new Integer(visible()?1:0);
  4186.        case ENABLED: return new Integer(enabled()?1:0);
  4187.        case PART_A:  return new Integer(part_a());
  4188.        case PART_B:  return new Integer(part_b());
  4189.        default:
  4190.          throw new sub_arctic_error("Unknown part_number " + part_number + 
  4191.                  " passed to base_interactor.get_value()");
  4192.      }
  4193.      }
  4194.  
  4195.    //had:
  4196.    //* @exception bad_value if an unrecognized part is requested.
  4197.    //* @exception general
  4198.  
  4199.   // we have a problem here in that the constants here are really bit 
  4200.   // bit positions, not part numbers.  Need to separate those two notions
  4201.   // at some point.
  4202.  
  4203.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4204.  
  4205.   /** 
  4206.    * Register something as interested in (dependent on) one of the parts 
  4207.    * (X, Y, W, H, VISIBLE, ENABLED, PART_A, or PART_B) of this object.  The 
  4208.    * entity registered is a part within a value_consumer object (typically 
  4209.    * an external_constraint).  Whenever the part value in question is marked 
  4210.    * out-of-date, the value_ood() method is invoked on  each currently 
  4211.    * registered  (object,part) pair.  
  4212.    *
  4213.    * @param int            on_part_num the part of this object that the 
  4214.    *                                   dependency is being attached to.
  4215.    * @param value_consumer dep_obj     the object that is dependent.
  4216.    * @param int            dep_part    the part within that object which is 
  4217.    *                                   dependent.
  4218.    */
  4219.   public void attach_dependent(
  4220.     int            on_part_num, 
  4221.     value_consumer dep_obj, 
  4222.     int            dep_part) 
  4223. {
  4224.       /* set flag to indicate we have an external notify to do */
  4225.       switch (on_part_num)
  4226.     {
  4227.       case X: set_constraint_flag_bit(X_HAS_EXT_NOTIFY); break;
  4228.       case Y: set_constraint_flag_bit(Y_HAS_EXT_NOTIFY); break;
  4229.       case W: set_constraint_flag_bit(W_HAS_EXT_NOTIFY); break;
  4230.       case H: set_constraint_flag_bit(H_HAS_EXT_NOTIFY); break;
  4231.       case VISIBLE: set_constraint_flag_bit(VISIBLE_HAS_EXT_NOTIFY); break;
  4232.       case ENABLED: set_constraint_flag_bit(ENABLED_HAS_EXT_NOTIFY); break;
  4233.       case PART_A:  set_constraint_flag_bit(PART_A_HAS_EXT_NOTIFY); break;
  4234.       case PART_B:  set_constraint_flag_bit(PART_B_HAS_EXT_NOTIFY); break;
  4235.       default: 
  4236.          throw new sub_arctic_error("Unknown part_number " + on_part_num + 
  4237.              " passed to base_interactor.attach_dependent()");
  4238.     }
  4239.  
  4240.       /* the manager maintains our notify list for us, have them handle it */
  4241.       manager.add_to_ood_notify(this, on_part_num, dep_obj, dep_part);
  4242.     }
  4243.  
  4244.    //had:
  4245.    //* @exception bad_value if an unrecognized part code is given.
  4246.    //* @exception general
  4247.  
  4248.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4249.  
  4250.   /** 
  4251.    * Remove an (object,part) pair from the dependent (interested in) list 
  4252.    * associated with a particular part of this object. 
  4253.    *
  4254.    * @param int            on_part_num the part of this object that the 
  4255.    *                                   dependency is attached to.
  4256.    * @param value_consumer dep_obj     the object that was dependent.
  4257.    * @param int            dep_part    the part within that object which was 
  4258.    *                                   dependent.
  4259.    */
  4260.   public void detach_dependent(
  4261.     int            on_part_num, 
  4262.     value_consumer dep_obj, 
  4263.     int            dep_part) 
  4264. {
  4265.       boolean empty;
  4266.  
  4267.       if (on_part_num < X || on_part_num > PART_B)
  4268.     throw new sub_arctic_error("Unknown part_number " + on_part_num + 
  4269.                 " passed to base_interactor.detach_dependent()");
  4270.  
  4271.       /* the manager maintains our notify list for us, have them handle it */
  4272.       empty = manager.remove_ood_notify(this, on_part_num, dep_obj, dep_part);
  4273.  
  4274.       /* if the notify list is now empty, remove our flag */
  4275.       if (empty)
  4276.         switch (on_part_num)
  4277.       {
  4278.         case X: clear_constraint_flag_bit(X_HAS_EXT_NOTIFY); break;
  4279.         case Y: clear_constraint_flag_bit(Y_HAS_EXT_NOTIFY); break;
  4280.         case W: clear_constraint_flag_bit(W_HAS_EXT_NOTIFY); break;
  4281.         case H: clear_constraint_flag_bit(H_HAS_EXT_NOTIFY); break;
  4282.         case VISIBLE: 
  4283.           clear_constraint_flag_bit(VISIBLE_HAS_EXT_NOTIFY); 
  4284.         break;
  4285.         case ENABLED: 
  4286.           clear_constraint_flag_bit(ENABLED_HAS_EXT_NOTIFY); 
  4287.         break;
  4288.         case PART_A: 
  4289.           clear_constraint_flag_bit(PART_A_HAS_EXT_NOTIFY); 
  4290.         break;
  4291.         case PART_B: 
  4292.           clear_constraint_flag_bit(PART_B_HAS_EXT_NOTIFY); 
  4293.         break;
  4294.       }
  4295.     }
  4296.  
  4297.    //had:
  4298.    //* @exception bad_value if an unrecognized part code is given.
  4299.    //* @exception general
  4300.   
  4301.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4302.  
  4303.   /** 
  4304.    * Indicate that a part value (X, Y, W, H, VISIBLE, ENABLED, PART_A, or 
  4305.    * PART_B) with an external constraint attached should be marked out-of-date 
  4306.    * because something it depends on (externally) is out-of-date.
  4307.    *
  4308.    * @param int            for_part_here part within this object that should be
  4309.    *                                     marked out-of-date.
  4310.    * @param value_provider prov_obj      object that we depend on.
  4311.    * @param int            prov_part     part within that object that is 
  4312.    */
  4313.    public void value_ood(
  4314.      int            for_part_here, 
  4315.      value_provider prov_obj, 
  4316.      int            prov_part) 
  4317. {
  4318.       switch (for_part_here)
  4319.     {
  4320.       case X: mark_x_ood(); break;
  4321.       case Y: mark_y_ood(); break;
  4322.       case W: mark_w_ood(); break;
  4323.       case H: mark_h_ood(); break;
  4324.       case VISIBLE: mark_visible_ood(); break;
  4325.       case ENABLED: mark_enabled_ood(); break;
  4326.       case PART_A:  mark_part_a_ood(); break;
  4327.       case PART_B:  mark_part_b_ood(); break;
  4328.       default: 
  4329.          throw new sub_arctic_error("Unknown part_number " + for_part_here + 
  4330.              " passed to base_interactor.value_ood()");
  4331.     }
  4332.      }
  4333.  
  4334.    //had:
  4335.    //* @exception bad_value if an unrecognized part code is given.
  4336.    //* @exception general
  4337.  
  4338.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4339.  
  4340.   /** 
  4341.    * A custom function accessible in the constraint system.  This function
  4342.    * is accessible from the (lightweight) constraint system and can be 
  4343.    * overridden by particular subclasses to perform custom computations 
  4344.    * associated with that class.  This version is passed a single parameter 
  4345.    * value derived from a depended upon object, plus a constant value taken 
  4346.    * from the constraint.  <p>
  4347.    *
  4348.    * <b>Important note</b>: for the constraint system to work correctly, this
  4349.    * function must compute its value solely on its parameters and not access 
  4350.    * additional information from this object or other objects (since the 
  4351.    * attribute constrained to the result of this function will not hear about
  4352.    * changes and be properly updated).
  4353.    *
  4354.    * @param int val1      a value from a depended upon object.
  4355.    * @param int const_val a constant value taken from the constraint.
  4356.    * @returns int by default this returns the sum of the two values.  More 
  4357.    *              interesting functions will be provided by subclasses.
  4358.    */
  4359.   public int custom_fun1(int val1, int const_val) {return val1 + const_val;}
  4360.  
  4361.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4362.  
  4363.   /** 
  4364.    * A custom function accessible in the constraint system.  This function
  4365.    * is accessible from the (lightweight) constraint system and can be 
  4366.    * overridden by particular subclasses to perform custom computations 
  4367.    * associated with that class.  This version is passed two parameter values 
  4368.    * derived from a depended upon object, plus a constant value taken from the 
  4369.    * constraint. <p> 
  4370.    *
  4371.    * <b>Important note</b>: for the constraint system to work correctly, this
  4372.    * function must compute its value solely on its parameters and not access 
  4373.    * additional information from this object or other objects (since the 
  4374.    * attribute constrained to the result of this function will not hear about
  4375.    * changes and be properly updated).
  4376.    *
  4377.    * @param int val1      a value from a depended upon object.
  4378.    * @param int val2      another value from a depended upon object.
  4379.    * @param int const_val a constant value taken from the constraint.
  4380.    * @returns int by default this returns the sum of the three values. More 
  4381.    *              interesting functions will be provided by subclasses.
  4382.    */
  4383.   public int custom_fun2(int val1, int val2, int const_val) 
  4384.     {return val1 + val2 + const_val;}
  4385.  
  4386.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4387.  
  4388.   /** 
  4389.    * Do the constraint evaluation necessary to make sure all visible objects 
  4390.    * in the subtree rooted at this object have up-to-date bounds (and other 
  4391.    * information) prior to drawing.  This routine implements the "configure"
  4392.    * pass which occurs right before the pass that does the actual drawing.<p>
  4393.    *
  4394.    * <b>Important note</b>: In addition to the work done here in the base class
  4395.    * (which should almost always be done by invoking super() from any subclass
  4396.    * implementations), each subclass should also be certain to update anything
  4397.    * which could effect its bounds here, and <b>not</b> in draw_self_local().
  4398.    * So for example if the height of an object depends on a font that might
  4399.    * have changed, the potentially new height must be computed and set here
  4400.    * and not in draw_self_local().  In general, for things to work out right
  4401.    * it must be the case that this object's bound is correct once this method
  4402.    * returns. The reason for this is that by the time draw_self_local() is 
  4403.    * called, the clipping region corresponding to the bound of this object
  4404.    * will have already been set and changing the bound then will not modify
  4405.    * the clipping region accordingly (so the drawing may be incorrect).
  4406.    */
  4407.   public void configure()
  4408.     {
  4409.       interactor chld;
  4410.  
  4411.       /* if we are not visible, bail out early */
  4412.       if (!visible()) return;
  4413.  
  4414.       /* eval all the local coordinates */
  4415.       eval_x(); eval_y();
  4416.       eval_w(); eval_h();
  4417.  
  4418.       /* bring enabled, part_a, and part_b up to date */
  4419.       enabled(); part_a(); part_b();
  4420.  
  4421.       /* walk down the children and recursively configure them */
  4422.       for (int i = 0; i<num_children(); i++)
  4423.     {
  4424.       chld = child(i);
  4425.       if (chld != null) chld.configure();
  4426.     }
  4427.     }
  4428.  
  4429.   /*---------------------------------------------------------------------*/
  4430.   /* Picking */
  4431.   /*---------------------------------------------------------------------*/
  4432.  
  4433.   /** 
  4434.    * Determine if the given point (in the local coordinates of this object) 
  4435.    * is inside the extent of this object's normal bound.  You should <b>not</b>
  4436.    * normally override this routine to handle picking of non-rectangular 
  4437.    * objects.  Do that in picked_by() instead.
  4438.    * 
  4439.    * @see #picked_by
  4440.    * @param int pt_x x coordinate of the query point.
  4441.    * @param int pt_y y coordinate of the query point.
  4442.    * @return boolean indicating whether the point is inside the objects 
  4443.    *                 bounding box.
  4444.    */
  4445.   public boolean inside_bounds(int pt_x, int pt_y)
  4446.     {
  4447.       return (new Rectangle(0,0,w(),h())).inside(pt_x,pt_y);
  4448.     }
  4449.  
  4450.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4451.  
  4452.   /** 
  4453.    * Determine if the given point (in the local coordinates of this object) 
  4454.    * is inside the extent of the object picking purposes.  Be default, this
  4455.    * method just checks the normal bound (bounding box), however, it can 
  4456.    * be overridden to support accurate picking of non-rectangular objects.
  4457.    * 
  4458.    * @see #inside_bounds
  4459.    * @param int pt_x x coordinate of the query point.
  4460.    * @param int pt_y y coordinate of the query point.
  4461.    * @return boolean indicating whether the point is inside the objects 
  4462.    *                 bounding box.
  4463.    */
  4464.   public boolean picked_by(int pt_x, int pt_y)
  4465.     {
  4466.       return inside_bounds(pt_x, pt_y);
  4467.     }
  4468.  
  4469.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4470.  
  4471.   /** 
  4472.    * Determine if this object and/or any of its decedent objects is "picked" 
  4473.    * by the the given point.  If it is, it must add itself to the end of the 
  4474.    * given given pick_collection by calling report_pick().  If not, it should 
  4475.    * leave the pick_collector as is.<p>
  4476.  
  4477.    * This method is also responsible for recursively invoking itself as 
  4478.    * appropriate for its children (this is usually done using the 
  4479.    * pick_within_children() utility routine).  By default we pick against any 
  4480.    * children first (since they are by default drawn last) and then this 
  4481.    * object.  However, if the drawing order is changed from the default, this 
  4482.    * method must be changed to reflect (the reverse of) that non-standard order.
  4483.    * For example, if this object does drawing both under and on top of its 
  4484.    * children, two sets of part specific tests would typically be needed, one 
  4485.    * before recursively picking the children, and one after.
  4486.    * 
  4487.    * @see #pick_within_children
  4488.    * @param int            pt_x      x coordinate of the query point.
  4489.    * @param int            pt_y      y coordinate of the query point.
  4490.    * @param pick_collector pick_list object that collects and returns pick 
  4491.    *                                 results.
  4492.    */
  4493.   public void pick(int pt_x, int pt_y, pick_collector pick_list) 
  4494. {
  4495.       /* don't pick anything unless we are enabled and its inside our bounds */
  4496.       if (enabled() && visible() && picked_by(pt_x, pt_y))
  4497.     {
  4498.       /* do child picks first (since they were drawn "over" us) */
  4499.           pick_within_children(pt_x, pt_y, pick_list);
  4500.  
  4501.       /* now pick us (since we were drawn first) */
  4502.       pick_list.report_pick(this);
  4503.     }
  4504.     }
  4505.  
  4506.    //had:
  4507.    //* @exception general
  4508.  
  4509.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4510.  
  4511.   /** 
  4512.    * Utility routine to perform pick over children.  The point is given in 
  4513.    * local coordinates of the parent object. 
  4514.    *
  4515.    * @param int            pt_x      x coordinate of the query point.
  4516.    * @param int            pt_y      y coordinate of the query point.
  4517.    * @param pick_collector pick_list object that collects and returns pick 
  4518.    *                                 results.
  4519.    */
  4520.   protected void pick_within_children(
  4521.     int            pt_x, 
  4522.     int            pt_y, 
  4523.     pick_collector pick_list) 
  4524. {
  4525.       Point      child_point;
  4526.       interactor ch;
  4527.  
  4528.       for (int i = num_children()-1; i >= 0; i--)
  4529.     {
  4530.       ch = child(i);
  4531.       if (ch != null)
  4532.         {
  4533.           child_point = ch.into_local(new Point(pt_x, pt_y));
  4534.           ch.pick(child_point.x, child_point.y, pick_list);
  4535.         }
  4536.     }
  4537.     }
  4538.  
  4539.    //has:
  4540.    //* @exception general
  4541.  
  4542.   /*---------------------------------------------------------------------*/
  4543.   /* Generic traversal support */
  4544.   /*---------------------------------------------------------------------*/
  4545.  
  4546.   /** 
  4547.    * Do a traversal of the interactor tree to collect nodes meeting some 
  4548.    * criteria (or perform actions on qualifying nodes).  Traversals are 
  4549.    * given a specialized "kind" so that subclasses can recognize and 
  4550.    * override behavior for certain traversals, while keeping default behavior 
  4551.    * for the rest.  In addition, several traversal orders are provided.  
  4552.    * Qualification for collection (or action) is done by an inclusion test 
  4553.    * predicate object.  This predicate is given the interactor in question 
  4554.    * as well as some (optional) data specific to the predicate.  This 
  4555.    * data is passed in from the root of the traversal and (optionally) 
  4556.    * transformed from parent to child values as the traversal proceeds.
  4557.    * Objects are collected (along with optional additional data) by adding
  4558.    * them to a pick_collector object. Recursive traversal is stopped when
  4559.    * either leaves are reached or the continue_test predicate for an 
  4560.    * interior node fails (in which case its children will not be visited).<p>
  4561.    *
  4562.    * Examples of possible traversals include:<br>
  4563.    * Replacement for the normal pick operation:<br>
  4564.    *  <pre>
  4565.    *    traverse_and_collect(pick_trav, TRAV_DRAW, pt_inside_bounds, pt_inside_bounds,
  4566.    *                         coord_parent_to_local, pick_pt, result);
  4567.    *  </pre>
  4568.    * and a tree dump:<br>
  4569.    *  <pre>
  4570.    *    traverse_and_collect(dump_trav, TRAV_PRE, dump_interactor, incr_int,
  4571.    *                         null, new Integer(0), result)
  4572.    *  </pre>
  4573.    * where dump_interactor printed to the node to System.out at the indentation
  4574.    * level of its Integer parameter, but always returns false
  4575.    *
  4576.    * @param traversal_kind   a unique integer (i.e., generated by 
  4577.    *                         manager.unique_int()) that represents the kind 
  4578.    *                         of traversal being performed.
  4579.    * @param traversal_order  one of TRAV_DRAW, TRAV_PICK, TRAV_PRE, or 
  4580.    *                         TRAV_POST indicating drawing order, pick order, 
  4581.    *                         left-to-right pre-order, or left-to-right 
  4582.    *                         post-order traversal.
  4583.    * @param inclusion_test   an interactor predicate object which is to 
  4584.    *                         perform the inclusion test for this traversal.  
  4585.    *                         If the traversal is being done for its action 
  4586.    *                         side-effects (rather than a collection, per se) 
  4587.    *                         then this object's test() method should perform
  4588.    *                         that action on selected nodes.  A null 
  4589.    *                         inclusion_test is treated as a function that 
  4590.    *                         selects everything (always returns true).
  4591.    * @param continue_test    an interactor_predicate object which determines 
  4592.    *                         if the given object's children are traversed.  
  4593.    *                         If this method returns false, then the children
  4594.    *                         will not be visited.  A null continue_test is 
  4595.    *                         is treated as a function that always returns 
  4596.    *                         true.
  4597.    * @param xform_parent_to_child object containing a method to transform the 
  4598.    *                          parameters data (passed to the inclusion_test)
  4599.    *                          from its parent condition to the condition 
  4600.    *                          suitable for use by a given child.  This can 
  4601.    *                          be used, for example, to transform a point from
  4602.    *                          the parent's coordinates into those of a child.
  4603.    *                          A null object is treated as the identity 
  4604.    *                          transformation (i.e. uses the parent's 
  4605.    *                          parameters directly for all children).
  4606.    *
  4607.    * @param parameters        the initial parameters data passed to the 
  4608.    *                          inclusion_test at the root, then transformed by 
  4609.    *                          xform_parent_to_child for recursive calls on 
  4610.    *                          children.
  4611.    * @param collection_result a pick_collector object which holds a list of 
  4612.    *                          interactors collected by this traversal (and 
  4613.    *                          optional associated data).  If an object 
  4614.    *                          determines that it should be a part of the 
  4615.    *                          collection of this traversal, it should add 
  4616.    *                          itself to this collection by calling its
  4617.    *                          report_pick() method.
  4618.    */
  4619.   public void traverse_and_collect(
  4620.     int             traversal_kind,
  4621.     int             traversal_order,
  4622.     interactor_pred inclusion_test,
  4623.     interactor_pred continue_test,
  4624.     traversal_xform xform_parent_to_child,
  4625.     Object          parameters,
  4626.     pick_collector  collection_result) 
  4627. {
  4628.       int i;
  4629.       interactor ch;
  4630.  
  4631.       /* here we are providing the default, so we do all kinds the same */
  4632.  
  4633.       /* select control flow for the order they want */
  4634.       switch(traversal_order)
  4635.     {
  4636.       default:
  4637.         /* if they provide a nonsensical order we throw bad_value */
  4638.         throw new sub_arctic_error("Unrecognized traversal order (" + 
  4639.                                traversal_order + ")");
  4640.       
  4641.       /* default drawing order is parent, then children, left-to-right */
  4642.       case TRAV_DRAW:
  4643.       case TRAV_PRE:
  4644.         /* test this object for inclusion */
  4645.         traverse_and_collect_parent(
  4646.           traversal_kind, inclusion_test, parameters, collection_result);
  4647.  
  4648.         /* now do children left-to-right */
  4649.         traverse_and_collect_children(traversal_kind, traversal_order, 
  4650.         true, inclusion_test, continue_test, xform_parent_to_child, 
  4651.         parameters, collection_result);
  4652.       break;
  4653.  
  4654.       /* default pick order is children right-to-left, then parent */
  4655.       case TRAV_PICK:
  4656.         /* do children right-to-left */
  4657.         traverse_and_collect_children(traversal_kind, traversal_order, 
  4658.         false, inclusion_test, continue_test, xform_parent_to_child, 
  4659.         parameters, collection_result);
  4660.  
  4661.         /* now test this object for inclusion */
  4662.         traverse_and_collect_parent(
  4663.           traversal_kind, inclusion_test, parameters, collection_result);
  4664.       break;
  4665.  
  4666.       case TRAV_POST:
  4667.         /* do children left-to-right */
  4668.         traverse_and_collect_children(traversal_kind, traversal_order, 
  4669.         true, inclusion_test, continue_test, xform_parent_to_child, 
  4670.         parameters, collection_result);
  4671.  
  4672.         /* now test this object for inclusion */
  4673.         traverse_and_collect_parent(
  4674.           traversal_kind, inclusion_test, parameters, collection_result);
  4675.       break;
  4676.     }
  4677.     }
  4678.  
  4679.    //had:
  4680.    //* @exception sub_arctic.exception.bad_value thrown when an improperly typed
  4681.    //*    value is passed in the parameters parameter or for traversal_order.
  4682.    //* @exception sub_arctic.exception.general a "place-holder" to cover 
  4683.    //*    additional exceptions that subclasses might want to throw.
  4684.  
  4685.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4686.  
  4687.   /** 
  4688.    * Helper routine for traverse_and_collect() -- this does test on a single 
  4689.    * (parent) object.
  4690.    *
  4691.    * @see #traverse_and_collect
  4692.    * @param int             traversal_kind    the identifier for this traversal 
  4693.    *                                          type.
  4694.    * @param interactor_pred inclusion_test    the predicate we are testing this 
  4695.    *                                          object against.
  4696.    * @param Object          parameters        the additional parameters to be 
  4697.    *                                          passed to that predicate.
  4698.    * @param pick_collector  collection_result the object that collects and 
  4699.    *                                          returns any objects which are 
  4700.    *                                          selected.
  4701.    */
  4702.   protected void traverse_and_collect_parent(
  4703.     int             traversal_kind,
  4704.     interactor_pred inclusion_test,
  4705.     Object          parameters,
  4706.     pick_collector  collection_result) 
  4707. {
  4708.       /* here we are providing the default, so we do all kinds the same */
  4709.  
  4710.       /* test this object for inclusion */
  4711.       if (inclusion_test == null || inclusion_test.test(this, parameters))
  4712.         {
  4713.       if (collection_result != null)
  4714.         collection_result.report_pick(this, parameters);
  4715.         }
  4716.     }
  4717.  
  4718.    //had:
  4719.    //* @exception sub_arctic.exception.bad_value thrown when an improperly typed
  4720.    //*    value is passed in the parameters parameter or for traversal_order.
  4721.    //* @exception sub_arctic.exception.general a "place-holder" to cover
  4722.    //*    additional exceptions that subclasses might want to throw.
  4723.  
  4724.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4725.  
  4726.   /** Helper routine for traverse_and_collect() -- does recursive traversal
  4727.    *  of children in either left-to-right or right-to-left order. 
  4728.    *
  4729.    * @see #traverse_and_collect
  4730.    * @param int             traversal_kind        the traversal type id.
  4731.    * @param int             traversal_order       traversal order we are to use.
  4732.    * @param boolean         l_to_r                true for left-to-right 
  4733.    *                                              traversal, false for 
  4734.    *                                              right-to-left.
  4735.    * @param interactor_pred inclusion_test        the inclusion test for the 
  4736.    *                                              traversal (see 
  4737.    *                                              traverse_and_collect()). 
  4738.    * @param interactor_pred continue_test         the continue test for the 
  4739.    *                                              traversal(see 
  4740.    *                                              traverse_and_collect()).
  4741.    * @param traversal_xform xform_parent_to_child the parameter transformer 
  4742.    *                                              for the traversal(see 
  4743.    *                                              traverse_and_collect()).
  4744.    * @param Object          parameters            the parameters passed to the 
  4745.    *                                              inclusion and continue test 
  4746.    *                                              predicates.
  4747.    * @param pick_collector  collection_result     the object which collects and 
  4748.    *                                              returns the selected objects.
  4749.    */
  4750.   public void traverse_and_collect_children(
  4751.     int             traversal_kind,
  4752.     int             traversal_order,
  4753.     boolean         l_to_r,
  4754.     interactor_pred inclusion_test,
  4755.     interactor_pred continue_test,
  4756.     traversal_xform xform_parent_to_child,
  4757.     Object          parameters,
  4758.     pick_collector  collection_result) 
  4759. {
  4760.       int        i;
  4761.       interactor ch;
  4762.       Object     ch_parms;
  4763.  
  4764.       /* if the continue test fails we bail out now */
  4765.       if (continue_test != null && !continue_test.test(this, parameters))
  4766.     return;
  4767.  
  4768.       /* walk over child list forward or backwards as needed */
  4769.       for (i = (l_to_r) ? 0 : (num_children()-1);      // begin at start or end
  4770.        (l_to_r) ? (i < num_children()) : (i >= 0); // go to start or end
  4771.        i += ((l_to_r) ? 1 : -1))                   // incr or decr
  4772.           {
  4773.         /* pull out the child and if its not null recurse on it */
  4774.             ch = child(i);
  4775.         if (ch != null)
  4776.           {
  4777.             /* transform the parameters into those for the child */
  4778.             if (xform_parent_to_child != null)
  4779.               ch_parms = xform_parent_to_child.xform(parameters, ch, i);
  4780.             else
  4781.               ch_parms = parameters;
  4782.  
  4783.             /* recursively traverse the child */
  4784.             ch.traverse_and_collect(traversal_kind, traversal_order,
  4785.                inclusion_test, continue_test, xform_parent_to_child,
  4786.                    ch_parms, collection_result);
  4787.           }
  4788.           }
  4789.     }
  4790.  
  4791.    //had:
  4792.    //* @exception sub_arctic.exception.bad_value thrown when an improperly typed
  4793.    //*    value is passed in the parameters parameter or for traversal_order.
  4794.    //* @exception sub_arctic.exception.general a "place-holder" to cover
  4795.    //*    additional exceptions that subclasses might want to throw.
  4796.  
  4797.   /*---------------------------------------------------------------------*/
  4798.   /* Status */
  4799.   /*---------------------------------------------------------------------*/
  4800.  
  4801.   /** 
  4802.    * Determine if a particular bit (or bits) is set in the flag set for the
  4803.    * interactor.  In the case of testing for multiple flag bits, they must
  4804.    * all be set to get a result of true.  See interactor_consts for 
  4805.    * possible values that can be queried.
  4806.    *
  4807.    * @see sub_arctic.lib.interactor_consts
  4808.    * @param int mask_value the flag bit or bits we are enquiring about.
  4809.    * @return boolean indicating whether the bit or bits are (all) set.
  4810.    */
  4811.   public final boolean flag_is_set(int mask_value)
  4812.     {
  4813.       return (_flags & mask_value) == mask_value;
  4814.     }
  4815.  
  4816.     // why are these final?
  4817.  
  4818.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4819.  
  4820.   /** 
  4821.    * Set the given flag bit(s) to the given value. See interactor_consts for
  4822.    * possible values that can be set.
  4823.    *
  4824.    * @see sub_arctic.lib.interactor_consts
  4825.    * @param int     mask_value the bit or bits to be modified within the flags.
  4826.    * @param boolean v          the value to set those bits to.
  4827.    */
  4828.   protected final void set_flag_bit(int mask_value, boolean v)
  4829.     {
  4830.       if (v)
  4831.     _flags |= (mask_value & 0xffffffff);
  4832.       else
  4833.     _flags &= ~mask_value;
  4834.     }
  4835.  
  4836.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4837.  
  4838.   /** 
  4839.    * Set the given flag bit(s) to true. See interactor_consts for
  4840.    * possible values that can be set.
  4841.    *
  4842.    * @see sub_arctic.lib.interactor_consts
  4843.    * @param int     mask_value the bit or bits to be modified within the flags.
  4844.    */
  4845.   protected final void set_flag_bit(int mask_value)
  4846.     {
  4847.       _flags |= (mask_value & 0xffffffff);
  4848.     }
  4849.  
  4850.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4851.  
  4852.   /** 
  4853.    * Set the given flag bit(s) to false. See interactor_consts for
  4854.    * possible values that can be set.
  4855.    *
  4856.    * @see sub_arctic.lib.interactor_consts
  4857.    * @param int     mask_value the bit or bits to be modified within the flags.
  4858.    */
  4859.   protected final void clear_flag_bit(int mask_value)
  4860.     {
  4861.       _flags &= ~mask_value;
  4862.     }
  4863.  
  4864.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4865.  
  4866.   /** Determine if a particular bit (or bits) is set in the constraint_flag 
  4867.    *  set for the interactor.  In the case of testing for multiple 
  4868.    *  constraint_flag bits, they must all be set to get a result of true.  
  4869.    *  See interactor_consts for possible values that can be queried.
  4870.    */
  4871.   public final boolean constraint_flag_is_set(int mask_value)
  4872.     {
  4873.       return (_constraint_flags & mask_value) == mask_value;
  4874.     }
  4875.  
  4876.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4877.  
  4878.   /** 
  4879.    * Set the given constraint_flag bit(s) to the given value. See 
  4880.    * interactor_consts for possible values that can be set.
  4881.    *
  4882.    * @see sub_arctic.lib.interactor_consts
  4883.    * @param int     mask_value the bit or bits to be modified within the flags.
  4884.    * @param boolean v          the value to set those bits to.
  4885.    */
  4886.   protected final void set_constraint_flag_bit(int mask_value, boolean v)
  4887.     {
  4888.       if (v)
  4889.     _constraint_flags |= (mask_value & 0xffffffff);
  4890.       else
  4891.     _constraint_flags &= ~mask_value;
  4892.     }
  4893.  
  4894.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4895.  
  4896.   /** 
  4897.    * Set the given constraint_flag bit(s) to true. See interactor_consts for 
  4898.    * possible values that can be set.
  4899.    *
  4900.    * @see sub_arctic.lib.interactor_consts
  4901.    * @param int     mask_value the bit or bits to be modified within the flags.
  4902.    */
  4903.   protected final void set_constraint_flag_bit(int mask_value)
  4904.     {
  4905.       _constraint_flags |= (mask_value & 0xffffffff);
  4906.     }
  4907.  
  4908.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4909.  
  4910.   /** 
  4911.    * Set the given constraint_flag bit(s) to false. See interactor_consts for 
  4912.    * possible values that can be set.
  4913.    *
  4914.    * @see sub_arctic.lib.interactor_consts
  4915.    * @param int     mask_value the bit or bits to be modified within the flags.
  4916.    */
  4917.   protected final void clear_constraint_flag_bit(int mask_value)
  4918.     {
  4919.       _constraint_flags &= ~mask_value;
  4920.     }
  4921.  
  4922.   /*---------------------------------------------------------------------*/
  4923.   /* Output */
  4924.   /*---------------------------------------------------------------------*/
  4925.  
  4926.   /** 
  4927.    * Given a drawable surface set up for the parent coordinate space, 
  4928.    * create a new drawable set up for the local coordinate space.
  4929.    * This surface will have a translation installed corresponding to the 
  4930.    * local origin, and will clip to the extent of the local object.
  4931.    *
  4932.    * @param drawable parent_draw the drawable set up for the parent.
  4933.    * @return drawable a new drawable set up for the child.
  4934.    */
  4935.   protected drawable enter_local_coordinates(drawable parent_draw)
  4936.     {
  4937.       drawable result;
  4938.  
  4939.       /* make a copy of the drawable for use in local coords */
  4940.       result = parent_draw.copy();
  4941.  
  4942.       /* apply transformation to get from parent to local coords */
  4943.       result.translate(x(), y());
  4944.  
  4945.       /* clip to local bounds */
  4946.       result.clipRect(0, 0, w(), h());
  4947.  
  4948.       return result;
  4949.     }
  4950.     
  4951.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4952.  
  4953.   /** 
  4954.    * Do the work to exit the local coordinate system.  Here this does
  4955.    * nothing since we just revert to the original parent drawable.
  4956.    * However, this is here as a useful hook for subclasses that need to do
  4957.    * something else at this point. 
  4958.    * 
  4959.    * @param drawable parent_draw the drawable used by our parent.
  4960.    * @param drawable local_draw  the drawable derived from it used by us.
  4961.    */
  4962.   protected void exit_local_coords(drawable parent_draw, drawable local_draw)
  4963.     {
  4964.       /* here do nothing */
  4965.     }
  4966.  
  4967.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4968.  
  4969.   /** 
  4970.    * Do a trivial reject test that indicates whether the given bounding
  4971.    * box is entirely outside the clipping region of the given drawable 
  4972.    * object.  Returns true if nothing inside the box will survive the clip
  4973.    * and hence need not be drawn.  This can also be used for optimizing 
  4974.    * drawing by testing whether an expensive object is completely clipped 
  4975.    * away before trying to draw it.
  4976.    * 
  4977.    * @param drawable  d            the drawable whose current clipping we are 
  4978.    *                               testing against.
  4979.    * @param Rectangle bounding_box the bounding box we are comparing that with.
  4980.    */
  4981.   public static boolean trivial_reject(drawable d, Rectangle bounding_box)
  4982.     {
  4983.       Rectangle clip = d.getClipRect();
  4984.       return !clip.intersects(bounding_box);
  4985.     }
  4986.  
  4987.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  4988.  
  4989.   /** 
  4990.    * Do a trivial reject test that indicates whether the bounds of this object 
  4991.    * are entirely outside the clipping region of the given drawable object.  
  4992.    * The drawable object is assumed to be configured for our parent's 
  4993.    * coordinate system.  Returns true if nothing inside our bounds will 
  4994.    * survive the clip and hence need not be drawn.  This test is used in 
  4995.    * draw_self() to avoid drawing anything for the object if none of it 
  4996.    * could show up anyway.
  4997.    * 
  4998.    * @see #draw_self
  4999.    * @param drawable  d            the drawable whose current clipping we are 
  5000.    *                               testing against.
  5001.    * @param Rectangle bounding_box the bounding box we are comparing that with.
  5002.    */
  5003.   public boolean trivial_reject(drawable d)
  5004.     {
  5005.       return trivial_reject(d, bound());
  5006.     }
  5007.  
  5008.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5009.  
  5010.   /** 
  5011.    * Draw the object's current appearance.  The drawable object passed in
  5012.    * is still set up in the parent's coordinate system.  This routine normally
  5013.    * sets up the transformation for the local coordinate system, then calls
  5014.    * draw_self_local().  Consequently, most interactors do not override this
  5015.    * routine, but instead override draw_self_local().
  5016.    *
  5017.    * @see #draw_self_local
  5018.    * @param drawable parent_d a drawable (still set up for the parent) to 
  5019.    *                          produce output on.
  5020.    */
  5021.   public void draw_self(drawable parent_d) 
  5022. {
  5023.       drawable local_d;
  5024.  
  5025.       /* only draw if we are visible and trivial reject test indicates it 
  5026.        * might actually appear */
  5027.       if (visible() && !trivial_reject(parent_d))
  5028.     {
  5029.           /* save the graphics state and do the translation into local coords */
  5030.           local_d = enter_local_coordinates(parent_d);
  5031.  
  5032.           /* do the actual drawing */
  5033.           draw_self_local(local_d);
  5034.  
  5035.           /* restore the graphics state and undo the translation */
  5036.           exit_local_coords(parent_d, local_d);
  5037.     }
  5038.  
  5039.       /* damage is now fixed */
  5040.       damage_fixed();
  5041.     }
  5042.  
  5043.    //has:
  5044.    //* @exception general
  5045.  
  5046.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5047.  
  5048.   /** 
  5049.    * Draw the object's current appearance (along with that of its children).  
  5050.    * The drawable object passed in will be set up for the local coordinate 
  5051.    * system.  Most interactors override this routine to provide a custom 
  5052.    * appearance, but this routine is not called directly to produce output 
  5053.    * (that is done with draw_self()).<p>
  5054.    *
  5055.    * Normal drawing order with respect to children is to draw the this object
  5056.    * (the parent) first, then draw the children (so they appear on top). 
  5057.    * Drawing children (in normal low to high index order) can be done by the
  5058.    * draw_children() utility routine.  Note that if normal drawing order is
  5059.    * overridden changes also must be made to the picking routines (pick()
  5060.    * and pick_within_children()) as well.
  5061.    *
  5062.    * @see #draw_self
  5063.    * @see #draw_children
  5064.    * @see #pick
  5065.    * @see #pick_within_children
  5066.    * @param drawable d a drawable object (set up for this object) to produce 
  5067.    *                   output on.
  5068.    */
  5069.   protected void draw_self_local(drawable d) 
  5070. {
  5071.       /* in base class we draw nothing (for ourselves) */
  5072.  
  5073.       /* draw any children we have */
  5074.       draw_children(d);
  5075.     }
  5076.  
  5077.    //has:
  5078.    //* @exception general
  5079.  
  5080.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5081.  
  5082.   /** 
  5083.    * Helper routine to draw the children of this interactor in normal (low to 
  5084.    * high index) drawing order.  This simply calls draw_self() for each child
  5085.    * in order.  Note that if normal drawing order is overridden changes also 
  5086.    * must be made to the picking routines (pick() and pick_within_children()) 
  5087.    * as well.
  5088.    *
  5089.    * @see #draw_self
  5090.    * @see #draw_self_local
  5091.    * @see #pick
  5092.    * @see #pick_within_children
  5093.    * @param drawable d a drawable object (set up for this object) to produce 
  5094.    *                   output on.
  5095.    */
  5096.   protected void draw_children(drawable d) 
  5097. {
  5098.       interactor chld;
  5099.  
  5100.       /* walk down the children and draw them all in order. */
  5101.       for (int i=0; i<num_children(); i++)
  5102.     {
  5103.       chld = child(i);
  5104.       if (chld != null) chld.draw_self(d);
  5105.     }
  5106.     }
  5107.  
  5108.    //has:
  5109.    //* @exception general
  5110.  
  5111.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5112.  
  5113.   /** 
  5114.    * Indicate that any previous damage to the object's appearance has been
  5115.    * fixed (by redrawing it).  This is normally called automatically by 
  5116.    * draw_self and need not be called elsewhere.
  5117.    */
  5118.   protected void damage_fixed()
  5119.     {
  5120.       clear_flag_bit(DAMAGED);
  5121.     }
  5122.  
  5123.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5124.  
  5125.   /** 
  5126.    * Indicate that the object has been modified in such as way that its
  5127.    * appearance within the given area of the screen (expressed in local 
  5128.    * coordinates) might change and needs to be redrawn.  This does not 
  5129.    * update any attributes controlling size and position of this object 
  5130.    * or any other object up the parent chain, but instead uses existing 
  5131.    * values (reflecting the existing sizes and positions).  If you need to 
  5132.    * damage this object's updated position, explicitly update it first.
  5133.    *
  5134.    * @param Point     top_left top left corner of the damaged rectangle.
  5135.    * @param Dimension sz           size of the damaged rectangle.
  5136.    */
  5137.   public void damage_self(Point top_left, Dimension sz) 
  5138. {
  5139.       Point parent_tl;
  5140.       interactor p;
  5141.  
  5142.       /* mark us as damaged */
  5143.       set_flag_bit(DAMAGED);
  5144.  
  5145.       /* convert to parent's coords and tell them about it */
  5146.       p = parent();
  5147.       if (p != null)
  5148.     {
  5149.       /* put into coords of parent and pass damage up */
  5150.           top_left.x = top_left.x + _x;
  5151.           top_left.y = top_left.y + _y;
  5152.       p.damage_from_child(top_left,sz);
  5153.     }
  5154.     }
  5155.  
  5156.    //had:
  5157.    //* @exception general
  5158.  
  5159.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5160.  
  5161.   /** 
  5162.    * Indicate that the object has been modified in such as way that its
  5163.    * appearance within the given area of the screen (expressed in local 
  5164.    * coordinates) might change and needs to be redrawn.  This does not 
  5165.    * update any attributes controlling size and position of this object 
  5166.    * or any other object up the parent chain, but instead uses existing 
  5167.    * values (reflecting the existing sizes and positions).  If you need to 
  5168.    * damage this object's updated position, explicitly update it first.
  5169.    *
  5170.    * @param int left left edge of the damaged rectangle.
  5171.    * @param int top  top edge of the damaged rectangle.
  5172.    * @param int wid  width of the damaged rectangle.
  5173.    * @param int hi   height of the damaged rectangle.
  5174.    */
  5175.   public void damage_self(int left, int top, int wid, int hi) 
  5176. {
  5177.       Point parent_tl;
  5178.       interactor p;
  5179.  
  5180.       /* mark us as damaged */
  5181.       set_flag_bit(DAMAGED);
  5182.  
  5183.       /* convert to parent's coords and tell them about it */
  5184.       p = parent();
  5185.       if (p != null)
  5186.     {
  5187.       /* put into coords of parent and pass damage up */
  5188.           left = left + _x;
  5189.           top  = top + _y;
  5190.       p.damage_from_child(new Point(left,top), new Dimension(wid,hi));
  5191.     }
  5192.     }
  5193.  
  5194.    //has:
  5195.    //* @exception general
  5196.  
  5197.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5198.  
  5199.   /** 
  5200.    * Indicate that the object has been modified in such as way that any or
  5201.    * all of its appearance may change and its area of the screen needs
  5202.    * to be redrawn.  
  5203.    */
  5204.   public void damage_self() 
  5205. {
  5206.       damage_self(new Point(0,0),new Dimension(_w,_h));
  5207.     }
  5208.  
  5209.    //had:
  5210.    //* @exception general
  5211.  
  5212.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5213.  
  5214.   /** 
  5215.    * Indicate that a change to a child (or grandchild, etc.) affects the 
  5216.    * given screen region (expressed in the coordinates of this object).
  5217.    * This is responsible for passing damage up the tree.
  5218.    *
  5219.    * @param Point     top_left top left corner of the damaged rectangle.
  5220.    * @param Dimension sz           size of the damaged rectangle.
  5221.    */
  5222.   public void damage_from_child(Point top_left, Dimension sz) 
  5223. {
  5224.       /* just pass on the damage */
  5225.       damage_self(top_left, sz);
  5226.     }
  5227.  
  5228.    //had:
  5229.    //* @exception general
  5230.  
  5231.   /*---------------------------------------------------------------------*/
  5232.   /* Feature points */
  5233.   /*---------------------------------------------------------------------*/
  5234.   
  5235.   /** 
  5236.    * The number of "feature points" of an object.  Feature points are points
  5237.    * within an object which are interesting for alignment, snapping or 
  5238.    * other purposes.  They are used by the move_drag and snap_drag agents.<p>
  5239.    * 
  5240.    * Feature points are expressed in the local coordinates of the object in 
  5241.    * question. Objects by default provide 5 points corresponding to their 
  5242.    * corners and center.  Constants representing indexes for these standard 
  5243.    * points are defined in interactor_consts.  Additional points with 
  5244.    * specialized meanings may be provided by subclasses.
  5245.    * 
  5246.    * @see sub_arctic.input.move_drag_focus_agent
  5247.    * @see sub_arctic.input.move_draggable
  5248.    * @see sub_arctic.input.move_drag_filter
  5249.    * @see sub_arctic.input.std_drag_filters
  5250.    * @see sub_arctic.input.snap_drag_agent
  5251.    * @see sub_arctic.input.snap_draggable
  5252.    * @see sub_arctic.input.snap_targetable
  5253.    * @see sub_arctic.lib.interactor_consts
  5254.    *
  5255.    * @return int the number of feature points this object has.
  5256.    */
  5257.   public int num_feature_points() { return 5; }
  5258.  
  5259.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5260.   
  5261.   /** 
  5262.    * Access to the "feature points" of an object (by index).  Feature points 
  5263.    * are points within an object which are interesting for alignment,  
  5264.    * snapping or other purposes. They are used by the move_drag and 
  5265.    * snap_drag agents. <p>
  5266.    *
  5267.    * Feature points are expressed in the local coordinates of the object in 
  5268.    * question. Objects by default provide 5  points corresponding to their 
  5269.    * corners and center.  Constants representing indexes for these standard 
  5270.    * points are defined in interactor_consts.  Additional points with 
  5271.    * specialized meanings may be provided by subclasses.  If an index out of 
  5272.    * range is given the top-left corner (index FEATURE_TOP_LEFT which is 
  5273.    * always 0,0) is returned.
  5274.    *
  5275.    * @see sub_arctic.input.move_drag_focus_agent
  5276.    * @see sub_arctic.input.move_draggable
  5277.    * @see sub_arctic.input.move_drag_filter
  5278.    * @see sub_arctic.input.std_drag_filters
  5279.    * @see sub_arctic.input.snap_drag_agent
  5280.    * @see sub_arctic.input.snap_draggable
  5281.    * @see sub_arctic.input.snap_targetable
  5282.    * @see sub_arctic.lib.interactor_consts
  5283.    *
  5284.    * @param int indx the index of the requested feature point.
  5285.    * @return Point the location of the requested feature point in local 
  5286.    *               coordinates.
  5287.    */
  5288.   public Point feature_point(int indx)
  5289.     {
  5290.       switch(indx)
  5291.     {
  5292.       default:
  5293.       case FEATURE_TOP_LEFT:
  5294.         return new Point(0,0);
  5295.  
  5296.       case FEATURE_TOP_RIGHT:
  5297.         return new Point(w()-1,0);
  5298.  
  5299.       case FEATURE_BOTTOM_LEFT:
  5300.         return new Point(0,h()-1);
  5301.  
  5302.       case FEATURE_BOTTOM_RIGHT:
  5303.         return new Point(w()-1,h()-1);
  5304.  
  5305.       case FEATURE_CENTER:
  5306.         return new Point(w()/2,h()/2);
  5307.     }
  5308.     }
  5309.  
  5310.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5311.   
  5312.   /** 
  5313.    * Indicate whether the indicated "feature point" of an object is 
  5314.    * considered to be enabled.  Feature points are points within an object 
  5315.    * which are interesting for alignment, snapping or other purposes. They are 
  5316.    * used by the move_drag and snap_drag agents. <p>
  5317.    *
  5318.    * Feature points are expressed in the local coordinates of the object in
  5319.    * question. Objects by default provide 5 points corresponding to their
  5320.    * corners and center.  Constants representing indexes for these standard 
  5321.    * points are defined in interactor_consts.  Additional points with 
  5322.    * specialized meanings may be provided by subclasses. <p>
  5323.    *
  5324.    * By default all standard feature points are always enabled. If an index 
  5325.    * out of range is given false will always be returned.
  5326.    *
  5327.    * @see sub_arctic.input.move_drag_focus_agent
  5328.    * @see sub_arctic.input.move_draggable
  5329.    * @see sub_arctic.input.move_drag_filter
  5330.    * @see sub_arctic.input.std_drag_filters
  5331.    * @see sub_arctic.input.snap_drag_agent
  5332.    * @see sub_arctic.input.snap_draggable
  5333.    * @see sub_arctic.input.snap_targetable
  5334.    * @see sub_arctic.lib.interactor_consts
  5335.    *
  5336.    * @param int indx the index of the feature point in question.
  5337.    * @return boolean indicating whether it is enabled.
  5338.    */
  5339.   public boolean feature_point_enabled(int indx)
  5340.     {
  5341.       return (indx >= 0) && (indx < FIRST_FREE_FEATURE);
  5342.     }
  5343.  
  5344.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5345.   
  5346.   /** Indicate the current "feature point" of an object.  This point will be
  5347.    * used by the move_drag agent to control dragging. Feature points are 
  5348.    * points within an object which are interesting for alignment, snapping 
  5349.    * or other purposes. The current feature point is used by the move_drag
  5350.    * agent.  See that agent for complete details.
  5351.    *
  5352.    * Feature points are expressed in the local coordinates of the object in
  5353.    * question. Objects by default provide 5 points corresponding to their
  5354.    * corners and center.  Constants representing indexes for these standard 
  5355.    * points are defined in interactor_consts.  Additional points with 
  5356.    * specialized meanings may be provided by subclasses. <p>
  5357.    * 
  5358.    * Note: this routine and the ones that use it ignore the enable status 
  5359.    * of the point as returned by feature_point_enabled().  This routine
  5360.    * defaults to the top left corner of the object.
  5361.    * 
  5362.    * @see sub_arctic.input.move_drag_focus_agent
  5363.    * @see sub_arctic.input.move_draggable
  5364.    * @see sub_arctic.input.move_drag_filter
  5365.    * @see sub_arctic.input.std_drag_filters
  5366.    * @see sub_arctic.lib.interactor_consts
  5367.    *
  5368.    * @return the index of the current feature point.
  5369.    */
  5370.   public int drag_feature_point()
  5371.     {
  5372.       /* defaults to top-left */
  5373.       return FEATURE_TOP_LEFT;
  5374.     }
  5375.  
  5376.   /*---------------------------------------------------------------------*/
  5377.   /* Support for common input protocols */
  5378.   /*---------------------------------------------------------------------*/
  5379.  
  5380.   /** 
  5381.    * Default action for entering a focus set.  Several of the focus agents
  5382.    * handle focus entry in custom ways (and do not call this routine) and 
  5383.    * many objects don't need to do anything special when they enter the focus
  5384.    * set since they requested the focus themselves.  So we provide a default 
  5385.    * here for ignoring the dispatch.   This is only relevant for objects 
  5386.    * implementing the focusable interface (or one of the other input dispatch 
  5387.    * protocol interfaces derived from it), but its easy enough to do here and 
  5388.    * saves a bit of coding in subclasses.
  5389.    *
  5390.    * @see sub_arctic.input.focusable
  5391.    * @see sub_arctic.input.focus_dispatch_agent
  5392.    * 
  5393.    * @param event                cause_evt the event that caused the focus.
  5394.    * @param focus_dispatch_agent of_agent  the agent doing the focus. 
  5395.    * @param Object               user_info uninterpreted information that was
  5396.    *                                       given to the agent when the focus
  5397.    *                                       was requested.
  5398.    */
  5399.   public void focus_set_enter(
  5400.     event                cause_evt, 
  5401.     focus_dispatch_agent of_agent, 
  5402.     Object               user_info)
  5403.     {
  5404.       /* ignore this by default */
  5405.     }
  5406.  
  5407.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5408.  
  5409.   /** 
  5410.    * Default action for exiting a focus set.  Several of the focus agents
  5411.    * handle focus entry in custom ways (and do not call this routine) and 
  5412.    * many objects don't need to do anything special when they enter the focus
  5413.    * set since they requested the focus themselves.  So we provide a default 
  5414.    * here for ignoring the dispatch.   This is only relevant for objects 
  5415.    * implementing the focusable interface (or one of the other input dispatch 
  5416.    * protocol interfaces derived from it), but its easy enough to do here and 
  5417.    * saves a bit of coding in subclasses.
  5418.    *
  5419.    * @see sub_arctic.input.focusable
  5420.    * @see sub_arctic.input.focus_dispatch_agent
  5421.    * 
  5422.    * @param event                cause_evt the event that caused the focus.
  5423.    * @param focus_dispatch_agent of_agent  the agent doing the focus. 
  5424.    * @param Object               user_info uninterpreted information that was
  5425.    *                                       given to the agent when the focus
  5426.    *                                       was requested.
  5427.    */
  5428.   public void focus_set_exit(
  5429.     event                cause_evt, 
  5430.     focus_dispatch_agent of_agent,
  5431.     Object               user_info)
  5432.     {
  5433.       /* ignore this by default */
  5434.     }
  5435.  
  5436.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5437.  
  5438.   /** 
  5439.    * Default point filter.  Point filters are used by the move_drag agent
  5440.    * to limit the area of a drag or transform the path of a drag.  Here we 
  5441.    * use the identity filter, so it imposes no limit or translation. 
  5442.    * A collection of useful filters that can be called from subclass 
  5443.    * specializations of this method can be found in std_drag_filters.
  5444.    *
  5445.    * @see sub_arctic.input.move_drag_filter
  5446.    * @see sub_arctic.input.move_drag_focus_agent
  5447.    * @see sub_arctic.input.move_draggable
  5448.    * @see sub_arctic.input.std_drag_filters
  5449.    * @see sub_arctic.lib.interactor_consts
  5450.    *
  5451.    * @param original_pt the point to be filtered (in parent's coords).
  5452.    * @param drag_obj    the object being dragged.
  5453.    * @param feature_pt  the feature point within the object being dragged 
  5454.    *                    that is being filtered (in object's coords).
  5455.    * @return the location of the filtered point 
  5456.    */
  5457.   public Point filter_pt(Point original_pt, interactor obj, Point feature_pt)
  5458.     {
  5459.       return original_pt;
  5460.     }
  5461.  
  5462.   /*---------------------------------------------------------------------*/
  5463.   /* User Info */
  5464.   /*---------------------------------------------------------------------*/
  5465.  
  5466.   /** 
  5467.    * Access to uninterpreted "user information" that we are holding for the 
  5468.    * user of this object.  This information is for use of the user or 
  5469.    * application only and is typically used to associated application specific 
  5470.    * information with a particular interactor object.  This information can be 
  5471.    * entered using set_user_info().  It is not modified by the toolkit, and 
  5472.    * can later be retrieved with this routine as needed.  
  5473.    *
  5474.    * @see #set_user_info
  5475.    * @returns Object the user info object attached to this interactor.
  5476.    */
  5477.   public Object user_info() {return _user_info;}
  5478.   
  5479.   /** 
  5480.    * Set the uninterpreted "user information" that we are holding for the 
  5481.    * user of this object.  This information is for use of the user or 
  5482.    * application only and is typically used to associated application specific 
  5483.    * information with a particular interactor object.  This information can be 
  5484.    * entered using this routine.  It is not modified by the toolkit, and can 
  5485.    * later be retrieved with user_info() as needed.  
  5486.    *
  5487.    * @see #user_info
  5488.    * @param Object user_inf the object to associate with this interactor.
  5489.    */
  5490.   public void set_user_info(Object user_inf) {_user_info = user_inf;}
  5491.  
  5492.   /*---------------------------------------------------------------------*/
  5493.   /* Debugging */
  5494.   /*---------------------------------------------------------------------*/
  5495.  
  5496.   /** 
  5497.    * Convert a flag set into a human readable string.
  5498.    * @return String displaying the values of the flag set.
  5499.    */
  5500.   public String flag_string()
  5501.     {
  5502.       StringBuffer result = new StringBuffer();
  5503.  
  5504.       if (constraint_flag_is_set(IS_VISIBLE)) result.append("IS_VISIBLE ");
  5505.       if (constraint_flag_is_set(IS_ENABLED)) result.append("IS_ENABLED ");
  5506.       if (constraint_flag_is_set(SUPPORTS_CHILDREN)) 
  5507.     result.append("SUPPORTS_CHILDREN ");
  5508.       if (flag_is_set(FIXED_CHILDREN)) result.append("FIXED_CHILDREN ");
  5509.       if (flag_is_set(DAMAGED)) result.append("DAMAGED ");
  5510.  
  5511.       return result.toString();
  5512.     }
  5513.  
  5514.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5515.   /** 
  5516.    * Convert a constraint flag set into a human readable string.
  5517.    * @return String displaying the values of the flag set.
  5518.    */
  5519.   public String constraint_flag_string()
  5520.     {
  5521.       StringBuffer result = new StringBuffer();
  5522.  
  5523.       if (constraint_flag_is_set(X_OOD)) result.append("X_OOD ");
  5524.       if (constraint_flag_is_set(Y_OOD)) result.append("Y_OOD ");
  5525.       if (constraint_flag_is_set(W_OOD)) result.append("W_OOD ");
  5526.       if (constraint_flag_is_set(H_OOD)) result.append("H_OOD ");
  5527.       if (constraint_flag_is_set(VISIBLE_OOD)) result.append("VISIBLE_OOD ");
  5528.       if (constraint_flag_is_set(ENABLED_OOD)) result.append("ENABLED_OOD ");
  5529.       if (constraint_flag_is_set(PART_A_OOD)) result.append("PART_A_OOD ");
  5530.       if (constraint_flag_is_set(PART_B_OOD)) result.append("PART_B_OOD ");
  5531.       if (constraint_flag_is_set(X_IN_PROCESS)) result.append("X_IN_PROCESS ");
  5532.       if (constraint_flag_is_set(Y_IN_PROCESS)) result.append("Y_IN_PROCESS ");
  5533.       if (constraint_flag_is_set(W_IN_PROCESS)) result.append("W_IN_PROCESS ");
  5534.       if (constraint_flag_is_set(H_IN_PROCESS)) result.append("H_IN_PROCESS ");
  5535.       if (constraint_flag_is_set(VISIBLE_IN_PROCESS)) 
  5536.     result.append("VISIBLE_IN_PROCESS ");
  5537.       if (constraint_flag_is_set(ENABLED_IN_PROCESS)) 
  5538.     result.append("ENABLED_IN_PROCESS ");
  5539.       if (constraint_flag_is_set(PART_A_IN_PROCESS)) 
  5540.     result.append("PART_A_IN_PROCESS ");
  5541.       if (constraint_flag_is_set(PART_B_IN_PROCESS)) 
  5542.     result.append("PART_B_IN_PROCESS ");
  5543.       if (constraint_flag_is_set(X_HAS_EXT_NOTIFY)) 
  5544.     result.append("X_HAS_EXT_NOTIFY ");
  5545.       if (constraint_flag_is_set(Y_HAS_EXT_NOTIFY)) 
  5546.     result.append("Y_HAS_EXT_NOTIFY ");
  5547.       if (constraint_flag_is_set(W_HAS_EXT_NOTIFY)) 
  5548.     result.append("W_HAS_EXT_NOTIFY ");
  5549.       if (constraint_flag_is_set(H_HAS_EXT_NOTIFY)) 
  5550.     result.append("H_HAS_EXT_NOTIFY ");
  5551.       if (constraint_flag_is_set(VISIBLE_HAS_EXT_NOTIFY)) 
  5552.     result.append("VISIBLE_HAS_EXT_NOTIFY ");
  5553.       if (constraint_flag_is_set(ENABLED_HAS_EXT_NOTIFY)) 
  5554.     result.append("ENABLED_HAS_EXT_NOTIFY ");
  5555.       if (constraint_flag_is_set(PART_A_HAS_EXT_NOTIFY)) 
  5556.     result.append("PART_A_HAS_EXT_NOTIFY ");
  5557.       if (constraint_flag_is_set(PART_B_HAS_EXT_NOTIFY)) 
  5558.     result.append("PART_B_HAS_EXT_NOTIFY ");
  5559.  
  5560.       if (flag_is_set(VISIBLE_IS_HORIZONTAL)) 
  5561.     result.append("VISIBLE_IS_HORIZONTAL ");
  5562.       if (flag_is_set(ENABLED_IS_HORIZONTAL)) 
  5563.     result.append("ENABLED_IS_HORIZONTAL ");
  5564.       if (flag_is_set(PART_A_IS_HORIZONTAL)) 
  5565.     result.append("PART_A_IS_HORIZONTAL ");
  5566.       if (flag_is_set(PART_B_IS_HORIZONTAL)) 
  5567.     result.append("PART_B_IS_HORIZONTAL ");
  5568.  
  5569.       return result.toString();
  5570.     }
  5571.  
  5572.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5573.  
  5574.   /** 
  5575.    * Convert to a human readable string. 
  5576.    * @return String a human readable dump of the object.
  5577.    */
  5578.   public String toString()
  5579.     {
  5580.       StringBuffer result = new StringBuffer();
  5581.  
  5582.       /* Do a minimal dump */
  5583.       result.append(getClass().getName());
  5584.       result.append(":[x="); result.append(x());
  5585.       result.append(", y="); result.append(y());
  5586.       result.append(", w="); result.append(w());
  5587.       result.append(", h="); result.append(h());
  5588.       result.append(", flags={"); 
  5589.       result.append(flag_string());
  5590.       result.append(constraint_flag_string());
  5591.       result.append("}]");
  5592.  
  5593.       return result.toString();
  5594.     }
  5595.  
  5596.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5597.  
  5598.   /** 
  5599.    * Convert to a small tag string which indicates the type of interactor
  5600.    * along with a (hopefully unique) integer (its hashCode) that can 
  5601.    * be used to identify it during debugging.
  5602.    * @return String an terse identifying tag string for the object.
  5603.    */
  5604.   public String tag_str()
  5605.     {
  5606.       return getClass().getName() + ":" + hashCode();
  5607.     }
  5608.  
  5609.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  5610. }
  5611. /*=========================== COPYRIGHT NOTICE ===========================
  5612.  
  5613. This file is part of the subArctic user interface toolkit.
  5614.  
  5615. Copyright (c) 1996 Scott Hudson and Ian Smith
  5616. All rights reserved.
  5617.  
  5618. The subArctic system is freely available for most uses under the terms
  5619. and conditions described in 
  5620.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  5621. and appearing in full in the lib/interactor.java source file.
  5622.  
  5623. The current release and additional information about this software can be 
  5624. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  5625.  
  5626. ========================================================================*/
  5627.