public class SoundcheckView
extends javax.swing.JDialog
This class defines the UI for the soundcheck window.
javax.swing.JDialog.AccessibleJDialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
private MidicaButton |
btnPlay |
private javax.swing.JComboBox<NamedInteger> |
cbxChannel |
private javax.swing.JCheckBox |
cbxKeep |
static java.lang.String |
CMD_KEEP |
static java.lang.String |
CMD_PLAY |
private java.awt.Container |
content |
private static int |
DEFAULT_DURATION |
static int |
DEFAULT_VELOCITY |
private java.awt.Dimension |
dimTblInstr |
private java.awt.Dimension |
dimTblNote |
private java.awt.Dimension |
dimTextField |
private javax.swing.JTextField |
fldDuration |
private javax.swing.JTextField |
fldVelocity |
private javax.swing.JTextField |
fldVolume |
private static int |
HEIGHT_TABLE_INSTR |
private static int |
HEIGHT_TABLE_NOTE |
private SoundcheckInstrumentModel |
instrModel |
private KeyBindingManager |
keyBindingManager |
private FilterIconWithLabel |
labelWithFilterInstr |
private FilterIconWithLabel |
labelWithFilterNote |
static int |
MAX_DURATION |
static int |
MIN_DURATION |
static java.lang.String |
NAME_DURATION |
static java.lang.String |
NAME_INSTR |
static java.lang.String |
NAME_NOTE |
static java.lang.String |
NAME_VELOCITY |
static java.lang.String |
NAME_VOLUME |
private SoundcheckNoteModel |
noteModel |
private static long |
serialVersionUID |
private MidicaSlider |
sldVelocity |
private MidicaSlider |
sldVolume |
private static SoundcheckView |
soundcheckView |
private MidicaTable |
tblInstrument |
private MidicaTable |
tblNote |
private static int |
TEXT_FIELD_WIDTH |
private static int |
VOL_OR_VEL_LABEL_SKIP |
private static int |
WIDTH_COL_BANK |
private static int |
WIDTH_COL_NAME_SB |
private static int |
WIDTH_COL_NAME_SYNTAX |
private static int |
WIDTH_COL_NOTE_LONG |
private static int |
WIDTH_COL_NOTE_NUM |
private static int |
WIDTH_COL_NOTE_SHORT |
private static int |
WIDTH_COL_PROG |
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Modifier | Constructor and Description |
---|---|
private |
SoundcheckView(javax.swing.JDialog owner)
Creates the soundcheck window.
|
Modifier and Type | Method and Description |
---|---|
private void |
addKeyBindings()
Adds key bindings to the soundcheck window using the
KeyBindingManager . |
static void |
close()
Destroys the
SoundcheckView object. |
private MidicaSlider |
createVolOrVelSlider(SoundcheckController controller)
Creates the volume or velocity slider for the soundcheck window.
|
int |
getChannel()
Returns the currently selected channel from the channel combobox.
|
int |
getDurationFromField()
Returns the content of the duration text field.
|
javax.swing.ListSelectionModel |
getListSelectionModelFromTable(boolean fromInstrumentTable)
Returns the list selection model either from the instruments/drumkit table or from the note/percussion table.
|
int |
getSelectedInstrumentRow()
Determines the currently selected row index of the instrument table (model).
|
int |
getSelectedNoteRow()
Determines the currently selected index of the note list.
|
int |
getVelocity()
Returns the current velocity from the velocity slider.
|
byte |
getVeloctiyFromField()
Returns the content of the velocity text field.
|
byte |
getVolume()
Returns the current volume from the volume slider.
|
byte |
getVolumeFromField()
Returns the content of the volume text field.
|
private void |
init()
Initializes the content of the soundcheck window.
|
boolean |
isDrumSelected()
Determins if the category or instrument currently selected in the instruments table is a drumkit or not.
|
boolean |
isFilterLayerOpen()
Indicates, if a string filter layer is currently open or not.
|
boolean |
isVelocitySliderAdjusting()
Shows if the velocity slider is being changed via mouse click in the moment.
|
boolean |
isVolumeSliderAdjusting()
Shows if the volume slider is being changed via mouse click in the moment.
|
void |
makeVisible()
Shows the soundcheck window and brings it to the front.
|
boolean |
mustKeepSettings()
Determins if the ‘keep settings’ checkbox is checked or not.
|
void |
pressPlayButton()
Causes a click on the play button.
|
void |
scrollInstrumentTable()
Scrolls the instrument table so that the selected row is visible.
|
void |
scrollNoteTable()
Scrolls the note/percussion table so that the selected row is visible.
|
private void |
scrollTable(MidicaTable table)
Scrolls the given table to the selected row.
|
void |
setSelectedInstrumentRow(int i)
Selects the given row of the instruments table, if possible.
|
void |
setSelectedNoteRow(int i)
Selects the given row of the notes table, if possible.
|
void |
setTextFieldColor(java.lang.String name,
java.awt.Color color)
Sets the given text field’s background to the given color.
|
void |
setVelocity(byte velocity)
Sets the velocity slider and the velocity text field to the given value.
|
void |
setVolume(byte volume)
Sets the volume slider and the volume text field to the given value.
|
static void |
showSoundcheck(javax.swing.JDialog owner)
This method is used instead of the (private) constructor to create the soundcheck window if not yet done.
|
void |
toggleInstrumentSelectionListener(boolean on)
Enables or disables the selection listener for the instruments table.
|
void |
toggleNoteListener(boolean on)
Enables or disables the selection listener for the note/percussion table, depending on the given value.
|
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private static final long serialVersionUID
public static final int DEFAULT_VELOCITY
public static final int MIN_DURATION
public static final int MAX_DURATION
public static final java.lang.String CMD_PLAY
public static final java.lang.String CMD_KEEP
public static final java.lang.String NAME_INSTR
public static final java.lang.String NAME_NOTE
public static final java.lang.String NAME_VOLUME
public static final java.lang.String NAME_VELOCITY
public static final java.lang.String NAME_DURATION
private static final int TEXT_FIELD_WIDTH
private static final int WIDTH_COL_PROG
private static final int WIDTH_COL_BANK
private static final int WIDTH_COL_NAME_SB
private static final int WIDTH_COL_NAME_SYNTAX
private static final int HEIGHT_TABLE_INSTR
private static final int WIDTH_COL_NOTE_NUM
private static final int WIDTH_COL_NOTE_SHORT
private static final int WIDTH_COL_NOTE_LONG
private static final int HEIGHT_TABLE_NOTE
private static final int VOL_OR_VEL_LABEL_SKIP
private static final int DEFAULT_DURATION
private java.awt.Dimension dimTblInstr
private java.awt.Dimension dimTblNote
private java.awt.Dimension dimTextField
private javax.swing.JComboBox<NamedInteger> cbxChannel
private MidicaTable tblInstrument
private MidicaTable tblNote
private FilterIconWithLabel labelWithFilterInstr
private FilterIconWithLabel labelWithFilterNote
private javax.swing.JTextField fldVolume
private javax.swing.JTextField fldVelocity
private MidicaSlider sldVolume
private MidicaSlider sldVelocity
private javax.swing.JTextField fldDuration
private javax.swing.JCheckBox cbxKeep
private MidicaButton btnPlay
private KeyBindingManager keyBindingManager
private static SoundcheckView soundcheckView
private java.awt.Container content
private SoundcheckNoteModel noteModel
private SoundcheckInstrumentModel instrModel
private SoundcheckView(javax.swing.JDialog owner)
Creates the soundcheck window.
This constructor is private to ensure a singleton behaviour.
owner
- The player window (a PlayerView
object).private void init()
Initializes the content of the soundcheck window. This is called by the constructor.
private MidicaSlider createVolOrVelSlider(SoundcheckController controller)
Creates the volume or velocity slider for the soundcheck window.
controller
- The event listener object for the soundcheck.public static void showSoundcheck(javax.swing.JDialog owner)
This method is used instead of the (private) constructor to create the soundcheck window if not yet done.
owner
- The player window (a PlayerView
object).public static void close()
Destroys the SoundcheckView
object.
This is called if the player window is closed.
public void makeVisible()
Shows the soundcheck window and brings it to the front.
This is called whenever the soundcheck button in the player window is pushed.
public void setVolume(byte volume)
Sets the volume slider and the volume text field to the given value.
volume
- The volume value to set.public void setVelocity(byte velocity)
Sets the velocity slider and the velocity text field to the given value.
velocity
- The velocity value to set.public void setTextFieldColor(java.lang.String name, java.awt.Color color)
Sets the given text field’s background to the given color.
name
- Text field name.color
- Background color.public boolean isVolumeSliderAdjusting()
Shows if the volume slider is being changed via mouse click in the moment.
Returns true, if a mouse click on the slider has been started (mouse down) but is not yet finished (mouse up).
public boolean isVelocitySliderAdjusting()
Shows if the velocity slider is being changed via mouse click in the moment.
Returns true, if a mouse click on the slider has been started (mouse down) but is not yet finished (mouse up).
public byte getVolumeFromField() throws java.lang.NumberFormatException
Returns the content of the volume text field.
java.lang.NumberFormatException
- if the text cannot be parsed to a byte value.public byte getVeloctiyFromField() throws java.lang.NumberFormatException
Returns the content of the velocity text field.
java.lang.NumberFormatException
- if the text cannot be parsed to a byte value.public int getDurationFromField() throws java.lang.NumberFormatException
Returns the content of the duration text field.
java.lang.NumberFormatException
- if the text cannot be parsed to an integer value.public int getChannel()
Returns the currently selected channel from the channel combobox.
public boolean isFilterLayerOpen()
Indicates, if a string filter layer is currently open or not.
public int getSelectedInstrumentRow()
Determines the currently selected row index of the instrument table (model).
public void setSelectedInstrumentRow(int i)
Selects the given row of the instruments table, if possible.
i
- row index (model index) to be selectedpublic int getSelectedNoteRow()
Determines the currently selected index of the note list.
public void setSelectedNoteRow(int i)
Selects the given row of the notes table, if possible.
i
- row index (model index) to be selectedpublic void scrollInstrumentTable()
Scrolls the instrument table so that the selected row is visible.
public void scrollNoteTable()
Scrolls the note/percussion table so that the selected row is visible.
private void scrollTable(MidicaTable table)
Scrolls the given table to the selected row.
table
- the table to be scrolledpublic boolean isDrumSelected()
Determins if the category or instrument currently selected in the instruments table is a drumkit or not.
public void toggleNoteListener(boolean on)
Enables or disables the selection listener for the note/percussion table, depending on the given value.
The listener must be disabled temporarily while another channel or instrument/drumkit is selected because that causes a rebuild of the note/percussion combobox.
on
- true to activate the listener, false to deactivate it.public void toggleInstrumentSelectionListener(boolean on)
Enables or disables the selection listener for the instruments table. During channel selection the listener must be disabled temporarily while the instruments table is refilled and the last selection is restored.
on
- true to activate the listener, false to deactivate it.public javax.swing.ListSelectionModel getListSelectionModelFromTable(boolean fromInstrumentTable)
Returns the list selection model either from the instruments/drumkit table or from the note/percussion table.
This is needed from the controller to determine from which table a selection event comes from.
fromInstrumentTable
- true for the instruments table, false for the note tablepublic byte getVolume()
Returns the current volume from the volume slider.
public int getVelocity()
Returns the current velocity from the velocity slider.
public void pressPlayButton()
Causes a click on the play button.
This is called if an item from one of the comboboxes has been selected or if Enter has been pressed while one of the text fields was focused.
public boolean mustKeepSettings()
Determins if the ‘keep settings’ checkbox is checked or not.
private void addKeyBindings()
Adds key bindings to the soundcheck window using the KeyBindingManager
.