sub_arctic.new_lib
Class historical_whiteboard

java.lang.Object
  |
  +--sub_arctic.lib.min_interactor
        |
        +--sub_arctic.lib.base_interactor
              |
              +--sub_arctic.lib.base_parent_interactor
                    |
                    +--sub_arctic.new_lib.historical_whiteboard

public class historical_whiteboard
extends base_parent_interactor
implements pressable, simple_draggable, move_draggable

Whiteboard demo app to work with a lens over time...


Field Summary
protected  whiteboard_obj _create_proto
          The whiteboard_obj that we currently are cloning new objects from
protected  int _current_mode
          Current mode of the whiteboard.
protected  whiteboard_obj _current_obj
          The object currently being manipulated
protected  int _current_person
          The current person id
protected static long _now
          Counter for implementing virtual time
protected  java.util.Vector _objects
          Vector of whiteboard_obj objects currently in the whiteboard.
static int MODE_CREATE
          Flag for create mode
static int MODE_DEL
          Flag for delete mode
static int MODE_PICK
          Flag for pick/move mode
 
Fields inherited from class sub_arctic.lib.base_interactor
_child_index, _child_list, _clip_bounds, _constraint_flags, _enabled_constraint, _flags, _h, _h_constraint, _parent, _part_a_constraint, _part_b_constraint, _user_data, _visible_constraint, _w, _w_constraint, _x, _x_constraint, _y, _y_constraint, default_child_hint
 
Constructor Summary
historical_whiteboard(int x, int y, int w, int h)
          Full constructor.
 
Method Summary
 void add_object(whiteboard_obj obj)
           
static void advance_time()
          Advance virtual time
 whiteboard_obj create_proto()
          The whiteboard_obj that we currently are cloning new objects from
 int current_mode()
          Current mode of the whiteboard.
 int current_person()
          The current person id
 boolean drag_end(event evt, int x, int y, int start_x, int start_y, int grab_x, int grab_y, java.lang.Object user_info)
          Dispatch input corresponding to the end of a drag.
 boolean drag_end(event evt, java.lang.Object user_info)
          Dispatch event corresponding to the end of a simple drag.
 boolean drag_feedback(event evt, int x, int y, int start_x, int start_y, int grab_x, int grab_y, java.lang.Object user_info)
          Dispatch a movement during a drag.
 boolean drag_feedback(event evt, java.lang.Object user_info)
          Dispatch a movement event during a simple drag.
 boolean drag_start(event evt, int x, int y, int grab_x, int grab_y, java.lang.Object user_info)
          Dispatch the start of a drag to the object.
 boolean drag_start(event evt, java.lang.Object user_info)
          Dispatch the start event of a simple drag.
 void draw_self_local_at(drawable d, long at_time, long selection, boolean select_owner, java.awt.Color[] map)
          Draw the object's current appearance as it was at the given time (but don't draw child objects).
protected  void draw_self_local(drawable d)
          Draw the object's current appearance.
static long now()
          Get the current virtual time
protected  whiteboard_obj pick_an_obj(event evt)
          Do a pick over our internal objects
 boolean press(event evt, java.lang.Object user_info)
          Handle press input.
 boolean release(event evt, java.lang.Object user_info)
          Companion to press() -- here this is ignored.
 void set_create_proto(whiteboard_obj proto)
          Set the whiteboard_obj that we currently are cloning new objects from
 void set_current_mode(int new_md)
          Set the current mode of the whiteboard.
 void set_current_person(int id)
          Set the current person id
 void set_mode(int mode_kind, whiteboard_obj obj_to_create, int cur_person)
          Set the current mode of the whiteboard
 
