sky.monome
Class Component


java.lang.Object

  extended by sky.monome.Component

Direct Known Subclasses:
Analog, Container, LedButtonCouple

public abstract class Component
extends java.lang.Object

Monome component. This class is the base of all components on a Monome device.

Author:
PJ Skyman

Field Summary
protected  Container container
          Container which contains this component.
protected  javax.swing.event.EventListenerList eventListenerList
          List of all listeners registered with this component.
protected  java.lang.Object lockObject
          Lock object needed for exclusive operations.
protected  java.lang.String name
          Name of this component.
protected  int x
          X-coordinate of this component.
protected  int y
          Y-coordinate of this component.
 
Constructor Summary
Component(java.lang.String name, Container container, int x, int y)
          Deprecated. Since SkyMonome v1.2, all components register themselves inside their container, so you don't need to specify the container by calling this constructor.
Component(java.lang.String name, int x, int y)
          Constructs a component with the specified name and specified coordinates.
 
Method Summary
abstract  boolean canHaveParentContainer()
          Indicates whether this component can have a parent container in the Monome assembling tree.
abstract  int getAbsoluteX()
          Returns the absolute X-coordinate of this component.
abstract  int getAbsoluteY()
          Returns the absolute Y-coordinate of this component.
abstract  java.awt.Rectangle getBounds()
          Returns the bounds of this component in the local context of its container.
 Container getContainer()
          Returns the container that contains this component.
 java.lang.Object getLockObject()
          Returns the lock object needed for exclusive operations.
abstract  Monome getMonome()
          Returns the logical Monome device that contains this component.
 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.
abstract  boolean isVisible()
          Indicates whether this component is actually visible.
abstract  void notify(OSCMessageDigester messageDigester)
          Notifies this component that a message comes from the Monome device.
abstract  java.lang.String toString()
          Returns a string representation of this component.
abstract  void writeOn(Frame frame)
          Writes this component on the specified frame in order to refresh the Monome device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name


protected final java.lang.String name
Name of this component.


x


protected final int x
X-coordinate of this component.


y


protected final int y
Y-coordinate of this component.


lockObject


protected final java.lang.Object lockObject
Lock object needed for exclusive operations.


eventListenerList


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


container


protected Container container
Container which contains this component. Since SkyMonome v1.2, this field is not final anymore due to the automatic registering of this component inside its container.

Constructor Detail

Component


@Deprecated

public Component(java.lang.String name,

                            Container container,

                            int x,

                            int y)
Deprecated. Since SkyMonome v1.2, all components register themselves inside their container, so you don't need to specify the container by calling this constructor.

Constructs a component with the specified name and specified coordinates and contained by the specified container.

Parameters:
name - Name of this component.
container - Container that contains this component.
x - X-coordinate of this component in the local context of its container.
y - Y-coordinate of this component in the local context of its container.

Component


public Component(java.lang.String name,

                 int x,

                 int y)
Constructs a component with the specified name and specified coordinates.

Parameters:
name - Name of this component.
x - X-coordinate of this component in the local context of its container.
y - Y-coordinate of this component in the local context of its container.
Since:
SkyMonome v1.2
Method Detail

getName


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

Returns:
The name of this component.

getX


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

Returns:
The X-coordinate of this component in the local context of its container.

getY


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

Returns:
The Y-coordinate of this component in the local context of its container.

getLockObject


public java.lang.Object getLockObject()
Returns the lock object needed for exclusive operations.

Returns:
The lock object needed for exclusive operations.

getContainer


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

Returns:
The container that contains this component.

notify


public abstract void notify(OSCMessageDigester messageDigester)

                     throws MonomeException
Notifies this component that a message comes from the Monome device.

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.

writeOn


public abstract void writeOn(Frame frame)

                      throws MonomeException
Writes this component on the specified frame in order to refresh the Monome device. Once this frame is completed, it is sent to the Monome device. Implementors must essentially use the set(int,int,LedState) method of class Frame for writing their led state, or call the writeOn(Frame) method of contained components for the containers, or do nothing when they haven't any relation with the leds.

Parameters:
frame - Frame in which this component must write its led state.
Throws:
MonomeException - When a problem has occured while getting the led state of this component, or a component inside (for containers).
See Also:
Monome.refresh()

getMonome


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

Returns:
The logical Monome device that contains this component.

getAbsoluteX


public abstract int getAbsoluteX()
Returns the absolute X-coordinate of this component.

Returns:
The absolute X-coordinate of this component.

getAbsoluteY


public abstract int getAbsoluteY()
Returns the absolute Y-coordinate of this component.

Returns:
The absolute Y-coordinate of this component.

isVisible


public abstract boolean isVisible()
Indicates whether this component is actually visible.

Returns:
true if this component is actually visible, false otherwise.

canHaveParentContainer


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

Returns:
true if this component can have a parent container, false otherwise.

toString


public abstract java.lang.String toString()
Returns a string representation of this component. Implementors should always not forget to implement/override this method.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this component.

getBounds


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

Returns:
The bounds of this component in the local context of its container.