001package jmri.jmrix.can.adapters.gridconnect.pilcc.serialdriver.configurexml; 002 003import org.jdom2.Element; 004 005import jmri.jmrix.PortAdapter; 006import jmri.jmrix.can.adapters.gridconnect.pilcc.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 */ 022public class ConnectionConfigXml extends AbstractSerialConnectionConfigXml { 023 024 public ConnectionConfigXml() { 025 super(); 026 } 027 028 @Override 029 protected void getInstance() { 030 adapter = new PiLccSerialDriverAdapter(); 031 } 032 033 @Override 034 protected void getInstance(Object object) { 035 adapter = ((ConnectionConfig) object).getAdapter(); 036 } 037 038 @Override 039 protected void register() { 040 this.register(new ConnectionConfig(adapter)); 041 } 042 043 @Override 044 protected void loadOptions(Element shared, Element perNode, PortAdapter adapter) { 045 super.loadOptions(shared, perNode, adapter); 046 047 jmri.jmrix.openlcb.configurexml.ConnectionConfigXml.maybeLoadOlcbProfileSettings( 048 shared.getParentElement(), perNode.getParentElement(), adapter); 049 } 050 051 @Override 052 protected void extendElement(Element e) { 053 jmri.jmrix.openlcb.configurexml.ConnectionConfigXml.maybeSaveOlcbProfileSettings( 054 e, adapter); 055 } 056}