Search in sources :

Example 1 with SE8cSignalHead

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();
}
Also used : QuadOutputSignalHead(jmri.implementation.QuadOutputSignalHead) JFrame(javax.swing.JFrame) DoubleTurnoutSignalHead(jmri.implementation.DoubleTurnoutSignalHead) SE8cSignalHead(jmri.implementation.SE8cSignalHead) NamedBeanHandle(jmri.NamedBeanHandle) Test(org.junit.Test)

Example 2 with SE8cSignalHead

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;
}
Also used : Element(org.jdom2.Element) SE8cSignalHead(jmri.implementation.SE8cSignalHead)

Example 3 with SE8cSignalHead

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;
}
Also used : Element(org.jdom2.Element) SignalHead(jmri.SignalHead) SE8cSignalHead(jmri.implementation.SE8cSignalHead) Turnout(jmri.Turnout) SE8cSignalHead(jmri.implementation.SE8cSignalHead)

Aggregations

SE8cSignalHead (jmri.implementation.SE8cSignalHead)3 Element (org.jdom2.Element)2 JFrame (javax.swing.JFrame)1 NamedBeanHandle (jmri.NamedBeanHandle)1 SignalHead (jmri.SignalHead)1 Turnout (jmri.Turnout)1 DoubleTurnoutSignalHead (jmri.implementation.DoubleTurnoutSignalHead)1 QuadOutputSignalHead (jmri.implementation.QuadOutputSignalHead)1 Test (org.junit.Test)1