01: // PropertyFeeder.java
02: // $Id: PropertyFeeder.java,v 1.5 2000/08/16 21:37:27 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1997.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigadm.editors;
07:
08: import org.w3c.jigadm.RemoteResourceWrapper;
09:
10: import java.util.Hashtable;
11: import java.util.Properties;
12: import java.util.StringTokenizer;
13:
14: public class PropertyFeeder implements EditorFeeder {
15:
16: public static final String FEEDER_DATA_P = "feeder.data";
17:
18: String[] s = null;
19:
20: public String[] getDefaultItems() {
21: return s;
22: }
23:
24: protected String[] getStringArray(Properties p, String name) {
25: String v = (String) p.get(name);
26: if (v == null)
27: return new String[0];
28: // Parse the property value:
29: StringTokenizer st = new StringTokenizer(v, "|");
30: int len = st.countTokens();
31: String ret[] = new String[len];
32: for (int i = 0; i < ret.length; i++) {
33: ret[i] = st.nextToken();
34: }
35: return ret;
36: }
37:
38: public void initialize(RemoteResourceWrapper rrw, Properties p) {
39: s = getStringArray(p, FEEDER_DATA_P);
40: }
41: }
|