sky.monome
Class AbstractPageSwitcher


java.lang.Object

  extended by sky.monome.Component

      extended by sky.monome.Container

          extended by sky.monome.AbstractGroup<Page>

              extended by sky.monome.AbstractPageSwitcher

Direct Known Subclasses:
PageSwitcher, StrictPageSwitcher

public abstract class AbstractPageSwitcher
extends AbstractGroup<Page>

Page switcher which can show different pages. This class is the base class for all implementations of page switchers.

Author:
PJ Skyman

Field Summary
protected  Page activePage
          Active page in this page switcher.
 
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
AbstractPageSwitcher(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.
AbstractPageSwitcher(java.lang.String name, int x, int y, int width, int height)
          Constructs an abstract page switcher with the specified name and specified coordinates and dimensions.
 
Method Summary
 void addPage(Page page)
          Adds the specified page to the list of contained pages.
 Page getActivePage()
          Returns the currently active page.
 Page[] getPages()
          Returns an array of all pages contained by this page switcher.
 void notify(OSCMessageDigester messageDigester)
          Notifies this page switcher that a message comes from the Monome device.
abstract  void removePage(Page page)
          Removes the specified page from the list of contained pages.
abstract  void showPage(Page page)
          Shows the specified page, if this page is actually contained by this page switcher.
 void writeOn(Frame frame)
          Writes this page switcher on the specified frame in order to refresh the Monome device.
 
Methods inherited from class sky.monome.AbstractGroup
canHaveParentContainer, getAbsoluteX, getAbsoluteY, getBounds, getMonome, isVisible
 
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

activePage


protected Page activePage
Active page in this page switcher.

Constructor Detail

AbstractPageSwitcher


@Deprecated

public AbstractPageSwitcher(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 page switcher with the specified name, specified coordinates and dimensions, and contained by the specified container.

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

AbstractPageSwitcher


public AbstractPageSwitcher(java.lang.String name,

                            int x,

                            int y,

                            int width,

                            int height)
Constructs an abstract page switcher with the specified name and specified coordinates and dimensions.

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

getPages


public Page[] getPages()
Returns an array of all pages contained by this page switcher.

Returns:
An array of all pages contained by this page switcher.

addPage


public void addPage(Page page)

             throws MonomeException
Adds the specified page to the list of contained pages.

Parameters:
page - Page to add to the list of contained pages.
Throws:
MonomeException - When the first page is added and when it can't be drawn.

removePage


public abstract void removePage(Page page)

                         throws MonomeException
Removes the specified page from the list of contained pages.

Parameters:
page - Page to remove from the list of contained pages.
Throws:
MonomeException - When the active page is changed as a result of the call, and it can't be drawn.

getActivePage


public Page getActivePage()
Returns the currently active page.

Returns:
The currently active page.

showPage


public abstract void showPage(Page page)

                       throws MonomeException
Shows the specified page, if this page is actually contained by this page switcher.

Parameters:
page - Page to show. It will become the new active page.
Throws:
MonomeException - When the new active page can't be drawn.

notify


public void notify(OSCMessageDigester messageDigester)

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

Overrides:
notify in class AbstractGroup<Page>
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 page switcher on the specified frame in order to refresh the Monome device. Once this frame is completed, it is sent to the Monome device.

Overrides:
writeOn in class AbstractGroup<Page>
Parameters:
frame - Frame in which this page switcher must write its led state.
Throws:
MonomeException - When a problem has occured while getting the led state of a component inside this page switcher.
See Also:
Monome.refresh()