public class UiView
extends javax.swing.JFrame
This class provides the main window containing configuration area, player button and file import/export buttons. It uses the UiController
as WindowListener
and ActionListener
for all buttons and dropdown boxes.
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
APP_ICON_PATH |
private static javax.swing.ImageIcon |
appIcon |
private MidicaButton |
btnExport |
private MidicaButton |
btnInfo |
private MidicaButton |
btnPlayer |
private MidicaButton |
btnSelectImport |
private MidicaButton |
btnSelectSoundbank |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxGuiLang |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxHalfTone |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxInstrument |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxNoteSys |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxOctave |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxPercussion |
private javax.swing.JCheckBox |
cbxRememberImport |
private javax.swing.JCheckBox |
cbxRememberSound |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxSharpFlat |
private javax.swing.JComboBox<ComboboxStringOption> |
cbxSyntax |
static java.lang.String |
CMD_EXPORT |
static java.lang.String |
CMD_IMPORT |
static java.lang.String |
CMD_OPEN_SNDBNK_FILE |
static java.lang.String |
CMD_SELECT_LANGUAGE |
static java.lang.String |
CMD_SHOW_INFO_WINDOW |
static java.lang.String |
CMD_START_PLAYER |
private java.awt.Container |
content |
private UiController |
controller |
private KeyBindingManager |
keyBindingManager |
private javax.swing.JLabel |
lblChosenImportedFile |
private javax.swing.JLabel |
lblChosenImportedType |
private javax.swing.JLabel |
lblChosenSoundbankFile |
private javax.swing.JLabel |
lblTranspose |
private static java.awt.Dimension |
MAX_FILE_NAME_DIM |
static java.lang.String |
NAME_REMEMBER_IMPORT |
static java.lang.String |
NAME_REMEMBER_SOUND |
static java.lang.String |
NAME_SELECT_HALF_TONE |
static java.lang.String |
NAME_SELECT_INSTRUMENT |
static java.lang.String |
NAME_SELECT_LANGUAGE |
static java.lang.String |
NAME_SELECT_OCTAVE |
static java.lang.String |
NAME_SELECT_PERCUSSION |
static java.lang.String |
NAME_SELECT_SHARP_FLAT |
static java.lang.String |
NAME_SELECT_SYNTAX |
static java.lang.String |
NAME_SELECT_SYSTEM |
private static long |
serialVersionUID |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
UiView(UiController controller)
Creates the main window of the program.
|
Modifier and Type | Method and Description |
---|---|
private void |
addKeyBindings()
Adds key bindings to the window.
|
void |
close()
Closes the window.
|
private java.awt.Container |
createConfigArea()
Creates the configuration area containing the dropdown boxes with their labels and the button to open the info and config view.
|
private java.awt.Container |
createExportArea()
Creates the export area containing the sub areas for all exportable file types.
|
private java.awt.Container |
createImportArea()
Creates the import area with the import selection button, the remember checkbox and labels for the imported file name and type.
|
private java.awt.Container |
createLeftArea()
Creates the left area consisting of the (upper) configuration area and the (lower) area for the player button.
|
private java.awt.Container |
createPlayerArea()
Creates the player area containing the button to open the player.
|
private java.awt.Container |
createRightArea()
Creates the right area containing the (upper) import area and the (lower) export area.
|
private java.awt.Container |
createSoundbankArea()
Creates the soundbank area with the selection button, the remember checkbox and a label for the loaded soundbank file name.
|
javax.swing.JLabel |
getChosenSoundbankFileLbl()
Returns the label displaying the successfully imported bank file.
|
javax.swing.JComboBox<?>[] |
getConfigComboboxes()
Returns the config comboboxes.
|
javax.swing.JLabel |
getImportedFileLbl()
Returns the label displaying the successfully imported sequence file.
|
javax.swing.JLabel |
getImportedFileTypeLbl()
Returns the label displaying the successfully imported file type.
|
private void |
init()
Separates the main window by the left part (configuration area and player button) and the right part (import/export area).
|
void |
setTransposeLevel(int level)
Writes the current transpose level into the according label.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
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, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, 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, 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 java.lang.String NAME_SELECT_LANGUAGE
public static final java.lang.String NAME_SELECT_SYSTEM
public static final java.lang.String NAME_SELECT_HALF_TONE
public static final java.lang.String NAME_SELECT_SHARP_FLAT
public static final java.lang.String NAME_SELECT_OCTAVE
public static final java.lang.String NAME_SELECT_SYNTAX
public static final java.lang.String NAME_SELECT_PERCUSSION
public static final java.lang.String NAME_SELECT_INSTRUMENT
public static final java.lang.String NAME_REMEMBER_SOUND
public static final java.lang.String NAME_REMEMBER_IMPORT
public static final java.lang.String CMD_SELECT_LANGUAGE
public static final java.lang.String CMD_START_PLAYER
public static final java.lang.String CMD_IMPORT
public static final java.lang.String CMD_OPEN_SNDBNK_FILE
public static final java.lang.String CMD_SHOW_INFO_WINDOW
public static final java.lang.String CMD_EXPORT
private static final java.lang.String APP_ICON_PATH
private static javax.swing.ImageIcon appIcon
private static final java.awt.Dimension MAX_FILE_NAME_DIM
private KeyBindingManager keyBindingManager
private java.awt.Container content
private UiController controller
private javax.swing.JLabel lblChosenImportedFile
private javax.swing.JLabel lblChosenImportedType
private javax.swing.JLabel lblChosenSoundbankFile
private javax.swing.JComboBox<ComboboxStringOption> cbxGuiLang
private javax.swing.JComboBox<ComboboxStringOption> cbxNoteSys
private javax.swing.JComboBox<ComboboxStringOption> cbxHalfTone
private javax.swing.JComboBox<ComboboxStringOption> cbxSharpFlat
private javax.swing.JComboBox<ComboboxStringOption> cbxOctave
private javax.swing.JComboBox<ComboboxStringOption> cbxSyntax
private javax.swing.JComboBox<ComboboxStringOption> cbxPercussion
private javax.swing.JComboBox<ComboboxStringOption> cbxInstrument
private javax.swing.JLabel lblTranspose
private MidicaButton btnInfo
private MidicaButton btnPlayer
private MidicaButton btnSelectImport
private MidicaButton btnSelectSoundbank
private MidicaButton btnExport
private javax.swing.JCheckBox cbxRememberSound
private javax.swing.JCheckBox cbxRememberImport
public UiView(UiController controller)
Creates the main window of the program.
Fills the contents via calling init()
.
controller
- Used as listener for all events.private void init()
Separates the main window by the left part (configuration area and player button) and the right part (import/export area). Those areas are filled by calling createLeftArea()
and createRightArea()
.
private java.awt.Container createLeftArea()
Creates the left area consisting of the (upper) configuration area and the (lower) area for the player button. Fills those areas by calling createConfigArea()
and createPlayerArea()
.
private java.awt.Container createRightArea()
Creates the right area containing the (upper) import area and the (lower) export area. Fills those areas by calling createImportArea()
and createExportArea()
.
private java.awt.Container createConfigArea()
Creates the configuration area containing the dropdown boxes with their labels and the button to open the info and config view.
private java.awt.Container createPlayerArea()
Creates the player area containing the button to open the player.
private java.awt.Container createImportArea()
Creates the import area with the import selection button, the remember checkbox and labels for the imported file name and type.
private java.awt.Container createSoundbankArea()
Creates the soundbank area with the selection button, the remember checkbox and a label for the loaded soundbank file name.
private java.awt.Container createExportArea()
Creates the export area containing the sub areas for all exportable file types.
public javax.swing.JLabel getImportedFileLbl()
Returns the label displaying the successfully imported sequence file.
public javax.swing.JLabel getImportedFileTypeLbl()
Returns the label displaying the successfully imported file type.
public javax.swing.JLabel getChosenSoundbankFileLbl()
Returns the label displaying the successfully imported bank file.
public void close()
Closes the window. This is used after changing the language, followed by re-initializing the window.
public void setTransposeLevel(int level)
Writes the current transpose level into the according label. Adjusts the font color of that label according to the transpose level.
level
- Transpose level.public javax.swing.JComboBox<?>[] getConfigComboboxes()
Returns the config comboboxes. Used for unit-testing.
private void addKeyBindings()
Adds key bindings to the window.