001package jmri.jmrix.zimo.mx1;
002
003import java.util.ResourceBundle;
004import org.slf4j.Logger;
005import org.slf4j.LoggerFactory;
006
007/**
008 * Definition of objects to handle configuring an LocoBuffer layout connection
009 * via a Zimo MX-1 SerialDriverAdapter object.
010 *
011 * @author Bob Jacobsen Copyright (C) 2001, 2003
012 */
013public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig {
014
015    private final static Logger log = LoggerFactory.getLogger(ConnectionConfig.class);
016
017    /**
018     * Ctor for an object being created during load process; Swing init is
019     * deferred.
020     *
021     * @param p the associated serial port
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     * {@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 "MX-1"; // NOI18N
056    }
057
058    /**
059     * {@inheritDoc}
060     */
061    @Override
062    protected void setInstance() {
063        adapter = new Mx1Adapter();
064    }
065
066}