1 26 27 package org.objectweb.util.browser.plugin.java; 28 29 import java.util.Collection ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 import java.util.Vector ; 33 34 import org.objectweb.util.browser.api.Context; 35 import org.objectweb.util.browser.api.Entry; 36 import org.objectweb.util.browser.api.Wrapper; 37 import org.objectweb.util.browser.core.naming.DefaultEntry; 38 import org.objectweb.util.browser.core.naming.DefaultName; 39 40 48 public class CollectionContext 49 implements Wrapper, Context { 50 51 57 58 protected Collection collection_; 59 60 66 72 78 82 public Entry[] getEntries() { 83 List entryList = new Vector (); 84 Iterator iterator = collection_.iterator(); 85 int cpt = 1; 86 while (iterator.hasNext()) { 87 Object element = iterator.next(); 88 entryList.add(new DefaultEntry(element, new DefaultName(element + " (" + cpt + ")"), this)); 89 cpt++; 90 } 91 return (Entry[])entryList.toArray(new Entry[0]); 92 } 93 94 100 105 public void 106 setWrapped(Object object) { 107 collection_ = (Collection )object; 108 } 109 110 115 public Object 116 getWrapped() { 117 return collection_; 118 } 119 120 } | Popular Tags |