001package jmri.jmrix.lenz.liusb;
002
003import jmri.util.SystemType;
004
005/**
006 * Handle configuring an XpressNet layout connection via a Lenz LIUSBadapter.
007 * <p>
008 * This uses the {@link LIUSBAdapter} class to do the actual connection.
009 *
010 * @author Paul Bender Copyright (C) 2005
011 *
012 * @see LIUSBAdapter
013 */
014public class ConnectionConfig extends jmri.jmrix.lenz.AbstractXNetSerialConnectionConfig {
015
016    /**
017     * Ctor for an object being created during load process.
018     * Swing init is deferred.
019     * @param p serial port adapter.
020     */
021    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
022        super(p);
023    }
024
025    /**
026     * Ctor for a connection configuration with no preexisting adapter.
027     * {@link #setInstance()} will fill the adapter member.
028     */
029    public ConnectionConfig() {
030        super();
031    }
032
033    @Override
034    public String name() {
035        return "Lenz LIUSB"; // NOI18N
036    }
037
038    @Override
039    protected String[] getPortFriendlyNames() {
040        if (SystemType.isWindows()) {
041            return new String[]{Bundle.getMessage("LIUSBSerialPortOption"), "LI-USB"};
042        }
043        return new String[]{};
044    }
045
046    /**
047     * {@inheritDoc}
048     */
049    @Override
050    protected void setInstance() {
051        if (adapter == null) {
052            adapter = new LIUSBAdapter();
053        }
054    }
055
056}