/*
 * File: addingLayers.diff
 * Date: Feb-Jul 2001
 * Author: Kai Lessmann <klessman@intevation.de>
 * Copyright 2001 Intevation GmbH, Germany
 *
 * This file is Free Software to be included into OpenMap 
 * under its Free Software license.
 * Permission is granted to use, modify and redistribute.
 *
 * Intevation hereby grants BBN a royalty free, worldwide right and license 
 * to use, copy, distribute and make Derivative Works
 * of this Free Software created by Kai Lessmann 
 * and sublicensing rights of any of the foregoing.
 */
diff -ur --new-file --exclude *.html openmap-4.1.1/Makefile.in changed-openmap-4.1.1/Makefile.in
--- openmap-4.1.1/Makefile.in	Tue Feb 27 19:51:42 2001
+++ changed-openmap-4.1.1/Makefile.in	Mon Jul 30 12:47:42 2001
@@ -92,7 +92,8 @@
 		com.bbn.openmap.layer.mif \
 		com.bbn.openmap.layer.nexrad \
 		com.bbn.openmap.layer.terrain \
-		com.bbn.openmap.layer.etopo
+		com.bbn.openmap.layer.etopo \
+		com.bbn.openmap.layer.propertyeditor
 
 
 Layer.classes =	com/bbn/openmap/layer/*.class \
@@ -114,7 +115,8 @@
 		com/bbn/openmap/layer/mif/*.class \
 		com/bbn/openmap/layer/nexrad/*.class \
 		com/bbn/openmap/layer/terrain/*.class \
-		com/bbn/openmap/layer/etopo/*.class
+		com/bbn/openmap/layer/etopo/*.class \
+		com/bbn/openmap/layer/propertyeditor/*.class
 
 
 Layer.props =   com/bbn/openmap/layer/vpf/*.properties
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/Layer.java changed-openmap-4.1.1/com/bbn/openmap/Layer.java
--- openmap-4.1.1/com/bbn/openmap/Layer.java	Thu Mar 15 20:37:48 2001
+++ changed-openmap-4.1.1/com/bbn/openmap/Layer.java	Tue Jul 10 16:23:15 2001
@@ -56,12 +56,42 @@
      */
     protected static final String SWING_PACKAGE = getPackage(JComponent.class);
 
+    /*
+     * Sets default Name for this class.
+     */
+    {
+        setName("plain Layer");
+    }
+
     /**
      * The String to use for a key lookup in a Properties object to
      * find the name to use in a GUI relating to this layer.  
      */
     public static final String PrettyNameProperty = "prettyName";
 
+    /** The key String in the Properties object associated with
+	 *  this Layer holding the class name. 
+	 *  Gets used when interactively instantiating a layer.
+	 */
+    public static final String classProperty = ".class";
+
+	/**
+	 * The String to use for a PropertyEditor lookup in the
+	 * Properties returned by getPropertyInfo().
+	 * The value associated with this key should be a class name
+	 * on the CLASSPATH of a PropertyEditor class.
+	 */
+	public static final String editorProperty = ".editor";
+
+	/**
+	 *  Key in the associated propertyInfo object.
+	 *  Holds a list of property names, which should be displayed
+	 *  and editable when configuring a layer object interatively.
+	 *  List is space seperated and the order is the order in which 
+	 *  the properties will appear.
+	 */
+	public static final String initPropertiesProperty = ".initProperties";
+
     /**
      * The property to set to add the layer to the BeanContext
      * "addToBeanContext".  This needs be set by the layer itself,
@@ -110,7 +140,7 @@
     /**
      * Used by the LayerHandler to check if the layer should be added
      * to the MapHandler BeanContext.  See the comments under the
-     * AddToBeanContextProperty.  False by default.
+     * AddToBeanContextProperty.
      */
     protected boolean addToBeanContext = false;
 
@@ -250,11 +280,11 @@
 	String realPrefix = "";
 
 	if (prefix != null) {
-	    realPrefix = prefix + ".";
+	    prettyName = prefix + "." + PrettyNameProperty; realPrefix = prefix + ".";
 	}
 
 	prettyName = realPrefix + PrettyNameProperty;
-	setName(props.getProperty(prettyName, "Anonymous"));
+	setName(props.getProperty(prettyName, "untitled Layer"));
 	propertyPrefix = prefix;
 
 
@@ -287,6 +317,7 @@
 	}
 
 	props.put(prettyName, getName());
+	props.put(propertyPrefix + classProperty, this.getClass().getName());
 	return props;
     }
 
@@ -299,6 +330,20 @@
      * the property that would be helpful (range, default value,
      * etc.).  For Layer, this method should at least return the
      * 'prettyName' property.
+	 *
+	 * There are three different kinds of entries in the Properties
+	 * object that is returned:  associated with the name of a 
+	 * PropertyConsumer property (without prefix) there may be 
+	 * text explaining the meaning of the property. If a specialiced
+	 * PropertyEditor exists for the property, the class name of the
+	 * editor can be supplied associated with property name and
+	 * the editorProperty String, concatenated using a "." dot. 
+	 * Finally, to indicate to a sort of "property sheet" editor
+	 * that allows to interactively initiate a PropertyConsumer, 
+	 * there may be a initPropertiesProperty, which is a blank
+	 * seperated list of PropertyConsumer properties to be displayed
+	 * to edit, and the order in this list will determine the order
+	 * in the GUI.
      *
      * @param list a Properties object to load the PropertyConsumer
      * properties into.  If getList equals null, then a new Properties
@@ -371,6 +416,14 @@
     public java.awt.Component getGUI() {
 	return null;
     }
