sky.monome.behavior
Class Pad.PadGroup.Lure


java.lang.Object

  extended by sky.monome.Component

      extended by sky.monome.LedButtonCouple

          extended by sky.monome.behavior.Pad.PadGroup.Lure

All Implemented Interfaces:
ButtonManager<LedButtonCouple>
Enclosing class:
Pad.PadGroup

protected class Pad.PadGroup.Lure
extends LedButtonCouple

Virtual led/button couple internally associated with the common behavior of the pad group.

Since:
SkyMonome v1.1
Author:
PJ Skyman

Nested Class Summary
 
Nested classes/interfaces inherited from class sky.monome.LedButtonCouple
LedButtonCouple.ButtonState, LedButtonCouple.LedState
 
Field Summary
 
Fields inherited from class sky.monome.LedButtonCouple
behavior, buttonState, ledState, ledStateModificationLayer
 
Fields inherited from class sky.monome.Component
container, eventListenerList, lockObject, name, x, y
 
Constructor Summary
protected Pad.PadGroup.Lure(Behavior behavior)
          Constructs a "lure" with the specified common behavior.
 
Method Summary
 void addButtonListener(ButtonListener<LedButtonCouple> buttonListener)
          Adds the specified listener to the listeners list of this button.
 boolean canHaveParentContainer()
          Indicates whether this led/button couple can have a parent container in the Monome assembling tree.
 void fireButtonActionned(LedButtonCouple buttonManager, ButtonEvent.ButtonAction buttonAction)
          Notifies all the listeners that a new button action occured.
 int getAbsoluteX()
          Returns the absolute X-coordinate of this led/button couple.
 int getAbsoluteY()
          Returns the absolute Y-coordinate of this led/button couple.
 java.awt.Rectangle getBounds()
          Returns the bounds of this led/button couple in the local context of its container.
 ButtonListener<LedButtonCouple>[] getButtonListeners()
          Returns an array of all listeners contained in the listeners list of this button.
 Container getContainer()
          Returns the container that contains this component.
 Monome getMonome()
          Returns the logical Monome device that contains this led/button couple.
 java.lang.String getName()
          Returns the name of this component.
 int getX()
          Returns the X-coordinate of this component in the local context of its container.
 int getY()
          Returns the Y-coordinate of this component in the local context of its container.
 void initLedState(boolean ledState)
          Initializes the state of this led.
 boolean isVisible()
          Indicates whether this led/button couple is actually visible.
 void notify(OSCMessageDigester messageDigester)
          Notifies this led/button couple that a message comes from the Monome device.
 void removeButtonListener(ButtonListener<LedButtonCouple> buttonListener)
          Removes the specified listener from the listeners list of this button.
protected  void setButtonState(LedButtonCouple.ButtonState buttonState)
          Modifies the state of this button.
 void setLedState(LedButtonCouple.LedState ledState, boolean mustRefresh)
          Modifies the state of this led.
 java.lang.String toString()
          Returns a string representation of this "lure".
 void writeOn(Frame frame)
          Writes this led on the specified frame in order to refresh the Monome device.
 
Methods inherited from class sky.monome.LedButtonCouple
doClick, getBehavior, getButtonState, getLedState
 
Methods inherited from class sky.monome.Component
getLockObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pad.PadGroup.Lure


protected Pad.PadGroup.Lure(Behavior behavior)

                     throws MonomeException
Constructs a "lure" with the specified common behavior.

Parameters:
behavior - Common behavior which will be associated to this "lure".
Throws:
MonomeException - When this "lure" can't be initialized.
Method Detail

addButtonListener


public void addButtonListener(ButtonListener<LedButtonCouple> buttonListener)
Adds the specified listener to the listeners list of this button. This method does nothing.

Specified by:
addButtonListener in interface ButtonManager<LedButtonCouple>
Overrides:
addButtonListener in class LedButtonCouple
Parameters:
buttonListener - Listener to add to the listeners list of this button.

canHaveParentContainer


public boolean canHaveParentContainer()
Indicates whether this led/button couple can have a parent container in the Monome assembling tree.

Overrides:
canHaveParentContainer in class LedButtonCouple
Returns:
Always false.

fireButtonActionned


public void fireButtonActionned(LedButtonCouple buttonManager,

                                ButtonEvent.ButtonAction buttonAction)
Notifies all the listeners that a new button action occured. This method does nothing.

Specified by:
fireButtonActionned in interface ButtonManager<LedButtonCouple>
Overrides:
fireButtonActionned in class LedButtonCouple
Parameters:
buttonManager - Button manager that triggered the button event.
buttonAction - Button action performed on the specified button manager.

