com.miginfocom.calendar.grid
Class GridRowInteractor

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

public class GridRowInteractor
extends AbstractInteractor
implements java.beans.PropertyChangeListener, PropertyProvider

An Interactor that can listen to property and state changes in an Activity.


Field Summary
protected  InteractionBroker broker
          The broker to interact with.
protected  GridRow gridRow
          The GridRow to monitor.
static PropertyKey PROPERTY
          A trigger to interact with the grid row properties.
 
Fields inherited from class com.miginfocom.ashape.interaction.AbstractInteractor
TRIGGER_ONCE
 
Fields inherited from interface com.miginfocom.ashape.interaction.Interactor
TEMPLATE_CHAR
 
Constructor Summary
GridRowInteractor(GridRow gridRow, InteractionBroker broker, java.util.Collection interactions)
          Constructor
 
Method Summary
 void addInteraction(Interaction inter)
          Adds an interaction.
protected  void checkInteractions()
          Checks all interations and see if they are valid and if so, execute broker.handleCommand().
 boolean containsProperty(PropertyKey property)
          Empty implementation that always return false.
 GridRow getGridRow()
          Returns the contained GridRow
 java.lang.Object getInteracted()
          Returns the object that this interactor is currently interacting with.
 InteractionBroker getInteractionBroker()
          Returns the interaction broker for this interactor.
 java.lang.Object getOverride(java.lang.String name, PropertyKey property, java.lang.Object def)
          Handles the overrider as specified in Interactor.getOverride(String, PropertyKey, Object).
 java.lang.Object getProperty(PropertyKey propName)
          Empty implementation.
 void propertyChange(java.beans.PropertyChangeEvent e)
           
static OverrideFilter removeStaticOverride(java.lang.String name, PropertyKey property)
          Removes the static override filter.
static OverrideFilter setStaticOverride(java.lang.String name, PropertyKey property, OverrideFilter filter)
          Adds a static override filter that will be asked to return a possibly new or derived object for the name/PropName combination.
 
Methods inherited from class com.miginfocom.ashape.interaction.AbstractInteractor
addInteractions, addOverride, addOverrideListener, addOverrideListener, fireOverrideChanged, getInteractions, getOverrideById, 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

PROPERTY

public static final PropertyKey PROPERTY
A trigger to interact with the grid row properties.


gridRow

protected final GridRow gridRow
The GridRow to monitor.


broker

protected final InteractionBroker broker
The broker to interact with.

Constructor Detail

GridRowInteractor

public GridRowInteractor(GridRow gridRow,
                         InteractionBroker broker,
                         java.util.Collection interactions)
Constructor

Parameters:
gridRow - The grid row to monitor. Will be return as the "interacted". Not null.
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.

Specified by:
getInteractionBroker in interface Interactor
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.

Specified by:
getInteracted in interface Interactor
Returns:
The object that this interactor is currently interacting with. May be null.

getOverride

public java.lang.Object getOverride(java.lang.String name,
                                    PropertyKey property,
                                    java.lang.Object def)
Description copied from class: AbstractInteractor
Handles the overrider as specified in Interactor.getOverride(String, PropertyKey, Object). If propName is surounded with Interactor.TEMPLATE_CHAR characters (e.g. "$summary$") and the object returned from Interactor.getInteracted() is instance of PropertyProvider the returned override will be the property returned from the interacted.

If the object to be returned (i.e. is stored as an override) is a OverrideFilter that filter will be asked to return the object instead and it is given the "interacted" object as the "subject". See Interactor.getInteracted()

Specified by:
getOverride in interface Interactor
Overrides:
getOverride in class AbstractInteractor
Parameters:
name - The target name. May for instance be the name of a sub shape in an AShape.
property - The name of the property. May for instance be a property name of an AShape. E.g. AShape.A_FONT
def - The default object returned if no override
Returns:
The object to replace another object or def if there are none.

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-

checkInteractions

protected void checkInteractions()
Checks all interations and see if they are valid and if so, execute broker.handleCommand().


propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

getProperty

public java.lang.Object getProperty(PropertyKey propName)
Description copied from class: AbstractInteractor
Empty implementation. Override to to provide a property for a propertyName .

Specified by:
getProperty in interface PropertyProvider
Overrides:
getProperty in class AbstractInteractor
Parameters:
propName - The property.
Returns:
The value, may be null.

containsProperty

public boolean containsProperty(PropertyKey property)
Description copied from class: AbstractInteractor
Empty implementation that always return false. Override to to provide meaningful return value.

Specified by:
containsProperty in interface PropertyProvider
Overrides:
containsProperty in class AbstractInteractor
Parameters:
property - The property.
Returns:
If the provider contains the property.

getGridRow

public GridRow getGridRow()
Returns the contained GridRow

Returns:
The contained GridRow

setStaticOverride

public static OverrideFilter setStaticOverride(java.lang.String name,
                                               PropertyKey property,
                                               OverrideFilter filter)
Adds a static override filter that will be asked to return a possibly new or derived object for the name/PropName combination. The filter will always be fed a GridRow as subject.

If there are another filter for the name/propName combination it will be replaced

Parameters:
name - The name. Normally a name of a subshape in a RootAShape. E.g. "backgroundShape"
property - The name of the property. Normally a property name of an AShape. E.g. AShape.A_PAINT
Returns:
The old OverrideFilter or null if none.

removeStaticOverride

public static OverrideFilter removeStaticOverride(java.lang.String name,
                                                  PropertyKey property)
Removes the static override filter.

Parameters:
name - The name. Normally a name of a subshape in a RootAShape. E.g. "backgroundShape"
property - The name of the property. Normally a property name of an AShape. E.g. AShape.A_PAINT
Returns:
The old OverrideFilter or null if none.
See Also:
setStaticOverride(String, PropertyKey, com.miginfocom.ashape.interaction.OverrideFilter)


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.