public class DecompileConfigController extends FileConfigController
Controller for the decompile config window.
Modifier and Type | Field and Description |
---|---|
private static DecompileConfigController |
controller |
private static java.util.TreeSet<java.lang.Long> |
extraGlobalTicks |
configClasses, configKeys, configWidgets, icon, sessionConfig, view
Modifier | Constructor and Description |
---|---|
private |
DecompileConfigController(DecompileConfigView view,
ConfigIcon icon)
Creates a controller for the decompile config window.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
protected boolean |
applyConfigById(java.lang.String id)
Copies the given config key’s value to the session config, if the value is correct.
|
protected void |
createDefaultView()
Creates a default view that is not intended to be used as a real window.
|
void |
focusGained(java.awt.event.FocusEvent e) |
static javax.swing.DefaultComboBoxModel<NamedInteger> |
getComboboxModel(java.lang.String id)
Returns the model for a combobox.
|
protected java.util.HashMap<java.lang.String,java.lang.String> |
getDefaultConfig()
Returns the hard-coded default config.
|
static java.util.TreeSet<java.lang.Long> |
getExtraGlobalTicks()
Returns the ticks for extra global commands.
|
private java.util.TreeSet<java.lang.Long> |
getExtraTicksFromTxtArea()
Converts the comma-separated extra ticks from the text area into a data structure.
|
static DecompileConfigController |
getInstance(DecompileConfigView view,
ConfigIcon icon)
Creates a singleton instance of the controller.
|
private static NamedInteger |
getMaxNoteLengthCbxModelElement(int ticks,
java.lang.String lengthName)
Creates a numbered integer that can be put into the combobox model for the max note length combobox.
|
protected void |
handleDocumentChange(javax.swing.event.DocumentEvent e)
Adjusts the background color of fields that are not directly related to a config variable, if overridden accordingly.
|
protected void |
initSessionConfig(boolean fromConfig)
Initializes the session config and the state of the widgets.
|
protected void |
initSessionConfigSpecific(boolean fromConfig)
Initializes the specific part of the session config.
|
private void |
refillExtraGlobalField()
(Re)fills the text area with ticks for extra global commands.
|
applyConfig, changedUpdate, focusLost, getSessionConfig, init, initWidgetConfig, insertUpdate, removeUpdate, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
private static DecompileConfigController controller
private static java.util.TreeSet<java.lang.Long> extraGlobalTicks
private DecompileConfigController(DecompileConfigView view, ConfigIcon icon)
Creates a controller for the decompile config window.
view
- the window to be controlledicon
- the icon that is used to open the config windowpublic static DecompileConfigController getInstance(DecompileConfigView view, ConfigIcon icon)
Creates a singleton instance of the controller.
view
- the window to be controlledicon
- the icon that is used to open the config windowprotected void createDefaultView()
FileConfigController
Creates a default view that is not intended to be used as a real window. This is used to initialize data structures, if the user does not want to config window is.
createDefaultView
in class FileConfigController
public static java.util.TreeSet<java.lang.Long> getExtraGlobalTicks()
Returns the ticks for extra global commands.
protected void initSessionConfig(boolean fromConfig)
FileConfigController
Initializes the session config and the state of the widgets.
If the parameter fromConfig is true, the config is copied from Config
to the session config. Otherwise the session config is left unchanged.
initSessionConfig
in class FileConfigController
fromConfig
- true if the session config shall be copied from the Config
class.protected java.util.HashMap<java.lang.String,java.lang.String> getDefaultConfig()
FileConfigController
Returns the hard-coded default config.
getDefaultConfig
in class FileConfigController
protected void initSessionConfigSpecific(boolean fromConfig)
FileConfigController
Initializes the specific part of the session config.
initSessionConfigSpecific
in class FileConfigController
fromConfig
- true if the session config shall be copied from the Config
class.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class FileConfigController
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
focusGained
in class FileConfigController
protected boolean applyConfigById(java.lang.String id)
FileConfigController
Copies the given config key’s value to the session config, if the value is correct.
Adjusts the widget according to the correctness (background of text fields etc.).
applyConfigById
in class FileConfigController
id
- config IDprotected void handleDocumentChange(javax.swing.event.DocumentEvent e)
FileConfigController
Adjusts the background color of fields that are not directly related to a config variable, if overridden accordingly.
Does nothing by default. Per default, this is called by all kinds of document change event.
handleDocumentChange
in class FileConfigController
e
- document eventprivate void refillExtraGlobalField()
(Re)fills the text area with ticks for extra global commands. Makes the according config variable ready to be saved.
private java.util.TreeSet<java.lang.Long> getExtraTicksFromTxtArea() throws java.lang.NumberFormatException
Converts the comma-separated extra ticks from the text area into a data structure.
java.lang.NumberFormatException
- if there are errors in the text string.public static javax.swing.DefaultComboBoxModel<NamedInteger> getComboboxModel(java.lang.String id)
Returns the model for a combobox.
id
- config ID, identifying the config variable that the combobox controlsprivate static NamedInteger getMaxNoteLengthCbxModelElement(int ticks, java.lang.String lengthName)
Creates a numbered integer that can be put into the combobox model for the max note length combobox.
ticks
- note length in ticks of the target resolution (480 PPQ)lengthName
- note length name or description