+
+    /** 
+     * Gets the gui control for creating a new instance of 
+     * this Layer class.
+     */
+     public java.awt.Component getPropertiesGUI() {
+     	return null;
+     }
 
 
     ///////////////////////////////////////////////////
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/gui/Inspector.java changed-openmap-4.1.1/com/bbn/openmap/gui/Inspector.java
--- openmap-4.1.1/com/bbn/openmap/gui/Inspector.java	Thu Jan  1 01:00:00 1970
+++ changed-openmap-4.1.1/com/bbn/openmap/gui/Inspector.java	Tue Jul 31 12:20:22 2001
@@ -0,0 +1,255 @@
+/*
+ * File: Inspector.java
+ * Date: Jul 2001
+ * Author: Kai Lessmann <klessman@intevation.de>
+ * Copyright 2001 Intevation GmbH, Germany
+ *
+ * This file is Free Software to be included into OpenMap 
+ * under its Free Software license.
+ * Permission is granted to use, modify and redistribute.
+ *
+ * Intevation hereby grants BBN a royalty free, worldwide right and license 
+ * to use, copy, distribute and make Derivative Works
+ * of this Free Software created by Kai Lessmann 
+ * and sublicensing rights of any of the foregoing.
+ * 
+ */
+package com.bbn.openmap.gui;
+
+import com.bbn.openmap.*;
+import com.bbn.openmap.layer.shape.*;
+import com.bbn.openmap.util.PropUtils;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import java.beans.*;
+
+/** Class to inspect a PropertyConsumer. Used by the LayerAddPanel
+    class to interactively configure a Layer object before it gets
+	added to the map.
+    This class should suffice to "inspect" any PropertyConsumer on
+	a very basic level, handling is more convinient if property
+	editor classes are available.
+	The behavior of the Inspector is configured through properties;
+	the propertiesInfo object of a PropertyConsumer may contain
+	a initPropertiesProperty which determines which properties are
+	to be shown and in which order, in a space seperated list,
+	i.e. <code>initPropertiesProperty=class prettyName shapeFile</code><br>
+	For each property there may be a editorProperty entry giving
+	a PropertyEditor class to instanciate as an editor for the 
+	property, i.e. <code>shapeFile.editorProperty=com.bbn.openmap.layer.editor.FilePropertyEditor</code>. 
+	*/
+public class Inspector implements ActionListener {
+
+	/** Keyword for PropertyEditor class from PropertyInfo
+	 *  Property object.
+	 */
+	protected final String editorProperty = ".editor";
+
+	/** A simple TextField as a String editor. */
+	protected final String defaultEditorClass
+		= "com.bbn.openmap.layer.propertyeditor.TextPropertyEditor";
+
+	/** The PropertyConsumer being inspected. 
+	 *  Set in inspectPropertyConsumer. */
+	PropertyConsumer propertyConsumer = null;
+	
+	/** Handle to the GUI.  Used for setVisible(true/false). */
+	protected JFrame frame = null;
+
+	/** Action command for the cancelButton. */
+	//  public so it can be referenced from the actionListener
+	public final String cancelCommand = "cancelCommand";
+	
+	/** The action command for the doneButton. */
+	//  public so it can be referenced from the actionListener
+	public final String doneCommand = "doneCommand";
+	
+	/** The editors to display and change the properties. */
+	protected PropertyEditor[] propertyEditor = null;
+	
+	/** The property keys. Entries in keys[] correspont to 
+	 *  entries in propertyEditor[]. */
+	protected String[] keys = null;
+
+    /** Handle to call back the object that invokes this
+	 *  Inspector.
+	 *  @see setActionListener */
+	protected ActionListener actionListener=null;
+	
+	/** Set an Actionlistener for callbacks.
+	 *  Once a Layer object is configured, ie the "Add" button
+	 *  has been clicked, an ActionListener that invoked this
+	 *  Inspector can register here to be notified. */
+	public void addActionListener(java.awt.event.ActionListener al) {
+	  actionListener = al;
+	}
+	
+	/** Does nothing. */
+	public Inspector() {}
+
+	/** Sets the actionListener. */
+	public Inspector(ActionListener al) {
+	  actionListener = al;
+	}
+	
+	/** Inspect and configure a PropertyConsumer object.
+	    Main method of this class.  The argument PropertyConsumer
+		is inspected through the ProperyConsumer interface, the
+		properties are displayed to be edited. */
+	public void inspectPropertyConsumer(PropertyConsumer propertyConsumer) {
+		// fill variables
+		this.propertyConsumer = propertyConsumer;
+		Properties props = new Properties();
+		props = propertyConsumer.getProperties(props);
+		Properties info = new Properties();
+		info = propertyConsumer.getPropertyInfo(info);
+		String prefix = propertyConsumer.getPropertyPrefix();
+
+		// contruct GUI
+		if(frame==null) {
+			frame = new JFrame("Inspector - "+prefix);
+		} else {
+			frame.setVisible(false);
+			frame.dispose(); frame = null;
+			frame = new JFrame("inspector");
+		}
+		frame.getContentPane().add(createPropertyGUI(prefix, props, info));
+		frame.pack(); frame.setVisible(true);
+	}
+	
+	/**
+	 * Creates a JFrame with the properties to be changed.
+	 */
+	public JComponent createPropertyGUI(
+			String prefix, 
+			Properties props,
+			Properties info) {
+		// collect the info needed...
+		Collection keySet = props.keySet();
+		String propertyList = info.getProperty(Layer.initPropertiesProperty);
+		if(propertyList!=null) {
+			Vector propertiesToShow = PropUtils.parseSpacedMarkers(propertyList);
+			for(int i=0; i<propertiesToShow.size(); i++) {
+				propertiesToShow.set(i,prefix+"."+propertiesToShow.get(i));
+			}
+			keySet = propertiesToShow;
+		}
+		int num = keySet.size();
+		keys = new String[num];	// to store property names
+		Iterator it = keySet.iterator();
+		JPanel component = new JPanel(new GridLayout(num+1,1));
+		propertyEditor = new PropertyEditor[num];
+		JButton doneButton = null, cancelButton = null;
+		
+		int i=0;
+		while(it.hasNext()) { // iterate properties
+			keys[i] = (String)it.next();
+			String marker = keys[i];
+			if(keys[i].startsWith(prefix)) {
+				marker = keys[i].substring(prefix.length()+1);
+			}
+			String editorClass = info.getProperty(marker+editorProperty);
+			if(editorClass==null) {
+				editorClass = defaultEditorClass;
+			}
+			JPanel panel = new JPanel(new GridLayout(1,2));
+			
+			// instantiate PropertyEditor
+			Class propertyEditorClass = null;
+			try {
+				propertyEditorClass = Class.forName(editorClass);
+				propertyEditor[i] = (PropertyEditor)propertyEditorClass.newInstance();
+			} catch(Exception e) {
+				e.printStackTrace();
+				editorClass = null;
+			}
+
+			Component editorFace = null;
+			if(propertyEditor[i].supportsCustomEditor()) {
+				editorFace = propertyEditor[i].getCustomEditor();
+			} else {
+				editorFace = new JLabel("does not support custom editor");
+			}
+			propertyEditor[i].setValue(props.get(keys[i]));
+			JLabel label = new JLabel(marker);
+			label.setHorizontalAlignment(JLabel.CENTER);
+			label.setVerticalAlignment(JLabel.CENTER);
+			panel.add(label);
+			panel.add(editorFace);
+			String toolTip = (String)info.get(marker);
+			panel.setToolTipText(toolTip==null ? "no further info" : toolTip);
+			component.add(panel);
+			++i;
+		}
+		JPanel buttons = new JPanel();
+		doneButton = new JButton("Add");
+		doneButton.addActionListener(this);
+		doneButton.setActionCommand(doneCommand);
+		cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(this);
+		cancelButton.setActionCommand(cancelCommand);
+		buttons.add(doneButton);
+		buttons.add(cancelButton);
+		component.add(buttons);
+		
+		return component;
+	}
+
+	/** Implement the ActionListener interface. 
+		The actions registering here should be generated
+		by the two buttons in the Inspector GUI. */
+	public void actionPerformed(ActionEvent e) {
+		final String actionCommand = e.getActionCommand();
+		String prefix = propertyConsumer.getPropertyPrefix();
+		
+		if(actionCommand==doneCommand) {// confirmed
+			Properties props = collectProperties();
+			propertyConsumer.setProperties(prefix, props);
+			frame.setVisible(false);
+			if(actionListener!=null) {
+			  actionListener.actionPerformed(e);
+			}
+		} else if(actionCommand==cancelCommand) {// canceled
+		      propertyConsumer = null; // to be garb. coll'd
+		      frame.setVisible(false);
+		      frame.dispose();
+		      frame = null;
+		}
+	}
+
+	/** Extracts properties from textfield[]. */
+	protected Properties collectProperties() {
+		Properties props = new Properties();
+		for(int i=0; i<propertyEditor.length; ++i) {
+			props.put(keys[i], propertyEditor[i].getAsText());
+		}
+		return props;
+	}
+
+	
+	/** test cases. */
+	public static void main(String[] args) {
+		String name = (args.length<1)?"com.bbn.openmap.layer.shape.ShapeLayer":args[0];
+		PropertyConsumer propertyconsumer = null;
+		try{
+			Class c = Class.forName(name);
+			propertyconsumer = (PropertyConsumer)c.newInstance();
+		}catch(Exception e) {
+			e.printStackTrace(); System.exit(1);
+		}
+		
+		Properties props=new Properties(), info=new Properties();
+		System.out.println("SETTINGPREFIX");
+		propertyconsumer.setPropertyPrefix("shapeLayer");
+		props = propertyconsumer.getProperties(props);
+		info = propertyconsumer.getPropertyInfo(info);
+
+		Inspector inspector = new Inspector();
+		inspector.addActionListener(inspector);
+		inspector.inspectPropertyConsumer(propertyconsumer);
+
+	}
+}
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/gui/LayerAddPanel.java changed-openmap-4.1.1/com/bbn/openmap/gui/LayerAddPanel.java
--- openmap-4.1.1/com/bbn/openmap/gui/LayerAddPanel.java	Thu Jan  1 01:00:00 1970
+++ changed-openmap-4.1.1/com/bbn/openmap/gui/LayerAddPanel.java	Tue Jul 31 12:19:42 2001
@@ -0,0 +1,313 @@
+/*
+ *
+ * File: LayerAddPanel.java
+ * Date: Jul 2001
+ * Author: Kai Lessmann <klessman@intevation.de>
+ * Copyright 2001 Intevation GmbH, Germany
+ *
+ * This file is Free Software to be included into OpenMap 
+ * under its Free Software license.
+ * Permission is granted to use, modify and redistribute.
+ *
+ * Intevation hereby grants BBN a royalty free, worldwide right and license 
+ * to use, copy, distribute and make Derivative Works
+ * of this Free Software created by Kai Lessmann 
+ * and sublicensing rights of any of the foregoing.
+ * 
+ */
+package com.bbn.openmap.gui;
+
+import com.bbn.openmap.gui.Inspector;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.beans.*;
+import java.beans.beancontext.*;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.Properties;
+
+import javax.swing.*;
+import javax.accessibility.*;
+
+import com.bbn.openmap.util.Debug;
+import com.bbn.openmap.*;
+import com.bbn.openmap.event.LayerEvent;
+import com.bbn.openmap.event.LayerListener;
+import com.bbn.openmap.event.LayerSupport;
+import com.bbn.openmap.LayerHandler;
+import com.bbn.openmap.util.PropUtils;
+
+/**
+ * Class to interactively add a Layer to the map.
+ * A LayerAddPanel utilizes the bean context mechanisms to
+ * keep up to date about the applications LayerHandler and
+ * PropertyHandler (see findAndInit method).
+ * A property is used to determin objects of which Layer 
+ * subclasses can be instantiated (see static String layerTypes),
+ * for configuration of a layer-to-be an Inspector is
+ * invoked to inspect and configure a Layer object through
+ * the PropertyConsumer interface.
+ */
+public class LayerAddPanel extends JPanel
+    implements Serializable, ActionListener,
+	      BeanContextChild, BeanContextMembershipListener
+{
+	/**
+	 * Constant field containing marker used in properties file.
+	 */
+	private static String layerTypes="layerTypes";
+    /**
+     * BeanContextChildSupport object provides helper functions for
+     * BeanContextChild interface.
+     */
+    private BeanContextChildSupport beanContextChildSupport = new BeanContextChildSupport();
+	/**
+	 * Holds the PropertyHandler.
+	 */
+	protected PropertyHandler propertyHandler = null;
+	/**
+	 * Holds the LayerHandler.
+	 */
+	protected LayerHandler layerHandler = null;
+	/**
+	 * The list of available Layer classes.  Is initiated with pretty
+	 * names.
+	 */
+	protected JComboBox list = null;
+	/** The String to use as a prefix for the new Layer's properties. */
+	protected JTextField prefixTextField = null;
+	/** The LayerAddPanel GUI. */
+	protected JFrame window = null;
+	/** Action command String for JButton. */
+	protected final String configureActionCommand = "configureActionCommand";
+	/** Contains Layer classes to be instantiated.  */
+	protected Class[] layerClasses = null;
+	/** The Inspector to handle the configuration of the new Layer. */
+	protected Inspector inspector = null;
+	/** The layer to configure and add. */
+      protected Layer layer; 
+
+    /** Creates the LayerPanel.  
+	 *  Requires a the variables propertyHandler and layerrHandler 
+	 *  to be initiated. 
+	 */
+    public LayerAddPanel() {
+		super();
+		if(propertyHandler!=null && layerHandler!=null) {
+			createPanel(layerHandler.getLayers());
+		}
+		inspector = new Inspector();
+		inspector.addActionListener((java.awt.event.ActionListener)this);
+    }
+
+    /** Creates the LayerPanel.  
+     * @param l the LayerHandler controlling the layers.
+     */
+    public LayerAddPanel(PropertyHandler p, LayerHandler l) {
+		this();
+		propertyHandler = p;
+		layerHandler = l;
+	}
+		
+	/** Produces a dialog panel to add a Layer. */
+    public void createPanel(Layer[] inLayers) {
+		window = new JFrame("Add a Layer");
+		JPanel panel = new JPanel();
+		JButton configureButton = new JButton("Configure");
+		configureButton.addActionListener(this);
+		configureButton.setActionCommand(configureActionCommand);
+		prefixTextField = new JTextField("prefix",12);
+		Vector layerTypes = getLayerTypes();
+		list = new JComboBox(layerTypes);
+		panel.add(list);
+		panel.add(prefixTextField);
+		panel.add(configureButton);
+
+		window.getContentPane().add(panel);
+		window.pack();// window.setVisible(true);
+    }	
+
+
+	/** 
+	  * Gets Layer information from PropertyHandler and fills layerClasses[].
+	  * @return Vector of prettyName Strings
+	  */
+	protected Vector getLayerTypes() {
+		Properties props = propertyHandler.getProperties();
+		String prefix = "openmap";
+		Vector typeList = PropUtils.parseSpacedMarkers(props.getProperty(prefix+"."+layerTypes));
+		//System.out.println("layerTypes:"+typeList+"."); // debug info: available layers
+		layerClasses = new Class[typeList.size()];
+		for(int i=0; i<typeList.size(); ++i) {
+			try {
+				String className = props.getProperty(typeList.get(i)+".class");
+				//System.out.println("looking for "+className+".");
+				layerClasses[i] = Class.forName(className);
+			} catch(ClassNotFoundException cnfe) {
+				System.err.println(cnfe);
+			}
+			typeList.set(i, props.getProperty(typeList.get(i)+".prettyName"));
+		}
+		return typeList;
+	}
+
+    /**
+     * Method associated with the ActionListener interface. 
+     */
+    public void actionPerformed(java.awt.event.ActionEvent e) {
+
+		if(e.getActionCommand()==configureActionCommand) {
+			  // instanciate a default instance of the chosen layer
+			  // and bring up the Inspector to configure it
+			  int n = list.getSelectedIndex();
+			  String prefix = prefixTextField.getText().trim();
+			  try {
+				  layer = (Layer)layerClasses[n].newInstance();
+			  } catch(InstantiationException ie) {
+				  ie.printStackTrace();
+			  } catch(IllegalAccessException iae) {
+				  iae.printStackTrace();
+			  }
+			  if(layer instanceof PropertyConsumer) {
+				  layer.setPropertyPrefix(prefix);
+				  inspector.inspectPropertyConsumer(layer);
+			  }
+		} else if(e.getActionCommand()==inspector.doneCommand) {
+			// the confirmation button of the Inspector panel was pressed
+			// find the beancontext and add the layer at hand (var. layer)
+			if(layer!=null) {
+				BeanContext beancontext = getBeanContext();
+				if(beancontext!=null) {
+					beancontext.add(layer);
+				} else
+					System.out.println("beancontext is null");
+			} else {
+				JOptionPane.showMessageDialog(window, "no Layer instanciated");
+			}
+		} else {
+			if(window==null) {
+				if(layerHandler!=null) {
+					createPanel(layerHandler.getLayers());
+					window.setVisible(true);
+				} else {
+					JOptionPane.showMessageDialog(window, "No Layer types known");
+					return;
+				} 
+			} else {
+			    window.setVisible(true);
+			}
+		}
+    }
+
+
+    /**
+	  * Looks for PropertyHandler and LayerHandler.
+      */
+    protected void findAndInit(Iterator it) {
+	Object someObj;
+	while(it.hasNext()) {
+	    someObj = it.next();
+	    if(someObj instanceof PropertyHandler) {
+		// do the initializing that need to be done here
+		Debug.message("layerspanel","LayersPanel found a LayerHandler");
+		propertyHandler = (PropertyHandler)someObj;
+	    }	else if(someObj instanceof LayerHandler) {
+	      layerHandler = (LayerHandler)someObj;
+	    }
+	}
+    }
+
+    /** 
+     * BeanContextMembershipListener method.  Called when an object
+     * has been added to the parent BeanContext. 
+     *
+     * @param bcme event that provides an iterator to use for the
+     * added objects.
+     */
+    public void childrenAdded(BeanContextMembershipEvent bcme) {
+		findAndInit(bcme.iterator());      
+    }
+    
+    /** 
+     * BeanContextMembershipListener method.  Called when an object
+     * has been removed from the parent BeanContext.  If a
+     * LayerHandler is removed, and it's the current one being
+     * listened to, then the layers in the panel will be wiped clean.
+     *
+     * @param bcme event that provides an iterator to use for the
+     * removed objects.  
+     */
+    public void childrenRemoved(BeanContextMembershipEvent bcme) {
+		Iterator it = bcme.iterator();
+		Object someObj;
+		while(it.hasNext()) {
+			someObj = it.next();
+			if(someObj instanceof PropertyHandler) {
+				// do the initializing that need to be done here
+				Debug.message("layerspanel","LayersPanel removing LayerHandler");
+				propertyHandler = null;
+			}
+		}
+    }
+
+    /** 
+     * Method for BeanContextChild interface.  Allows access to the
+     * current BeanContext.
+     *
+     * @return BeanContext.  
+     */
+    public BeanContext getBeanContext() {
+	return beanContextChildSupport.getBeanContext();
+    }
+  
+    /** 
+     * Method for BeanContextChild interface.  Called when the
+     * LayersPanel is added to the BeanContext.  
+     *
+     * @param in_bc the BeanContext the LayersPanel is added to.
+     */
+    public void setBeanContext(BeanContext in_bc) throws PropertyVetoException {
+	if(in_bc != null) {
+	    in_bc.addBeanContextMembershipListener(this);
+	    beanContextChildSupport.setBeanContext(in_bc);
+	    findAndInit(in_bc.iterator());
+	}
+    }
+  
+    /** Method for BeanContextChild interface. */
+    public void addPropertyChangeListener(String propertyName,
+					  PropertyChangeListener in_pcl) {
+		beanContextChildSupport.addPropertyChangeListener(propertyName, in_pcl);
+    }
+
+    /** Method for BeanContextChild interface. */
+    public void removePropertyChangeListener(String propertyName, 
+					     PropertyChangeListener in_pcl) {
+		beanContextChildSupport.removePropertyChangeListener(propertyName, in_pcl);
+    }
+  
+    /** Method for BeanContextChild interface. */
+    public void addVetoableChangeListener(String propertyName,
+					  VetoableChangeListener in_vcl) {
+	beanContextChildSupport.addVetoableChangeListener(propertyName, in_vcl);
+    }
+  
+    /** Method for BeanContextChild interface. */
+    public void removeVetoableChangeListener(String propertyName, 
+					     VetoableChangeListener in_vcl) {
+	beanContextChildSupport.removeVetoableChangeListener(propertyName, in_vcl);
+    }
+
+	/** Test cases. */
+	public static void main(String[] args) {
+		LayerAddPanel lap = new LayerAddPanel(new PropertyHandler(), null);
+		Layer[] layers = new Layer[1];
+		layers[0] = new com.bbn.openmap.layer.shape.ShapeLayer();
+
+		lap.createPanel(layers);
+	}
+}
+
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/gui/LayersMenu.java changed-openmap-4.1.1/com/bbn/openmap/gui/LayersMenu.java
--- openmap-4.1.1/com/bbn/openmap/gui/LayersMenu.java	Mon Oct 16 18:17:09 2000
+++ changed-openmap-4.1.1/com/bbn/openmap/gui/LayersMenu.java	Tue Jul 10 16:34:48 2001
@@ -99,6 +99,11 @@
     public final static String defaultEditLayersButtonTitle = "Edit Layers...";
     /** The actual edit button title. */
     protected transient String editLayersButtonTitle = defaultEditLayersButtonTitle;
