com.groovemanager.gui.custom.mc909
Class Mc909Key

java.lang.Object
  extended by com.groovemanager.gui.custom.CustomComposite
      extended by com.groovemanager.gui.custom.mc909.Mc909Key

public class Mc909Key
extends CustomComposite

An Mc909Key represents a Composite surrounding a Mc909Pad. A number of Mc909Keys can be packed into a Mc909KeyComposite.

Author:
Manu Robledo

Field Summary
static int BLACK_LEFT
          Constants for different types of keys
static int BLACK_MIDDLE
          Constants for different types of keys
static int BLACK_RIGHT
          Constants for different types of keys
private static int LINE_WIDTH
          The constant for the line width
private  org.eclipse.swt.widgets.Label note
          The Label containing the note name and octave
private static java.lang.String[] notes
          Note names
private  Mc909Pad pad
          The Mc909Pad contained in this Key
static int WHITE_BEGIN
          Constants for different types of keys
static int WHITE_END
          Constants for different types of keys
static int WHITE_MIDDLE
          Constants for different types of keys
 
Constructor Summary
Mc909Key(org.eclipse.swt.widgets.Composite parent, int type, int key)
          Construct a new Mc909Key
 
Method Summary
protected  org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, int style)
          This method is to be overwritten by concrete subclasses to create the real contents of this CustomComposite
private  void drawKey(int type)
          Internal method for adding the PaintListener to the main composite
protected  int[] getListenerTypes()
          For all types of listeners that should be possible to add to this Composite directly, the corresponding SWT.* constant should be contained in the returned Array.
 Mc909Pad getPad()
          Get the Mc909Pad contained in this Key
protected  int getPossibleStyles()
          Get a combination of all allowed SWT.* style constants
 void setNoteVisible(boolean visible)
          Set the visible status of the note name
 
Methods inherited from class com.groovemanager.gui.custom.CustomComposite
addListener, checkStyle, getComposite, getData, getListeners, getParent, removeListener, setData, setLayoutData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLACK_LEFT

public static final int BLACK_LEFT
Constants for different types of keys

See Also:
Constant Field Values

BLACK_MIDDLE

public static final int BLACK_MIDDLE
Constants for different types of keys

See Also:
Constant Field Values

BLACK_RIGHT

public static final int BLACK_RIGHT
Constants for different types of keys

See Also:
Constant Field Values

LINE_WIDTH

private static final int LINE_WIDTH
The constant for the line width

See Also:
Constant Field Values

note

private org.eclipse.swt.widgets.Label note
The Label containing the note name and octave


notes

private static final java.lang.String[] notes
Note names


pad

private Mc909Pad pad
The Mc909Pad contained in this Key


WHITE_BEGIN

public static final int WHITE_BEGIN
Constants for different types of keys

See Also:
Constant Field Values

WHITE_END

public static final int WHITE_END
Constants for different types of keys

See Also:
Constant Field Values

WHITE_MIDDLE

public static final int WHITE_MIDDLE
Constants for different types of keys

See Also:
Constant Field Values
Constructor Detail

Mc909Key

public Mc909Key(org.eclipse.swt.widgets.Composite parent,
                int type,
                int key)
Construct a new Mc909Key

Parameters:
parent - The parent Composite
type - The type of the key (one of the type constants, e.g. WHITE_BEGIN
key - The key number in the range from 0 to 127
Method Detail

createComposite

protected org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent,
                                                            int style)
Description copied from class: CustomComposite
This method is to be overwritten by concrete subclasses to create the real contents of this CustomComposite

Specified by:
createComposite in class CustomComposite
Parameters:
parent - The parent Composite under which this Composite should be created
style - Combination of valid SWT.* style constants
Returns:
The new created main composite
See Also:
CustomComposite.createComposite(org.eclipse.swt.widgets.Composite, int)

drawKey

private void drawKey(int type)
Internal method for adding the PaintListener to the main composite

Parameters:
type - The type of this Key

getListenerTypes

protected int[] getListenerTypes()
Description copied from class: CustomComposite
For all types of listeners that should be possible to add to this Composite directly, the corresponding SWT.* constant should be contained in the returned Array.

Specified by:
getListenerTypes in class CustomComposite
Returns:
An Array of SWT.* constants defining the set of listeners types applicable to this Composite
See Also:
CustomComposite.getListenerTypes()

getPad

public Mc909Pad getPad()
Get the Mc909Pad contained in this Key

Returns:
The Mc909Pad contained in this Key

getPossibleStyles

protected int getPossibleStyles()
Description copied from class: CustomComposite
Get a combination of all allowed SWT.* style constants

Specified by:
getPossibleStyles in class CustomComposite
Returns:
A combination of all allowed style constants, for example SWT.BORDER | SWT.LEFT | SWT.BORDER
See Also:
CustomComposite.getPossibleStyles()

setNoteVisible

public void setNoteVisible(boolean visible)
Set the visible status of the note name

Parameters:
visible - true, if the note name and octave should be visible, false otherwise