Package jmri.jmrix
Class AbstractSerialConnectionConfig
- java.lang.Object
-
- jmri.jmrix.AbstractConnectionConfig
-
- jmri.jmrix.AbstractSerialConnectionConfig
-
- All Implemented Interfaces:
ConnectionConfig
- Direct Known Subclasses:
AbstractDCCppSerialConnectionConfig,AbstractXNetSerialConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig,ConnectionConfig
public abstract class AbstractSerialConnectionConfig extends AbstractConnectionConfig
Abstract base class for common implementation of the SerialConnectionConfig.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAbstractSerialConnectionConfig.ComboBoxRenderer-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractConnectionConfig
AbstractConnectionConfig.Option
-
-
Field Summary
Fields Modifier and Type Field Description protected SerialPortAdapteradapterprotected javax.swing.JComboBox<java.lang.String>baudBoxprotected javax.swing.JLabelbaudBoxLabelprotected java.lang.String[]baudListprotected booleaninit(package private) java.lang.StringinvalidPort(package private) java.util.Vector<java.lang.String>originalListprotected javax.swing.JLabeloutputIntervalLabelprotected javax.swing.JButtonoutputIntervalResetprotected javax.swing.JSpinneroutputIntervalSpinner(package private) UserPreferencesManagerpprotected javax.swing.JComboBox<java.lang.String>portBoxprotected javax.swing.JLabelportBoxLabel(package private) java.util.Vector<java.lang.String>v-
Fields inherited from class jmri.jmrix.AbstractConnectionConfig
_details, additionalItems, cL, connectionNameField, connectionNameLabel, cR, gbLayout, NUMOPTIONS, options, showAdvanced, systemPrefixField, systemPrefixLabel
-
-
Constructor Summary
Constructors Constructor Description AbstractSerialConnectionConfig()Ctor for a functional object with no preexisting adapter.AbstractSerialConnectionConfig(PortAdapter p)Ctor for an object being created during load process.AbstractSerialConnectionConfig(SerialPortAdapter p)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intaddStandardDetails(boolean incAdvanced, int i)protected voidcheckInitDone()Complete connection adapter initialization, adding desired options to the Connection Configuration pane.voiddispose()Done with this ConnectionConfig object.protected java.util.ResourceBundlegetActionModelResourceBundle()This is purely here for systems that do not implement the SystemConnectionMemo and can be removed once they have been migrated.SerialPortAdaptergetAdapter()java.lang.StringgetConnectionName()booleangetDisabled()java.lang.StringgetInfo()java.lang.StringgetManufacturer()protected java.lang.String[]getPortFriendlyNames()This provides a method to return potentially meaningful names that are used in OS to help identify ports against Hardware.protected java.util.Vector<java.lang.String>getPortNames()Provide a vector of valid port names, each a String.booleanisBaudAdvanced()booleanisPortAdvanced()voidloadDetails(javax.swing.JPanel details)Load the Swing widgets needed to configure this connection into a specified JPanel.voidrefreshPortBox()voidsetDisabled(boolean disabled)protected abstract voidsetInstance()Load the adapter with an appropriate object unless it's already been set.voidsetManufacturer(java.lang.String manufacturer)protected voidshowAdvancedItems()voidupdateAdapter()protected static voidupdateSerialPortNames(java.lang.String portName, javax.swing.JComboBox<java.lang.String> portCombo, java.util.Vector<java.lang.String> portList)Handle friendly port names.-
Methods inherited from class jmri.jmrix.AbstractConnectionConfig
addNameEntryCheckers, addStandardDetails, isDirty, isRestartRequired, register
-
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
name
-
-
-
-
Field Detail
-
init
protected boolean init
-
portBox
protected javax.swing.JComboBox<java.lang.String> portBox
-
portBoxLabel
protected javax.swing.JLabel portBoxLabel
-
baudBox
protected javax.swing.JComboBox<java.lang.String> baudBox
-
baudBoxLabel
protected javax.swing.JLabel baudBoxLabel
-
baudList
protected java.lang.String[] baudList
-
outputIntervalSpinner
protected javax.swing.JSpinner outputIntervalSpinner
-
outputIntervalLabel
protected javax.swing.JLabel outputIntervalLabel
-
outputIntervalReset
protected javax.swing.JButton outputIntervalReset
-
adapter
protected SerialPortAdapter adapter
-
v
java.util.Vector<java.lang.String> v
-
originalList
java.util.Vector<java.lang.String> originalList
-
invalidPort
java.lang.String invalidPort
-
-
Constructor Detail
-
AbstractSerialConnectionConfig
public AbstractSerialConnectionConfig(PortAdapter p)
Ctor for an object being created during load process.- Parameters:
p- port being configured
-
AbstractSerialConnectionConfig
public AbstractSerialConnectionConfig(SerialPortAdapter p)
-
AbstractSerialConnectionConfig
public AbstractSerialConnectionConfig()
Ctor for a functional object with no preexisting adapter. Expect that the subclass setInstance() will fill the adapter member.
-
-
Method Detail
-
getAdapter
public SerialPortAdapter getAdapter()
-
checkInitDone
protected 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
- Specified by:
checkInitDonein classAbstractConnectionConfig
-
updateAdapter
public void updateAdapter()
- Specified by:
updateAdapterin classAbstractConnectionConfig
-
setInstance
protected abstract void setInstance()
Load the adapter with an appropriate object unless it's already been set.- Specified by:
setInstancein classAbstractConnectionConfig
-
getInfo
public java.lang.String getInfo()
- Specified by:
getInfoin interfaceConnectionConfig- Specified by:
getInfoin classAbstractConnectionConfig
-
refreshPortBox
public void refreshPortBox()
-
loadDetails
public 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- Specified by:
loadDetailsin classAbstractConnectionConfig- Parameters:
details- the specific Swing object to be configured and filled
-
showAdvancedItems
protected void showAdvancedItems()
- Specified by:
showAdvancedItemsin classAbstractConnectionConfig
-
addStandardDetails
protected int addStandardDetails(boolean incAdvanced, int i)
-
isPortAdvanced
public boolean isPortAdvanced()
-
isBaudAdvanced
public boolean isBaudAdvanced()
-
getManufacturer
public java.lang.String getManufacturer()
- Specified by:
getManufacturerin interfaceConnectionConfig- Specified by:
getManufacturerin classAbstractConnectionConfig
-
setManufacturer
public void setManufacturer(java.lang.String manufacturer)
- Specified by:
setManufacturerin interfaceConnectionConfig- Specified by:
setManufacturerin classAbstractConnectionConfig
-
getDisabled
public boolean getDisabled()
- Specified by:
getDisabledin interfaceConnectionConfig- Specified by:
getDisabledin classAbstractConnectionConfig
-
setDisabled
public void setDisabled(boolean disabled)
- Specified by:
setDisabledin interfaceConnectionConfig- Specified by:
setDisabledin classAbstractConnectionConfig
-
getConnectionName
public java.lang.String getConnectionName()
- Specified by:
getConnectionNamein interfaceConnectionConfig- Specified by:
getConnectionNamein classAbstractConnectionConfig
-
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- Overrides:
disposein classAbstractConnectionConfig
-
updateSerialPortNames
protected static void updateSerialPortNames(java.lang.String portName, javax.swing.JComboBox<java.lang.String> portCombo, java.util.Vector<java.lang.String> portList)
Handle friendly port names. Note that this changes the selection in portCombo, so that should be tracked after this returns.- Parameters:
portName- The currently-selected port nameportCombo- The combo box that's displaying the available portsportList- The list of valid (unfriendly) port names
-
getPortNames
protected java.util.Vector<java.lang.String> getPortNames()
Provide a vector of valid port names, each a String. This may be implemented differently in subclasses that e.g. do loopback or use a custom port-access library.- Returns:
- Valid port names in the form used to select them later.
-
getPortFriendlyNames
protected java.lang.String[] getPortFriendlyNames()
This provides a method to return potentially meaningful names that are used in OS to help identify ports against Hardware.- Returns:
- array of friendly port names
-
getActionModelResourceBundle
protected java.util.ResourceBundle getActionModelResourceBundle()
This is purely here for systems that do not implement the SystemConnectionMemo and can be removed once they have been migrated.- Returns:
- Resource bundle for action model
-
-