1 26 27 package org.objectweb.util.explorer.plugin.java; 28 29 import java.util.Collection ; 30 import java.util.Iterator ; 31 32 import org.objectweb.util.explorer.api.Table; 33 import org.objectweb.util.explorer.api.TreeView; 34 35 36 45 public class CollectionTable 46 implements Table 47 { 48 49 50 56 62 68 74 77 public String [] getHeaders(TreeView treeView) { 78 return new String []{"Class name","Instance"}; 79 } 80 81 84 public Object [][] getRows(TreeView treeView) { 85 Collection collection = (Collection )treeView.getSelectedObject(); 86 Object [][] contenu = new Object [collection.size()][2]; 87 Iterator iterator = collection.iterator(); 88 int cpt = 0; 89 while (iterator.hasNext()) { 90 Object element = iterator.next(); 91 contenu[cpt] = new Object []{element.getClass().getName(), element}; 92 cpt++; 93 } 94 return contenu; 95 } 96 97 } 98 99 | Popular Tags |