use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.
the class ConnectionConfigXml method makeParameter.
protected Element makeParameter(String name, String value) {
Element p = new Element("parameter");
p.setAttribute("name", name);
p.addContent(value);
return p;
}
use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.
the class ConnectionConfigXml method makeParameter.
protected Element makeParameter(String name, String value) {
Element p = new Element("parameter");
p.setAttribute("name", name);
p.addContent(value);
return p;
}
use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.
the class ConnectionConfigXml method extendElement.
/**
* Write out the SerialNode objects too
*
* @param e Element being extended
*/
@Override
protected void extendElement(Element e) {
SerialNode node = (SerialNode) SerialTrafficController.instance().getNode(0);
int index = 1;
while (node != null) {
// add node as an element
Element n = new Element("node");
n.setAttribute("name", "" + node.getNodeAddress());
e.addContent(n);
// add parameters to the node as needed
n.addContent(makeParameter("transmissiondelay", "" + InputBits.getTimeoutTime()));
n.addContent(makeParameter("inputbits", "" + InputBits.getNumInputBits()));
n.addContent(makeParameter("senddelay", "" + OutputBits.getSendDelay()));
n.addContent(makeParameter("outputbits", "" + OutputBits.getNumOutputBits()));
// n.addContent(makeParameter("pulsewidth", ""+node.getPulseWidth()));
// look for the next node
node = (SerialNode) SerialTrafficController.instance().getNode(index);
index++;
}
}
use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.
the class ConnectionConfigXml method unpackElement.
@Override
protected void unpackElement(Element shared, Element perNode) {
List<Element> l = shared.getChildren("node");
for (int i = 0; i < l.size(); i++) {
Element n = l.get(i);
int addr = Integer.parseInt(n.getAttributeValue("name"));
int type = Integer.parseInt(findParmValue(n, "nodetype"));
// create node (they register themselves)
SerialNode node = new SerialNode(addr, type);
// Trigger initialization of this Node to reflect these parameters
SerialTrafficController.instance().initializeSerialNode(node);
}
}
use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.
the class PerformActionModelXml method load.
@Override
public boolean load(Element shared, Element perNode) throws Exception {
boolean result = true;
String className = shared.getAttribute("name").getValue();
PerformActionModel model = new PerformActionModel();
Exception exception = null;
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);
if (exception != null) {
throw exception;
}
return result;
}
Aggregations