|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CollectionEditor.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 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.Collection;
|
|
| 10 |
import java.util.Iterator;
|
|
| 11 |
import java.util.StringTokenizer;
|
|
| 12 |
import java.util.Vector;
|
|
| 13 |
|
|
| 14 |
/**
|
|
| 15 |
* Description of the Class
|
|
| 16 |
*
|
|
| 17 |
* @author Laurent Etiemble
|
|
| 18 |
* @version $Revision: 1.5 $
|
|
| 19 |
* @todo Javadoc to complete
|
|
| 20 |
* @todo Swing editor to complete
|
|
| 21 |
*/
|
|
| 22 |
public class CollectionEditor extends GenericEditor |
|
| 23 |
{
|
|
| 24 |
/** Constructor for the PropertiesEditor object */
|
|
| 25 | 0 |
public CollectionEditor()
|
| 26 |
{
|
|
| 27 | 0 |
this.value = new Vector(); |
| 28 |
} |
|
| 29 |
|
|
| 30 |
|
|
| 31 |
/**
|
|
| 32 |
* Getter for the asText attribute
|
|
| 33 |
*
|
|
| 34 |
* @return The value of asText attribute
|
|
| 35 |
*/
|
|
| 36 | 0 |
public String getAsText()
|
| 37 |
{
|
|
| 38 | 0 |
String result = "";
|
| 39 | 0 |
Iterator iterator = ((Collection) this.value).iterator();
|
| 40 | 0 |
while (iterator.hasNext())
|
| 41 |
{
|
|
| 42 | 0 |
result = result + iterator.next(); |
| 43 | 0 |
if (iterator.hasNext())
|
| 44 |
{
|
|
| 45 | 0 |
result = result + ",";
|
| 46 |
} |
|
| 47 |
} |
|
| 48 | 0 |
return result;
|
| 49 |
} |
|
| 50 |
|
|
| 51 |
|
|
| 52 |
/**
|
|
| 53 |
* Setter for the asText attribute
|
|
| 54 |
*
|
|
| 55 |
* @param s The new value for asText attribute
|
|
| 56 |
*/
|
|
| 57 | 0 |
public void setAsText(String s) |
| 58 |
{
|
|
| 59 | 0 |
StringTokenizer st = new StringTokenizer(s, ","); |
| 60 | 0 |
this.value = new Vector(); |
| 61 | 0 |
while (st.hasMoreTokens())
|
| 62 |
{
|
|
| 63 | 0 |
((Collection) this.value).add(st.nextToken());
|
| 64 |
} |
|
| 65 | 0 |
this.firePropertyChange();
|
| 66 |
} |
|
| 67 |
|
|
| 68 |
} |
|
| 69 |
|
|
||||||||||