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 classAbstractConnectionConfig.Option
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.JPanel_detailsprotected java.util.ArrayList<javax.swing.JComponent>additionalItemsprotected java.awt.GridBagConstraintscLprotected javax.swing.JTextFieldconnectionNameFieldprotected javax.swing.JLabelconnectionNameLabelprotected java.awt.GridBagConstraintscRprotected java.awt.GridBagLayoutgbLayoutprotected intNUMOPTIONSprotected java.util.Map<java.lang.String,AbstractConnectionConfig.Option>optionsprotected javax.swing.JCheckBoxshowAdvancedprotected ValidatedTextFieldsystemPrefixFieldprotected javax.swing.JLabelsystemPrefixLabel
-
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 voidaddNameEntryCheckers(PortAdapter adapter)protected intaddStandardDetails(PortAdapter adapter, boolean incAdvanced, int i)protected abstract voidcheckInitDone()Complete connection adapter initialization, adding desired options to the Connection Configuration pane.voiddispose()Done with this ConnectionConfig object.abstract java.lang.StringgetConnectionName()abstract booleangetDisabled()abstract java.lang.StringgetInfo()abstract java.lang.StringgetManufacturer()booleanisDirty()Determine if configuration needs to be written to disk.booleanisRestartRequired()Determine if application needs to be restarted for configuration changes to be applied.abstract voidloadDetails(javax.swing.JPanel details)Load the Swing widgets needed to configure this connection into a specified JPanel.voidregister()Register the ConnectionConfig with the running JMRI process.abstract voidsetDisabled(boolean disable)protected abstract voidsetInstance()Load the adapter with an appropriate object unless it's already been set.abstract voidsetManufacturer(java.lang.String manufacturer)protected abstract voidshowAdvancedItems()abstract voidupdateAdapter()-
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.AbstractConnectionConfigXmlloadCommon
-
-
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:
isDirtyin 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:
isRestartRequiredin 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:
getInfoin 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:
loadDetailsin 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:
getManufacturerin interfaceConnectionConfig
-
setManufacturer
public abstract void setManufacturer(java.lang.String manufacturer)
- Specified by:
setManufacturerin interfaceConnectionConfig
-
getConnectionName
public abstract java.lang.String getConnectionName()
- Specified by:
getConnectionNamein interfaceConnectionConfig
-
getDisabled
public abstract boolean getDisabled()
- Specified by:
getDisabledin interfaceConnectionConfig
-
setDisabled
public abstract void setDisabled(boolean disable)
- Specified by:
setDisabledin 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:
registerin interfaceConnectionConfig
-
dispose
public void dispose()
Description copied from interface:ConnectionConfigDone with this ConnectionConfig object. Invoked inJmrixConfigPanewhen switching away from this particular mode.- Specified by:
disposein interfaceConnectionConfig
-
addNameEntryCheckers
protected void addNameEntryCheckers(@Nonnull PortAdapter adapter)
-
-