Search in sources :

Example 1 with Example

use of catdata.ide.Example in project fql by CategoricalData.

the class AqlInACan method makeHtml.

// 
@SuppressWarnings("unused")
private static String makeHtml() {
    String s = "";
    String t = "";
    for (Example ex : Util.alphabetical(Examples.getExamples(Language.AQL))) {
        if (skip().contains(ex)) {
            continue;
        }
        s += "\nif (v == \"" + ex.getName() + "\") { document.getElementById('code').innerHTML = \"" + quote(ex.getText()) + "\" }";
        t += "\n<option value = \"" + ex.getName() + "\">" + ex.getName() + "</option>";
    }
    String html = "<html>" + "\n<head>" + "\n<title>Try AQL</title>" + "\n</head>" + "\n<script>" + "\nfunction setExample(t) {" + "\n    var v = t.value;" + "\n" + s + "\n}; " + "\n</script>" + "\n<body>" + "Choose example:" + "\n<select name=\"example\" onChange = \"setExample(this);\">" + "\n<option disabled selected value> -- select an option -- </option>" + "\n" + t + "\n</select>" + "\n<br>" + "\nEnter AQL code here:" + "\n<form action=\"cgi-bin/try.cgi\"" + "\n      method=\"POST\">" + "\n<textarea name=\"code\" id=\"code\" cols=80 rows=40>" + "\n</textarea>" + "\n<br>" + "\n<input type=\"submit\" value=\"Run\">" + "\n</form>" + "\n</body>" + "\n</html>" + "\n";
    return html;
}
Also used : Example(catdata.ide.Example)

Example 2 with Example

use of catdata.ide.Example in project fql by CategoricalData.

the class AqlTester method doSelfTests.

public static void doSelfTests() {
    int c = JOptionPane.showConfirmDialog(null, message, "Run Self-Test?", JOptionPane.YES_NO_OPTION);
    if (c != JOptionPane.YES_OPTION) {
        return;
    }
    Ctx<String, String> exs = new Ctx<>();
    for (Example e : Examples.getExamples(Language.AQL)) {
        exs.put(e.getName(), e.getText());
    }
    Ctx<String, Throwable> result = runMany(exs);
    if (result.isEmpty()) {
        JOptionPane.showMessageDialog(null, "OK: Tested Passed");
        return;
    }
    JTabbedPane t = new JTabbedPane();
    for (String k : result.keySet()) {
        t.addTab(k, new CodeTextPanel("Error", result.get(k).getMessage()));
    }
    JOptionPane.showMessageDialog(null, t);
}
Also used : CodeTextPanel(catdata.ide.CodeTextPanel) Ctx(catdata.Ctx) Example(catdata.ide.Example) JTabbedPane(javax.swing.JTabbedPane)

Aggregations

Example (catdata.ide.Example)2 Ctx (catdata.Ctx)1 CodeTextPanel (catdata.ide.CodeTextPanel)1 JTabbedPane (javax.swing.JTabbedPane)1