+    /** The menu item to add a layer to the map. */
+    protected transient JMenuItem add = null;
+	/** The default add button title. */
+    protected transient String addLayersButtonTitle = "Add Layers...";
+    
 
     /**
      * BeanContextChildSupport object provides helper functions for
@@ -229,6 +234,16 @@
 	}
     }
 
+	/**
+	 * Set the add menu item. 
+	 */
+    public void setAdd(JMenuItem a) {
+    	add = a;
+	if (getLayerHandler() != null) {
+	    setLayers(getLayerHandler().getLayers());
+	}
+    }
+
     /**
      * Get the edit menu item that tiggers the LayersPanel action
      * listener.
@@ -277,6 +292,9 @@
 	    add(new JSeparator());
 	    add(edit);
 	}
+	if (add != null) {
+	    add(add);
+	}
     }
 
     /**
@@ -502,6 +520,18 @@
 	setLayersPanel(lp);
     }
 
+	/** 
+	 * Constructs the menu item that will bring up the LayerAddPanel.
+	 */
+    public void setupLayerAddButton(final LayerAddPanel menu) {
+	final LayerAddPanel lap = menu;
+    	JMenuItem button = new JMenuItem(addLayersButtonTitle);
+	button.setActionCommand("add");
+	button.addActionListener(lap);
+	setAdd(button);
+	add(button);
+    }
+
     /**
      * Called when the BeanContext membership changes.  interator from
      * the BeanContext.  This lets this object hook up with what it
@@ -522,11 +552,17 @@
 		// do the initializing that need to be done here
 		Debug.message("bc","LayersMenu found a LayerHandler");
 		setLayerHandler((LayerHandler)someObj);
+	    } else if (someObj instanceof PropertyHandler) {
+	    	propertyHandler = (PropertyHandler)someObj;
 	    } else if (someObj instanceof LayersPanel) {
 		setupEditLayersButton((LayersPanel)someObj);
+	    } else if (someObj instanceof LayerAddPanel) {
+			// if a LayerAddPanel is present, do the necessary things
+	    	setupLayerAddButton((LayerAddPanel)someObj);
 	    }
 	}
     }
+    private PropertyHandler propertyHandler = null;
 
     /**
      * BeanContextMembershipListener method, called when new objects
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/gui/LayersPanel.java changed-openmap-4.1.1/com/bbn/openmap/gui/LayersPanel.java
--- openmap-4.1.1/com/bbn/openmap/gui/LayersPanel.java	Thu Mar 15 20:37:52 2001
+++ changed-openmap-4.1.1/com/bbn/openmap/gui/LayersPanel.java	Tue Jul 10 16:48:38 2001
@@ -510,12 +510,14 @@
 	bottom.addActionListener(this);
   	buttonPanel.add(bottom);
 
-//   	JButton delete = new JButton("Remove");
-// // 	delete.setPressedIcon(bottomclickedgif);
-// 	delete.setActionCommand(LayerRemoveCmd);
-// 	delete.setToolTipText("Remove selected layer");
-// 	delete.addActionListener(this);
-//   	buttonPanel.add(delete);
+	// actived the Remove button (was commented out,
+	//  but seems to work just fine)
+   	JButton deleteButton = new JButton("Remove");
+ 	deleteButton.setPressedIcon(bottomclickedgif);
+ 	deleteButton.setActionCommand(LayerRemoveCmd);
+ 	deleteButton.setToolTipText("Remove selected layer");
+ 	deleteButton.addActionListener(this);
+   	buttonPanel.add(deleteButton);
 
 	return buttonPanel;
     }
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/gui/Makefile.in changed-openmap-4.1.1/com/bbn/openmap/gui/Makefile.in
--- openmap-4.1.1/com/bbn/openmap/gui/Makefile.in	Tue Jan  9 15:03:51 2001
+++ changed-openmap-4.1.1/com/bbn/openmap/gui/Makefile.in	Mon Jul 30 12:29:57 2001
@@ -59,7 +59,9 @@
 	UserGuideMenuItems.java \
 	ZoomPanel.java \
 	SavePropertiesMenuItem.java \
-	SaveAsImageMenuItem.java
+	SaveAsImageMenuItem.java \
+	LayerAddPanel.java \
+	Inspector.java
 
 OBJS = $(SRCS:.java=.class)
 
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/EarthquakeLayer.java changed-openmap-4.1.1/com/bbn/openmap/layer/EarthquakeLayer.java
--- openmap-4.1.1/com/bbn/openmap/layer/EarthquakeLayer.java	Fri Dec  8 02:38:10 2000
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/EarthquakeLayer.java	Tue Jul 10 16:56:55 2001
@@ -64,7 +64,7 @@
  * <p>
  * Debugging information is printed when the OpenMap Viewer is launch
  * with -Ddebug.earthquake flag.<P>
- * # Properties for the Earthwuake Layer
+ * # Properties for the Earthquake Layer
  * earthquake.sites=<finger site> <finger site> ...
  * # in seconds
  * earthquake.queryinterval=300
@@ -124,6 +124,9 @@
     /** Reference to the current map projection. */
     protected Projection projection;
 
