Package jmri.jmrix
Class AbstractConnectionConfig
java.lang.Object
jmri.jmrix.AbstractConnectionConfig
- All Implemented Interfaces:
ConnectionConfig
- Direct Known Subclasses:
AbstractNetworkConnectionConfig
,AbstractSerialConnectionConfig
,AbstractSimulatorConnectionConfig
,AbstractStreamConnectionConfig
,AbstractUsbConnectionConfig
,IpocsConnectionConfig
,RaspberryPiConnectionConfig
public abstract class AbstractConnectionConfig extends Object implements ConnectionConfig
Abstract base class for common implementation of the ConnectionConfig.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractConnectionConfig.Option
-
Field Summary
Fields Modifier and Type Field Description protected JPanel
_details
protected ArrayList<JComponent>
additionalItems
protected GridBagConstraints
cL
protected JTextField
connectionNameField
protected JLabel
connectionNameLabel
protected GridBagConstraints
cR
protected GridBagLayout
gbLayout
protected int
NUMOPTIONS
protected Map<String,AbstractConnectionConfig.Option>
options
protected JCheckBox
showAdvanced
protected ValidatedTextField
systemPrefixField
protected JLabel
systemPrefixLabel
-
Constructor Summary
Constructors Constructor Description AbstractConnectionConfig()
Ctor for a functional object with no preexisting adapter. -
Method Summary
Modifier and Type Method Description protected void
addNameEntryCheckers(PortAdapter adapter)
protected int
addStandardDetails(PortAdapter adapter, boolean incAdvanced, int i)
protected abstract void
checkInitDone()
Complete connection adapter initialization, adding desired options to the Connection Configuration pane.void
dispose()
Done with this ConnectionConfig object.abstract String
getConnectionName()
abstract boolean
getDisabled()
abstract String
getInfo()
abstract String
getManufacturer()
boolean
isDirty()
Determine if configuration needs to be written to disk.boolean
isRestartRequired()
Determine if application needs to be restarted for configuration changes to be applied.abstract void
loadDetails(JPanel details)
Load the Swing widgets needed to configure this connection into a specified JPanel.void
register()
Register the ConnectionConfig with the running JMRI process.abstract void
setDisabled(boolean disable)
protected abstract void
setInstance()
Load the adapter with an appropriate object unless it's already been set.abstract void
setManufacturer(String manufacturer)
protected abstract void
showAdvancedItems()
abstract void
updateAdapter()
-
Field Details
-
Constructor Details
-
AbstractConnectionConfig
public AbstractConnectionConfig()Ctor for a functional object with no preexisting adapter. Expect that the subclass setInstance() will fill the adapter member.AbstractConnectionConfigXml
loadCommon
-
-
Method Details
-
checkInitDone
Complete connection adapter initialization, adding desired options to the Connection Configuration pane. Required action: set init to true. Optional actions:- fill in connectionNameField
- add ActionListeners to config fields eg. systemPrefixField to update adapter after change by the user
-
updateAdapter
-
isDirty
Determine if configuration needs to be written to disk.This default implementation always returns true to maintain the existing behavior.
- Specified by:
isDirty
in interfaceConnectionConfig
- Returns:
- true if configuration need to be saved, false otherwise
-
isRestartRequired
Determine if application needs to be restarted for configuration changes to be applied.The default implementation always returns true to maintain the existing behavior.
- Specified by:
isRestartRequired
in interfaceConnectionConfig
- Returns:
- true if application needs to restart, false otherwise
-
setInstance
Load the adapter with an appropriate object unless it's already been set. -
getInfo
- Specified by:
getInfo
in interfaceConnectionConfig
-
loadDetails
Load the Swing widgets needed to configure this connection into a specified JPanel. Used during the configuration process to fill out the preferences window with content specific to this Connection type. The JPanel contents need to handle their own gets/sets to the underlying Connection content.- Specified by:
loadDetails
in interfaceConnectionConfig
- Parameters:
details
- the specific Swing object to be configured and filled
-
showAdvancedItems
-
addStandardDetails
-
getManufacturer
- Specified by:
getManufacturer
in interfaceConnectionConfig
-
setManufacturer
- Specified by:
setManufacturer
in interfaceConnectionConfig
-
getConnectionName
- Specified by:
getConnectionName
in interfaceConnectionConfig
-
getDisabled
- Specified by:
getDisabled
in interfaceConnectionConfig
-
setDisabled
- Specified by:
setDisabled
in interfaceConnectionConfig
-
register
Register the ConnectionConfig with the running JMRI process.At a minimum, is responsible for:
- Registering this object with the ConfigurationManager for persistance, typically at the "Preferences" level
- Adding this object to the default (@link ConnectionConfigManager}
- Specified by:
register
in interfaceConnectionConfig
-
dispose
Description copied from interface:ConnectionConfig
Done with this ConnectionConfig object. Invoked inJmrixConfigPane
when switching away from this particular mode.- Specified by:
dispose
in interfaceConnectionConfig
-
addNameEntryCheckers
-