Search in sources :

Example 1 with ProgrammerConfigPane

use of jmri.jmrit.symbolicprog.ProgrammerConfigPane in project JMRI by JMRI.

the class ProgrammerConfigPaneXml method store.

/**
     * Default implementation for storing the static contents
     *
     * @param o Object to store, of type PositionableLabel
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    ProgrammerConfigPane p = (ProgrammerConfigPane) o;
    Element programmer = new Element("programmer");
    if (p.getSelectedItem() != null) {
        programmer.setAttribute("defaultFile", p.getSelectedItem());
    }
    programmer.setAttribute("verifyBeforeWrite", "no");
    if (!p.getShowEmptyTabs()) {
        programmer.setAttribute("showEmptyPanes", "no");
    }
    if (p.getShowCvNums()) {
        programmer.setAttribute("showCvNumbers", "yes");
    }
    if (p.getCanCacheDefault()) {
        programmer.setAttribute("canCacheDefault", "yes");
    } else {
        programmer.setAttribute("canCacheDefault", "no");
    }
    if (p.getDoConfirmRead()) {
        programmer.setAttribute("doConfirmRead", "yes");
    } else {
        programmer.setAttribute("doConfirmRead", "no");
    }
    programmer.setAttribute("class", this.getClass().getName());
    return programmer;
}
Also used : Element(org.jdom2.Element) ProgrammerConfigPane(jmri.jmrit.symbolicprog.ProgrammerConfigPane)

Example 2 with ProgrammerConfigPane

use of jmri.jmrit.symbolicprog.ProgrammerConfigPane in project JMRI by JMRI.

the class ProgrammerConfigPaneXml method load.

@Override
public boolean load(Element shared, Element perNode) {
    boolean result = true;
    if (shared.getAttribute("defaultFile") != null) {
        if (log.isDebugEnabled()) {
            log.debug("set programmer default file: " + shared.getAttribute("defaultFile").getValue());
        }
        InstanceManager.getDefault(ProgrammerConfigManager.class).setDefaultFile(shared.getAttribute("defaultFile").getValue());
    }
    Attribute a;
    if (null != (a = shared.getAttribute("showEmptyPanes"))) {
        InstanceManager.getDefault(ProgrammerConfigManager.class).setShowEmptyPanes(!a.getValue().equals("no"));
    }
    if (null != (a = shared.getAttribute("showCvNumbers"))) {
        InstanceManager.getDefault(ProgrammerConfigManager.class).setShowCvNumbers(a.getValue().equals("yes"));
    }
    if (null != (a = shared.getAttribute("canCacheDefault"))) {
        InstanceManager.getDefault(ProgrammerConfigManager.class).setCanCacheDefault(a.getValue().equals("yes"));
    }
    if (null != (a = shared.getAttribute("doConfirmRead"))) {
        InstanceManager.getDefault(ProgrammerConfigManager.class).setDoConfirmRead(a.getValue().equals("yes"));
    }
    ConfigureManager cm = InstanceManager.getNullableDefault(jmri.ConfigureManager.class);
    if (cm != null) {
        cm.registerPref(new ProgrammerConfigPane());
    }
    return result;
}
Also used : ConfigureManager(jmri.ConfigureManager) Attribute(org.jdom2.Attribute) ProgrammerConfigManager(jmri.jmrit.symbolicprog.ProgrammerConfigManager) ProgrammerConfigPane(jmri.jmrit.symbolicprog.ProgrammerConfigPane)

Aggregations

ProgrammerConfigPane (jmri.jmrit.symbolicprog.ProgrammerConfigPane)2 ConfigureManager (jmri.ConfigureManager)1 ProgrammerConfigManager (jmri.jmrit.symbolicprog.ProgrammerConfigManager)1 Attribute (org.jdom2.Attribute)1 Element (org.jdom2.Element)1