/* * File: addingLayers.diff * Date: Feb-Jul 2001 * Author: Kai Lessmann * 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 + * 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. initPropertiesProperty=class prettyName shapeFile
+ For each property there may be a editorProperty entry giving + a PropertyEditor class to instanciate as an editor for the + property, i.e. shapeFile.editorProperty=com.bbn.openmap.layer.editor.FilePropertyEditor. + */ +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 + * 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 * Debugging information is printed when the OpenMap Viewer is launch * with -Ddebug.earthquake flag.

- * # Properties for the Earthwuake Layer + * # Properties for the Earthquake Layer * earthquake.sites= ... * # 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; iinitPropertiesProperty (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.
+ * 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 +# .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 +# .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