sky.monome.behavior
Interface Behavior

All Known Implementing Classes:
AbstractRadio, BlinkingLight, BlinkingLightOnPush, DynamicBehavior, FrameGroup.PassiveBehavior, LightOnPush, Member, OptionalRadio, Pad, PassiveBehavior, Radio, SequencerRadio, StaticBehavior, Toggle

public interface Behavior

Led behavior. Typically, led behaviors can produce lighting effects like blinking, or more simply can automatize led states when buttons are pressed. Other behaviors can be also integrated in groups of behaviors, in order to do exclusive actions between these behaviors. More generally, a behavior avoids the use of button listeners by controlling directly and more simply led states. A led/button couple is registered with only one behavior, and a behavior is associated with only one led/button couple.

Author:
PJ Skyman

Method Summary
 LedButtonCouple getLedButtonCouple()
          Returns the led/button couple registered with this behavior.
 void init()
          Initializes this behavior and the registered led/button couple.
 void notify(ButtonEvent.ButtonAction buttonAction)
          Notifies this behavior that an action on the button is performed.
 void setLedButtonCouple(LedButtonCouple ledButtonCouple)
          Modifies the led/button couple registered with this behavior.
 

Method Detail

getLedButtonCouple


LedButtonCouple getLedButtonCouple()
Returns the led/button couple registered with this behavior.

Returns:
The led/button couple registered with this behavior.

setLedButtonCouple


void setLedButtonCouple(LedButtonCouple ledButtonCouple)

                        throws MonomeException
Modifies the led/button couple registered with this behavior. Note that the behavior can be registered with only one led/button couple in its whole life. If you attempt to register a second led/button couple, so a MonomeException is raised.

Parameters:
ledButtonCouple - New led/button couple to register with this behavior.
Throws:
MonomeException - When this behavior is already registered with a led/button couple when this method is called.

notify


void notify(ButtonEvent.ButtonAction buttonAction)

            throws MonomeException
Notifies this behavior that an action on the button is performed.

Parameters:
buttonAction - Button action that is performed.
Throws:
MonomeException - Only with a few behaviors, when a led state can't be modified, by example.

init


void init()

          throws MonomeException
Initializes this behavior and the registered led/button couple. By example, if the behavior forces the registered led to light on at the program launching, so it will be done in this method. Only led/button couples should call this method, and should call it only one time.

Throws:
MonomeException - When the initialization of this behavior and the registered led/button couple was not possible.