001package jmri.jmrix.tams.simulator;
002
003import javax.swing.JPanel;
004
005/**
006 * Definition of objects to handle configuring a layout connection via a Tams
007 * SerialDriverAdapter object.
008 *
009 * @author Bob Jacobsen Copyright (C) 2001, 2003 Copied from NCE
010 * @author kcameron Copyright (C) 2014
011 */
012public class ConnectionConfig extends jmri.jmrix.AbstractSimulatorConnectionConfig {
013
014    public final static String NAME = "Simulator"; // TODO I18N using Bundle.getMessage("key")
015
016    /**
017     * Create a connection configuration with a preexisting adapter. This is
018     * used principally when loading a configuration that defines this
019     * connection.
020     *
021     * @param p the adapter to create a connection configuration for
022     */
023    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
024        super(p);
025    }
026
027    /**
028     * Ctor for a connection configuration with no preexisting adapter.
029     * {@link #setInstance()} will fill the adapter member.
030     */
031    public ConnectionConfig() {
032        super();
033    }
034
035    @Override
036    public String name() {
037        return NAME;
038    }
039
040    /**
041     * {@inheritDoc}
042     */
043    @Override
044    public void loadDetails(JPanel details) {
045        super.loadDetails(details);
046    }
047
048    /**
049     * {@inheritDoc}
050     */
051    @Override
052    protected void setInstance() {
053        if (adapter == null) {
054            adapter = new SimulatorAdapter();
055        }
056    }
057
058}