001package jmri.jmrix.ieee802154.serialdriver;
002
003import javax.swing.BoxLayout;
004import javax.swing.JPanel;
005
006/**
007 * Definition of objects to handle configuring a layout connection
008 *
009 * @author Bob Jacobsen Copyright (C) 2003, 2006, 2007, 2008
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     *
017     * @param p serial port adapter for connection
018     */
019    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
020        super(p);
021    }
022
023    /**
024     * Ctor for a connection configuration with no preexisting adapter.
025     * {@link #setInstance()} will fill the adapter member.
026     */
027    public ConnectionConfig() {
028        super();
029    }
030
031    /**
032     * {@inheritDoc}
033     */
034    @Override
035    public void loadDetails(JPanel details) {
036        // have to embed the usual one in a new JPanel
037
038        JPanel p = new JPanel();
039        super.loadDetails(p);
040
041        details.setLayout(new BoxLayout(details, BoxLayout.Y_AXIS));
042        details.add(p);
043
044        // add another button
045        //JButton b = new JButton("Configure nodes");
046        //details.add(b);
047        //b.addActionListener(new NodeConfigAction());  
048    }
049
050    @Override
051    public String name() {
052        return "Generic IEEE 802.15.4";
053    }
054
055    public boolean isOptList1Advanced() {
056        return false;
057    }
058
059    @Override
060    protected void setInstance() {
061        if (adapter == null) {
062            adapter = new SerialDriverAdapter();
063        }
064    }
065
066}