001package jmri.jmrix.lenz.hornbyelite.configurexml; 002 003import jmri.jmrix.configurexml.AbstractSerialConnectionConfigXml; 004import jmri.jmrix.lenz.hornbyelite.ConnectionConfig; 005import jmri.jmrix.lenz.hornbyelite.EliteAdapter; 006 007/** 008 * Handle XML persistance of layout connections by persistening the EliteAdapter 009 * (and connections). Note this is named as the XML version of a 010 * ConnectionConfig object, but it's actually persisting the EliteAdapter. 011 * <p> 012 * This class is invoked from jmrix.JmrixConfigPaneXml on write, as that class 013 * is the one actually registered. Reads are brought here directly via the class 014 * attribute in the XML. 015 * 016 * @author Bob Jacobsen Copyright: Copyright (c) 2003 017 */ 018public class ConnectionConfigXml extends AbstractSerialConnectionConfigXml { 019 020 public ConnectionConfigXml() { 021 super(); 022 } 023 024 @Override 025 protected void getInstance() { 026 if (adapter == null) { 027 adapter = new EliteAdapter(); 028 } 029 } 030 031 @Override 032 protected void getInstance(Object object) { 033 adapter = ((ConnectionConfig) object).getAdapter(); 034 } 035 036 @Override 037 protected void register() { 038 this.register(new ConnectionConfig(adapter)); 039 } 040 041}