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
,RaspberryPiSimulatorConnectionConfig
public abstract class AbstractConnectionConfig extends java.lang.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 javax.swing.JPanel
_details
protected java.util.ArrayList<javax.swing.JComponent>
additionalItems
protected java.awt.GridBagConstraints
cL
protected javax.swing.JTextField
connectionNameField
protected javax.swing.JLabel
connectionNameLabel
protected java.awt.GridBagConstraints
cR
protected java.awt.GridBagLayout
gbLayout
protected int
NUMOPTIONS
protected java.util.Map<java.lang.String,AbstractConnectionConfig.Option>
options
protected javax.swing.JCheckBox
showAdvanced
protected ValidatedTextField
systemPrefixField
protected javax.swing.JLabel
systemPrefixLabel
-
Constructor Summary
Constructors Constructor Description AbstractConnectionConfig()
Ctor for a functional object with no preexisting adapter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods 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 java.lang.String
getConnectionName()
abstract boolean
getDisabled()
abstract java.lang.String
getInfo()
abstract java.lang.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(javax.swing.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(java.lang.String manufacturer)
protected abstract void
showAdvancedItems()
abstract void
updateAdapter()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.ConnectionConfig
getAdapter, name
-
-
-
-
Field Detail
-
NUMOPTIONS
protected int NUMOPTIONS
-
showAdvanced
protected javax.swing.JCheckBox showAdvanced
-
systemPrefixLabel
protected javax.swing.JLabel systemPrefixLabel
-
connectionNameLabel
protected javax.swing.JLabel connectionNameLabel
-
systemPrefixField
protected ValidatedTextField systemPrefixField
-
connectionNameField
protected javax.swing.JTextField connectionNameField
-
_details
protected javax.swing.JPanel _details
-
options
protected final java.util.Map<java.lang.String,AbstractConnectionConfig.Option> options
-
additionalItems
protected java.util.ArrayList<javax.swing.JComponent> additionalItems
-
gbLayout
protected java.awt.GridBagLayout gbLayout
-
cL
protected java.awt.GridBagConstraints cL
-
cR
protected java.awt.GridBagConstraints cR
-
-
Constructor Detail
-
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 Detail
-
checkInitDone
protected abstract void 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
public abstract void updateAdapter()
-
isDirty
public boolean 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
public boolean 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
protected abstract void setInstance()
Load the adapter with an appropriate object unless it's already been set.
-
getInfo
public abstract java.lang.String getInfo()
- Specified by:
getInfo
in interfaceConnectionConfig
-
loadDetails
public abstract void loadDetails(javax.swing.JPanel details)
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
protected abstract void showAdvancedItems()
-
addStandardDetails
protected int addStandardDetails(PortAdapter adapter, boolean incAdvanced, int i)
-
getManufacturer
public abstract java.lang.String getManufacturer()
- Specified by:
getManufacturer
in interfaceConnectionConfig
-
setManufacturer
public abstract void setManufacturer(java.lang.String manufacturer)
- Specified by:
setManufacturer
in interfaceConnectionConfig
-
getConnectionName
public abstract java.lang.String getConnectionName()
- Specified by:
getConnectionName
in interfaceConnectionConfig
-
getDisabled
public abstract boolean getDisabled()
- Specified by:
getDisabled
in interfaceConnectionConfig
-
setDisabled
public abstract void setDisabled(boolean disable)
- Specified by:
setDisabled
in interfaceConnectionConfig
-
register
public void 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
public void 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
protected void addNameEntryCheckers(@Nonnull PortAdapter adapter)
-
-