001package jmri.jmrix.direct.serial;
002
003import jmri.util.SystemType;
004
005/**
006 * Definition of objects to handle configuring a layout connection via a
007 * SerialDriverAdapter object.
008 *
009 * @author Bob Jacobsen Copyright (C) 2001, 2003
010 */
011public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig {
012
013    /**
014     * Ctor for an object being created during load process; Swing init is
015     * deferred.
016     * @param p serial port adapter.
017     */
018    public ConnectionConfig(jmri.jmrix.SerialPortAdapter 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    @Override
031    public String name() {
032        if (SystemType.isMacOSX()
033                || (SystemType.isWindows() && Double.parseDouble(System.getProperty("os.version")) >= 6)) {
034            return Bundle.getMessage("DirectSerialNameNot");
035        }
036
037        return Bundle.getMessage("DirectSerialName");
038    }
039
040    /**
041     * {@inheritDoc}
042     */
043    @Override
044    protected void setInstance() {
045        if (adapter == null) {
046            adapter = new SerialDriverAdapter();
047        }
048    }
049    
050}