示例#1
0
 public static <DO> DO findDataObjectInPath(TreeItem treeItem, Class<DO> doClass) {
   Iterator itr = treeItem.iterator();
   while (itr.hasNext()) {
     Object dataObj = itr.next();
     if (doClass.isInstance(dataObj)) {
       return doClass.cast(dataObj);
     }
   }
   return null;
 }
示例#2
0
 public static String toString(TreeItem treeItem) {
   LinkedList<Object> list = new LinkedList<Object>();
   Iterator pathItr = treeItem.iterator();
   while (pathItr.hasNext()) {
     list.addFirst(pathItr.next());
   }
   //
   StringBuilder sb = new StringBuilder();
   boolean isFirst = true;
   for (Object obj : list) {
     if (isFirst) {
       isFirst = false;
     } else {
       sb.append("/"); // NOI18N
     }
     sb.append(obj.toString());
   }
   //
   return sb.toString();
 }