Search in sources :

Example 1 with PerformScriptModel

use of apps.PerformScriptModel in project JMRI by JMRI.

the class PerformScriptModelXml method store.

/**
     * Default implementation for storing the model contents
     *
     * @param o Object to store, of type PerformActonModel
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    Element e = new Element("perform");
    PerformScriptModel g = (PerformScriptModel) o;
    e.setAttribute("name", FileUtil.getPortableFilename(g.getFileName()));
    e.setAttribute("type", "ScriptFile");
    e.setAttribute("class", this.getClass().getName());
    return e;
}
Also used : Element(org.jdom2.Element) PerformScriptModel(apps.PerformScriptModel)

Example 2 with PerformScriptModel

use of apps.PerformScriptModel in project JMRI by JMRI.

the class PerformScriptModelXml method load.

@Override
public boolean load(Element shared, Element perNode) throws Exception {
    boolean result = true;
    String fileName = shared.getAttribute("name").getValue();
    fileName = FileUtil.getAbsoluteFilename(fileName);
    PerformScriptModel m = new PerformScriptModel();
    m.setFileName(fileName);
    InstanceManager.getDefault(StartupActionsManager.class).addAction(m);
    return result;
}
Also used : StartupActionsManager(apps.StartupActionsManager) PerformScriptModel(apps.PerformScriptModel)

Aggregations

PerformScriptModel (apps.PerformScriptModel)2 StartupActionsManager (apps.StartupActionsManager)1 Element (org.jdom2.Element)1