sky.monome
Class SequencerPageSwitcher.SequencerPage

java.lang.Object
  extended by sky.monome.Component
      extended by sky.monome.Container
          extended by sky.monome.AbstractGroup<LedButtonCouple>
              extended by sky.monome.SequencerPageSwitcher.SequencerPage
All Implemented Interfaces:
SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>, LedStateModificationLayer
Enclosing class:
SequencerPageSwitcher

public class SequencerPageSwitcher.SequencerPage
extends AbstractGroup<LedButtonCouple>
implements SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>, LedStateModificationLayer

Page of sequencer. This class is a special implementation of the SequencerComponent interface based on the AbstractGroup<LedButtonCouple> class.


Field Summary
protected  SynchronizedList<SequencerRadio.SequencerRadioGroup> buttonManagers
          List of button managers that manage each step of the enclosing sequencer.
 
Fields inherited from class sky.monome.AbstractGroup
components
 
Fields inherited from class sky.monome.Container
height, width
 
Fields inherited from class sky.monome.Component
container, eventListenerList, lockObject, name, x, y
 
Constructor Summary
protected SequencerPageSwitcher.SequencerPage(java.lang.String name)
          Constructs a sequencer page with the specified name.
 
Method Summary
protected  void addLedButtonCouple(LedButtonCouple ledButtonCouple)
          Adds the specified led/button couple to the list of led/button couples.
 void addSequencerListener(SequencerListener<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup> sequencerListener)
          Adds the specified sequencer listener to the list of sequencer listeners.
 boolean canHaveParentContainer()
          Indicates whether this sequencer page can have a parent container in the Monome assembling tree.
 void fireStepChanged(SequencerPageSwitcher.SequencerPage sequencerPage, int activeStepNumber)
          Invoked when a step change occurs.
 int getAbsoluteX()
          Returns the absolute X-coordinate of this sequencer page.
 int getAbsoluteY()
          Returns the absolute Y-coordinate of this sequencer page.
 java.awt.Rectangle getBounds()
          Returns the bounds of this sequencer page in the local context of its container.
<T extends ButtonManager<?>>
T
getButtonManager(java.lang.Class<T> clazz, int number)
          Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManager(int) instead.
 SequencerRadio.SequencerRadioGroup getButtonManager(int number)
          Returns the button manager of this sequencer component at the specified step number.
 SequencerRadio.SequencerRadioGroup[] getButtonManagers()
          Returns an array of all button managers of this sequencer component.
<T extends ButtonManager<?>>
T[]
getButtonManagers(java.lang.Class<T> clazz)
          Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManagers() instead.
 LedButtonCouple.LedState getLedStateToShow(LedButtonCouple ledButtonCouple)
          Returns the led state to show instead of the natural led state of the specified led/button couple.
 Monome getMonome()
          Returns the logical Monome device that contains this sequencer page.
 SequencerListener<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>[] getSequencerListeners()
          Returns an array of all sequencer listeners.
 boolean isVisible()
          Indicates whether this sequencer page is actually visible.
 void removeSequencerListener(SequencerListener<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup> sequencerListener)
          Removes the specified sequencer listener from the list of sequencer listeners.
 java.lang.String toString()
          Returns a string representation of this sequencer page.
 
Methods inherited from class sky.monome.AbstractGroup
notify, writeOn
 
Methods inherited from class sky.monome.Container
getHeight, getWidth
 
Methods inherited from class sky.monome.Component
getContainer, getLockObject, getName, getX, getY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buttonManagers

protected SynchronizedList<SequencerRadio.SequencerRadioGroup> buttonManagers
List of button managers that manage each step of the enclosing sequencer.

Constructor Detail

SequencerPageSwitcher.SequencerPage

protected SequencerPageSwitcher.SequencerPage(java.lang.String name)
                                       throws MonomeException
Constructs a sequencer page with the specified name.

Parameters:
name - Name of this sequencer page.
Throws:
MonomeException - When a led state can't be initialized.
Method Detail

addLedButtonCouple

protected void addLedButtonCouple(LedButtonCouple ledButtonCouple)
                           throws MonomeException
Adds the specified led/button couple to the list of led/button couples.

Parameters:
ledButtonCouple - Led/button couple to add to the list of led/button couples.
Throws:
MonomeException - When a led/button couple has bounds already used by another led/button couple.

getMonome

public Monome getMonome()
Returns the logical Monome device that contains this sequencer page. The logical Monome device is always at the top of the Monome assembling tree.

Overrides:
getMonome in class AbstractGroup<LedButtonCouple>
Returns:
The logical Monome device that contains this sequencer page.

getAbsoluteX

public int getAbsoluteX()
Returns the absolute X-coordinate of this sequencer page.

