KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > adwt > editor > IteratorEditor


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.adwt.editor;
8
9 import java.util.Iterator JavaDoc;
10 import java.util.StringTokenizer JavaDoc;
11 import java.util.Vector JavaDoc;
12
13 /**
14  * Description of the Class
15  *
16  * @author Laurent Etiemble
17  * @version $Revision: 1.5 $
18  * @todo Javadoc to complete
19  * @todo Swing editor to complete
20  */

21 public class IteratorEditor extends GenericEditor
22 {
23    /** Constructor for the PropertiesEditor object */
24    public IteratorEditor()
25    {
26       this.value = (new Vector JavaDoc()).iterator();
27    }
28
29
30    /**
31     * Getter for the asText attribute
32     *
33     * @return The value of asText attribute
34     */

35    public String JavaDoc getAsText()
36    {
37       String JavaDoc result = "";
38       Iterator JavaDoc iterator = (Iterator JavaDoc) this.value;
39       while (iterator.hasNext())
40       {
41          result = result + iterator.next();
42          if (iterator.hasNext())
43          {
44             result = result + ",";
45          }
46       }
47       return result;
48    }
49
50
51    /**
52     * Setter for the asText attribute
53     *
54     * @param s The new value for asText attribute
55     */

56    public void setAsText(String JavaDoc s)
57    {
58       StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(s, ",");
59       Vector JavaDoc parsed = new Vector JavaDoc();
60       while (st.hasMoreTokens())
61       {
62          parsed.add(st.nextToken());
63       }
64       this.value = parsed.iterator();
65       this.firePropertyChange();
66    }
67 }
68
Popular Tags