use of catdata.ide.CodeTextPanel in project fql by CategoricalData.
the class FqlppDisplay method showSet.
@SuppressWarnings("ConstantConditions")
private static JPanel showSet(Set<?> view, Color c) {
JTabbedPane px = new JTabbedPane();
if (DefunctGlobalOptions.debug.fqlpp.set_graph) {
JComponent gp = makeCatViewer(Category.fromSet(view), c);
px.add("Graph", gp);
}
if (DefunctGlobalOptions.debug.fqlpp.set_tabular) {
Object[][] rowData = new Object[view.size()][1];
int i = 0;
for (Object o : view) {
rowData[i++][0] = Util.nice(o.toString());
}
Object[] colNames = new Object[] { "Element" };
JPanel gp = GuiUtil.makeTable(BorderFactory.createEtchedBorder(), view.size() + " elements", rowData, colNames);
px.add("Table", gp);
}
if (DefunctGlobalOptions.debug.fqlpp.set_textual) {
CodeTextPanel gp = new CodeTextPanel(BorderFactory.createEtchedBorder(), view.size() + " elements", Util.nice(view.toString()));
px.add("Text", gp);
}
JPanel top = new JPanel(new GridLayout(1, 1));
top.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
top.add(px);
return top;
}
use of catdata.ide.CodeTextPanel in project fql by CategoricalData.
the class OplExp method display.
@Override
public JComponent display() {
CodeTextPanel p = new CodeTextPanel(BorderFactory.createEtchedBorder(), "", toString());
JTabbedPane ret = new JTabbedPane();
ret.add(p, "Text");
return ret;
}
use of catdata.ide.CodeTextPanel in project fql by CategoricalData.
the class SqlChecker method doChecks.
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
private void doChecks(List<Pair<String, Pair<Triple<String, List<Pair<String, List<Pair<String, String>>>>, List<Pair<String, String>>>, Triple<String, List<Pair<String, List<Pair<String, String>>>>, List<Pair<String, String>>>>>> tocheck) throws SQLException {
for (Pair<String, Pair<Triple<String, List<Pair<String, List<Pair<String, String>>>>, List<Pair<String, String>>>, Triple<String, List<Pair<String, List<Pair<String, String>>>>, List<Pair<String, String>>>>> eq : tocheck) {
JTabbedPane ret = new JTabbedPane();
Triple<String, List<Pair<String, List<Pair<String, String>>>>, List<Pair<String, String>>> lhs = eq.second.first;
Triple<String, List<Pair<String, List<Pair<String, String>>>>, List<Pair<String, String>>> rhs = eq.second.second;
if (!lhs.first.equals(rhs.first)) {
throw new RuntimeException(eq.first + " starts at two different tables, " + lhs.first + " and " + rhs.first);
}
Triple<String, Set<String>, String> q1 = path(lhs.first, lhs.second, lhs.third, info);
Triple<String, Set<String>, String> q2 = path(rhs.first, rhs.second, rhs.third, info);
endMatches(eq.first, q1.third, q2.third, lhs.third, rhs.third);
Statement stmt = conn.createStatement();
stmt.execute(q1.first);
ResultSet q1r = stmt.getResultSet();
stmt = conn.createStatement();
stmt.execute(q2.first);
ResultSet q2r = stmt.getResultSet();
Set<Map<String, String>> tuples1 = toTuples(q1r);
Set<Map<String, String>> tuples2 = toTuples(q2r);
boolean b = tuples1.equals(tuples2);
if (b) {
CodeTextPanel p2 = new CodeTextPanel(BorderFactory.createEtchedBorder(), "", "OK");
ret.add(p2, "Result");
} else {
ret.add(showDiff(lhs.first, q1.third, tuples1, tuples2, new LinkedList<>(endType(info, q1.third, lhs.third).keySet())), "Result");
}
if (!q1.second.isEmpty() || !q2.second.isEmpty()) {
String exns = "LHS warnings:\n\n" + Util.sep(q1.second, "\n") + "\n\nRHS warnings:\n\n" + Util.sep(q2.second, "\n");
CodeTextPanel p = new CodeTextPanel(BorderFactory.createEtchedBorder(), "", exns);
ret.add("Warnings", p);
}
CodeTextPanel p = new CodeTextPanel(BorderFactory.createEtchedBorder(), "", q1.first + "\n\n = \n\n" + q2.first);
ret.add(p, "Query");
frames.add(new Pair<>(eq.first, ret));
}
}
use of catdata.ide.CodeTextPanel in project fql by CategoricalData.
the class Mpl method display.
@Override
public JComponent display() {
CodeTextPanel p = new CodeTextPanel(BorderFactory.createEtchedBorder(), "", toString());
JTabbedPane ret = new JTabbedPane();
ret.add(p, "Text");
return ret;
}
use of catdata.ide.CodeTextPanel in project fql by CategoricalData.
the class XMapping method display.
@SuppressWarnings("ConstantConditions")
@Override
public JComponent display() {
JTabbedPane pane = new JTabbedPane();
if (DefunctGlobalOptions.debug.fpql.x_text) {
String ret = toString();
pane.addTab("Text", new CodeTextPanel(BorderFactory.createEtchedBorder(), "", ret));
}
if (src.schema != null) {
if (DefunctGlobalOptions.debug.fpql.x_tables) {
pane.addTab("Tables", makeTables());
}
} else {
if (DefunctGlobalOptions.debug.fpql.x_tables) {
pane.addTab("Tables", makeTables2());
}
}
if (DefunctGlobalOptions.debug.fpql.x_graph && src.schema == null) {
pane.addTab("Graph", makeGraph());
}
return pane;
}
Aggregations