Overrides:
getAbsoluteX in class AbstractGroup<LedButtonCouple>
Returns:
The absolute X-coordinate of this sequencer page.

getAbsoluteY

public int getAbsoluteY()
Returns the absolute Y-coordinate of this sequencer page.

Overrides:
getAbsoluteY in class AbstractGroup<LedButtonCouple>
Returns:
The absolute Y-coordinate of this sequencer page.

isVisible

public boolean isVisible()
Indicates whether this sequencer page is actually visible.

Overrides:
isVisible in class AbstractGroup<LedButtonCouple>
Returns:
true if this sequencer page is actually visible, false otherwise.

canHaveParentContainer

public boolean canHaveParentContainer()
Indicates whether this sequencer page can have a parent container in the Monome assembling tree.

Overrides:
canHaveParentContainer in class AbstractGroup<LedButtonCouple>
Returns:
Always false, since pages are contained only by page switchers.

toString

public java.lang.String toString()
Returns a string representation of this sequencer page.

Specified by:
toString in class Component
Returns:
A string representation of this sequencer page.

getBounds

public java.awt.Rectangle getBounds()
Returns the bounds of this sequencer page in the local context of its container.

Overrides:
getBounds in class AbstractGroup<LedButtonCouple>
Returns:
The bounds of this sequencer page in the local context of its container.

addSequencerListener

public void addSequencerListener(SequencerListener<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup> sequencerListener)
Adds the specified sequencer listener to the list of sequencer listeners.

Specified by:
addSequencerListener in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Parameters:
sequencerListener - Sequencer listener to add to the list of sequencer listeners.

removeSequencerListener

public void removeSequencerListener(SequencerListener<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup> sequencerListener)
Removes the specified sequencer listener from the list of sequencer listeners.

Specified by:
removeSequencerListener in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Parameters:
sequencerListener - Sequencer listener to remove from the list of sequencer listeners.

getSequencerListeners

public SequencerListener<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>[] getSequencerListeners()
Returns an array of all sequencer listeners.

Specified by:
getSequencerListeners in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Returns:
An array of all sequencer listeners.

fireStepChanged

public void fireStepChanged(SequencerPageSwitcher.SequencerPage sequencerPage,
                            int activeStepNumber)
Invoked when a step change occurs.

Specified by:
fireStepChanged in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Parameters:
sequencerPage - Sequencer page that triggered the sequencer event.

getButtonManagers

@Deprecated
public <T extends ButtonManager<?>> T[] getButtonManagers(java.lang.Class<T> clazz)
Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManagers() instead.

Returns an array of all button managers of this sequencer component. Returned button managers are typed to the specified type.

Specified by:
getButtonManagers in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Type Parameters:
T - Desired type for button managers. It should be a subclass of ButtonManager.
Parameters:
clazz - Class object that specify the return type for button managers.
Returns:
An array of all button managers of this sequencer component.
Throws:
java.lang.ClassCastException - When button managers can't be typed to the specified type.

getButtonManagers

public SequencerRadio.SequencerRadioGroup[] getButtonManagers()
Returns an array of all button managers of this sequencer component. Returned button managers are typed to the type defined by the parametrization of this class.

Specified by:
getButtonManagers in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Returns:
An array of all button managers of this sequencer component.
Since:
SkyMonome v1.1

getButtonManager

@Deprecated
public <T extends ButtonManager<?>> T getButtonManager(java.lang.Class<T> clazz,
                                                                  int number)
Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManager(int) instead.

Returns the button manager of this sequencer component at the specified step number. The returned button manager is typed to the specified type.

Specified by:
getButtonManager in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Type Parameters:
T - Desired type for the button manager. It should be a subclass of ButtonManager.
Parameters:
clazz - Class object that specify the return type for the button manager.
number - Number of the button manager needed.
Returns:
The button manager of this sequencer component at the specified step number.
Throws:
java.lang.ClassCastException - When the button manager can't be typed to the specified type.

getButtonManager

public SequencerRadio.SequencerRadioGroup getButtonManager(int number)
Returns the button manager of this sequencer component at the specified step number. The returned button manager is typed to the type defined by the parametrization of this class.

Specified by:
getButtonManager in interface SequencerComponent<SequencerPageSwitcher.SequencerPage,SequencerRadio.SequencerRadioGroup>
Parameters:
number - Number of the button manager needed.
Returns:
The button manager of this sequencer component at the specified step number.
Since:
SkyMonome v1.1

getLedStateToShow

public LedButtonCouple.LedState getLedStateToShow(LedButtonCouple ledButtonCouple)
Returns the led state to show instead of the natural led state of the specified led/button couple.

Specified by:
getLedStateToShow in interface LedStateModificationLayer
Parameters:
ledButtonCouple - led/button couple which is the reference.
Returns:
The led state to show instead of the natural led state of the specified led/button couple.