+    {
+        setName("Earthquake Layer");
+    }
     /**
      * Construct an EarthquakeLayer.
      */
@@ -144,8 +147,9 @@
 	if (sites != null) {
 	    Vector v = new Vector();
 	    String str; StringTokenizer tok = new StringTokenizer(sites);
-	    while ((str = tok.nextToken()) != null) {
-		v.addElement(str);
+		while (tok.hasMoreTokens()) {
+	      str = tok.nextToken();
+		  v.addElement(str);
 	    }
 	    int len = v.size();
 	    fingerSites = new String[len];
@@ -748,4 +752,64 @@
      * Empty.
      */
     public void componentHidden(ComponentEvent e) {}
+
+    //----------------------------------------------------------------
+    // PropertyConsumer Interface
+    //----------------------------------------------------------------
+
+	/**
+	 * Get the associated properties object.
+	 */
+    public Properties getProperties(Properties props) {
+    	  props = super.getProperties(props);
+        return getProperties(propertyPrefix, props);
+    }
+
+	/**
+	 * Get the associated properties object.
+	 * This method creates a Properties object if necessary
+	 * and fills it with the relevant data for this layer.
+	 * Relevant properties for EarthquakeLayers are the 
+	 * sites to retrieve earth quake data from, and the interval
+	 * in milliseconds (see class description.)
+	 */
+    public Properties getProperties(String prefix, Properties props) {
+        if(props==null) {
+	      props = new Properties();
+	  }
+	  props = super.getProperties(props);
+
+        StringBuffer sitesToFinger = new StringBuffer("");
+	  for(int i=0; i<fingerSites.length; ++i) {
+	  	sitesToFinger.append(fingerSites[i]);
+		sitesToFinger.append(" ");
+	  }
+	  sitesToFinger.deleteCharAt(sitesToFinger.length()-1);
+	  props.put(prefix+fingerSitesProperty, sitesToFinger.toString());
+	  props.put(prefix+queryIntervalProperty, Long.toString(fetchIntervalMillis));
+	  return props;
+		
+    }
+
+	/**
+	 * Supplies the propertiesInfo object associated with
+	 * this EarthquakeLayer object.
+	 * Contains the human readable describtions of the properties
+	 * and the <code>initPropertiesProperty</code> (see Inspector
+	 * class.)
+	 */
+    public Properties getPropertyInfo(Properties info) {
+		super.getPropertyInfo(info);
+    	if(info==null) info = new Properties();	// cannot really happen
+		StringBuffer initProperties = new StringBuffer(PrettyNameProperty+" ");
+    	if(info==null)
+			info = new Properties();
+		info.put(fingerSitesProperty.substring(1), "www sites to finger");
+		initProperties.append(fingerSitesProperty.substring(1)+" ");
+		info.put(queryIntervalProperty.substring(1), "query interval in seconds");
+		initProperties.append(queryIntervalProperty.substring(1));
+
+		info.setProperty(initPropertiesProperty, initProperties.toString());
+        return info;
+    }
 }
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/Makefile.in changed-openmap-4.1.1/com/bbn/openmap/layer/Makefile.in
--- openmap-4.1.1/com/bbn/openmap/layer/Makefile.in	Mon Feb 26 16:15:30 2001
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/Makefile.in	Mon Jul 30 16:43:47 2001
@@ -45,6 +45,7 @@
 	cd nitf && $(MAKE) $@
 	cd plotLayer && $(MAKE) $@
 	cd pluginLayer && $(MAKE) $@
+	cd propertyeditor && $(MAKE) $@
 	cd shape && $(MAKE) $@
 	cd util && $(MAKE) $@
 	cd rpf && $(MAKE) $@
@@ -64,6 +65,7 @@
 	cd nitf && $(MAKE) $@
 	cd plotLayer && $(MAKE) $@
 	cd pluginLayer && $(MAKE) $@
+	cd propertyeditor && $(MAKE) $@
 	cd shape && $(MAKE) $@
 	cd util && $(MAKE) $@
 	cd rpf && $(MAKE) $@
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/FilePropertyEditor.java changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/FilePropertyEditor.java
--- openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/FilePropertyEditor.java	Thu Jan  1 01:00:00 1970
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/FilePropertyEditor.java	Fri May 11 17:51:16 2001
@@ -0,0 +1,69 @@
+
+package com.bbn.openmap.layer.propertyeditor;
+
+import java.awt.Component;
+import java.awt.event.*;
+import javax.swing.*;
+import java.beans.*;
+
+/** A PropertyEditor that brings up a JFileChooser panel
+	to select a file. */
+public class FilePropertyEditor extends PropertyEditorSupport
+	{
+	
+	/** The Component returned by getCustomEditor(). */
+	JButton button = new JButton("select file");
+
+	/** Create FilePropertyEditor.  */
+	public FilePropertyEditor() {
+	}
+
+	//
+	//	PropertyEditor interface
+	//
+
+	/** PropertyEditor interface.
+	 *  @return true 
+	 */
+	public boolean supportsCustomEditor() {
+		return true;
+	}
+
+	/** Returns a JButton that will bring up a JFileChooser dialog.
+	 *  @return JButton button
+	 */
+	public Component getCustomEditor() {
+		button.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				JFileChooser chooser = new JFileChooser();
+				int returnVal = chooser.showDialog((Component)null, "Select");
+				if(returnVal==JFileChooser.APPROVE_OPTION) {
+					String newFilename = chooser.getSelectedFile().getAbsolutePath();
+					FilePropertyEditor.this.button.setText(newFilename);
+					firePropertyChange();
+				}
+			}
+		});
+		return button;
+	}
+
+	/** Implement PropertyEditor interface. */
+	public void setValue(Object someObj) {
+		if(someObj instanceof String) {
+			button.setText((String)someObj);
+		}
+	}
+
+	/** Implement PropertyEditor interface. */
+	public String getAsText() {
+		return button.getText();
+	}
+
+	//
+	//	ActionListener interface
+	//
+
+	/** Implement ActionListener interface. */
+	public void actionPerformed(ActionEvent e) {
+	}
+}
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/Makefile.in changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/Makefile.in
--- openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/Makefile.in	Thu Jan  1 01:00:00 1970
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/Makefile.in	Mon Jul 30 17:10:28 2001
@@ -0,0 +1,45 @@
+# **********************************************************************
+# 
+#    Use, duplication, or disclosure by the Government is subject to
+# 	     restricted rights as set forth in the DFARS.
+#  
+# 			   BBNT Solutions LLC
+# 			      A Part of  
+# 			         GTE      
+# 			  10 Moulton Street
+# 			 Cambridge, MA 02138
+# 			    (617) 873-3000
+#  
+# 	  Copyright 1998, 2000 by BBNT Solutions LLC,
+# 		A part of GTE, all rights reserved.
+#  
+# **********************************************************************
+# 
+# $Source: /net/bitburg/u4/distapps/rcs/openmap/com/bbn/openmap/layer/Makefile.in,v $
+# $Revision: 1.31 $
+# $Date: 2001/02/26 15:15:30 $
+# $Author: dietrick $
+# 
+# **********************************************************************
+
+# cloned from com/bbn/openmap/layer/Makefile.in
+# (I just changed the source file names to mine) 
+
+TOP = @top_srcdir@
+
+include ${TOP}/openmap.mk
+
+SRCS =	FilePropertyEditor.java \
+	TextPropertyEditor.java 
+
+
+OBJS = $(SRCS:.java=.class)
+
+all:: $(OBJS)
+
+clean distclean::
+	$(RM) *.class *~
+
+distclean::
+	$(RM) Makefile
+
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/TextPropertyEditor.java changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/TextPropertyEditor.java
--- openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/TextPropertyEditor.java	Thu Jan  1 01:00:00 1970
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/TextPropertyEditor.java	Fri May 11 17:54:11 2001
@@ -0,0 +1,48 @@
+
+package com.bbn.openmap.layer.propertyeditor;
+
+import java.beans.*;
+import javax.swing.*;
+import java.awt.Component;
+import java.awt.event.*;
+
+/** A PropertyEditor that displays a TextField to edit a String. */
+public class TextPropertyEditor extends PropertyEditorSupport
+  implements ActionListener, FocusListener {
+
+  /** The GUI component of this editor. */
+  JTextField textField = new JTextField(20);
+
+  public boolean supportsCustomEditor() {
+    return true;
+  }
+
+  /** Returns the editor GUI, ie a JTextField. */
+  public Component getCustomEditor() {
+    JPanel panel = new JPanel();
+    textField.addActionListener(this);
+    textField.addFocusListener(this);
+    
+    panel.add(textField);
+    return panel;
+  }
+
+  public void actionPerformed(ActionEvent e) {
+    //System.out.println("value changed");
+    firePropertyChange();
+  }
+  public void focusGained(FocusEvent e) {}
+  public void focusLost(FocusEvent e) { firePropertyChange(); }
+
+  /** Sets String in JTextField. */
+  public void setValue(Object string) {
+    if(!(string instanceof String))
+      return;
+    textField.setText((String)string);
+  }
+  /** Returns String from JTextfield. */
+  /** Returns String from JTextfield. */
+  public String getAsText() {
+    return textField.getText();
+  }
+}
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFDatabasePropertyEditor.java changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFDatabasePropertyEditor.java
--- openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFDatabasePropertyEditor.java	Thu Jan  1 01:00:00 1970
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFDatabasePropertyEditor.java	Fri May 11 18:00:27 2001
@@ -0,0 +1,93 @@
+
+package com.bbn.openmap.layer.propertyeditor;
+
+import com.bbn.openmap.layer.propertyeditor.CoverageTree;
+
+import java.awt.Component;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.tree.*;
+import java.beans.*;
+
+/** PropertyEditor for VPFDatabase resource. **Under Construction** */
+public class VPFDatabasePropertyEditor extends PropertyEditorSupport
+	{
+	
+	/** The Component returned by getCustomEditor(). */
+	protected JButton button = new JButton("select file");
+
+	protected String databaseRoot = null;
+	protected String coverage = null;
+
+	/** JFileChooser to browse for VPF databases. */
+	protected JFileChooser chooser = new JFileChooser();
+
+	/** Create FilePropertyEditor.  */
+	public VPFDatabasePropertyEditor() {
+	}
+
+	public void selectDatabaseRoot() {
+		int returnVal = chooser.showDialog((Component)null, "Select VPF database");
+		if(returnVal==JFileChooser.APPROVE_OPTION) {
+			databaseRoot = chooser.getSelectedFile().getAbsolutePath();
+			VPFDatabasePropertyEditor.this.selectCoverage(databaseRoot);
+		}
+	
+	}
+
+	public String selectCoverage(final String rootPath) {
+		CoverageTree ct = new CoverageTree("Select Coverage");
+		/*ct.addTreeSelectionListener(new TreeSelectionListener() {
+			public void valueChanged(TreeSelectionEvent e) {
+				DefaultMutableTreeNode node = (DefaultMutableTreeNode) new DefaultMutableTreeNode();
+								   //e.getPath();
+				if (node == null) return;
+				if(node.isLeaf()) {
+					String coverage = (String)node.getUserObject();
+					this.button.setText(rootPath+":");
+				}
+			}
+		});*/
+
+		ct.pack(); ct.show();
+		return (String)null;
+	}
+
+	//
+	//	PropertyEditor interface
+	//
+
+	/** PropertyEditor interface.
+	 *  @return true 
+	 */
+	public boolean supportsCustomEditor() {
+		return true;
+	}
+
+	/** Returns a JButton that will bring up a JFileChooser dialog.
+	 *  @return JButton button
+	 */
+	public Component getCustomEditor() {
+		button.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				VPFDatabasePropertyEditor.this.selectDatabaseRoot();
+			}
+		});
+		return button;
+	}
+
+	/** Implement PropertyEditor interface. */
+	public void setValue(Object someObj) {
+		if(someObj instanceof String) {
+			button.setText((String)someObj);
+		}
+	}
+
+	/** Implement PropertyEditor interface. */
+	public String getAsText() {
+		return button.getText();
+	}
+
+	
+}
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFPropertyEditor.java.not_ready changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFPropertyEditor.java.not_ready
--- openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFPropertyEditor.java.not_ready	Thu Jan  1 01:00:00 1970
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/propertyeditor/VPFPropertyEditor.java.not_ready	Tue Apr 24 17:58:00 2001
@@ -0,0 +1,33 @@
+package com.bbn.openmap.layer.propertyeditor;
+
+import com.bbn.openmap.layer.propertyeditor.FilePropertyEditor;
+
+import javax.swing.JFileChooser;
+import java.awt.*;
+import java.awt.event.*;
+
+/** this class makes only the slightest modification
+    to its superclass:  the JFileChooser is set
+	to select directories only, not files.
+ */
+public class VPFPropertyEditor extends FilePropertyEditor {
+	/** Returns a JButton that will bring up a JFileChooser dialog.
+	 *  @return JButton button
+	 */
+	public Component getCustomEditor() {
+		button.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				JFileChooser chooser = new JFileChooser();
+				chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+				int returnVal = chooser.showDialog((Component)null, "Select");
+				if(returnVal==JFileChooser.APPROVE_OPTION) {
+					String newFilename = chooser.getSelectedFile().getAbsolutePath();
+					FilePropertyEditor.this.button.setText(newFilename);
+					firePropertyChange();
+				}
+			}
+		});
+		return button;
+	}
+
+}
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/layer/shape/ShapeLayer.java changed-openmap-4.1.1/com/bbn/openmap/layer/shape/ShapeLayer.java
--- openmap-4.1.1/com/bbn/openmap/layer/shape/ShapeLayer.java	Mon Feb 26 16:12:57 2001
+++ changed-openmap-4.1.1/com/bbn/openmap/layer/shape/ShapeLayer.java	Tue Jul 10 17:00:30 2001
@@ -68,12 +68,16 @@
 
     /** The name of the property that holds the name of the shape file. */ 
     public final static String shapeFileProperty = ".shapeFile";
