use of catdata.fql.decl.Type.Int in project fql by CategoricalData.
the class Signature method view.
@SuppressWarnings("serial")
public JPanel view() {
Object[][] arr = new Object[eqs.size()][2];
int i = 0;
for (Eq eq : eqs) {
arr[i][0] = eq.lhs;
arr[i][1] = eq.rhs;
i++;
}
Arrays.sort(arr, Comparator.comparing(f4 -> f4[0].toString()));
JTable eqsComponent = new JTable(arr, new Object[] { "lhs", "rhs" }) {
@Override
public Dimension getPreferredScrollableViewportSize() {
Dimension d = getPreferredSize();
return new Dimension(d.width, d.height);
}
};
List<JComponent> p = new LinkedList<>();
JPanel eqsTemp = new JPanel(new GridLayout(1, 1));
eqsTemp.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), "Equations (" + eqs.size() + ")"));
eqsTemp.add(new JScrollPane(eqsComponent));
Object[][] sn = new String[nodes.size()][1];
int ii = 0;
for (Node n : nodes) {
sn[ii++][0] = n.string;
}
Arrays.sort(sn, Comparator.comparing(f3 -> f3[0].toString()));
JTable nodesComponent = new JTable(sn, new String[] { "Name" }) {
@Override
public Dimension getPreferredScrollableViewportSize() {
Dimension d = getPreferredSize();
return new Dimension(d.width, d.height);
}
};
JPanel nodesTemp = new JPanel(new GridLayout(1, 1));
nodesTemp.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), "Nodes (" + nodes.size() + ")"));
nodesTemp.add(new JScrollPane(nodesComponent));
Object[][] es = new String[edges.size()][3];
int jj = 0;
for (Edge eq : edges) {
es[jj][0] = eq.name;
es[jj][1] = eq.source.string;
es[jj][2] = eq.target.string;
jj++;
}
Arrays.sort(es, Comparator.comparing(f2 -> f2[0].toString()));
JTable esC = new JTable(es, new String[] { "Name", "Source", "Target" }) {
@Override
public Dimension getPreferredScrollableViewportSize() {
Dimension d = getPreferredSize();
return new Dimension(d.width, d.height);
}
};
JPanel edgesTemp = new JPanel(new GridLayout(1, 1));
edgesTemp.add(new JScrollPane(esC));
edgesTemp.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), "Arrows (" + edges.size() + ")"));
Object[][] as = new String[attrs.size()][3];
jj = 0;
for (Attribute<Node> a : attrs) {
as[jj][0] = a.name;
as[jj][1] = a.source.string;
as[jj][2] = a.target.toString();
jj++;
}
Arrays.sort(as, Comparator.comparing(f -> f[0].toString()));
JTable asC = new JTable(as, new String[] { "Name", "Source", "Type" }) {
@Override
public Dimension getPreferredScrollableViewportSize() {
Dimension d = getPreferredSize();
return new Dimension(d.width, d.height);
}
};
JPanel attrsTemp = new JPanel(new GridLayout(1, 1));
attrsTemp.add(new JScrollPane(asC));
attrsTemp.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), "Attributes (" + attrs.size() + ")"));
p.add(nodesTemp);
p.add(edgesTemp);
p.add(attrsTemp);
p.add(eqsTemp);
return FqlUtil.makeGrid(p);
}
Aggregations