1 7 package org.ejtools.adwt.editor; 8 9 import java.util.Collection ; 10 import java.util.Iterator ; 11 import java.util.StringTokenizer ; 12 import java.util.Vector ; 13 14 22 public class CollectionEditor extends GenericEditor 23 { 24 25 public CollectionEditor() 26 { 27 this.value = new Vector (); 28 } 29 30 31 36 public String getAsText() 37 { 38 String result = ""; 39 Iterator iterator = ((Collection ) this.value).iterator(); 40 while (iterator.hasNext()) 41 { 42 result = result + iterator.next(); 43 if (iterator.hasNext()) 44 { 45 result = result + ","; 46 } 47 } 48 return result; 49 } 50 51 52 57 public void setAsText(String s) 58 { 59 StringTokenizer st = new StringTokenizer (s, ","); 60 this.value = new Vector (); 61 while (st.hasMoreTokens()) 62 { 63 ((Collection ) this.value).add(st.nextToken()); 64 } 65 this.firePropertyChange(); 66 } 67 68 } 69 | Popular Tags |