001package jmri.jmrix.secsi.serialdriver; 002 003import javax.swing.JButton; 004import javax.swing.JPanel; 005import jmri.jmrix.secsi.nodeconfig.NodeConfigAction; 006import jmri.jmrix.secsi.SecsiSystemConnectionMemo; 007 008/** 009 * Definition of objects to handle configuring a SECSI layout connection. 010 * 011 * @author Bob Jacobsen Copyright (C) 2003, 2006, 2007 012 */ 013public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig { 014 015 /** 016 * Ctor for an object being created during load process; Swing init is 017 * deferred. 018 * @param p Serial port adapter. 019 */ 020 public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) { 021 super(p); 022 } 023 024 /** 025 * Ctor for a connection configuration with no preexisting adapter. 026 * {@link #setInstance()} will fill the adapter member. 027 */ 028 public ConnectionConfig() { 029 super(); 030 } 031 032 JButton b = new JButton(Bundle.getMessage("ConfigNodesTitle")); 033 034 /** 035 * {@inheritDoc} 036 */ 037 @Override 038 public void loadDetails(JPanel details) { 039 setInstance(); 040 041 // have to embed the usual one in a new JPanel 042 b.addActionListener(new NodeConfigAction((SecsiSystemConnectionMemo)adapter.getSystemConnectionMemo())); 043 // add another button 044 if (!additionalItems.contains(b)) { 045 additionalItems.add(b); 046 } 047 super.loadDetails(details); 048 } 049 050 @Override 051 public String name() { 052 return Bundle.getMessage("SecsiBusConnection"); 053 } 054 055 /** 056 * {@inheritDoc} 057 */ 058 @Override 059 protected void setInstance() { 060 if (adapter == null ) { 061 adapter = new SerialDriverAdapter(); 062 } 063 } 064 065}