sky.monome.behavior
Class Pad.PadGroup

java.lang.Object
  extended by sky.monome.behavior.Member.Group<Pad,Pad.PadGroup>
      extended by sky.monome.behavior.Pad.PadGroup
All Implemented Interfaces:
ButtonManager<Pad.PadGroup>
Enclosing class:
Pad

public static class Pad.PadGroup
extends Member.Group<Pad,Pad.PadGroup>

Group of pads which is responsible for the synchronization between all associated pads.

Since:
SkyMonome v1.1
Author:
PJ Skyman

Nested Class Summary
protected  class Pad.PadGroup.Lure
          Virtual led/button couple internally associated with the common behavior of the pad group.
 
Field Summary
protected  Behavior behavior
          Common behavior of this group.
protected  Pad.PadGroup.Lure lure
          Virtual led/button couple that is registered to the common behavior of this group.
 
Fields inherited from class sky.monome.behavior.Member.Group
eventListenerList, members
 
Constructor Summary
Pad.PadGroup()
          Constructs a pad group.
Pad.PadGroup(Behavior behavior)
          Constructs a pad group with the specified behavior.
Pad.PadGroup(BehaviorFactory behaviorFactory)
          Constructs a pad group with the specified behavior factory.
 
Method Summary
protected  void addMember(Pad member)
          Adds the specified member behavior to the list of associated member behaviors.
protected  Behavior getBehavior()
          Returns the common behavior that is internally used for the synchronization of all associated pads.
protected  void notify(Pad member, ButtonEvent.ButtonAction buttonAction)
          Notifies that the specified pad behavior is itself notified (the led/button couple had notified its pad behavior).
protected  void setLedStates(LedButtonCouple.LedState ledState)
          Sets the led states of all associated pads.
 
Methods inherited from class sky.monome.behavior.Member.Group
addButtonListener, fireButtonActionned, getButtonListeners, getMembersNumber, removeButtonListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

behavior

protected final Behavior behavior
Common behavior of this group. This behavior is used for the synchronization of all associated pads.


lure

protected final Pad.PadGroup.Lure lure
Virtual led/button couple that is registered to the common behavior of this group. This "lure" is used to propagate its led state changes to all pads simultaneously.

Constructor Detail

Pad.PadGroup

public Pad.PadGroup()
             throws MonomeException
Constructs a pad group. A default LightOnPush common behavior is internally used.

Throws:
MonomeException - When a led state can't be initialized.

Pad.PadGroup

public Pad.PadGroup(BehaviorFactory behaviorFactory)
             throws MonomeException
Constructs a pad group with the specified behavior factory.

Parameters:
behaviorFactory - Behavior factory that will create a common behavior for internal use.
Throws:
MonomeException - When a led state can't be initialized, or when the behavior factory can't build a behavior for this pad group.

Pad.PadGroup

public Pad.PadGroup(Behavior behavior)
             throws MonomeException
Constructs a pad group with the specified behavior.

Parameters:
behavior - Common behavior for internal use.
Throws:
MonomeException - When a led state can't be initialized.
Method Detail

getBehavior

protected Behavior getBehavior()
Returns the common behavior that is internally used for the synchronization of all associated pads.

Returns:
The common behavior that is internally used for the synchronization of all associated pads.

setLedStates

protected void setLedStates(LedButtonCouple.LedState ledState)
                     throws MonomeException
Sets the led states of all associated pads.

Parameters:
ledState - New led state to give to all associated pads.
Throws:
MonomeException - When a led state can't be modified, or when the Monome device can't be refreshed.

addMember

protected void addMember(Pad member)
Adds the specified member behavior to the list of associated member behaviors.

Specified by:
addMember in class Member.Group<Pad,Pad.PadGroup>
Parameters:
member - Member behavior to add to the list of associated member behaviors.

notify

protected void notify(Pad member,
                      ButtonEvent.ButtonAction buttonAction)
               throws MonomeException
Notifies that the specified pad behavior is itself notified (the led/button couple had notified its pad behavior).

Specified by:
notify in class Member.Group<Pad,Pad.PadGroup>
Parameters:
member - Pad behavior that notifies this pad group.
buttonAction - Button action associated to this notification.
Throws:
MonomeException - When a led state can't be modified.