com.miginfocom.ashape.interaction
Class TimerInteractor

java.lang.Object
  extended by com.miginfocom.ashape.interaction.AbstractInteractor
      extended by com.miginfocom.ashape.interaction.TimerInteractor
All Implemented Interfaces:
Interactor, PropertyProvider, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener

public class TimerInteractor
extends AbstractInteractor

An interactor that support delays of one or more commands. The commands will NOT be executed in the Swing event thread.


Field Summary
protected  InteractionBroker broker
          The broker to interact with.
static PropertyKey ON_TIME
          A trigger on a specific delay.
static PropertyKey PROP_INITIAL_DELAY
          Delay in milliseconds until the interaction fires.
static PropertyKey PROP_REPEAT_COUNT
          Number of repetitions.
static PropertyKey PROP_REPEAT_MILLIS
          Milliseconds between repetitions.
 
Fields inherited from class com.miginfocom.ashape.interaction.AbstractInteractor
TRIGGER_ONCE
 
Fields inherited from interface com.miginfocom.ashape.interaction.Interactor
TEMPLATE_CHAR
 
Constructor Summary
TimerInteractor(InteractionBroker broker, java.util.Collection interactions)
          Constructor
 
Method Summary
 void addInteraction(Interaction inter)
          Adds an interaction.
 java.lang.Object getInteracted()
          Returns the object that this interactor is currently interacting with.
 InteractionBroker getInteractionBroker()
          Returns the interaction broker for this interactor.
protected  void installInteraction(Interaction inter)
          Sets up the timer.
 
Methods inherited from class com.miginfocom.ashape.interaction.AbstractInteractor
addInteractions, addOverride, addOverrideListener, addOverrideListener, containsProperty, fireOverrideChanged, getInteractions, getOverride, getOverrideById, getProperty, isOverridden, keyEventPost, keyEventPre, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseEventPost, mouseEventPre, mouseExited, mouseMoved, mousePressed, mouseReleased, processEvent, removeInteraction, removeOverride, removeOverrideById, removeOverrideListener, setInteractions, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ON_TIME

public static final PropertyKey ON_TIME
A trigger on a specific delay. Only Interactions with the trigger ON_TIME will be handled.
Set the expresstion in the interaction i a PropertyExpression. The property PROP_INITIAL_DELAY should be an Integer and that number of milliseconds will be the delay. If not set or set to null the delay will be 0.
PROP_REPEAT_MILLIS and PROP_REPEAT_COUNT can be set to an Integer to specify repetition delay and invocation count.


PROP_INITIAL_DELAY

public static final PropertyKey PROP_INITIAL_DELAY
Delay in milliseconds until the interaction fires. key in the PropertyExpression. Value should be an Integer with the delay in milliseconds.


PROP_REPEAT_MILLIS

public static final PropertyKey PROP_REPEAT_MILLIS
Milliseconds between repetitions. (Integer) May be null.


PROP_REPEAT_COUNT

public static final PropertyKey PROP_REPEAT_COUNT
Number of repetitions. (Integer) May be null.


broker

protected final InteractionBroker broker
The broker to interact with.

Constructor Detail

TimerInteractor

public TimerInteractor(InteractionBroker broker,
                       java.util.Collection interactions)
Constructor

Parameters:
broker - The AbstractInteractionBroker to send commands to
interactions - The interactions to start with.
Method Detail

getInteractionBroker

public InteractionBroker getInteractionBroker()
Description copied from interface: Interactor
Returns the interaction broker for this interactor. The broker is normally responsible for effectuating DefaultCommands.

Returns:
The interaction broker for this interactor. May be null if there is not broker.

getInteracted

public java.lang.Object getInteracted()
Description copied from interface: Interactor
Returns the object that this interactor is currently interacting with.

Returns:
The object that this interactor is currently interacting with. May be null.

addInteraction

public void addInteraction(Interaction inter)
Description copied from interface: Interactor
Adds an interaction. No checking if the interaction already exists. Override to catch changes in the interaction list or to only add interactions that are of interest to the implementing class.

Specified by:
addInteraction in interface Interactor
Overrides:
addInteraction in class AbstractInteractor
Parameters:
inter - The interaction to add-

installInteraction

protected void installInteraction(Interaction inter)
Sets up the timer.

Parameters:
inter - The interaction to set up a timer for. Not null.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.