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;
}
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;
}
Aggregations