001package jmri.jmrix.marklin.networkdriver;
002
003import javax.swing.JPanel;
004
005/**
006 * Definition of objects to handle configuring an Marklin CS2 layout connection
007 * via a NetworkDriverAdapter object.
008 *
009 * @author Bob Jacobsen Copyright (C) 2001, 2003
010 */
011public class ConnectionConfig extends jmri.jmrix.AbstractNetworkConnectionConfig {
012
013    /**
014     * Ctor for an object being created during load process; Swing init is
015     * deferred.
016     * @param p network port adapter.
017     */
018    public ConnectionConfig(jmri.jmrix.NetworkPortAdapter p) {
019        super(p);
020    }
021
022    /**
023     * Ctor for a connection configuration with no preexisting adapter.
024     * {@link #setInstance()} will fill the adapter member.
025     */
026    public ConnectionConfig() {
027        super();
028    }
029
030    /**
031     * {@inheritDoc}
032     */
033    @Override
034    public void loadDetails(final JPanel details) {
035        super.loadDetails(details);
036        portField.setEnabled(false);
037    }
038
039    @Override
040    public String name() {
041        return "CS2 via network";
042    } // NOI18N
043
044    /**
045     * Access to current selected command station mode
046     */
047    /*public String getMode() {
048     return opt2Box.getSelectedItem().toString();
049     }*/
050
051    @Override
052    protected void setInstance() {
053        if (adapter == null) {
054            adapter = new NetworkDriverAdapter();
055        }
056    }
057
058}