sub_arctic.input
Class point_agent_class

java.lang.Object
  |
  +--sub_arctic.input.dispatch_agent
        |
        +--sub_arctic.input.point_agent_class

public class point_agent_class
extends dispatch_agent
implements timer

This is the agent that handles the pointable interface as well as the display_help interface. It is an agent under the positional policy, but must dispatch events in some cases in which there might be no objects picked by the event. We use the dispatch_unused_event() method on dispatch_agent to get that to work. Further, we use the manager's "after_dispatch" list to get notified when other agents dispatch events.


Field Summary
protected  pointable _point_focus
          This is where we keep the object we are currently pointing at (or null to signify the that we aren't pointing at anything).
protected  long _stable_time
          This holds the number of milliseconds the user must be quiescent with the mouse to get a display help box.
protected  java.lang.reflect.Method help_close
          The method object representing help_close.
protected  boolean help_displayed
          This variable becomes true if we have a help message displayed right now.
protected  java.lang.reflect.Method help_open
          The method object representing help_open.
protected  int highest_event
          Highest event ID seen
protected  boolean in_list
          This variable tells us if we are yet on the managers list of interested agents for the "after_dispatch" notification.
protected  java.lang.reflect.Method mouse_enter
          The method object representing mouse_enter
protected  java.lang.reflect.Method mouse_exit
          The method object representing mouse_exit
protected  transition trans
           
protected  java.lang.Object user_info_cache
          We cache a copy of the user info whenever we find an object that speaks one of our protocols and it gets picked successfully.
 
Constructor Summary
point_agent_class()
          Construct a point_agent.
 
Method Summary
 void after_dispatch_notify(event evt, boolean dispatched)
          This method is called by the manager after an event is dispatched.
 boolean dispatch_event(event evt, java.lang.Object user_info, interactor to_obj, int seq_num)
          This is the method that does most of the work for dispatching these events.
 boolean dispatch_unused_event(event evt)
          We override dispatch_unused_event so we can tell the object that the mouse left the area even if the mouse is now not over any of our sub_arctic interactors.
 boolean event_is_useful(event evt)
          We are only interested for normal dispatching purposes in move events.
protected  boolean is_mouse_event(event e)
          This is a convenience method for checking if an event is any of the mouse events.
 void mouse_event_same_object(event evt)
          This gets called when we get a mouse event, but it is over the same object we were over before.
 pointable point_focus()
          Return the current point focus.
protected  void reschedule_transition()
          This is called to get a new scheduled transition.
 void set_point_focus(pointable i, event evt)
          Set the point focus.
 void set_stable_time(long stable)
          Set the length of time the user must be stable before a display help display is generated.
 long stable_time()
          Query the amount of time that the mouse must be stable to get a display help box.
 void time_expired(event evt)
          This is called to tell us that the timer we previous scheduled has expired.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

help_open

protected java.lang.reflect.Method help_open
The method object representing help_open.

help_close

protected java.lang.reflect.Method help_close
The method object representing help_close.

mouse_enter

protected java.lang.reflect.Method mouse_enter
The method object representing mouse_enter

mouse_exit

protected java.lang.reflect.Method mouse_exit
The method object representing mouse_exit

user_info_cache

protected java.lang.Object user_info_cache
We cache a copy of the user info whenever we find an object that speaks one of our protocols and it gets picked successfully. We do this so we can hand it back this user info object later when it is not being picked.

trans

protected transition trans

help_displayed

protected boolean help_displayed
This variable becomes true if we have a help message displayed right now.

_stable_time

protected long _stable_time
This holds the number of milliseconds the user must be quiescent with the mouse to get a display help box. It defaults to 1/2 second (500 millis).

in_list

protected boolean in_list
This variable tells us if we are yet on the managers list of interested agents for the "after_dispatch" notification.

highest_event

protected int highest_event
Highest event ID seen

_point_focus

protected pointable _point_focus
This is where we keep the object we are currently pointing at (or null to signify the that we aren't pointing at anything).
Constructor Detail

point_agent_class

public point_agent_class()
Construct a point_agent. User's should not have to do this, it should be done by toolkit initialization.
Method Detail

stable_time

public long stable_time()
Query the amount of time that the mouse must be stable to get a display help box.
Returns:
long the amount of stable time required to get a help display (in milliseconds)

set_stable_time

public void set_stable_time(long stable)
Set the length of time the user must be stable before a display help display is generated.
Parameters:
long - stable the length of time in milliseconds

point_focus

public pointable point_focus()
Return the current point focus.
Returns:
interactor the interactor we are currently pointing at (well, pointing at and which implements the pointable interface).

set_point_focus

public void set_point_focus(pointable i,
                            event evt)
Set the point focus. Pass null to indicate that there is no object currently in the focus.
Parameters:
pointable - i the new point focus
event - evt the event that caused this change in focus

event_is_useful

public boolean event_is_useful(event evt)
We are only interested for normal dispatching purposes in move events. We get a hold of the other types of mouse events via the manager's "after_dispatch" list and that is how we handle generating a mouse_exit() call.
Parameters:
event - evt the event to check to see if we care about it
Returns:
boolean return true if its an event we care about
Overrides:
event_is_useful in class dispatch_agent

dispatch_unused_event

public boolean dispatch_unused_event(event evt)
We override dispatch_unused_event so we can tell the object that the mouse left the area even if the mouse is now not over any of our sub_arctic interactors.
Parameters:
event - evt the event to dispatch
Returns:
boolean return true if we dispatched the event
Overrides:
dispatch_unused_event in class dispatch_agent

dispatch_event

public boolean dispatch_event(event evt,
                              java.lang.Object user_info,
                              interactor to_obj,
                              int seq_num)
This is the method that does most of the work for dispatching these events. It determines if the object in question is pointable and if it is sends it the right messages on in and out.
Parameters:
event - evt the event to dispatch
Object - user_info policy defined user information
interactor - to_obj the object to (possibly)send the event to
int - seq_num the sequence number of this event
Overrides:
dispatch_event in class dispatch_agent

after_dispatch_notify

public void after_dispatch_notify(event evt,
                                  boolean dispatched)
This method is called by the manager after an event is dispatched. This agent uses this to become informed of events which were handled by other agents so it can tell clients of its interface that the mouse may have left their area.
Parameters:
event - evt the event which was dispatched (or not)
boolean - dispatched true if the event was handled by some agent
Overrides:
after_dispatch_notify in class dispatch_agent

is_mouse_event

protected boolean is_mouse_event(event e)
This is a convenience method for checking if an event is any of the mouse events.
Parameters:
event - e the event to be tested
Returns:
boolean true if the event is a mouse event

time_expired

public void time_expired(event evt)
This is called to tell us that the timer we previous scheduled has expired.
Specified by:
time_expired in interface timer
Parameters:
event - e the event that caused this timer to expire

reschedule_transition

protected void reschedule_transition()
This is called to get a new scheduled transition. The user has moved or clicked, so we need to wait a few more seconds.

mouse_event_same_object

public void mouse_event_same_object(event evt)
This gets called when we get a mouse event, but it is over the same object we were over before.
Parameters:
event - evt the that caused this processing