001package jmri.jmrit.logixng.actions.configurexml; 002 003import jmri.*; 004import jmri.configurexml.JmriConfigureXmlException; 005import jmri.jmrit.logixng.StringActionManager; 006import jmri.jmrit.logixng.actions.StringActionStringIO; 007import jmri.jmrit.logixng.util.configurexml.LogixNG_SelectNamedBeanXml; 008 009import org.jdom2.Element; 010 011/** 012 * 013 */ 014public class StringActionStringIOXml extends jmri.managers.configurexml.AbstractNamedBeanManagerConfigXML { 015 016 public StringActionStringIOXml() { 017 } 018 019 /** 020 * Default implementation for storing the contents of a StringActionStringIO 021 * 022 * @param o Object to store, of type TripleLightSignalHead 023 * @return Element containing the complete info 024 */ 025 @Override 026 public Element store(Object o) { 027 StringActionStringIO p = (StringActionStringIO) o; 028 029 Element element = new Element("StringActionStringIO"); 030 element.setAttribute("class", this.getClass().getName()); 031 element.addContent(new Element("systemName").addContent(p.getSystemName())); 032 033 storeCommon(p, element); 034 035 var selectNamedBeanXml = new LogixNG_SelectNamedBeanXml<StringIO>(); 036 element.addContent(selectNamedBeanXml.store(p.getSelectNamedBean(), "namedBean")); 037 038 return element; 039 } 040 041 @Override 042 public boolean load(Element shared, Element perNode) throws JmriConfigureXmlException { // Test class that inherits this class throws exception 043 String sys = getSystemName(shared); 044 String uname = getUserName(shared); 045 StringActionStringIO h = new StringActionStringIO(sys, uname); 046 047 loadCommon(h, shared); 048 049 var selectNamedBeanXml = new LogixNG_SelectNamedBeanXml<StringIO>(); 050 selectNamedBeanXml.load(shared.getChild("namedBean"), h.getSelectNamedBean()); 051 selectNamedBeanXml.loadLegacy(shared, h.getSelectNamedBean(), "stringIO"); 052 053 InstanceManager.getDefault(StringActionManager.class).registerAction(h); 054 return true; 055 } 056 057// private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(StringActionStringIOXml.class); 058}