sky.monome
Class StrictPageSwitcher

java.lang.Object
  extended by sky.monome.Component
      extended by sky.monome.Container
          extended by sky.monome.AbstractGroup<Page>
              extended by sky.monome.AbstractPageSwitcher
                  extended by sky.monome.StrictPageSwitcher

public class StrictPageSwitcher
extends AbstractPageSwitcher

Page switcher that needs to show permanently a page, even at the beginning (the first page need to be added immediately after creation of this strict page switcher.

Author:
PJ Skyman

Field Summary
 
Fields inherited from class sky.monome.AbstractPageSwitcher
activePage
 
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
StrictPageSwitcher(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.
StrictPageSwitcher(java.lang.String name, int x, int y, int width, int height)
          Constructs a page switcher with the specified name, specified coordinates and dimensions.
 
Method Summary
 void removePage(Page page)
          Removes the specified page from the list of contained pages.
 void showPage(Page page)
          Shows the specified page, if this page is actually contained by this page switcher.
 java.lang.String toString()
          Returns a string representation of 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.AbstractPageSwitcher
addPage, getActivePage, getPages, notify
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StrictPageSwitcher

@Deprecated
public StrictPageSwitcher(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 a 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.

StrictPageSwitcher

public StrictPageSwitcher(java.lang.String name,
                          int x,
                          int y,
                          int width,
                          int height)
Constructs a page switcher with the specified name, 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

showPage

public void showPage(Page page)
              throws MonomeException
Shows the specified page, if this page is actually contained by this page switcher.

Specified by:
showPage in class AbstractPageSwitcher
Parameters:
page - Page to show. It will become the new active page.
Throws:
MonomeException - When the new active page can't be drawn.

removePage

public void removePage(Page page)
                throws MonomeException
Removes the specified page from the list of contained pages.

Specified by:
removePage in class AbstractPageSwitcher
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.

toString

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

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

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 AbstractPageSwitcher
Parameters:
frame - Frame in which this page switcher must write its led state.
Throws:
MonomeException - When this page switcher contains no page, or when a problem has occured while getting the led state of a component inside this page switcher.
See Also:
Monome.refresh()