001package apps.configurexml;
002
003import jmri.ConfigureManager;
004import jmri.InstanceManager;
005import jmri.managers.ManagerDefaultSelector;
006import org.jdom2.Element;
007import org.slf4j.Logger;
008import org.slf4j.LoggerFactory;
009
010/**
011 * Handle XML persistence of ManagerDefaultsConfigPane objects.
012 *
013 * @author Bob Jacobsen Copyright: Copyright (c) 2010
014 */
015public class ManagerDefaultsConfigPaneXml extends jmri.configurexml.AbstractXmlAdapter {
016
017    public ManagerDefaultsConfigPaneXml() {
018    }
019
020    /**
021     * Arrange for ManagerDefaultSelector to be stored
022     *
023     * @param o Object to store, ignored
024     * @return null after others arranged
025     */
026    @Override
027    public Element store(Object o) {
028        ConfigureManager cm = InstanceManager.getNullableDefault(jmri.ConfigureManager.class);
029        if (cm != null) {
030            cm.registerPref(InstanceManager.getDefault(ManagerDefaultSelector.class));
031        }
032        return null;
033    }
034
035    @Override
036    public boolean load(Element shared, Element perNode) {
037        log.error("load(Element) should not have been invoked");
038        return false;
039    }
040
041    /**
042     * Update static data from XML file
043     *
044     * @param element Top level Element to unpack.
045     * @param o       ignored
046     */
047    @Override
048    public void load(Element element, Object o) {
049        log.error("Unexpected call of load(Element, Object)");
050    }
051    // initialize logging
052    private final static Logger log = LoggerFactory.getLogger(ManagerDefaultsConfigPaneXml.class);
053
054}