001package jmri.jmrix.oaktree.serialdriver; 002 003import javax.swing.JButton; 004import javax.swing.JPanel; 005import jmri.jmrix.oaktree.OakTreeSystemConnectionMemo; 006import jmri.jmrix.oaktree.nodeconfig.NodeConfigAction; 007 008/** 009 * Definition of objects to handle configuring a Oak Tree layout connection. 010 * 011 * @author Bob Jacobsen Copyright (C) 2003, 2006 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 b.addActionListener(new NodeConfigAction((OakTreeSystemConnectionMemo) adapter.getSystemConnectionMemo())); 042 // add another button 043 if (!additionalItems.contains(b)) { 044 additionalItems.add(b); 045 } 046 super.loadDetails(details); 047 } 048 049 @Override 050 public String name() { 051 return Bundle.getMessage("RciBus"); 052 } 053 054 /** 055 * {@inheritDoc} 056 */ 057 @Override 058 protected void setInstance() { 059 if (adapter == null ) { 060 adapter = new SerialDriverAdapter(); 061 } 062 } 063 064}