Search in sources :

Example 1 with CreateButtonModel

use of apps.CreateButtonModel in project JMRI by JMRI.

the class CreateButtonModelXml method store.

/**
     * Default implementation for storing the model contents
     *
     * @param o Object to store, of type CreateButtonModel
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    Element element = new Element("perform");
    CreateButtonModel g = (CreateButtonModel) o;
    element.setAttribute("name", g.getClassName());
    element.setAttribute("type", "Button");
    element.setAttribute("class", this.getClass().getName());
    // NOI18N
    Element property = new Element("property");
    // NOI18N
    property.setAttribute("name", "systemPrefix");
    property.setAttribute("value", g.getSystemPrefix());
    element.addContent(property);
    return element;
}
Also used : Element(org.jdom2.Element) CreateButtonModel(apps.CreateButtonModel)

Example 2 with CreateButtonModel

use of apps.CreateButtonModel in project JMRI by JMRI.

the class CreateButtonModelXml method load.

@Override
public boolean load(Element shared, Element perNode) {
    boolean result = true;
    String className = shared.getAttribute("name").getValue();
    CreateButtonModel model = new CreateButtonModel();
    model.setClassName(className);
    for (Element child : shared.getChildren("property")) {
        // NOI18N
        if (// NOI18N
        child.getAttributeValue("name").equals("systemPrefix") && child.getAttributeValue("value") != null) {
            // NOI18N
            // NOI18N
            model.setSystemPrefix(child.getAttributeValue("value"));
        }
    }
    InstanceManager.getDefault(StartupActionsManager.class).addAction(model);
    return result;
}
Also used : Element(org.jdom2.Element) StartupActionsManager(apps.StartupActionsManager) CreateButtonModel(apps.CreateButtonModel)

Aggregations

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