sky.monome
Class AbstractGroup<T extends Component>

java.lang.Object
  extended by sky.monome.Component
      extended by sky.monome.Container
          extended by sky.monome.AbstractGroup<T>
Type Parameters:
T - Type of contained components.
Direct Known Subclasses:
AbstractPageSwitcher, Group, LedButtonGroup, MultiSequencerGroup, MultiSequencerGroup.SpecificSequencerGroup, SequencerGroup, SequencerPageSwitcher, SequencerPageSwitcher.SequencerPage

public abstract class AbstractGroup<T extends Component>
extends Container

Skeletton class for all groups.

Author:
PJ Skyman

Field Summary
protected  SynchronizedList<T> components
          List of contained 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
AbstractGroup(java.lang.String name, Container container, int x, int y, int width, int height)
          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.
AbstractGroup(java.lang.String name, int x, int y, int width, int height)
          Constructs an abstract group with the specified name and specified coordinates and dimensions.
 
Method Summary
 boolean canHaveParentContainer()
          Indicates whether this abstract group can have a parent container in the Monome assembling tree.
 int getAbsoluteX()
          Returns the absolute X-coordinate of this abstract group.
 int getAbsoluteY()
          Returns the absolute Y-coordinate of this abstract group.
 java.awt.Rectangle getBounds()
          Returns bounds of this abstract group in the local context of its container.
 Monome getMonome()
          Returns the logical Monome device that contains this abstract group.
 boolean isVisible()
          Indicates whether this abstract group is actually visible.
 void notify(OSCMessageDigester messageDigester)
          Notifies this abstract group that a message comes from the Monome device.
 void writeOn(Frame frame)
          Writes this abstract group on the specified frame in order to refresh the Monome device.
 
Methods inherited from class sky.monome.Container
getHeight, getWidth
 
Methods inherited from class sky.monome.Component
getContainer, getLockObject, getName, getX, getY, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

components

protected final SynchronizedList<T extends Component> components
List of contained components.

Constructor Detail

AbstractGroup

@Deprecated
public AbstractGroup(java.lang.String name,
                                Container container,
                                int x,
                                int y,
                                int width,
                                int height)
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 an abstract group with the specified name, specified coordinates and dimensions, and contained by the specified container.

Parameters:
name - Name of this abstract group.
container - Container that contains this abstract group.
x - X-coordinate of this abstract group in the local context of its container.
y - Y-coordinate of this abstract group in the local context of its container.
width - Width of this abstract group.
height - Height of this abstract group.

AbstractGroup

public AbstractGroup(java.lang.String name,
                     int x,
                     int y,
                     int width,
                     int height)
Constructs an abstract group with the specified name and specified coordinates and dimensions.

Parameters:
name - Name of this abstract group.
x - X-coordinate of this abstract group in the local context of its container.
y - Y-coordinate of this abstract group in the local context of its container.
width - Width of this abstract group.
height - Height of this abstract group.
Since:
SkyMonome v1.2
Method Detail

getAbsoluteX

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

Specified by:
getAbsoluteX in class Component
Returns:
The absolute X-coordinate of this abstract group.

getAbsoluteY

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

Specified by:
getAbsoluteY in class Component
Returns:
The absolute Y-coordinate of this abstract group.

getMonome

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

Specified by:
getMonome in class Component
Returns:
The logical Monome device that contains this abstract group.

notify

public void notify(OSCMessageDigester messageDigester)
            throws MonomeException
Notifies this abstract group that a message comes from the Monome device.

Specified by:
notify in class Component
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 void writeOn(Frame frame)
             throws MonomeException
Writes this abstract group on the specified frame in order to refresh the Monome device. Once this frame is completed, it is sent to the Monome device.

Specified by:
writeOn in class Component
Parameters:
frame - Frame in which this abstract group must write its led state.
Throws:
MonomeException - When a problem has occured while getting the led state of a component inside this abstract group.
See Also:
Monome.refresh()

isVisible

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

Specified by:
isVisible in class Component
Returns:
true if this abstract group is actually visible, false otherwise.

canHaveParentContainer

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

Specified by:
canHaveParentContainer in class Component
Returns:
Always true.

getBounds

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

Specified by:
getBounds in class Component
Returns:
Bounds of this abstract group in the local context of its container.