sub_arctic.new_lib
Class text_wb_obj

java.lang.Object
  |
  +--sub_arctic.new_lib.whiteboard_obj
        |
        +--sub_arctic.new_lib.text_wb_obj

public class text_wb_obj
extends whiteboard_obj

This class provides the implementation for a text object displayed on a historical_whiteboard object.


Field Summary
protected  java.lang.String _text
          Text value to be displayed
static int close
          Distance that is close enough to the edge to be a pick
protected static java.awt.Font draw_font
           
protected static java.awt.FontMetrics draw_metrics
           
protected static int font_h
           
protected  int x_off
          x offset of grab point during move-drag
protected  int y_off
          y offset of grab point during move-drag
 
Fields inherited from class sub_arctic.new_lib.whiteboard_obj
_end_time, _h, _mod_id, _owner_id, _start_time, _state_history, _w, _x, _y
 
Constructor Summary
text_wb_obj(int xv, int yv, int wv, int hv, int own_id, java.lang.String txt)
          Full constructor.
 
Method Summary
 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(drawable d)
          Draw the object as it appears at present.
 void draw_self(drawable d, long at_time, boolean sel_by_own, java.awt.Color[] map)
          Draw the object as it would appear at the given time.
 whiteboard_obj interactive_make(event evt, historical_whiteboard wb)
          Begin to make a new object like this one interactively.
 boolean pick(int xpt, int ypt)
          Indicate whether the given point should pick this object
protected  void resize_by_text()
          Resize the object based on the current text
 void set_text(java.lang.String txt)
          Set the text value to be displayed
protected  wb_obj_state snapshot()
          Build a record of the object's current state
 java.lang.String text()
          Text value to be displayed
 boolean was_alive(long at_time)
          Indicate whether the given object would have been alive at the given time.
 
Methods inherited from class sub_arctic.new_lib.whiteboard_obj
end_time, h, make_state_record, mod_id, owner_id, set_end_time, set_h, set_mod_id, set_owner_id, set_w, set_x, set_y, start_time, state_at, update_current_state, w, x, y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_text

protected java.lang.String _text
Text value to be displayed

draw_font

protected static java.awt.Font draw_font

draw_metrics

protected static java.awt.FontMetrics draw_metrics

font_h

protected static int font_h

close

public static final int close
Distance that is close enough to the edge to be a pick

x_off

protected int x_off
x offset of grab point during move-drag

y_off

protected int y_off
y offset of grab point during move-drag
Constructor Detail

text_wb_obj

public text_wb_obj(int xv,
                   int yv,
                   int wv,
                   int hv,
                   int own_id,
                   java.lang.String txt)
Full constructor.
Parameters:
int - xv x position of this object
int - yv y position of this object
int - wv w position of this object
int - hv h position of this object
int - own_id id value for owner of this object
Method Detail

text

public java.lang.String text()
Text value to be displayed

set_text

public void set_text(java.lang.String txt)
Set the text value to be displayed

resize_by_text

protected void resize_by_text()
Resize the object based on the current text

snapshot

protected wb_obj_state snapshot()
Build a record of the object's current state
Overrides:
snapshot in class whiteboard_obj

pick

public boolean pick(int xpt,
                    int ypt)
Indicate whether the given point should pick this object
Parameters:
int - xpt x coordinate of query point
int - ypt y coordinate of query point
Returns:
boolean whether that point is considered to pick this object
Overrides:
pick in class whiteboard_obj

was_alive

public boolean was_alive(long at_time)
Indicate whether the given object would have been alive at the given time.
Parameters:
long - at_time the time in question
Returns:
boolean the status of the object at that time.
Overrides:
was_alive in class whiteboard_obj

draw_self

public void draw_self(drawable d,
                      long at_time,
                      boolean sel_by_own,
                      java.awt.Color[] map)
Draw the object as it would appear at the given time.
Overrides:
draw_self in class whiteboard_obj

draw_self

public void draw_self(drawable d)
Draw the object as it appears at present.
Overrides:
draw_self in class whiteboard_obj

interactive_make

public whiteboard_obj interactive_make(event evt,
                                       historical_whiteboard wb)
Begin to make a new object like this one interactively. Interaction will have started with the given event (which will be mouse button press) and will be occuring within the given whiteboard object. This routine will fill in some state from this object and some from the event. It will then make the owning whiteboard the simple_drag focus in order to start a drag of itself to complete the initial creation of the object. The whiteboard will forward calls to the drag_start(), drag_feedback() and drag_end() routines to the returned object.
Overrides:
interactive_make in class whiteboard_obj

drag_start

public boolean drag_start(event evt,
                          java.lang.Object user_info)
Dispatch the start event of a simple drag.
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.
Overrides:
drag_start in class whiteboard_obj

drag_feedback

public boolean drag_feedback(event evt,
                             java.lang.Object user_info)
Dispatch a movement event during a simple drag.
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.
Overrides:
drag_feedback in class whiteboard_obj

drag_end

public boolean drag_end(event evt,
                        java.lang.Object user_info)
Dispatch event corresponding to the end of a simple drag.
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.
Overrides:
drag_end in class whiteboard_obj

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.
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.
Overrides:
drag_start in class whiteboard_obj

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.
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.
Overrides:
drag_feedback in class whiteboard_obj

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.
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.
Overrides:
drag_end in class whiteboard_obj