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