+	/** Name of the underlying shap (.shp) file.  */
+    protected String shapeFileName = "not initialized";
 
     /**
      * The name of the property that holds the name of the
      * spatial index file.
      */
     public final static String spatialIndexProperty = ".spatialIndex";
+	/** Name of the underlying spatial index (.ssx) file. */
+    protected String spatialIndexFileName = "not initialized";
 
     /** The URL of an image to use for point objects. */
     public final static String pointImageURLProperty = ".pointImageURL";
@@ -116,6 +120,11 @@
 
     /** command for the palette redraw button. */
     public static final String redrawCommand = "redraw";
+    /** command for --- button. */
+    public static final String shpBrowseCommand = "shpbrowse";
+    /** command for --- button. */
+    public static final String ssxBrowseCommand = "ssxbrowse";
+
 
     /**
      * Initializes an empty shape layer.
@@ -147,9 +156,14 @@
      */
     public void setProperties (String prefix, Properties props) {
 	super.setProperties(prefix, props);
-	String shapeFileName = props.getProperty(prefix + shapeFileProperty);
-	String spatialIndexFileName
-	    = props.getProperty(prefix + spatialIndexProperty);
+	
+	shapeFileName = props.getProperty(prefix + shapeFileProperty);
+	spatialIndexFileName = props.getProperty(prefix + spatialIndexProperty);
+	/*if(spatialIndexProperty==null || spatialIndexProperty.indexOf(".ssx")==-1) {
+		System.out.println("shapeFileName: "+shapeFileName+" -- lastIndexOf: "+ shapeFileName.lastIndexOf(".shp"));
+		spatialIndexFileName = shapeFileName.substring(0, shapeFileName.lastIndexOf(".shp")) + ".ssx";
+		System.out.println(spatialIndexFileName);
+	}*/
 
 	if ( ( shapeFileName != null ) && ( spatialIndexFileName != null ) ) {
 
@@ -202,6 +216,76 @@
 			    shadowYProperty + " = " + shadowYString);
 	    }
 	}
