001package jmri.jmrix.loconet.pr4;
002
003import jmri.util.SystemType;
004
005/**
006 * Definition of objects to handle configuring a PR4 layout connection via a
007 * PR2Adapter object.
008 * <p>
009 * Copied from loconet.pr3.ConnectionConfig
010 *
011 * @author Bob Jacobsen Copyright (C) 2001, 2003, 2008, 2010
012 * @author B. Milhaupt Copyright (C) 2019
013 */
014
015public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig {
016
017    /**
018     * Ctor for an object being created during load process; Swing init is
019     * deferred.
020     * 
021     * @param p   Serial port adapter for the connection
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    /**
036     * Get the connection type name.
037     *
038     * @return Connection type name
039     */
040    @Override
041    public String name() {
042        return "LocoNet PR4"; // NOI18N
043    }
044
045    /**
046     * Is Option List 2 Advanced?
047     * @return boolean, always false 
048     */
049    public boolean isOptList2Advanced() {
050        return false;
051    }
052
053    @Override
054    protected String[] getPortFriendlyNames() {
055        if (SystemType.isWindows()) {
056            return new String[]{"Communications Port"}; // NOI18N
057        }
058        return new String[]{};
059    }
060
061    /**
062     * {@inheritDoc}
063     */
064    @Override
065    protected void setInstance() {
066        if (adapter == null) {
067            adapter = new PR4Adapter();
068        }
069    }
070
071}