diff --git a/openmap.properties b/openmap.properties index cb5a9efc..0204b771 100644 --- a/openmap.properties +++ b/openmap.properties @@ -213,9 +213,8 @@ openmap.UseInternalFrames=false openmap.components=informationDelegator projFactory mouseDelegator projectionstack addlayer glc menulist toolBar navpanel zoompanel scalepanel projectionstacktool mouseModePanel deleteButton omdtl overviewMapHandler layersPanel selectMouseMode navMouseMode distanceMouseMode panMouseMode omdrawingtool omlineloader omcircleloader omrectloader ompointloader omsplineloader ompolyloader omscalingrasterloader omdistloader layerHandler projkeys repaintPolicy srl # ### -# Applet components, also alternative component configuration -# with OMControlPanel on the left side of the applet. To enable this -# list, simply uncomment it. +# Alternative component configuration with OMControlPanel on the left +# side. To enable this list, simply uncomment it. # ### #openmap.components=informationDelegator projFactory mouseDelegator projectionstack addlayer glc menulist toolBar mouseModePanel selectMouseMode navMouseMode distanceMouseMode omdtl deleteButton omdrawingtool omlineloader omcircleloader omrectloader ompointloader omsplineloader omdecsplineloader ompolyloader omscalingrasterloader omdistloader controlpanel layerHandler projkeys repaintPolicy srl diff --git a/share/omapplet.html b/share/omapplet.html deleted file mode 100644 index 2f0cd30a..00000000 --- a/share/omapplet.html +++ /dev/null @@ -1,12 +0,0 @@ - - -
-*
- * This search pattern allows system properties and properties specified as - * applet parameters or command line properties (using -DProperty=value Java - * flag) to override more hardcoded properties specified elsewhere, say in a - * user preferences file. + * This search pattern allows system properties or command line properties + * (using -DProperty=value Java flag) to override more hardcoded properties + * specified elsewhere, say in a user preferences file. * * @see java.util.Properties
* @@ -114,7 +109,6 @@ public class Environment extends Properties { protected Properties hardcodedProps; protected Properties runtimeProps; protected JLayeredPane desktop = null; - protected static Applet applet; private static int counter = 0; private static transient Vector extraPaths = new Vector(); // user preferences file (used for later references) @@ -186,30 +180,6 @@ protected final static void initHardCodedProperties(Properties p) { }// no BuildDate } - /** - * Initializes the environment of an applet. - * - * @param applet An applet - * @see java.applet.Applet - */ - public static void init(Applet applet) { - if (applet == null) { - init(System.getProperties()); - } else { - if (env != null) { - // overwrite properties - Debug.output("Reinitializing Applet Environment!"); - setApplet(applet); - env.setAppletProperties(applet, env); - return; - } - new Environment(applet); - } - if (Debug.debugging("env")) { - env.list(System.out); - } - } - /** * Initializes the environment of an application. * @@ -235,18 +205,6 @@ public static void init() { init(System.getProperties()); } - /** - * Creates an Environment based on applet properties. - * - * @param applet an Applet - */ - protected Environment(Applet applet) { - env = this; - setApplet(applet); - setAppletProperties(applet, this); - commonInit(); - } - /** * Creates an Environment with the specified system properties. * @@ -297,45 +255,6 @@ protected void commonInit() { initRuntimeProperties(runtimeProps); } - /** - * Populates the system properties for an applet. Currently this property - * list contains the ten system properties available to applets and any - * applet parameters specified in Applet.getParameterInfo(). - * - * @param applet the applet - * @see java.applet.Applet#getParameterInfo - */ - protected void setAppletProperties(Applet applet, Properties props) { - /* - * These are the ten properties available to applets. - */ - final String[] appletProps = { "java.version", "java.vendor", - "java.vendor.url", "java.class.version", "os.name", "os.arch", - "os.version", "file.separator", "path.separator", - "line.separator" }; - - int i; - - for (i = 0; i < appletProps.length; i++) { - String prop = appletProps[i]; - props.put(prop, System.getProperty(prop)); - } - - String[][] pinfo = applet.getParameterInfo(); - if (pinfo == null) - return; - for (i = 0; i < pinfo.length; i++) { - try { - String key = pinfo[i][0]; - String value = applet.getParameter(key); - Debug.message("env", "Applet Parameter " + key + " has value " - + value); - props.put(key, value); - } catch (NullPointerException e) { - } - } - } - /** * Initializes the runtime properties list. Runtime properties are those * properties that exist only while the program is running. They are not @@ -345,10 +264,6 @@ protected void setAppletProperties(Applet applet, Properties props) { * @param p The runtime properties list */ protected static void initRuntimeProperties(Properties p) { - if (isApplet()) { - p.put("user.name", "appletUser");// for convenience - } - java.net.InetAddress addr = null; try { addr = java.net.InetAddress.getLocalHost(); @@ -382,13 +297,6 @@ protected static void initRuntimeProperties(Properties p) { // polygon wraparound bug. String osname = Environment.get("os.name"); - if (osname == null) { - isXWindows = false; - doingXWindowsWorkaround = false; - Debug.message("env", "Environment: is applet, Web Start."); - return; - } - if (osname.equalsIgnoreCase("solaris") || osname.equalsIgnoreCase("SunOS")) { isXWindows = true; @@ -428,33 +336,6 @@ protected static void initRuntimeProperties(Properties p) { } } - /** - * Indicates whether the current process is an applet. - * - * @return*true
if process is an applet;false
- * otherwise. - */ - public static boolean isApplet() { - return (applet != null); - } - - protected static void setApplet(Applet applet) { - Environment.applet = applet; - if (applet instanceof JApplet) { - Environment.useInternalFrames(((JApplet) applet).getRootPane()); - } - } - - /** - * Indicates whether the current process is an application. - * - * @returntrue
if process is an application; - *false
otherwise. - */ - public static boolean isApplication() { - return (applet == null); - } - /** * Searches for the named property in the environment. If the key is not * found, null is returned. All three property lists, runtime, user, and @@ -656,15 +537,6 @@ public static double getDouble(String key, double defaultValue) { } } - /** - * Gets the applet associated with this process. - * - * @return the applet, or null if process is an application - */ - public static Applet getApplet() { - return applet; - } - /** * Adds a key/value pair to the Environment's system properties list. * @@ -746,18 +618,14 @@ public static String generateUniqueString() { */ public final static VectorgetClasspathDirs() { Vector v = new Vector(); - try { - String classPath = System.getProperty("java.class.path"); - StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator); - - while (st.hasMoreTokens()) { - String path = st.nextToken(); - if ((new File(path)).isDirectory()) { - v.addElement(path); - } + String classPath = System.getProperty("java.class.path"); + StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator); + + while (st.hasMoreTokens()) { + String path = st.nextToken(); + if ((new File(path)).isDirectory()) { + v.addElement(path); } - } catch (java.security.AccessControlException ace) { - // Running as an applet?!? } v.addAll(extraPaths); diff --git a/src/openmap/com/bbn/openmap/Layer.java b/src/openmap/com/bbn/openmap/Layer.java index a95f99bf..606f89fe 100644 --- a/src/openmap/com/bbn/openmap/Layer.java +++ b/src/openmap/com/bbn/openmap/Layer.java @@ -1449,8 +1449,7 @@ protected WindowSupport createWindowSupport() { } /** - * Make the palette visible. Will automatically determine if we're running - * in an applet environment and will use a JInternalFrame over a JFrame if + * Make the palette visible. Will use a JInternalFrame over a JFrame if * necessary. */ public void showPalette() { diff --git a/src/openmap/com/bbn/openmap/PropertyHandler.java b/src/openmap/com/bbn/openmap/PropertyHandler.java index 3061cda7..e72acb78 100644 --- a/src/openmap/com/bbn/openmap/PropertyHandler.java +++ b/src/openmap/com/bbn/openmap/PropertyHandler.java @@ -29,7 +29,6 @@ import java.io.PrintStream; import java.net.MalformedURLException; import java.net.URL; -import java.net.URLClassLoader; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; @@ -331,15 +330,6 @@ protected void searchForAndLoadProperties(String propsFileName) { InputStream propsIn = getClass().getResourceAsStream(propsFileName); - // Look in the codebase for applets... - if (propsIn == null && Environment.isApplet()) { - URL[] cba = new URL[1]; - cba[0] = Environment.getApplet().getCodeBase(); - - URLClassLoader ucl = URLClassLoader.newInstance(cba); - propsIn = ucl.getResourceAsStream(propsFileName); - } - if (propsIn == null) { propsIn = ClassLoader.getSystemResourceAsStream(propsFileName); @@ -358,16 +348,10 @@ protected void searchForAndLoadProperties(String propsFileName) { tmpProperties.clear(); } - if (!foundProperties && (Environment.isApplet() || DEBUG)) { + if (!foundProperties && DEBUG) { logger.fine("Unable to locate as resource: " + propsFileName); } - // Seems like we can kick out here in event of Applet... - if (Environment.isApplet()) { - Environment.init(getProperties()); - return; - } - Properties systemProperties; try { @@ -436,7 +420,7 @@ protected void searchForAndLoadProperties(String propsFileName) { logger.fine("***** Done with property search ****"); } - if (!foundProperties && !Environment.isApplet()) { + if (!foundProperties) { PropUtils.copyProperties(PropUtils.promptUserForProperties(), properties); } @@ -531,10 +515,8 @@ protected void init(Properties props, String howString) { Properties includeProperties = getIncludeProperties(props.getProperty(prefix + includeProperty), props); merge(includeProperties, "include file properties", howString); - if (!Environment.isApplet()) { - Properties systemProperties = System.getProperties(); - merge(systemProperties, props); - } + Properties systemProperties = System.getProperties(); + merge(systemProperties, props); merge(props, "loaded", howString); diff --git a/src/openmap/com/bbn/openmap/app/OpenMapApplet.java b/src/openmap/com/bbn/openmap/app/OpenMapApplet.java deleted file mode 100644 index ca31bb9a..00000000 --- a/src/openmap/com/bbn/openmap/app/OpenMapApplet.java +++ /dev/null @@ -1,370 +0,0 @@ -// ********************************************************************** -// -// -// -// BBN Technologies -// 10 Moulton Street -// Cambridge, MA 02138 -// (617) 873-8000 -// -// Copyright (C) BBNT Solutions LLC. All rights reserved. -// -// -// ********************************************************************** -// -// $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/app/OpenMapApplet.java,v $ -// $RCSfile: OpenMapApplet.java,v $ -// $Revision: 1.9 $ -// $Date: 2005/07/29 19:17:48 $ -// $Author: dietrick $ -// -// ********************************************************************** - -package com.bbn.openmap.app; - -import java.awt.Container; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.beancontext.BeanContext; -import java.beans.beancontext.BeanContextChild; -import java.beans.beancontext.BeanContextChildSupport; -import java.beans.beancontext.BeanContextMembershipEvent; -import java.beans.beancontext.BeanContextMembershipListener; -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Iterator; - -import javax.swing.JApplet; -import javax.swing.JMenuBar; - -import com.bbn.openmap.Environment; -import com.bbn.openmap.MapBean; -import com.bbn.openmap.PropertyHandler; -import com.bbn.openmap.gui.BasicMapPanel; -import com.bbn.openmap.gui.MapPanel; -import com.bbn.openmap.util.Debug; - -/** - * OpenMap Applet. Uses the MapHandler, via BeanContextMembershipListener - * methods to lay out the MapPanel and JMenuBar. Creates a PropertyHandler that - * will look for the openmap.properties file in the codebase. If the - * - *- * PROPERTIES - *- * - * applet parameter is specified with a different properties file, that file - * will be used instead. - */ -public class OpenMapApplet - extends JApplet - implements BeanContextMembershipListener, BeanContextChild { - - public final static String PropertiesProperty = "PROPERTIES"; - - /** - * BeanContextChildSupport object provides helper functions for - * BeanContextChild interface. - */ - private BeanContextChildSupport beanContextChildSupport = new BeanContextChildSupport(); - - // pinfo used to have these parameters, too, but that doesn't - // seem right to include visibroker arguments in the generic - // applet parameter info. - // {"ORBdisableLocator", "boolean", "disable Visiborker - // Gatekeeper"}, - // {"ORBgatekeeperIOR", "boolean", "URL to gatekeeper IOR."}, - - protected final String pinfo[][] = { - { - Environment.Latitude, - "float", - "Starting center latitude" - }, - { - Environment.Longitude, - "float", - "Starting center longitude" - }, - { - Environment.Scale, - "float", - "Starting Scale" - }, - { - Environment.Projection, - "String", - "Default projection type" - }, - { - "debug.basic", - "none", - "enable basic debugging" - }, - { - Environment.HelpURL, - "String", - "URL location of OpenMap help pages" - } - }; - - /** - * Returns information about this applet. - *- * - * @return a string containing information about the author, version, and - * copyright of the applet. - * @since JDK1.0 - */ - public String getAppletInfo() { - return MapBean.getCopyrightMessage(); - } - - /** - * Returns information about the parameters that are understood by this - * applet. - *
- * Each element of the array should be a set of three
Strings
- * containing the name, the type, and a description. For example: - *- *
- * - *- *- * String pinfo[][] = { - * { - * "fps", - * "1-10", - * "frames per second" - * }, - * { - * "repeat", - * "boolean", - * "repeat image loop" - * }, - * { - * "imgs", - * "url", - * "images directory" - * } - * }; - *- * - *- * - * @return an array describing the parameters this applet looks for. - * @since JDK1.0 - */ - public String[][] getParameterInfo() { - return pinfo; - } - - /** - * Called by the browser or applet viewer to inform this applet that it has - * been loaded into the system. It is always called before the first time - * that the
start
method is called. - *- * The implementation of this method provided by the
Applet
- * class does nothing. - * - * @see java.applet.Applet#destroy() - * @see java.applet.Applet#start() - * @see java.applet.Applet#stop() - * @since JDK1.0 - */ - public void init() { - // Initialize as an applet - Environment.init(this); - Debug.init(this, new String[] { - "debug.basic", - "debug.cspec", - "debug.layer", - "debug.mapbean", - "debug.plugin" - }); - - String propValue = getParameter(PropertiesProperty); - PropertyHandler propHandler = null; - - try { - if (propValue != null) { - PropertyHandler.Builder builder = new PropertyHandler.Builder().setPropertiesFile(propValue); - propHandler = new PropertyHandler(builder); - if (Debug.debugging("app")) { - Debug.output("OpenMapApplet: Using properties from " + propValue); - } - } - } catch (MalformedURLException murle) { - Debug.error("OpenMap: property file specified: " + propValue - + " doesn't exist, searching for default openmap.properties file..."); - } catch (IOException ioe) { - Debug.error("OpenMap: There is a problem using the property file specified: " + propValue - + ", searching for default openmap.properties file..."); - } - - if (propHandler == null) { - propHandler = new PropertyHandler(); - } - - MapPanel mapPanel = new BasicMapPanel(propHandler); - mapPanel.getMapHandler().add(this); - Debug.message("app", "OpenMapApplet.init()"); - } - - /** - * Called by the browser or applet viewer to inform this applet that it - * should start its execution. It is called after theinit
- * method and each time the applet is revisited in a Web page. - *- * - * @see java.applet.Applet#destroy() - * @see java.applet.Applet#init() - * @see java.applet.Applet#stop() - * @since JDK1.0 - */ - public void start() { - Debug.message("app", "OpenMapApplet.start()"); - super.start(); - } - - /** - * Called by the browser or applet viewer to inform this applet that it - * should stop its execution. It is called when the Web page that contains - * this applet has been replaced by another page, and also just before the - * applet is to be destroyed. - *
- * - * @see java.applet.Applet#destroy() - * @see java.applet.Applet#init() - * @since JDK1.0 - */ - public void stop() { - Debug.message("app", "OpenMapApplet.stop()"); - super.stop(); - } - - /** - * Called by the browser or applet viewer to inform this applet that it is - * being reclaimed and that it should destroy any resources that it has - * allocated. The
stop
method will always be called before - *destroy
. - *- * - * @see java.applet.Applet#init() - * @see java.applet.Applet#start() - * @see java.applet.Applet#stop() - * @since JDK1.0 - */ - public void destroy() { - Debug.message("app", "OpenMapApplet.destroy()"); - super.destroy(); - } - - /** - * The method called by BeanContextMembershipListener methods to find - * components in the MapHandler. - */ - public void findAndInit(Iterator it) { - while (it.hasNext()) { - findAndInit(it.next()); - } - } - - /** - * Called when an object is added to the MapHandler. - */ - public void findAndInit(Object someObj) { - if (someObj instanceof MapPanel && someObj instanceof Container) { - getContentPane().add((Container) someObj); - - JMenuBar jmb = ((MapPanel) someObj).getMapMenuBar(); - if (jmb != null) { - Debug.message("basic", "OpenMapApplet: Got MenuBar from MapPanel"); - getRootPane().setJMenuBar(jmb); - } - - invalidate(); - } - - if (someObj instanceof JMenuBar) { - getRootPane().setJMenuBar((JMenuBar) someObj); - invalidate(); - } - } - - /** - * BeanContextMembership interface method. Called when objects are added to - * the BeanContext. - * - * @param bcme contains an Iterator that lets you go through the new - * objects. - */ - public void childrenAdded(BeanContextMembershipEvent bcme) { - findAndInit(bcme.iterator()); - } - - /** - * BeanContextMembership interface method. Called by BeanContext when - * children are being removed. Unhooks itself from the objects that are - * being removed if they are contained within the Frame. - * - * @param bcme event that contains an Iterator to use to go through the - * removed objects. - */ - public void childrenRemoved(BeanContextMembershipEvent bcme) { - for (Iterator it = bcme.iterator(); it.hasNext();) { - findAndUndo(it.next()); - } - } - - /** - * Called when an object is removed from the MapHandler. - */ - public void findAndUndo(Object someObj) { - if (someObj instanceof MapPanel && someObj instanceof Container) { - Debug.message("basic", "OpenMapApplet: MapPanel is being removed from applet"); - getContentPane().remove((Container) someObj); - - if (getJMenuBar() == ((MapPanel) someObj).getMapMenuBar()) { - Debug.message("basic", "OpenMapApplet: Menu Bar is being removed"); - setJMenuBar(null); - } - } - - if (someObj instanceof JMenuBar) { - if (getJMenuBar() == (JMenuBar) someObj) { - Debug.message("basic", "OpenMapApplet: MenuBar is being removed from applet"); - setJMenuBar(null); - } - } - } - - /** Method for BeanContextChild interface. */ - public BeanContext getBeanContext() { - return beanContextChildSupport.getBeanContext(); - } - - /** - * Method for BeanContextChild interface. - * - * @param in_bc The context to which this object is being added - */ - 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 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); - } -} \ No newline at end of file diff --git a/src/openmap/com/bbn/openmap/app/package.html b/src/openmap/com/bbn/openmap/app/package.html index 065b573e..97dc16c6 100644 --- a/src/openmap/com/bbn/openmap/app/package.html +++ b/src/openmap/com/bbn/openmap/app/package.html @@ -20,10 +20,10 @@
-Provides the basic OpenMap applet and application classes. The -OpenMap application framework can be used to create any type of -application, simply by modifying the openmap.properties file. By -changing what components and layers that are added to the application, -you can control the look and functionality of it. +Provides the basic OpenMap application classes. The OpenMap +application framework can be used to create any type of application, +simply by modifying the openmap.properties file. By changing what +components and layers that are added to the application, you can +control the look and functionality of it. diff --git a/src/openmap/com/bbn/openmap/dataAccess/cgm/CGMApplet.java b/src/openmap/com/bbn/openmap/dataAccess/cgm/CGMApplet.java deleted file mode 100644 index 9121b061..00000000 --- a/src/openmap/com/bbn/openmap/dataAccess/cgm/CGMApplet.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - *Copyright 1997-2003 BBNT Solutions, LLC under - * sponsorship of the Defense Advanced Research Projects Agency - * (DARPA). - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the Cougaar Open Source License as - * published by DARPA on the Cougaar Open Source Website - * (www.cougaar.org). - * - * THE COUGAAR SOFTWARE AND ANY DERIVATIVE SUPPLIED BY LICENSOR IS - * PROVIDED 'AS IS' WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS OR - * IMPLIED, INCLUDING (BUT NOT LIMITED TO) ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND WITHOUT - * ANY WARRANTIES AS TO NON-INFRINGEMENT. IN NO EVENT SHALL COPYRIGHT - * HOLDER BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE OF DATA OR PROFITS, - * TORTIOUS CONDUCT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THE COUGAAR SOFTWARE. - */ -package com.bbn.openmap.dataAccess.cgm; - -import java.applet.Applet; -import java.awt.BorderLayout; -import java.awt.Color; -import java.io.DataInputStream; -import java.net.URL; - -public class CGMApplet extends Applet { - public void init() { - String file = getParameter("File"); - if (file == null) - return; - setBackground(new Color(244, 244, 242)); - try { - URL url = new URL(getCodeBase(), file); - DataInputStream in = new DataInputStream(url.openStream()); - CGM cgm = new CGM(); - cgm.read(in); - in.close(); - setLayout(new BorderLayout()); - CGMDisplay d = new CGMDisplay(cgm); - CGMPanel p = new CGMPanel(d); - add("Center", p); - } catch (Exception e) { - System.out.println(e); - return; - } - repaint(); - } -} \ No newline at end of file diff --git a/src/openmap/com/bbn/openmap/graphicLoader/GLPoint.java b/src/openmap/com/bbn/openmap/graphicLoader/GLPoint.java index eec30adc..6d2190c6 100644 --- a/src/openmap/com/bbn/openmap/graphicLoader/GLPoint.java +++ b/src/openmap/com/bbn/openmap/graphicLoader/GLPoint.java @@ -137,8 +137,7 @@ public int getHeight() { protected transient java.awt.Container palette = null; /** - * Make the palette visible. Will automatically determine if we're - * running in an applet environment and will use a JInternalFrame + * Make the palette visible. Will use a JInternalFrame * over a JFrame if necessary. */ public void showPalette() { diff --git a/src/openmap/com/bbn/openmap/graphicLoader/netmap/NetMapReader.java b/src/openmap/com/bbn/openmap/graphicLoader/netmap/NetMapReader.java index 39edc0f9..4b8b7703 100644 --- a/src/openmap/com/bbn/openmap/graphicLoader/netmap/NetMapReader.java +++ b/src/openmap/com/bbn/openmap/graphicLoader/netmap/NetMapReader.java @@ -594,151 +594,4 @@ protected String getVal(String marker, String line) { return (line.substring(sTok + marker.length(), eTok)); } - - // All this stuff below may be used later for more JMAP - // integration... - - // jicon jget(String name) { - // jicon x = (jicon)jicons.get(name); - - // if (x == null) { - // x = new jicon(name); - // jicons.put(name, x); - - // x.icon = can.loadImage("images/"+name); - - // if (jmap.on && jmap.dbgmode) - // System.err.println("new jicon " + name + " " + x.icon); - // } - - // return x; - // } - - /** - * Got a response from our cexec request - */ - // private void cexec(String a) { - // f.status("exec " + a); // show message in status line - // try { - // Runtime.getRuntime().exec(a); - // } catch(IOException err) { - // if (jmap.on) - // System.err.println(err.toString()); - // } - // } - /** - * Got a response from our cshow request - */ - // public void cshow(String url) { - // // show message in status line - // f.status("show " + url); - // try { - // AppletContext apcon = jmap.getAppletContext(); - - // if (url.substring(0, 2).equals("r ")) { // relative - // apcon.showDocument(new URL(jmap.getDocumentBase(), - // url.substring(2))); - // } - // else - // apcon.showDocument(new URL(url)); - // } catch (java.net.MalformedURLException err) { - // if (jmap.on) - // System.err.println(err.toString()); - // } - // } - /** - * We got a popup menu from NetMap that we had requested a bit - * ago. jmenu 2 SNMP (('show name' MCMD 'echo $NAME') ('ping' MCMD - * 'pingf $NAME')) - */ - // private void jmenu(String line) { - // PopupMenu tmenuh; - // int type = nargs[ 1 ]; - // if (jmap.on && jmap.dbgmode) - // System.err.println("Got jmenu type " + type); - // Vector l; - // Vector r = new Vector(4, 4); - - // if (f.pmenu[ type ] == null) { // if not already saved - // // create menu; store it in our global array - // l = (Vector)v.elementAt(3); - // tmenuh = new PopupMenu(v.elementAt(2).toString()); - // popupButtons(tmenuh, l, r); - // f.pmenu[ type ] = tmenuh; - // f.pmenuV[ type ] = r; - // can.add(tmenuh); - // } - // if (f.tmenutypeDesired == type) { // if still desired - // // install menu in ourjmap window - // f.tmenu = f.pmenu[ type ]; - // f.tmenutype = type; - // f.tmenutypeDesired = 0; - // f.tmenu.show(can, f.tmenux, f.tmenuy); - // } - // } - // private void jpulldowns(String line) { - // if (pulldowns) - // return; // already have pulldowns; skip this - // pulldowns = true; - // Menu tmenuh; - // int type = nargs[1 ]; - // Vector l; - // Vector r= new Vector(4, 4); - // Vector g = (Vector)v.elementAt(1); - // Enumeration e = g.elements(); - // while (e.hasMoreElements()) { - // tmenuh = new Menu(e.nextElement().toString()); - // l = (Vector)e.nextElement(); - // popupButtons(tmenuh, l, r); - // f.mb.add(tmenuh); - // } - // f.pulldownV = r; // save action data for menu operations - // } - /** - * Recursively create menu from list specification Vector r is - * result lookup list to correlate MenuItem with details - */ - // private void popupButtons(Menu menu, Vector l, Vector r) { - // Object ob, ob2; - // int i; - // Vector m; - // Menu submenu; - // MenuItem mi; - // for (i = 0; i < l.size(); i++) { - // m = (Vector)l.elementAt(i); - // ob = m.elementAt(0); - // ob2 = m.elementAt(1); - // if (ob2 instanceof Symbol) { - // mi = new MenuItem((String)ob); - // m.setElementAt(mi, 0); - // // replace first element with MenuItem - // menu.add(mi); - // // save for use by jmapFrame event handler - // r.addElement(m); - // } - // else if (ob2 instanceof Vector) { - // submenu = new Menu((String)ob); - // menu.add(submenu); - // m.removeElementAt(0); - // popupButtons(submenu, m, r); - // } - // else if (jmap.on && jmap.dbgmode) - // System.err.println("Invalid menu item " + m); - // } - // menu.addActionListener(f); - // } - // // got a response from our mcmd request - // private void mcmd(String a) { - // // f.status(a); // show message in status line - // if ((v.size() > 4) && - // (v.elementAt(1).toString().equals("host"))) { - // String b = v.elementAt(5).toString(); - // /* - // if (b.equals("Up")) - // new jmapSoundPlayer(f.jmap, "up.au"); - // else if (b.equals("not")) - // new jmapSoundPlayer(f.jmap, "noanswer.au"); - // */ - // } - // } } \ No newline at end of file diff --git a/src/openmap/com/bbn/openmap/gui/BasicMapPanel.java b/src/openmap/com/bbn/openmap/gui/BasicMapPanel.java index 1b64ba9b..0e988d9d 100644 --- a/src/openmap/com/bbn/openmap/gui/BasicMapPanel.java +++ b/src/openmap/com/bbn/openmap/gui/BasicMapPanel.java @@ -51,19 +51,19 @@ /** * The BasicMapPanel is a MapPanel and OMComponentPanel that is the heart of the - * OpenMap application framework. It can be used in a application or applet. The - * Panel has a BorderLayout, and creates a MapBean for its center area. It - * creates a MapHandler to use to hold all of its OpenMap components, and uses - * the PropertyHandler given to it in its constructor to create and configure - * all of the application components. The best way to add components to the - * MapPanel is to get the MapHandler from it and add components to that. The - * BasicMapPanel also adds itself to its MapHandler, so when the PropertyHandler - * adds MapPanelChildren components to the MapHandler, the BasicMapPanel is able - * to find them via the findAndInit method. By default, the BasicMapPanel looks - * for MapPanelChildren and asks them for where they would prefer to be located - * (BorderLayout.NORTH, BorderLayout.SOUTH, BorderLayout.EAST, - * BorderLayout.WEST). If you extend this component, though, other components - * could be found via that same findAndInit method. + * OpenMap application framework. The Panel has a BorderLayout, and creates a + * MapBean for its center area. It creates a MapHandler to use to hold all of + * its OpenMap components, and uses the PropertyHandler given to it in its + * constructor to create and configure all of the application components. The + * best way to add components to the MapPanel is to get the MapHandler from it + * and add components to that. The BasicMapPanel also adds itself to its + * MapHandler, so when the PropertyHandler adds MapPanelChildren components to + * the MapHandler, the BasicMapPanel is able to find them via the findAndInit + * method. By default, the BasicMapPanel looks for MapPanelChildren and asks + * them for where they would prefer to be located (BorderLayout.NORTH, + * BorderLayout.SOUTH, BorderLayout.EAST, BorderLayout.WEST). If you extend + * this component, though, other components could be found via that same + * findAndInit method. ** If a property prefix is set on this MapPanel, that property prefix can be * used to designate MapPanelChild objects for this MapPanel. The setName diff --git a/src/openmap/com/bbn/openmap/gui/FileMenu.java b/src/openmap/com/bbn/openmap/gui/FileMenu.java index c992f341..28fbb54c 100644 --- a/src/openmap/com/bbn/openmap/gui/FileMenu.java +++ b/src/openmap/com/bbn/openmap/gui/FileMenu.java @@ -34,8 +34,7 @@ /** * FileMenu creates AboutMenuItem, SavePropertiesMenuItem, - * SaveImageMenuItem, ExitMenuItem. It only adds AboutMenuItem if - * runing as an Applet, all otherwise. These menu items are added by + * SaveImageMenuItem, ExitMenuItem. These menu items are added by * default. */ public class FileMenu extends AbstractOpenMapMenu { @@ -53,16 +52,13 @@ public FileMenu() { // setMnemonic(defaultMnemonic); add(new AboutMenuItem()); - - if (!Environment.isApplet()) { - add(new JSeparator()); - add(new SavePropertiesMenuItem()); - add(new LoadPropertiesMenuItem()); - add(new JSeparator()); - add(new SaveAsMenu()); - add(new MapBeanPrinterMenuItem()); - add(new JSeparator()); - add(new QuitMenuItem()); - } + add(new JSeparator()); + add(new SavePropertiesMenuItem()); + add(new LoadPropertiesMenuItem()); + add(new JSeparator()); + add(new SaveAsMenu()); + add(new MapBeanPrinterMenuItem()); + add(new JSeparator()); + add(new QuitMenuItem()); } } \ No newline at end of file diff --git a/src/openmap/com/bbn/openmap/gui/MapPanel.java b/src/openmap/com/bbn/openmap/gui/MapPanel.java index 519caa4f..96cc8f99 100644 --- a/src/openmap/com/bbn/openmap/gui/MapPanel.java +++ b/src/openmap/com/bbn/openmap/gui/MapPanel.java @@ -30,7 +30,7 @@ * The MapPanel is a interface describing a component that contains a MapBean, MapHandler, menu widgets and all the * other components connected to make an OpenMap map widget. A MapPanel is a self-contained OpenMap Swing component. It * is expected that the MapPanel will extend from java.awt.Container. If it doesn't, it might not be automatically added - * to the OpenMapFrame or OpenMapApplet if it is found in the MapHandler. + * to the OpenMapFrame if it is found in the MapHandler. */ public interface MapPanel { diff --git a/src/openmap/com/bbn/openmap/gui/OpenMapFrame.java b/src/openmap/com/bbn/openmap/gui/OpenMapFrame.java index f09a65f2..3f18c379 100644 --- a/src/openmap/com/bbn/openmap/gui/OpenMapFrame.java +++ b/src/openmap/com/bbn/openmap/gui/OpenMapFrame.java @@ -53,11 +53,6 @@ * Beans to the MapHandler BeanContext, and then positions the widgets it can * deal with within itself. The frame does not present itself until an MapPanel * is found. - * - *
- * The OpenMapFrame is intended to be used in an application environment. The - * applet checks and code to handle the applet environment was moved to the - * OpenMapApplet class. */ public class OpenMapFrame extends JFrame diff --git a/src/openmap/com/bbn/openmap/image/MagicPlanetImageComponent.java b/src/openmap/com/bbn/openmap/image/MagicPlanetImageComponent.java index 0e04a484..42d12c4c 100644 --- a/src/openmap/com/bbn/openmap/image/MagicPlanetImageComponent.java +++ b/src/openmap/com/bbn/openmap/image/MagicPlanetImageComponent.java @@ -717,7 +717,7 @@ protected String generatePostProcessingCmd(String script, String filePath) { ret = ret.replace('/', '\\'); } } catch (NullPointerException npe) { - // Applet, or Environment not set up. + // Environment not set up. } if (DEBUG) { diff --git a/src/openmap/com/bbn/openmap/io/BinaryFile.java b/src/openmap/com/bbn/openmap/io/BinaryFile.java index 4b3a805c..ce423651 100644 --- a/src/openmap/com/bbn/openmap/io/BinaryFile.java +++ b/src/openmap/com/bbn/openmap/io/BinaryFile.java @@ -31,7 +31,6 @@ import java.lang.ref.WeakReference; import java.net.MalformedURLException; import java.net.URL; -import java.net.URLClassLoader; import java.util.Vector; import com.bbn.openmap.Environment; @@ -107,20 +106,14 @@ public BinaryFile(String name) throws IOException { } try { - File file = null; + File file = new File(name); URL url = null; - if (!Environment.isApplet()) { - file = new File(name); - } - - if (file != null && file.exists()) { + if (file.exists()) { // If the string represents a file, then we want to // use the RandomAccessFile aspect of the BinaryFile. setInputReader(new FileInputReader(file)); } else { - // see JNLP deploy tip here - // http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#ClassLoader_and_Resources final InputStream resourceStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (resourceStream != null) { if (showDebug) { @@ -155,11 +148,9 @@ protected void reopen() throws IOException { Debug.output("BinaryFile: looking for " + newname); } - if (!Environment.isApplet()) { - file = new File(newname); - } + file = new File(newname); - if (file != null && file.exists()) { + if (file.exists()) { // It's still a file, available directly. // Access it with the RandomAccessFile setInputReader(new FileInputReader(file)); @@ -177,20 +168,6 @@ protected void reopen() throws IOException { } - } else if (Environment.isApplet()) { - if (showDebug) { - Debug.output(" As applet, checking codebase..."); - } - // Look in the codebase for applets... - URL[] cba = new URL[1]; - cba[0] = Environment.getApplet().getCodeBase(); - - URLClassLoader ucl = URLClassLoader.newInstance(cba); - url = ucl.getResource(name); - - if (url != null) { - setInputReader(new URLInputReader(url)); - } } } @@ -296,14 +273,10 @@ protected boolean setJarInputReader(String name) throws IOException { public static boolean exists(String name) { boolean exists = false; try { - File file = null; + File file = new File(name); URL url = null; - if (!Environment.isApplet()) { - file = new File(name); - } - - if (file != null && file.exists()) { + if (file.exists()) { exists = true; } else { @@ -324,29 +297,6 @@ public static boolean exists(String name) { // a classpath, available for direct access. if (url != null) { exists = true; - } else if (Environment.isApplet()) { - if (Debug.debugging("binaryfile")) { - Debug.output(" As applet, checking codebase..."); - } - // Look in the codebase for applets... - URL[] cba = new URL[1]; - cba[0] = Environment.getApplet().getCodeBase(); - - URLClassLoader ucl = URLClassLoader.newInstance(cba); - if (ucl.getResource(name) != null) { - exists = true; - - // This has been commented out because the - // AppletDataNugget has been deprecated, and - // is not needed. - - // } else { - // url = AppletDataNugget.findResource(name); - - // if (url != null) { - // exists = true; - // } - } } // It's not in the classpath, so try it as a URL to a diff --git a/src/openmap/com/bbn/openmap/layer/DemoLayer.java b/src/openmap/com/bbn/openmap/layer/DemoLayer.java index dead4343..1b9a9035 100644 --- a/src/openmap/com/bbn/openmap/layer/DemoLayer.java +++ b/src/openmap/com/bbn/openmap/layer/DemoLayer.java @@ -172,14 +172,6 @@ public OMGraphicList init() { OMGraphicList omList = new OMGraphicList(); - // Location loc = new - // URLRasterLocation(42.3583f,-71.06f,"Boston,Massachusetts,USA","http://javamap.bbn.com:4711/appletimages/city.gif"); - // //loc.setLocationColor(Color.blue); - // loc.setShowLocation(true); - // loc.setShowName(true); - // //loc.setDetails("Details"); - // omList.add(loc); - int bytearrsize = (16 * 16) / 8; byte[] bytearr = new byte[bytearrsize]; diff --git a/src/openmap/com/bbn/openmap/layer/beanbox/openmap.properties b/src/openmap/com/bbn/openmap/layer/beanbox/openmap.properties index 67320780..c63f7466 100644 --- a/src/openmap/com/bbn/openmap/layer/beanbox/openmap.properties +++ b/src/openmap/com/bbn/openmap/layer/beanbox/openmap.properties @@ -198,22 +198,6 @@ openmap.UseInternalFrames=false #openmap.Debug= -# You may be trying to run OpenMap as an applet, with the data files -# in their own jar file. It's difficult to get the applet to look in -# a data jar file if there are no classes in it (I couldn't find a -# solution to this). So, OpenMap now has a workaround. You can use -# the com.bbn.openmap.io.AppletDataNugget class to create a -# package-less, empty class to put at the root of your data jar file -# (JavaDocs contains instructions, and there is a usage statement -# printout if you run the class). It might be good practice to name -# this class the same name as the jar file itself. Put the name of -# the class (or classes) that is in the data jar file in this list, -# and the BinaryFile will be able to find it. If you aren't running -# as an applet, or your data is not in a jar file by itself, you don't -# need to use this property. - -#openmap.appletDataNuggets= - # ################################################### # These properties define the general components to use in the # application, OTHER than layers. Notice the marker name list. You diff --git a/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java b/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java index 72995f21..08de4ca4 100644 --- a/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java +++ b/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java @@ -374,7 +374,6 @@ protected void setLocationHandlers(String prefix, Properties p) { + "\""); } - // Works for applet! Object obj = Class.forName(className).newInstance(); if (obj instanceof LocationHandler) { diff --git a/src/openmap/com/bbn/openmap/layer/vpf/VPFConfig.java b/src/openmap/com/bbn/openmap/layer/vpf/VPFConfig.java index c58ee139..865e9574 100644 --- a/src/openmap/com/bbn/openmap/layer/vpf/VPFConfig.java +++ b/src/openmap/com/bbn/openmap/layer/vpf/VPFConfig.java @@ -53,6 +53,7 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; import javax.swing.tree.TreeSelectionModel; import com.bbn.openmap.Layer; @@ -374,7 +375,7 @@ public void valueChanged(TreeSelectionEvent e) { @SuppressWarnings("unchecked") protected void loadCurrentFeatures(DefaultMutableTreeNode top, String featureName, LayerGraphicWarehouseSupport warehouse) { - Enumeration
treeEnum = top.children(); + Enumeration treeEnum = top.children(); while (treeEnum.hasMoreElements()) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeEnum.nextElement(); Object obj = node.getUserObject(); diff --git a/src/openmap/com/bbn/openmap/omGraphics/EditableOMScalingRaster.java b/src/openmap/com/bbn/openmap/omGraphics/EditableOMScalingRaster.java index 2949e740..5109b92f 100644 --- a/src/openmap/com/bbn/openmap/omGraphics/EditableOMScalingRaster.java +++ b/src/openmap/com/bbn/openmap/omGraphics/EditableOMScalingRaster.java @@ -127,14 +127,8 @@ public void createGraphic(GraphicAttributes ga) { init(); stateMachine.setUndefined(); - String pathToFile = null; - // / This would be an ideal place to bring up a chooser! - if (!Environment.isApplet()) { - pathToFile = com.bbn.openmap.util.FileUtils.getFilePathToOpenFromUser("Choose Image File for Raster"); - } else { - JOptionPane.showMessageDialog(null, "Can't search for images in an applet!", "Can't Choose Image", JOptionPane.ERROR_MESSAGE); - } + String pathToFile = com.bbn.openmap.util.FileUtils.getFilePathToOpenFromUser("Choose Image File for Raster"); if (pathToFile == null) return; diff --git a/src/openmap/com/bbn/openmap/plugin/esri/ExampleApplet.java b/src/openmap/com/bbn/openmap/plugin/esri/ExampleApplet.java deleted file mode 100644 index 2dc532da..00000000 --- a/src/openmap/com/bbn/openmap/plugin/esri/ExampleApplet.java +++ /dev/null @@ -1,291 +0,0 @@ -// ********************************************************************** -// -// -// -// BBN Technologies -// 10 Moulton Street -// Cambridge, MA 02138 -// (617) 873-8000 -// -// Copyright (C) BBNT Solutions LLC. All rights reserved. -// -// -// ********************************************************************** -// -// $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/plugin/esri/ExampleApplet.java,v $ -// $RCSfile: ExampleApplet.java,v $ -// $Revision: 1.4 $ -// $Date: 2005/08/09 20:33:38 $ -// $Author: dietrick $ -// -// ********************************************************************** - -package com.bbn.openmap.plugin.esri; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.URL; -import java.util.Properties; -import java.util.Vector; - -import javax.swing.JApplet; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import com.bbn.openmap.Layer; -import com.bbn.openmap.LayerHandler; -import com.bbn.openmap.MapBean; -import com.bbn.openmap.MouseDelegator; -import com.bbn.openmap.dataAccess.shape.DbfTableModel; -import com.bbn.openmap.dataAccess.shape.EsriGraphicList; -import com.bbn.openmap.event.NavMouseMode; -import com.bbn.openmap.event.SelectMouseMode; -import com.bbn.openmap.gui.OMToolSet; -import com.bbn.openmap.gui.Tool; -import com.bbn.openmap.gui.ToolPanel; -import com.bbn.openmap.layer.GraticuleLayer; -import com.bbn.openmap.omGraphics.OMGraphic; -import com.bbn.openmap.proj.coords.LatLonPoint; - -/** - * ExampleApplet is an example of how to use the EsriLayer in a JApplet. When - * the user clicks on the "Add Layers" button, three sets of shape files are - * streamed from a web server to the clients web browser. After the shape files - * have been streamed to the client's browser, the user may click on the - * "View Table" button. Clicking this button will display a new JFrame - * containing a JTable. This JTable will contain data from a corresponding - * layer's .dbf file. To enable the user to run this applet as an application - * the user may check off a box reading "Running Locally". Checking this box, - * will cause the applet to load files from the local file system. - * - * @author Doug Van Auken - */ -public class ExampleApplet extends JApplet { - private MapBean _mapBean = null; - private Layer _layers[] = null; - private LayerHandler _layerHandler = null; - private OMToolSet _omts = null; - private ToolPanel _toolPanel = null; - private MouseDelegator _mouseDelegator = null; - - private JButton _cmdAddLayers = null; - private JButton _cmdShowTable = null; - - private JCheckBox _runningLocally = null; - - /* - * Constructor. - */ - public ExampleApplet() { - _mapBean = new MapBean(); - _toolPanel = new ToolPanel(); - _omts = new OMToolSet(); - _omts.findAndInit(_mapBean); - _mouseDelegator = new MouseDelegator(_mapBean); - - NavMouseMode nmm = new NavMouseMode(); - SelectMouseMode smm = new SelectMouseMode(); - _mouseDelegator.addMouseMode(nmm); - _mouseDelegator.addMouseMode(smm); - - setupUI(); - } - - /** - * Provides a dialog box from which the user can pick the layer that they - * would like to view table data for - * - * @return The layer that user has selected - */ - private EsriLayer pickEsriLayer() { - Layer[] layers = _layerHandler.getLayers(); - Vectorvector = new Vector (); - for (int n = 0; n <= layers.length - 1; n++) { - String name = layers[n].getName(); - vector.add(name); - } - Object[] objects = vector.toArray(); - String selectedValue = (String) JOptionPane.showInputDialog(null, - "Choose one", - "Input", - JOptionPane.INFORMATION_MESSAGE, - null, - objects, - objects[0]); - - for (int n = 0; n <= layers.length - 1; n++) { - String name = layers[n].getName(); - if (name.equalsIgnoreCase(selectedValue)) { - return (EsriLayer) layers[n]; - } - } - return null; - } - - /** - * Sets up the user interface. - */ - public void setupUI() { - _runningLocally = new JCheckBox("Running Locally"); - - getContentPane().setLayout(new BorderLayout()); - setSize(640, 480); - _mapBean.setCenter(new LatLonPoint.Double(43.0f, -95.0f)); - _mapBean.setScale(120000000f); - _layers = new Layer[1]; - - _toolPanel = new ToolPanel(); - - Properties props = new Properties(); - props.put("prettyName", "Graticule"); - props.put("showRuler", "true"); - props.put("show1And5Lines", "true"); - props.put("threshold", "2"); - props.put("10DegreeColor", "FF000000"); - props.put("5DegreeColor", "FF009900"); - props.put("1DegreeColor", "FF003300"); - props.put("equatorColor", "FFFF0000"); - props.put("dateLineColor", "FF000099"); - props.put("specialLineColor", "FF000000"); - props.put("textColor", "FF000000"); - GraticuleLayer graticule = new GraticuleLayer(); - graticule.setProperties(props); - _layers[0] = graticule; - - // Finish setting up the GUI. - _layerHandler = new LayerHandler(_layers); - _layerHandler.addLayerListener(_mapBean); - - // _omts.add(_mouseModePanel);; - - _cmdAddLayers = new JButton("Add Layers"); - _cmdAddLayers.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - try { - EsriLayer rivers = null; - EsriLayer cities = null; - EsriLayer states = null; - URL dbf = null; - URL shx = null; - URL shp = null; - - if (_runningLocally.isSelected()) { - dbf = new URL("file://localhost/c:/data/rivers.dbf"); - shp = new URL("file://localhost/c:/data/rivers.shp"); - shx = new URL("file://localhost/c:/data/rivers.shx"); - rivers = new EsriLayer("Southwest", dbf, shp, shx); - - dbf = new URL("file://localhost/c:/data/cities.dbf"); - shp = new URL("file://localhost/c:/data/cities.shp"); - shx = new URL("file://localhost/c:/data/cities.shx"); - cities = new EsriLayer("Cities", dbf, shp, shx); - - dbf = new URL("file://localhost/c:/data/states.dbf"); - shp = new URL("file://localhost/c:/data/states.shp"); - shx = new URL("file://localhost/c:/data/states.shx"); - states = new EsriLayer("States", dbf, shp, shx); - } else { - dbf = new URL(getCodeBase(), "resources/rivers.dbf"); - shp = new URL(getCodeBase(), "resources/rivers.shp"); - shx = new URL(getCodeBase(), "resources/rivers.shx"); - rivers = new EsriLayer("Rivers", dbf, shp, shx); - - dbf = new URL(getCodeBase(), "resources/cities.dbf"); - shp = new URL(getCodeBase(), "resources/cities.shp"); - shx = new URL(getCodeBase(), "resources/cities.shx"); - cities = new EsriLayer("Cities", dbf, shp, shx); - - dbf = new URL(getCodeBase(), "resources/states.dbf"); - shp = new URL(getCodeBase(), "resources/states.shp"); - shx = new URL(getCodeBase(), "resources/states.shx"); - states = new EsriLayer("States", dbf, shp, shx); - } - - _layerHandler.addLayer(rivers); - _layerHandler.addLayer(cities); - _layerHandler.addLayer(states); - _cmdAddLayers.setEnabled(false); - _cmdShowTable.setEnabled(true); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - }); - - _cmdShowTable = new JButton("View Table"); - _cmdShowTable.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - Layer[] layers = _layerHandler.getMapLayers(); - if (layers.length >= 4) { - EsriLayer layer = pickEsriLayer(); - showTable(layer); - _cmdAddLayers.setEnabled(false); - } - } - }); - - _toolPanel.add(_runningLocally); - _toolPanel.add(_cmdAddLayers, 0); - _toolPanel.add(_cmdShowTable, 1); - _toolPanel.add((Tool) _omts); - - getContentPane().add(_toolPanel, BorderLayout.NORTH); - getContentPane().add(_mapBean, BorderLayout.CENTER); - setVisible(true); - } - - /** - * Displays a new window containing the tabular data for the passed-in layer - * - * @param layer The layer whose data is to be displayed - */ - public void showTable(final EsriLayer layer) { - JFrame frame = new JFrame("Table"); - DbfTableModel model = layer.getModel(); - JTable table = new JTable(model); - JScrollPane pane = new JScrollPane(table); - frame.getContentPane().add(pane, BorderLayout.CENTER); - - ListSelectionModel lsm = table.getSelectionModel(); - lsm.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - // Ignore extra messages. - if (e.getValueIsAdjusting()) { - return; - } - ListSelectionModel lsm2 = (ListSelectionModel) e.getSource(); - if (lsm2.isSelectionEmpty()) { - // no rows are selected - } else { - int index = lsm2.getMinSelectionIndex(); - EsriGraphicList list = layer.getEsriGraphicList(); - OMGraphic graphic = list.getOMGraphicAt(index); - graphic.select(); - list.generate(_mapBean.getProjection()); - layer.repaint(); - } - } - }); - frame.setSize(400, 300); - frame.setVisible(true); - } - - /** - * Main method to facilitate testing and to run as stand alone application. - */ - public static void main(String args[]) { - ExampleApplet example = new ExampleApplet(); - JFrame frame = new JFrame(); - frame.getContentPane().add(example); - frame.setSize(800, 600); - frame.setVisible(true); - } -} \ No newline at end of file diff --git a/src/openmap/com/bbn/openmap/plugin/esri/package.html b/src/openmap/com/bbn/openmap/plugin/esri/package.html index b253a1f1..5c66b931 100755 --- a/src/openmap/com/bbn/openmap/plugin/esri/package.html +++ b/src/openmap/com/bbn/openmap/plugin/esri/package.html @@ -30,7 +30,7 @@ clicking on a map object will highlight an entry in the database table. -The EsriLayer, ExampleApplet and ExampleApplication demonstrate the +The EsriLayer and ExampleApplication demonstrate the different capabilities of the package contents. The ExampleApplication is an example of adding graphics to a shape file and how to use the components to create a shape file. The Tester diff --git a/src/openmap/com/bbn/openmap/util/Debug.java b/src/openmap/com/bbn/openmap/util/Debug.java index 59a5cdba..c9b80176 100644 --- a/src/openmap/com/bbn/openmap/util/Debug.java +++ b/src/openmap/com/bbn/openmap/util/Debug.java @@ -22,7 +22,6 @@ package com.bbn.openmap.util; -import java.applet.Applet; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -46,7 +45,7 @@ * put into it. *
* Debugging output is turned on or off by system properties for - * applications, or parameters for applets. + * applications. *
* A programmer can use code like the following: *
@@ -59,14 +58,9 @@ *
* The message gets printed when the application is run with
- * -Ddebug.foo
or when the applet gets run with:
- *
- *
- * <param name=debug.foo value=>
- *
- *
+ * -Ddebug.foo
.
* The special token debug.all
turns on all debugging
- * for both applets and applications.
+ * for applications.
*
* @author Tom Mitchell (tmitchell@bbn.com)
* @author $Author: dietrick $
@@ -137,59 +131,6 @@ private Debug() {
private static Hashtable dbgTable = new Hashtable();
private static String debugTokenHeader = "debug.";
- /**
- * Initialize debugging for the given applet. Applets must pass an array of
- * parameters because the applet Parameters list cannot be accessed in
- * whole, only queried. The parameters list looks something like this:
- *
- *
- *
- * String[] debugTokens = { "debug.debug", // com.bbn.openmap.Debug
- * "debug.openmap", // com.bbn.openmap.client.OpenMap
- * "debug.mappanel", // com.bbn.openmap.awt.MapPanel
- * "debug.awt", // com.bbn.openmap.awt.*
- * "debug.map", // com.bbn.openmap.Map
- * "debug.layer", // com.bbn.openmap.Layer
- * "debug.proj", // com.bbn.openmap.proj.*
- * "debug.spec", // com.bbn.openmap.spec.*
- * "debug.env" // com.bbn.openmap.Environment
- * };
- *
- *
- *
- * @param applet The applet
- * @param parameters The debugging flags to look for in the applet's
- * parameters list
- */
- public static void init(Applet applet, String[] parameters) {
- if (applet == null) {
- // handle a SecurityException in case we are an applet
- // but no applet was passed as an argument.
- try {
- init(System.getProperties());
- } catch (SecurityException e) {
- }
- } else if (parameters != null) {
- try {
- for (int i = 0; i < parameters.length; i++) {
- String pname = parameters[i];
- if (pname.startsWith(debugTokenHeader)
- && (applet.getParameter(parameters[i]) != null)) {
- String token = pname.substring(debugTokenHeader.length());
- dbgTable.put(token, Boolean.TRUE);
- }
- }
- // look for special debug.all token!
- if (applet.getParameter(debugTokenHeader + debugAllToken) != null) {
- dbgTable.put(debugAllToken, Boolean.TRUE);
- }
- } catch (NullPointerException npe) {
- }
- }
-
- Debug.postInit();
- }
-
/**
* Initialize debugging for an application. Debugging symbols are detected
* in the given properties list, and must have the form "debug.X", where X
@@ -224,7 +165,7 @@ public static void init() {
}
/**
- * Common inits, regardless of applet or application.
+ * Common inits
*/
private static void postInit() {
debugAll = dbgTable.containsKey(debugAllToken);
diff --git a/src/openmap/com/bbn/openmap/util/PropUtils.java b/src/openmap/com/bbn/openmap/util/PropUtils.java
index 772de377..b2d1fb89 100644
--- a/src/openmap/com/bbn/openmap/util/PropUtils.java
+++ b/src/openmap/com/bbn/openmap/util/PropUtils.java
@@ -31,7 +31,6 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
-import java.net.URLClassLoader;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedList;
@@ -764,7 +763,7 @@ public static URL getResourceOrFileOrURL(Class extends Object> askingClass, St
retval = Thread.currentThread().getContextClassLoader().getResource(name);
}
- // if (retval == null && !Environment.isApplet()) {
+ // if (retval == null) {
// // Check the classpath plus the share directory, which may
// // be in the openmap.jar file or in the development
// // environment.
@@ -773,15 +772,6 @@ public static URL getResourceOrFileOrURL(Class extends Object> askingClass, St
// retval = ClassLoader.getSystemResource("share/" + name);
// }
- if (retval == null && Environment.isApplet()) {
- if (DEBUG)
- logger.fine("checking with URLClassLoader");
- URL[] cba = new URL[1];
- cba[0] = Environment.getApplet().getCodeBase();
- URLClassLoader ucl = URLClassLoader.newInstance(cba);
- retval = ucl.getResource(name);
- }
-
// If there was no resource by that name available
if (retval == null) {
if (DEBUG)