1 28 29 package org.objectweb.util.explorer.plugin.java.map; 30 31 import org.objectweb.util.explorer.api.Table; 32 import org.objectweb.util.explorer.api.TreeView; 33 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 34 35 43 public class MapTable 44 implements Table 45 { 46 47 48 54 60 66 72 75 public String [] getHeaders(TreeView treeView) 76 { 77 return new String []{"Keys","Values"}; 78 } 79 80 84 public Object [][] getRows(TreeView treeView) 85 { 86 java.util.Map map = (java.util.Map )treeView.getSelectedObject(); 88 89 java.util.Map.Entry[] elements = 91 (java.util.Map.Entry[])map.entrySet().toArray(new java.util.Map.Entry[0]); 92 93 Object [][] mappings = new Object [map.size()][2]; 95 for (int i = 0; i < elements.length; i++) { 96 mappings[i] = 97 new Object []{elements[i].getKey(), 98 new DefaultEntry(elements[i].getKey().toString(), elements[i].getValue())}; 99 } 100 return mappings; 101 } 102 103 } | Popular Tags |