Methods inherited from class sub_arctic.lib.base_interactor
active_constraints, add_child, add_user_datum, attach_dependent, bound, callback_obj, child_index, child, clear_child_list, clear_constraint_flag_bit, clear_flag_bit, configure, constraint_flag_is_set, constraint_flag_string, constraint_on, custom_fun1, custom_fun2, damage_fixed, damage_from_child, damage_self, damage_self, damage_self, damage_self, damage_self, detach_dependent, do_action, do_action, do_callback, do_callback, drag_feature_point, draw_children, draw_self, enabled_constraint, enabled, enter_local_coordinates, eval_enabled, eval_h, eval_part_a, eval_part_b, eval_visible, eval_w, eval_x, eval_y, eval, exit_local_coords, feature_point_enabled, feature_point, filter_pt, find_child, first_callback_num, fixed_children, flag_is_set, flag_string, focus_set_enter, focus_set_exit, get_awt_component, get_external_constraint, get_part, get_top_level, get_value, global_to_local, global_to_local, h_constraint, h, handle_cycle, inform_ood, insert_child, inside_bounds, into_local, into_local, into_parent, into_parent, intrinsic_constraints, is_constrained, last_callback_num, local_to_global, local_to_global, mark_all_ood, mark_enabled_ood, mark_h_ood, mark_ood, mark_part_a_ood, mark_part_b_ood, mark_reparented_ood, mark_visible_ood, mark_w_ood, mark_x_ood, mark_y_ood, marked_ood, move_child_downward, move_child_downward, move_child_to_bottom, move_child_to_bottom, move_child_to_top, move_child_to_top, move_child_upward, move_child_upward, move_downward, move_to_bottom, move_to_top, move_upward, new_look_configure, next_sibling, num_actions, num_children, num_feature_points, ood_inform_all, parent, part_a_constraint, part_a, part_b_constraint, part_b, pick_within_children, pick, picked_by, pos, prev_sibling, register_resource_names, remove_child, remove_child, remove_user_datum, restyle_look_resources, restyle, set_callback_obj, set_child_index, set_child, set_constraint_flag_bit, set_constraint_flag_bit, set_constraint, set_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled, set_flag_bit, set_flag_bit, set_h_constraint, set_h_constraint, set_h_constraint, set_h, set_intrinsic_h, set_intrinsic_size, set_intrinsic_w, set_parent, set_part_a_constraint, set_part_a_constraint, set_part_a_constraint, set_part_a, set_part_b_constraint, set_part_b_constraint, set_part_b_constraint, set_part_b, set_pos, set_pos, set_raw_enabled, set_raw_h, set_raw_part_a, set_raw_part_b, set_raw_visible, set_raw_w, set_raw_x, set_raw_y, set_size, set_style_lock, set_user_info, set_visible_constraint, set_visible_constraint, set_visible_constraint, set_visible, set_w_constraint, set_w_constraint, set_w_constraint, set_w, set_x_constraint, set_x_constraint, set_x_constraint, set_x, set_y_constraint, set_y_constraint, set_y_constraint, set_y, setup_for_children, setup_for_children, setup_for_fixed_children, size, style_change_local, style_change, supports_children, tag_str, toString, traverse_and_collect_children, traverse_and_collect_parent, traverse_and_collect, trivial_reject, trivial_reject, user_data, user_info, value_ood, visible_constraint, visible, w_constraint, w, x_constraint, x_into_local, x_into_parent, x, y_constraint, y_into_local, y_into_parent, y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_now

protected static long _now
Counter for implementing virtual time

_objects

protected java.util.Vector _objects
Vector of whiteboard_obj objects currently in the whiteboard. Note, objects have recorded lifetimes, but are never actualy removed from this vector. All objects in this vector will be whiteboard_obj's.

MODE_PICK

public static final int MODE_PICK
Flag for pick/move mode

MODE_DEL

public static final int MODE_DEL
Flag for delete mode

MODE_CREATE

public static final int MODE_CREATE
Flag for create mode

_current_mode

protected int _current_mode
Current mode of the whiteboard. This should be one of the values: MODE_PICK, MODE_DEL, or MODE_CREATE.

_create_proto

protected whiteboard_obj _create_proto
The whiteboard_obj that we currently are cloning new objects from

_current_person

protected int _current_person
The current person id

_current_obj

protected whiteboard_obj _current_obj
The object currently being manipulated
Constructor Detail

historical_whiteboard

public historical_whiteboard(int x,
                             int y,
                             int w,
                             int h)
