// PropertyFeeder.java
// $Id: PropertyFeeder.java,v 1.2 1997/07/29 10:06:57 bmahe Exp $
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html


package w3c.jigadm.editors ;

import w3c.jigadm.*;
import java.util.*;

public class PropertyFeeder implements EditorFeeder {

  public static final String FEEDER_DATA_P = "feeder.data";

  String[] s = null;

  public String[] getDefaultItems() {
    return s;
  }

  protected String[] getStringArray(Properties p, String name) {
    String v = (String) p.get(name);
    if ( v == null )
      return new String[0];
    // Parse the property value:
    StringTokenizer st    = new StringTokenizer(v, "|");
    int             len   = st.countTokens();
    String          ret[] = new String[len];
    for (int i = 0 ; i < ret.length ; i++) {
      ret[i] = st.nextToken();
    }
    return ret;
  }

  public void initialize (RemoteResourceWrapper rrw, Properties p) {
    s = getStringArray(p,FEEDER_DATA_P);
  }

  
}
