Exemple #1
0
 private MutableTreeNode populatePlot(Plot p) throws SQLException {
   DefaultMutableTreeNode tree = new DefaultMutableTreeNode(p);
   // tree.add(populateAttributes(p));
   Statement stmt = db.statement();
   for (Tree t : p.loadTrees(stmt)) {
     tree.add(populateTree(t));
   }
   stmt.close();
   return tree;
 }
Exemple #2
0
 private MutableTreeNode populateNest(Nest n) throws SQLException {
   DefaultMutableTreeNode tree = new DefaultMutableTreeNode(n);
   // tree.add(populateAttributes(n));
   Statement stmt = db.statement();
   for (Visit v : n.loadVisits(stmt)) {
     tree.add(populateVisit(v));
   }
   stmt.close();
   return tree;
 }
Exemple #3
0
 private MutableTreeNode populateCavity(Cavity c) throws SQLException {
   DefaultMutableTreeNode tree = new DefaultMutableTreeNode(c);
   // tree.add(populateAttributes(c));
   Statement stmt = db.statement();
   for (Nest n : c.loadNests(stmt)) {
     tree.add(populateNest(n));
   }
   stmt.close();
   return tree;
 }
Exemple #4
0
 private MutableTreeNode populateTree(Tree t) throws SQLException {
   DefaultMutableTreeNode tree = new DefaultMutableTreeNode(t);
   // tree.add(populateAttributes(t));
   Statement stmt = db.statement();
   for (Cavity c : t.loadCavities(stmt)) {
     tree.add(populateCavity(c));
   }
   stmt.close();
   return tree;
 }
Exemple #5
0
  private MutableTreeNode populateAttributes(CavityDBObject obj) {
    DefaultMutableTreeNode tree = new DefaultMutableTreeNode("attrs");
    Class cls = obj.getClass();
    for (Field f : cls.getFields()) {
      int mod = f.getModifiers();
      if (Modifier.isPublic(mod) && !Modifier.isStatic(mod)) {
        String fieldName = f.getName();
        try {
          Object value = f.get(obj);
          tree.add(
              new DefaultMutableTreeNode(String.format("%s=%s", fieldName, String.valueOf(value))));

        } catch (IllegalAccessException e) {
          // do nothing.
        }
      }
    }
    return tree;
  }
Exemple #6
0
 private void populate() throws SQLException {
   Collection<Plot> plots = db.select(Plot.class).values();
   for (Plot p : plots) {
     top.add(populatePlot(p));
   }
 }