sky.monome.behavior
Class Member.Group<M extends Member<G>,G extends Member.Group<M,G>>


java.lang.Object

  extended by sky.monome.behavior.Member.Group<M,G>

Type Parameters:
M - Type of member behaviors that this group will contain.
G - Type of group that extends this abstract group.
All Implemented Interfaces:
ButtonManager<G>
Direct Known Subclasses:
AbstractRadio.AbstractRadioGroup, Pad.PadGroup
Enclosing class:
Member<G extends Member.Group<?,G>>

public abstract static class Member.Group<M extends Member<G>,G extends Member.Group<M,G>>
extends java.lang.Object
implements ButtonManager<G>

Group of members which is responsible for a common behavior between all associated members.

Since:
SkyMonome v1.1
Author:
PJ Skyman

Field Summary
protected  javax.swing.event.EventListenerList eventListenerList
          List of all listeners registered with this group.
protected  SynchronizedList<M> members
          List of all member behaviors associated with this group.
 
Constructor Summary
protected Member.Group()
          Constructs a group.
 
Method Summary
 void addButtonListener(ButtonListener<G> buttonListener)
          Adds the specified button listener to the list of button listeners.
protected abstract  void addMember(M member)
          Adds the specified member behavior to the list of associated member behaviors.
 void fireButtonActionned(G buttonManager, ButtonEvent.ButtonAction buttonAction)
          Invoked when a button action occurs.
 ButtonListener<G>[] getButtonListeners()
          Returns an array of all button listeners.
 int getMembersNumber()
          Returns the number of associated member behaviors.
protected abstract  void notify(M member, ButtonEvent.ButtonAction buttonAction)
          Notifies that the specified member behavior is itself notified (the led/button couple notified its behavior).
 void removeButtonListener(ButtonListener<G> buttonListener)
          Removes the specified button listener from the list of button listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventListenerList


protected final javax.swing.event.EventListenerList eventListenerList
List of all listeners registered with this group.


members


protected final SynchronizedList<M extends Member<G>> members
List of all member behaviors associated with this group.

Constructor Detail

Member.Group


protected Member.Group()
Constructs a group.

Method Detail

addMember


protected abstract void addMember(M member)

                           throws MonomeException
Adds the specified member behavior to the list of associated member behaviors.

Parameters:
member - Member behavior to add to the list of associated member behaviors.
Throws:
MonomeException - In special cases, when a led state can't be initialized.

getMembersNumber


public int getMembersNumber()
Returns the number of associated member behaviors.

Returns:
The number of associated member behaviors.

notify


protected abstract void notify(M member,

                               ButtonEvent.ButtonAction buttonAction)

                        throws MonomeException
Notifies that the specified member behavior is itself notified (the led/button couple notified its behavior).

Parameters:
member - Member behavior that notifies this group.
buttonAction - Button action associated to this notification.
Throws:
MonomeException - When a led state can't be modified.

addButtonListener


public void addButtonListener(ButtonListener<G> buttonListener)
Adds the specified button listener to the list of button listeners.

Specified by:
addButtonListener in interface ButtonManager<G extends Member.Group<M,G>>
Parameters:
buttonListener - Button listener to add to the list of button listeners.

removeButtonListener


public void removeButtonListener(ButtonListener<G> buttonListener)
Removes the specified button listener from the list of button listeners.

Specified by:
removeButtonListener in interface ButtonManager<G extends Member.Group<M,G>>
Parameters:
buttonListener - Button listener to remove from the list of button listeners.

getButtonListeners


public ButtonListener<G>[] getButtonListeners()
Returns an array of all button listeners.

Specified by:
getButtonListeners in interface ButtonManager<G extends Member.Group<M,G>>
Returns:
An array of all button listeners.

fireButtonActionned


public void fireButtonActionned(G buttonManager,

                                ButtonEvent.ButtonAction buttonAction)
Invoked when a button action occurs.

Specified by:
fireButtonActionned in interface ButtonManager<G extends Member.Group<M,G>>
Parameters:
buttonManager - Button manager that triggered the button event.
buttonAction - Button action that is performed.