use of jmri.implementation.DoubleTurnoutSignalHead in project JMRI by JMRI.
the class DoubleTurnoutSignalHeadXml method store.
/**
* Default implementation for storing the contents of a
* DoubleTurnoutSignalHead
*
* @param o Object to store, of type TripleTurnoutSignalHead
* @return Element containing the complete info
*/
@Override
public Element store(Object o) {
DoubleTurnoutSignalHead p = (DoubleTurnoutSignalHead) 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.getGreen(), "green"));
element.addContent(addTurnoutElement(p.getRed(), "red"));
return element;
}
use of jmri.implementation.DoubleTurnoutSignalHead 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.DoubleTurnoutSignalHead in project JMRI by JMRI.
the class DoubleTurnoutSignalHeadXml method load.
@Override
public boolean load(Element shared, Element perNode) {
List<Element> l = shared.getChildren("turnoutname");
if (l.size() == 0) {
l = shared.getChildren("turnout");
}
NamedBeanHandle<Turnout> green = loadTurnout(l.get(0));
NamedBeanHandle<Turnout> red = loadTurnout(l.get(1));
// put it together
String sys = getSystemName(shared);
String uname = getUserName(shared);
SignalHead h;
if (uname == null) {
h = new DoubleTurnoutSignalHead(sys, green, red);
} else {
h = new DoubleTurnoutSignalHead(sys, uname, green, red);
}
loadCommon(h, shared);
InstanceManager.getDefault(jmri.SignalHeadManager.class).register(h);
return true;
}
Aggregations