Esempio n. 1
0
 /** Leaves can be used for many-to-many relations */
 public void deleteLeaves(String name) {
   for (int i = 0; i < _leaves.size(); i++) {
     CatalogTreeLeaf leaf = _leaves.get(i);
     if (name.equals(leaf.getName())) {
       _leaves.remove(i);
     }
   }
 }
Esempio n. 2
0
 public CatalogTreeLeaf getLeaf(String name, String path) {
   for (int i = 0; i < _leaves.size(); i++) {
     CatalogTreeLeaf leaf = _leaves.get(i);
     if (name.equals(leaf.getName()) && path.equals(leaf.getPath())) {
       return leaf;
     }
   }
   return null;
 }
Esempio n. 3
0
 public void deleteLeaf(String name, String path) {
   for (int i = 0; i < _leaves.size(); i++) {
     CatalogTreeLeaf leaf = _leaves.get(i);
     if (name.equals(leaf.getName()) && path.equals(leaf.getPath())) {
       _leaves.remove(i);
       return;
     }
   }
 }
Esempio n. 4
0
 /** Leaves can be used for many-to-many relations */
 public ArrayList<CatalogTreeLeaf> getLeaves(String name) {
   ArrayList<CatalogTreeLeaf> leaves = new ArrayList<CatalogTreeLeaf>();
   for (int i = 0; i < _leaves.size(); i++) {
     CatalogTreeLeaf leaf = _leaves.get(i);
     if (name.equals(leaf.getName())) {
       leaves.add(leaf);
     }
   }
   return leaves;
 }
Esempio n. 5
0
 /** Insert leaf according to height. */
 public void addLeaf(String name, String path) {
   // check path
   NamedIcon icon = NamedIcon.getIconByName(path);
   if (icon == null) {
     log.warn("path \"" + path + "\" is not a NamedIcon.");
     return;
   }
   int h = icon.getIconHeight();
   for (int i = 0; i < _leaves.size(); i++) {
     CatalogTreeLeaf leaf = _leaves.get(i);
     if (h < leaf.getSize()) {
       _leaves.add(i + 1, new CatalogTreeLeaf(name, path, h));
       return;
     }
   }
   _leaves.add(new CatalogTreeLeaf(name, path, h));
 }