1
2
3
4
5 package org.rcfaces.core.internal.converter;
6
7 import java.util.ArrayList;
8 import java.util.List;
9 import java.util.StringTokenizer;
10
11 import javax.faces.FacesException;
12 import javax.faces.component.UIComponent;
13 import javax.faces.context.FacesContext;
14 import javax.faces.convert.Converter;
15
16 import org.rcfaces.core.model.AbstractConverter;
17
18
19
20
21
22
23 public class DragDropTypesConverter extends AbstractConverter {
24 private static final String REVISION = "$Revision: 1.1 $";
25
26 public static final Converter SINGLETON = new DragDropTypesConverter();
27
28 public Object getAsObject(FacesContext context, UIComponent component,
29 String value) {
30 if (value == null) {
31 return null;
32 }
33
34 StringTokenizer st = new StringTokenizer(value, ",");
35
36 List list = new ArrayList();
37
38 for (; st.hasMoreTokens();) {
39 String token = st.nextToken().trim();
40
41 list.add(token);
42 }
43
44 return (String[]) list.toArray(new String[list.size()]);
45 }
46
47 public String getAsString(FacesContext context, UIComponent component,
48 Object value) {
49 throw new FacesException("Not implemented !");
50 }
51 }