Search in sources :

Example 6 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class CompositeVariableValueTest method createTestVar.

// create and load the an object to test
protected CompositeVariableValue createTestVar() {
    ProgDebugger p = new ProgDebugger();
    // create 3 CVs
    HashMap<String, CvValue> v = createCvMap();
    cv17 = new CvValue("17", p);
    cv18 = new CvValue("18", p);
    cv19 = new CvValue("19", p);
    cv17.setValue(2);
    cv18.setValue(3);
    cv18.setValue(4);
    v.put("17", cv17);
    v.put("18", cv18);
    v.put("19", cv19);
    // create variables for each CV
    var17 = new DecVariableValue("label17", "comment17", "", false, false, false, false, "17", "VVVVVVVV", 0, 255, v, null, null);
    var18 = new DecVariableValue("label18", "comment18", "", false, false, false, false, "18", "VVVVVVVV", 0, 255, v, null, null);
    var19 = new DecVariableValue("label19", "comment19", "", false, false, false, false, "19", "VVVVVVVV", 0, 255, v, null, null);
    // create composite variable
    CompositeVariableValue testVar = new CompositeVariableValue("testVariable", "commentTest", "", false, false, false, false, "17", "VVVVVVVV", 0, 2, v, null, null);
    // two choices
    testVar.addChoice("first");
    testVar.addSetting("first", "label17", var17, "11");
    testVar.addSetting("first", "label18", var18, "12");
    testVar.addSetting("first", "label19", var19, "13");
    testVar.addChoice("second");
    testVar.addSetting("second", "label17", var17, "21");
    testVar.addSetting("second", "label18", var18, "22");
    testVar.addSetting("second", "label19", var19, "23");
    testVar.addChoice("third");
    testVar.addSetting("third", "label17", var17, "123");
    testVar.addSetting("third", "label18", var18, "123");
    testVar.addSetting("third", "label19", var19, "123");
    testVar.lastItem();
    return testVar;
}
Also used : ProgDebugger(jmri.progdebugger.ProgDebugger)

Example 7 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class FnMapPanelTest method testCtor.

public void testCtor() {
    ProgDebugger p = new ProgDebugger();
    VariableTableModel tableModel = new VariableTableModel(new JLabel(""), new String[] { "Name", "Value" }, new CvTableModel(new JLabel(""), p), new IndexedCvTableModel(new JLabel(""), p));
    List<Integer> varsUsed = null;
    Element model = new Element("model");
    new FnMapPanel(tableModel, varsUsed, model);
}
Also used : ProgDebugger(jmri.progdebugger.ProgDebugger) Element(org.jdom2.Element) JLabel(javax.swing.JLabel)

Example 8 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class PackageTest method testConfigProgrammer.

// check configuring the programmer
public void testConfigProgrammer() {
    // initialize the system
    Programmer p = new ProgDebugger();
    InstanceManager.setProgrammerManager(new DefaultProgrammerManager(p));
    assertTrue(InstanceManager.getDefault(jmri.ProgrammerManager.class).getGlobalProgrammer() == p);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) DefaultProgrammerManager(jmri.managers.DefaultProgrammerManager) DefaultProgrammerManager(jmri.managers.DefaultProgrammerManager)

Example 9 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class QualifierAdderTest method setUp.

// The minimal setup for log4J
@Override
protected void setUp() {
    apps.tests.Log4JFixture.setUp();
    p = new ProgDebugger();
    cvtable = new CvTableModel(new JLabel(""), p);
    model = new VariableTableModel(new JLabel(""), new String[] { "Name", "Value" }, cvtable, new IndexedCvTableModel(new JLabel(""), p));
    // create a JDOM tree with just some elements
    Element root = new Element("decoder-config");
    Document doc = new Document(root);
    doc.setDocType(new DocType("decoder-config", "decoder-config.dtd"));
    // add some elements
    Element el1, el2, el3;
    root.addContent(// the sites information here lists all relevant
    new Element("decoder").addContent(new Element("variables").addContent(el1 = new Element("variable").setAttribute("CV", "1").setAttribute("item", "one").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1"))).addContent(el2 = new Element("variable").setAttribute("CV", "2").setAttribute("item", "two").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1"))).addContent(el3 = new Element("variable").setAttribute("CV", "3").setAttribute("item", "three").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1")))));
    // end of adding contents
    // and test reading this
    model.setRow(0, el1);
    model.setRow(1, el2);
    model.setRow(1, el3);
    v1 = model.findVar("one");
    v2 = model.findVar("two");
    v3 = model.findVar("three");
}
Also used : ProgDebugger(jmri.progdebugger.ProgDebugger) Element(org.jdom2.Element) JLabel(javax.swing.JLabel) Document(org.jdom2.Document) DocType(org.jdom2.DocType)

Example 10 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class QualifierCombinerTest method setUp.

// The minimal setup for log4J
@Before
public void setUp() {
    apps.tests.Log4JFixture.setUp();
    p = new ProgDebugger();
    cvtable = new CvTableModel(new JLabel(""), p);
    model = new VariableTableModel(new JLabel(""), new String[] { "Name", "Value" }, cvtable, new IndexedCvTableModel(new JLabel(""), p));
    // create a JDOM tree with just some elements
    Element root = new Element("decoder-config");
    Document doc = new Document(root);
    doc.setDocType(new DocType("decoder-config", "decoder-config.dtd"));
    // add some elements
    Element el1, el2, el3;
    root.addContent(// the sites information here lists all relevant
    new Element("decoder").addContent(new Element("variables").addContent(el1 = new Element("variable").setAttribute("CV", "1").setAttribute("item", "one").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1"))).addContent(el2 = new Element("variable").setAttribute("CV", "2").setAttribute("item", "two").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1"))).addContent(el3 = new Element("variable").setAttribute("CV", "3").setAttribute("item", "three").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1")))));
    // end of adding contents
    // and test reading this
    model.setRow(0, el1);
    model.setRow(1, el2);
    model.setRow(1, el3);
    v1 = model.findVar("one");
    v2 = model.findVar("two");
    v3 = model.findVar("three");
}
Also used : ProgDebugger(jmri.progdebugger.ProgDebugger) Element(org.jdom2.Element) JLabel(javax.swing.JLabel) Document(org.jdom2.Document) DocType(org.jdom2.DocType) Before(org.junit.Before)

Aggregations

ProgDebugger (jmri.progdebugger.ProgDebugger)40 Programmer (jmri.Programmer)33 ProgListener (jmri.ProgListener)27 JLabel (javax.swing.JLabel)4 Element (org.jdom2.Element)4 DocType (org.jdom2.DocType)2 Document (org.jdom2.Document)2 DefaultProgrammerManager (jmri.managers.DefaultProgrammerManager)1 Before (org.junit.Before)1