Full constructor.
Parameters:
int - x x position of the container.
int - y y position of the container.
int - w width of the container.
int - h height of the container.
Method Detail

now

public static long now()
Get the current virtual time

advance_time

public static void advance_time()
Advance virtual time

add_object

public void add_object(whiteboard_obj obj)

current_mode

public int current_mode()
Current mode of the whiteboard.
Returns:
int the flag for the current mode. This should be one of the values: MODE_PICK, MODE_DEL, or MODE_CREATE.

set_current_mode

public void set_current_mode(int new_md)
Set the current mode of the whiteboard.
Parameters:
int - new_md the new mode we enter. This should be one of the values: MODE_PICK, MODE_DEL, or MODE_CREATE.

create_proto

public whiteboard_obj create_proto()
The whiteboard_obj that we currently are cloning new objects from
Returns:
whiteboard_obj the current cloning prototype

set_create_proto

public void set_create_proto(whiteboard_obj proto)
Set the whiteboard_obj that we currently are cloning new objects from
Parameters:
whiteboard_obj - proto the new cloning prototype

current_person

public int current_person()
The current person id

set_current_person

public void set_current_person(int id)
Set the current person id

set_mode

public void set_mode(int mode_kind,
                     whiteboard_obj obj_to_create,
                     int cur_person)
Set the current mode of the whiteboard
Parameters:
int - mode_kind the mode we enter. This must be one of the values: MODE_PICK, MODE_DEL, or MODE_CREATE.
whiteboard_obj - obj_to_create for MODE_CREATE, this parameter gives a prototype object to clone new objects from (in other cases it is ignored).
int - cur_person id of the current person

draw_self_local

protected void draw_self_local(drawable d)
Draw the object's current appearance.
Parameters:
drawable - d the surface we draw on.
Overrides:
draw_self_local in class base_interactor

draw_self_local_at

public void draw_self_local_at(drawable d,
                               long at_time,
                               long selection,
                               boolean select_owner,
                               java.awt.Color[] map)
Draw the object's current appearance as it was at the given time (but don't draw child objects).
Parameters:
drawable - d the surface we draw on.
long - at_time the time (in ms since the epoch) to draw at)
long - selection selection set stored as bit set
boolean - select_owner select on owner (true) or modifier (false)
Color[] - map mapping from person id's to colors

pick_an_obj

protected whiteboard_obj pick_an_obj(event evt)
Do a pick over our internal objects

press

public boolean press(event evt,
                     java.lang.Object user_info)
Handle press input. This will do one of several things based on the current mode of the whiteboard. In pick/move mode, it will try to pick an object and start a drag of that object. In delete mode it will try to pick, then remove an object, and in create mode it will clone a new object from the current prototype, place it and potentially start a creation drag for it.
Specified by:
press in interface pressable
Parameters:
event - evt the event for the press.
Object - user_info the user information that was associated with the pick used to dispatch this input to this object.
Returns:
boolean indicating if the event was consumed.

release

public boolean release(event evt,
                       java.lang.Object user_info)
Companion to press() -- here this is ignored.
Specified by:
release in interface pressable
Parameters:
event - evt the event for the release.
Object - user_info the user information that was associated with the pick used to dispatch this input to this object.
Returns:
boolean indicating if the event was consumed.

drag_start

public boolean drag_start(event evt,
                          java.lang.Object user_info)
Dispatch the start event of a simple drag.
Specified by:
drag_start in interface simple_draggable
Parameters:
event - evt the event "causing" the start of the drag (normally a mouse button press).
Object - user_info the uninterpreted user info that was associated with this object when it became the drag focus.
Returns:
boolean indicating whether the input was consumed.

drag_feedback

public boolean drag_feedback(event evt,
                             java.lang.Object user_info)
Dispatch a movement event during a simple drag.
Specified by:
drag_feedback in interface simple_draggable
Parameters:
event - evt the event "causing" the the drag (normally a mouse move).
Object - user_info the uninterpreted user info that was associated with this object when it became the drag focus.
Returns:
boolean indicating whether the input was consumed.

