use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class PaneProgPaneTest method testVariables.
// test specifying variables in columns
@Test
public void testVariables() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
// make sure XML document is ready
setupDoc();
PaneProgFrame pFrame = new PaneProgFrame(null, new RosterEntry(), "test frame", "programmers/Basic.xml", p, false) {
// dummy implementations
@Override
protected JPanel getModePane() {
return null;
}
};
CvTableModel cvModel = new CvTableModel(new JLabel(), p);
IndexedCvTableModel icvModel = new IndexedCvTableModel(new JLabel(), p);
String[] args = { "CV", "Name" };
VariableTableModel varModel = new VariableTableModel(null, args, cvModel, icvModel);
log.debug("VariableTableModel ctor complete");
// create test object with special implementation of the newVariable(String) operation
varCount = 0;
PaneProgPane pane = new PaneProgPane(pFrame, "name", pane1, cvModel, icvModel, varModel, null, null) {
@Override
public void newVariable(Element e, JComponent p, GridBagLayout g, GridBagConstraints c, boolean a) {
varCount++;
}
};
assertNotNull("exists", pane);
assertEquals("variable defn count", 7, varCount);
}
use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class QualifiedVarTest method setupDoc.
// provide a test document in the above static variables
void setupDoc() {
// create a JDOM tree with just some elements
root = new Element("programmer-config");
doc = new Document(root);
doc.setDocType(new DocType("programmer-config", "programmer-config.dtd"));
// add some elements
root.addContent(new Element("programmer").setAttribute("showFnLanelPane", "no").setAttribute("showRosterMediaPane", "no").addContent(new Element("pane").setAttribute("name", "Test").addContent(new Element("column").addContent(new Element("display").setAttribute("item", "Primary Address")).addContent(new Element("display").setAttribute("item", "CV2")).addContent(new Element("display").setAttribute("item", "CV3")).addContent(new Element("display").setAttribute("item", "CV4")).addContent(new Element("display").setAttribute("item", "CV5")).addContent(new Element("display").setAttribute("item", "CV6")).addContent(new Element("separator")).addContent(new Element("label").setAttribute("label", "set cv3 >= 100 to see CV4")).addContent(new Element("label").setAttribute("label", "set cv3 <=100 to see CV5, CV6"))).addContent(new Element("column").addContent(new Element("display").setAttribute("item", "Minor Version Number")).addContent(new Element("display").setAttribute("item", "Major Version Number")).addContent(new Element("display").setAttribute("item", "iCV53.5.0")).addContent(new Element("display").setAttribute("item", "iCV55.92.0")).addContent(new Element("display").setAttribute("item", "iCV55.92.1")).addContent(new Element("separator")).addContent(new Element("label").setAttribute("label", "set cv3 >= 100 to see iCV53.5.0")).addContent(new Element("label").setAttribute("label", "set minor >= 100 to see iCV55.92.0")).addContent(new Element("label").setAttribute("label", "set minor, major >= 100 to see iCV55.92.1")))).addContent(new Element("pane").setAttribute("name", "CV").addContent(new Element("column").addContent(new Element("cvtable")))).addContent(new Element("pane").setAttribute("name", "iCV").addContent(new Element("column").addContent(new Element("indxcvtable")))).addContent(new Element("pane").setAttribute("name", "CV3>50").addContent(new Element("qualifier").addContent(new Element("variableref").addContent("CV3")).addContent(new Element("relation").addContent("gt")).addContent(new Element("value").addContent("50"))).addContent(new Element("column").addContent(new Element("display").setAttribute("item", "CV3")).addContent(new Element("display").setAttribute("item", "CV4")).addContent(new Element("label").setAttribute("label", "Pane visible with CV3>100")))));
return;
}
use of org.neo4j.ogm.domain.gh806.Element 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);
}
use of org.neo4j.ogm.domain.gh806.Element 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");
}
use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class QualifierAdderTest method testExistsOk1.
public void testExistsOk1() {
Element e = new Element("variable").addContent(new Element("qualifier").addContent(new Element("variableref").addContent("one")).addContent(new Element("relation").addContent("exists")).addContent(new Element("value").addContent("1")));
// 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"));
root.addContent(// the sites information here lists all relevant
new Element("decoder").addContent(new Element("variables").addContent(e)));
// print JDOM tree, to check
//org.jdom2.output.XMLOutputter fmt
// = new org.jdom2.output.XMLOutputter(org.jdom2.output.Format.getPrettyFormat());
//try {
// fmt.output(doc, System.out);
//} catch (Exception ex) { log.error("error writing XML", ex);}
// test Exists
processModifierElements(e, v2);
Assert.assertTrue(v2.getAvailable());
}
Aggregations