+    }
+
+
+    /**
+     * Provides the properties of this class.
+     */
+    public Properties getProperties(Properties props) {
+	  props = super.getProperties(props);
+      return getProperties(propertyPrefix, props);
+    }
+
+    /**
+     * Provides the properties of this class.<br>
+	 * See class description for details.
+     */
+    public Properties getProperties(String prefix, Properties props) {
+      if(props==null) {
+	    throw new RuntimeException("argument null");
+	  }
+	  if(prefix==null) {
+	  	if(propertyPrefix!=null) {
+	  		prefix=propertyPrefix;
+	  	} else {
+	  		System.out.println("propertyPrefix is "+propertyPrefix+"!!!");
+	  	}
+	  }
+
+	  props.put(prefix+".class", this.getClass().getName());
+        System.out.println("setting prefix "+prefix+" shapeFileProperty "+
+	  	shapeFileProperty+" shapeFileName "+shapeFileName);
+	  props.put(prefix+shapeFileProperty, shapeFileName);
+	  props.put(prefix+spatialIndexProperty, spatialIndexFileName);
+	  props.put(prefix+shadowXProperty, Integer.toString(shadowX));
+	  props.put(prefix+shadowYProperty, Integer.toString(shadowY));
+
+	  return props;
+    }
+
+	/** Supplies a Properties object with the additional
+	    information about the PropertyConsumer properties
+		of this layer. 
+	 */
+    public Properties getPropertyInfo(Properties props) {
+	  StringBuffer initProperties = new StringBuffer(PrettyNameProperty+" ");
+      if(props==null) {
+	    props = new Properties();
+	  }
+	  props = super.getPropertyInfo(props);
+
+	  props.put(shapeFileProperty.substring(1),
+	  	"filename of the underlying shape file (.shp)");
+	  props.put(shapeFileProperty.substring(1) + editorProperty,
+	  	"com.bbn.openmap.layer.propertyeditor.FilePropertyEditor");
+	  initProperties.append(shapeFileProperty.substring(1)+" ");
+
+	  props.put(spatialIndexProperty.substring(1),
+	  	"filename of the spatial index file (.ssx)");
+	  props.put(spatialIndexProperty.substring(1) + editorProperty,
+	  	"com.bbn.openmap.layer.propertyeditor.FilePropertyEditor");
+	  initProperties.append(spatialIndexProperty.substring(1)+" ");
+
+	  props.put(shadowXProperty.substring(1), "shadow X property, an integer");
+	  initProperties.append(shadowXProperty.substring(1)+" ");
+
+	  props.put(shadowYProperty.substring(1), "shadow Y property, an integer");
+	  initProperties.append(shadowYProperty.substring(1)+" ");
+
+	  props.setProperty(initPropertiesProperty, initProperties.toString());
+
+        return props;
     }
     
     public void setDrawingAttributes(DrawingAttributes da) {
diff -ur --new-file --exclude *.html openmap-4.1.1/com/bbn/openmap/openmap.properties changed-openmap-4.1.1/com/bbn/openmap/openmap.properties
--- openmap-4.1.1/com/bbn/openmap/openmap.properties	Wed Nov 29 21:43:55 2000
+++ changed-openmap-4.1.1/com/bbn/openmap/openmap.properties	Mon Jul 30 17:28:47 2001
@@ -44,7 +44,7 @@
 
 # Define the components used in the app.
 # Note the order in which menu objects are important, except helpMenu which is always adjusted to be the last menu item
-openmap.components=frame toolBar omToolSet layersPanel layerHandler mouseModePanel informationDelegator mouseDelegator navMouseMode selectMouseMode distanceMouseMode nullMouseMode menuBar fileMenu helpMenu controlMenu navigateMenu layersMenu helpUserMenuItem
+openmap.components=frame toolBar omToolSet layersPanel layerHandler mouseModePanel informationDelegator mouseDelegator navMouseMode selectMouseMode distanceMouseMode nullMouseMode menuBar fileMenu helpMenu controlMenu navigateMenu layersMenu helpUserMenuItem layerAddPanel
 
 frame.class=com.bbn.openmap.gui.OpenMapFrame
 layerHandler.class=com.bbn.openmap.LayerHandler
@@ -68,12 +68,25 @@
 controlMenu.class=com.bbn.openmap.gui.ControlMenu
 navigateMenu.class=com.bbn.openmap.gui.NavigateMenu
 helpUserMenuItem.class=com.bbn.openmap.gui.UserGuideMenuItems
+layerAddPanel.class=com.bbn.openmap.gui.LayerAddPanel
 
 # Layers listed here appear on the Map in the order of their names.
-openmap.layers=hello date daynight test graticule
+openmap.layers=hello date daynight graticule
 
 # These layers are turned on when the map is first started.
-openmap.startUpLayers=hello graticule
+openmap.startUpLayers=daynight graticule
+
+# The layers can be initiated interactively (using the LayerAddPanel 
+#  and Inspector classes)  Layers listed here need to supply the
+#  <layername>.class field (see below)
+openmap.layerTypes=hello earth shape
+#hello.class= see below
+earth.class=com.bbn.openmap.layer.EarthquakeLayer
+earth.prettyName=Earthquake Layer
+shape.class=com.bbn.openmap.layer.shape.ShapeLayer
+shape.prettyName=Shape Layer
+vpf.class=com.bbn.openmap.layer.vpf.VPFLayer
+vpf.prettyName=VPF Layer
 
 overviewLayers=overviewLayer
 overviewScaleFactor=10f
diff -ur --new-file --exclude *.html openmap-4.1.1/configure changed-openmap-4.1.1/configure
--- openmap-4.1.1/configure	Mon Feb 26 15:48:05 2001
+++ changed-openmap-4.1.1/configure	Mon Jul 30 16:00:59 2001
@@ -578,7 +578,6 @@
     ;;
 esac
 
-
 #
 ## Handle the possibility that we're on a Cygwin platform.
 ##
@@ -1224,6 +1223,7 @@
 	com/bbn/openmap/layer/nitf/Makefile
 	com/bbn/openmap/layer/plotLayer/Makefile
 	com/bbn/openmap/layer/pluginLayer/Makefile
+	com/bbn/openmap/layer/propertyeditor/Makefile
 	com/bbn/openmap/layer/rpf/Makefile
 	com/bbn/openmap/layer/rpf/corba/Makefile
 	com/bbn/openmap/layer/shape/Makefile
diff -ur --new-file --exclude *.html openmap-4.1.1/configure.in changed-openmap-4.1.1/configure.in
--- openmap-4.1.1/configure.in	Tue Jan  9 15:11:28 2001
+++ changed-openmap-4.1.1/configure.in	Mon Jul 30 12:37:43 2001
@@ -199,6 +199,7 @@
 	com/bbn/openmap/layer/nitf/Makefile
 	com/bbn/openmap/layer/plotLayer/Makefile
 	com/bbn/openmap/layer/pluginLayer/Makefile
+	com/bbn/openmap/layer/propertyeditor/Makefile
 	com/bbn/openmap/layer/rpf/Makefile
 	com/bbn/openmap/layer/rpf/corba/Makefile
 	com/bbn/openmap/layer/shape/Makefile
diff -ur --new-file --exclude *.html openmap-4.1.1/share/openmap.properties changed-openmap-4.1.1/share/openmap.properties
--- openmap-4.1.1/share/openmap.properties	Mon Feb 26 15:49:40 2001
+++ changed-openmap-4.1.1/share/openmap.properties	Tue Jul 31 11:31:50 2001
@@ -44,7 +44,7 @@
 
 # Define the components used in the app.
 # Note the order in which menu objects are important, except helpMenu which is always adjusted to be the last menu item
-openmap.components=frame toolBar omToolSet layersPanel layerHandler overviewMapHandler mouseModePanel informationDelegator mouseDelegator navMouseMode selectMouseMode distanceMouseMode nullMouseMode menuBar fileMenu helpMenu controlMenu navigateMenu layersMenu helpUserMenuItem omdrawingtool omlineloader projectionstack projectionstacktool
+openmap.components=frame toolBar omToolSet layersPanel layerHandler overviewMapHandler mouseModePanel informationDelegator mouseDelegator navMouseMode selectMouseMode distanceMouseMode nullMouseMode menuBar fileMenu helpMenu controlMenu navigateMenu layersMenu helpUserMenuItem omdrawingtool omlineloader projectionstack projectionstacktool layerAddPanel
 
 frame.class=com.bbn.openmap.gui.OpenMapFrame
 layerHandler.class=com.bbn.openmap.LayerHandler
@@ -71,12 +71,26 @@
 omlineloader.class=com.bbn.openmap.tools.drawing.OMLineLoader
 projectionstack.class=com.bbn.openmap.proj.ProjectionStack
 projectionstacktool.class=com.bbn.openmap.gui.ProjectionStackTool
+layerAddPanel.class=com.bbn.openmap.gui.LayerAddPanel
 
 # Layers listed here appear on the Map in the order of their names.
 openmap.layers=graticule daynight test shapePolitical
 
 # These layers are turned on when the map is first started.
 openmap.startUpLayers=graticule shapePolitical
+
+# The layers can be initiated interactively (using the LayerAddPanel 
+#  and Inspector classes)  Layers listed here need to supply the
+#  <layername>.class field (see below)
+openmap.layerTypes=hello earth shape
+#hello.class= see below
+earth.class=com.bbn.openmap.layer.EarthquakeLayer
+earth.prettyName=Earthquake Layer
+shape.class=com.bbn.openmap.layer.shape.ShapeLayer
+shape.prettyName=Shape Layer
+vpf.class=com.bbn.openmap.layer.vpf.VPFLayer
+vpf.prettyName=VPF Layer
+
 
 overviewLayers=overviewLayer
 overviewScaleFactor=10f