getAbsoluteX


public int getAbsoluteX()
Returns the absolute X-coordinate of this led/button couple.

Overrides:
getAbsoluteX in class LedButtonCouple
Returns:
0.

getAbsoluteY


public int getAbsoluteY()
Returns the absolute Y-coordinate of this led/button couple.

Overrides:
getAbsoluteY in class LedButtonCouple
Returns:
0.

getBounds


public java.awt.Rectangle getBounds()
Returns the bounds of this led/button couple in the local context of its container.

Overrides:
getBounds in class LedButtonCouple
Returns:
A default rectangle with null dimensions and null coordinates.

getButtonListeners


public ButtonListener<LedButtonCouple>[] getButtonListeners()
Returns an array of all listeners contained in the listeners list of this button. The returned array is always empty.

Specified by:
getButtonListeners in interface ButtonManager<LedButtonCouple>
Overrides:
getButtonListeners in class LedButtonCouple
Returns:
An array of all listeners contained in the listeners list of this button.

getMonome


public Monome getMonome()
Returns the logical Monome device that contains this led/button couple. The logical Monome device is always at the top of the Monome assembling tree. Note that if the pad group that uses this "lure" has no associated pads, so null is returned.

Overrides:
getMonome in class LedButtonCouple
Returns:
The logical Monome device that contains this led/button couple, or null.

initLedState


public void initLedState(boolean ledState)
Initializes the state of this led. This method is exclusively made for use in behaviors.

Overrides:
initLedState in class LedButtonCouple
Parameters:
ledState - Initial state to give to this led.

isVisible


public boolean isVisible()
Indicates whether this led/button couple is actually visible.

Overrides:
isVisible in class LedButtonCouple
Returns:
Always true, since this object is a "lure" and needs to be always active/visible.

notify


public void notify(OSCMessageDigester messageDigester)

            throws MonomeException
Notifies this led/button couple that a message comes from the Monome device. This method does nothing since no Monome device can notify this "lure".

Overrides:
notify in class LedButtonCouple
Parameters:
messageDigester - Message digester that prepares and encapsulates the message for an easy access of informations contained in the message.
Throws:
MonomeException - When a problem has occured when treating the message. By example, a led/button couple can treat a message by lighting on the led, and lighting on a led is a potentially risked operation.

removeButtonListener


public void removeButtonListener(ButtonListener<LedButtonCouple> buttonListener)
Removes the specified listener from the listeners list of this button. This method does nothing.

Specified by:
removeButtonListener in interface ButtonManager<LedButtonCouple>
Overrides:
removeButtonListener in class LedButtonCouple
Parameters:
buttonListener - Listener to remove from the listeners list of this button.

setButtonState


protected void setButtonState(LedButtonCouple.ButtonState buttonState)
Modifies the state of this button.

Overrides:
setButtonState in class LedButtonCouple
Parameters:
buttonState - state New state of this button, among ButtonState.BUTTON_PUSHED and ButtonState.BUTTON_RELEASED.

setLedState


public void setLedState(LedButtonCouple.LedState ledState,

                        boolean mustRefresh)

                 throws MonomeException
Modifies the state of this led.

Overrides:
setLedState in class LedButtonCouple
Parameters:
ledState - New state to give to this led, among LedState.ON and LedState.OFF.
mustRefresh - true if the Monome device must be updated immediately, false otherwise. This parameter is not used.
Throws:
MonomeException - When a led state can't be modified.

toString


public java.lang.String toString()
Returns a string representation of this "lure".

Overrides:
toString in class LedButtonCouple
Returns:
A string representation of this "lure".

writeOn


public void writeOn(Frame frame)
Writes this led on the specified frame in order to refresh the Monome device. Once this frame is completed, it is sent to the Monome device. This method does nothing.

Overrides:
writeOn in class LedButtonCouple
Parameters:
frame - Frame in which this led must write its led state.
See Also:
Monome.refresh()

getContainer


public Container getContainer()
Returns the container that contains this component.

Overrides:
getContainer in class Component
Returns:
Always null.

getName


public java.lang.String getName()
Returns the name of this component.

Overrides:
getName in class Component
Returns:
Always an empty string.

getX


public int getX()
Returns the X-coordinate of this component in the local context of its container.

Overrides:
getX in class Component
Returns:
Always 0.

getY


public int getY()
Returns the Y-coordinate of this component in the local context of its container.

Overrides:
getY in class Component
Returns:
Always 0.