001package jmri.jmrix.can.adapters.gridconnect.sproggen5.serialdriver.configurexml; 002 003import org.jdom2.Element; 004 005import jmri.jmrix.PortAdapter; 006import jmri.jmrix.can.adapters.gridconnect.sproggen5.serialdriver.*; 007import jmri.jmrix.configurexml.AbstractSerialConnectionConfigXml; 008 009/** 010 * Handle XML persistance of layout connections by persistening the 011 * SerialDriverAdapter (and connections). Note this is named as the XML version 012 * of a ConnectionConfig object, but it's actually persisting the 013 * SerialDriverAdapter. 014 * <p> 015 * This class is invoked from jmrix.JmrixConfigPaneXml on write, as that class 016 * is the one actually registered. Reads are brought here directly via the class 017 * attribute in the XML. 018 * 019 * @author Bob Jacobsen Copyright: Copyright (c) 2003 020 * @author Andrew Crosland 2008 021 * @author Andrew Crosland 2019 022 */ 023public class PiSprog3ConnectionConfigXml extends AbstractSerialConnectionConfigXml { 024 025 public PiSprog3ConnectionConfigXml() { 026 super(); 027 } 028 029 @Override 030 protected void getInstance() { 031 adapter = new PiSprog3SerialDriverAdapter(); 032 } 033 034 @Override 035 protected void getInstance(Object object) { 036 adapter = ((PiSprog3ConnectionConfig) object).getAdapter(); 037 } 038 039 @Override 040 protected void register() { 041 this.register(new PiSprog3ConnectionConfig(adapter)); 042 } 043 044 @Override 045 protected void loadOptions(Element shared, Element perNode, PortAdapter adapter) { 046 super.loadOptions(shared, perNode, adapter); 047 048 jmri.jmrix.openlcb.configurexml.ConnectionConfigXml.maybeLoadOlcbProfileSettings( 049 shared.getParentElement(), perNode.getParentElement(), adapter); 050 } 051 052 @Override 053 protected void extendElement(Element e) { 054 jmri.jmrix.openlcb.configurexml.ConnectionConfigXml.maybeSaveOlcbProfileSettings( 055 e, adapter); 056 } 057}