sky.monome.frame
Class AbstractWindow<T extends Frame,F extends AbstractWindow<T,F>>

java.lang.Object
  extended by sky.monome.frame.AbstractWindow<T,F>
Type Parameters:
T - Type of viewed frame.
F - Type of window that extends this abstract window.
All Implemented Interfaces:
DynamicFrame<F>, Frame
Direct Known Subclasses:
AbstractFrameWindow, AbstractInertiaFrameWindow

public abstract class AbstractWindow<T extends Frame,F extends AbstractWindow<T,F>>
extends java.lang.Object
implements Frame, DynamicFrame<F>

Window that makes a movable view over a frame. This class is the based class for all windows.

Author:
PJ Skyman

Nested Class Summary
static class AbstractWindow.WindowType
          Type of window.
 
Field Summary
protected  javax.swing.event.EventListenerList eventListenerList
          List of registered listeners.
protected  T frame
          Frame over which this window makes a view.
protected  Container windowContainer
          Container that contains this window.
 
Constructor Summary
AbstractWindow(T frame)
          Constructs an abstract window with the specified frame.
 
Method Summary
 void addFrameListener(FrameListener<F> frameListener)
          Adds the specified listener to the list of all registered listeners.
 void fireFrameChanged(F dynamicFrame)
          Invoked when a frame change occurs.
 FrameListener<F>[] getFrameListeners()
          Returns an array of all registered listeners.
 LedButtonCouple.LedState getOnFrame(int x, int y)
          Returns the led state on the viewed frame at specified coordinates.
 void removeFrameListener(FrameListener<F> frameListener)
          Removes the specified listener from the list of all registered listeners.
 void set(int x, int y, LedButtonCouple.LedState ledState)
          Deprecated. Since it is recommended to set led states directly on the viewed frame with setOnFrame(int,int,LedState) method.
 void setOnFrame(int x, int y, LedButtonCouple.LedState ledState)
          Modifies the led state on the viewed frame at specified coordinates.
 void setWindowContainer(Container windowContainer)
          Modifies the container that contains this window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sky.monome.frame.Frame
get
 

Field Detail

frame

protected final T extends Frame frame
Frame over which this window makes a view.


eventListenerList

protected final javax.swing.event.EventListenerList eventListenerList
List of registered listeners.


windowContainer

protected Container windowContainer
Container that contains this window.

Since:
SkyMonome v1.3
Constructor Detail

AbstractWindow

public AbstractWindow(T frame)
Constructs an abstract window with the specified frame.

Parameters:
frame - Frame over which this windows makes a view.
Method Detail

setWindowContainer

public void setWindowContainer(Container windowContainer)
Modifies the container that contains this window.

Parameters:
windowContainer - New window container, or null to remove this window from any container.
Since:
SkyMonome v1.3

getOnFrame

public LedButtonCouple.LedState getOnFrame(int x,
                                           int y)
Returns the led state on the viewed frame at specified coordinates.

Parameters:
x - X-coordinate of the needed led state on the viewed frame.
y - Y-coordinate of the needed led state on the viewed frame.
Returns:
The led state on the viewed frame at specified coordinates.

set

@Deprecated
public void set(int x,
                           int y,
                           LedButtonCouple.LedState ledState)
Deprecated. Since it is recommended to set led states directly on the viewed frame with setOnFrame(int,int,LedState) method.

Modifies the led state on this window at specified coordinates.

Specified by:
set in interface Frame
Parameters:
x - X-coordinate of the led state to be modified on this window.
y - Y-coordinate of the led state to be modified on this window.
ledState - New led state to affect at specified coordinates on this window.

setOnFrame

public void setOnFrame(int x,
                       int y,
                       LedButtonCouple.LedState ledState)
Modifies the led state on the viewed frame at specified coordinates.

Parameters:
x - X-coordinate of the led state to be modified on the viewed frame.
y - Y-coordinate of the led state to be modified on the viewed frame.
ledState - New led state to affect at specified coordinates on the viewed frame.

addFrameListener

public void addFrameListener(FrameListener<F> frameListener)
Adds the specified listener to the list of all registered listeners.

Specified by:
addFrameListener in interface DynamicFrame<F extends AbstractWindow<T,F>>
Parameters:
frameListener - Listener to add to the list of all registered listeners.

removeFrameListener

public void removeFrameListener(FrameListener<F> frameListener)
Removes the specified listener from the list of all registered listeners.

Specified by:
removeFrameListener in interface DynamicFrame<F extends AbstractWindow<T,F>>
Parameters:
frameListener - Listener to remove from the list of all registered listeners.

getFrameListeners

public FrameListener<F>[] getFrameListeners()
Returns an array of all registered listeners.

Specified by:
getFrameListeners in interface DynamicFrame<F extends AbstractWindow<T,F>>
Returns:
An array of all registered listeners.

fireFrameChanged

public void fireFrameChanged(F dynamicFrame)
Invoked when a frame change occurs.

Specified by:
fireFrameChanged in interface DynamicFrame<F extends AbstractWindow<T,F>>
Parameters:
dynamicFrame - Dynamic frame that triggered the frame event.