use of jmri.implementation.SE8cSignalHead in project JMRI by JMRI.
the class SignalHeadTableActionTest method testAddAndInvoke.
@Test
public void testAddAndInvoke() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
// add a few signals and see if they exist
InstanceManager.getDefault(jmri.SignalHeadManager.class).register(new DoubleTurnoutSignalHead("IH2", "double example 1-2", new NamedBeanHandle<>("IT1", InstanceManager.turnoutManagerInstance().provideTurnout("IT1")), new NamedBeanHandle<>("IT2", InstanceManager.turnoutManagerInstance().provideTurnout("IT2"))));
InstanceManager.getDefault(jmri.SignalHeadManager.class).register(new QuadOutputSignalHead("IH4", "quad example 11-14", new NamedBeanHandle<>("IT11", InstanceManager.turnoutManagerInstance().provideTurnout("IT11")), new NamedBeanHandle<>("IT12", InstanceManager.turnoutManagerInstance().provideTurnout("IT12")), new NamedBeanHandle<>("IT13", InstanceManager.turnoutManagerInstance().provideTurnout("IT13")), new NamedBeanHandle<>("IT14", InstanceManager.turnoutManagerInstance().provideTurnout("IT14"))));
InstanceManager.getDefault(jmri.SignalHeadManager.class).register(new SE8cSignalHead(new NamedBeanHandle<>("IT1", InstanceManager.turnoutManagerInstance().provideTurnout("IT21")), new NamedBeanHandle<>("IT2", InstanceManager.turnoutManagerInstance().provideTurnout("IT22")), "SE8c from handles"));
InstanceManager.getDefault(jmri.SignalHeadManager.class).register(new SE8cSignalHead(31, "SE8c from number"));
new SignalHeadTableAction().actionPerformed(null);
JFrame f = JFrameOperator.waitJFrame(Bundle.getMessage("TitleSignalTable"), true, true);
Assert.assertNotNull("found frame", f);
f.dispose();
}
use of jmri.implementation.SE8cSignalHead in project JMRI by JMRI.
the class SE8cSignalHeadXml method store.
/**
* Default implementation for storing the contents of a SE8cSignalHead
*
* @param o Object to store, of type TripleTurnoutSignalHead
* @return Element containing the complete info
*/
@Override
public Element store(Object o) {
SE8cSignalHead p = (SE8cSignalHead) o;
Element element = new Element("signalhead");
element.setAttribute("class", this.getClass().getName());
element.addContent(new Element("systemName").addContent(p.getSystemName()));
storeCommon(p, element);
element.addContent(addTurnoutElement(p.getLow(), "low"));
element.addContent(addTurnoutElement(p.getHigh(), "high"));
return element;
}
use of jmri.implementation.SE8cSignalHead in project JMRI by JMRI.
the class SE8cSignalHeadXml method load.
@Override
public boolean load(Element shared, Element perNode) {
List<Element> l = shared.getChildren("turnoutname");
if (l.size() == 0) {
// older form
l = shared.getChildren("turnout");
}
NamedBeanHandle<Turnout> low = loadTurnout(l.get(0));
NamedBeanHandle<Turnout> high = loadTurnout(l.get(1));
// put it together
String sys = getSystemName(shared);
String uname = getUserName(shared);
SignalHead h;
if (uname == null) {
h = new SE8cSignalHead(sys, low, high);
} else {
h = new SE8cSignalHead(sys, low, high, uname);
}
loadCommon(h, shared);
InstanceManager.getDefault(jmri.SignalHeadManager.class).register(h);
return true;
}
Aggregations