001package jmri.jmrix.zimo.mxulf;
002
003import java.util.ResourceBundle;
004import jmri.util.SystemType;
005import org.slf4j.Logger;
006import org.slf4j.LoggerFactory;
007
008/**
009 * Definition of objects to handle configuring an Zimo MXULF SerialDriverAdapter
010 * object.
011 *
012 * @author Bob Jacobsen Copyright (C) 2001, 2003
013 *
014 */
015public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig {
016
017    private final static Logger log = LoggerFactory.getLogger(ConnectionConfig.class);
018
019    /**
020     * Create a connection with a known serial port.
021     *
022     * @param p the serial port
023     */
024    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
025        super(p);
026    }
027
028    /**
029     * Create a connection without a known serial port.
030     */
031    public ConnectionConfig() {
032        super();
033    }
034
035    /**
036     * {@inheritDoc}
037     */
038    @Override
039    protected void checkInitDone() {
040        log.debug("init called for {}", name());
041        if (init) {
042            return;
043        }
044        super.checkInitDone();
045        connectionNameField.setText(name());
046    }
047
048    @Override
049    protected ResourceBundle getActionModelResourceBundle() {
050        return ResourceBundle.getBundle("jmri.jmrix.zimo.ZimoActionListBundle");
051    }
052
053    @Override
054    public String name() {
055        return "MXULF"; // NOI18N
056    }
057
058    /**
059     * {@inheritDoc}
060     */
061    @Override
062    protected void setInstance() {
063        if (adapter == null) {
064            adapter = new SerialDriverAdapter();
065        }
066    }
067
068    @Override
069    protected String[] getPortFriendlyNames() {
070        if (SystemType.isWindows()) {
071            return new String[]{"MX31ZL", "ZIMO"};
072        }
073        return new String[]{};
074    }
075
076}