drag_end

public boolean drag_end(event evt,
                        java.lang.Object user_info)
Dispatch event corresponding to the end of a simple drag.
Specified by:
drag_end in interface simple_draggable
Parameters:
event - evt the event "causing" the end of the drag (normally a mouse button release).
Object - user_info the uninterpreted user info that was associated with this object when it became the drag focus.
Returns:
boolean indicating whether the input was consumed.

drag_start

public boolean drag_start(event evt,
                          int x,
                          int y,
                          int grab_x,
                          int grab_y,
                          java.lang.Object user_info)
Dispatch the start of a drag to the object. Returns true if the drag is accepted (and hence the event consumed). The x,y values give the position of the start of drag in the parent's coordinate system as filtered by the move_drag_filter object established with the move_drag agent (if any). The event retains the original raw coordinate values. grab_x, grab_y indicate the offset of the drag start point from the origin of the object (this indicates the "grab point" within the object). The user_info object passed here will be the one that was given to the agent when focus was established.
Specified by:
drag_start in interface move_draggable
Parameters:
event - evt The event which "caused" the drag.
int - x x position where object should be placed at start of drag (in parent's coordinates).
int - y y position where object should be placed at start of drag (in parent's coordinates).
int - grab_x x position where drag started (in local coords).
int - grab_y y position where drag started (in local coords).
Object - user_info uninterpreted information provided when the object was made the move-drag focus.
Returns:
boolean indicating whether the input was consumed.

drag_feedback

public boolean drag_feedback(event evt,
                             int x,
                             int y,
                             int start_x,
                             int start_y,
                             int grab_x,
                             int grab_y,
                             java.lang.Object user_info)
Dispatch a movement during a drag. Returns true if the event should be considered to have been consumed. The x,y values give the current position of the of drag in the parent's coordinate system as filtered by the move_drag_filter object established with the move_drag agent (if any). start_x, start_y give the start position of the drag (again, filtered by the established move_drag_filter object, if any). The event retains the original raw coordinate values. grab_x, grab_y indicate the offset of the drag start point from the origin of the object at the start of dragging (this indicates the "grab point" within the object). The user_info object passed here will be the one that was given to the agent when focus was established.
Specified by:
drag_feedback in interface move_draggable
Parameters:
event - evt The event which "caused" the drag.
int - x x position where object should be placed at start of drag (in parent's coordinates).
int - y y position where object should be placed at start of drag (in parent's coordinates).
int - start_x x position where drag started (in parent's coords).
int - start_y y position where drag started (in parent's coords).
int - grab_x x position where drag started (in local coords).
int - grab_y y position where drag started (in local coords).
Object - user_info uninterpreted information provided when the object was made the move-drag focus.
Returns:
boolean indicating whether the input was consumed.

drag_end

public boolean drag_end(event evt,
                        int x,
                        int y,
                        int start_x,
                        int start_y,
                        int grab_x,
                        int grab_y,
                        java.lang.Object user_info)
Dispatch input corresponding to the end of a drag. Returns true if the even should be considered to have been consumed. The x,y values give the current position of the of drag in the parent's coordinate system as filtered by the move_drag_filter object established with the move_drag agent (if any). start_x, start_y give the start position of the drag (again, filtered by the established move_drag_filter object, if any). The event retains the original raw coordinate values. start_off_x, start_off_y indicate the offset of the drag start point from the origin of the object at the start of dragging (this indicates the "grab point" within the object). The user_info object passed here will be the one that was given to the agent when focus was established.
Specified by:
drag_end in interface move_draggable
Parameters:
event - evt The event which "caused" the drag.
int - x x position where object should be placed at start of drag (in parent's coordinates).
int - y y position where object should be placed at start of drag (in parent's coordinates).
int - start_x x position where drag started (in parent's coords).
int - start_y y position where drag started (in parent's coords).
int - grab_x x position where drag started (in local coords).
int - grab_y y position where drag started (in local coords).
Object - user_info uninterpreted information provided when the object was made the move-drag focus.
Returns:
boolean indicating whether the input was consumed.