[mapguide-commits] r9948 - in sandbox/jng/vanilla_swig: Doc/samples/javasamples Doc/samples/javasamples/hello_map Doc/samples/javasamples/interacting_with_layers Doc/samples/javaviewersample Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jun 20 02:10:57 PDT 2022


Author: jng
Date: 2022-06-20 02:10:56 -0700 (Mon, 20 Jun 2022)
New Revision: 9948

Modified:
   sandbox/jng/vanilla_swig/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp
   sandbox/jng/vanilla_swig/Doc/samples/javasamples/index.jsp
   sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp
   sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp
   sandbox/jng/vanilla_swig/Doc/samples/javasamples/main.jsp
   sandbox/jng/vanilla_swig/Doc/samples/javaviewersample/utilityfunctions.jsp
   sandbox/jng/vanilla_swig/Web/src/viewerfiles/ajaxmappane.templ
Log:
Fix up java viewer samples and fix up ajaxmappane.templ to guard against non-existent commands

Modified: sandbox/jng/vanilla_swig/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp
===================================================================
--- sandbox/jng/vanilla_swig/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp	2022-06-06 12:12:30 UTC (rev 9947)
+++ sandbox/jng/vanilla_swig/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp	2022-06-20 09:10:56 UTC (rev 9948)
@@ -42,7 +42,7 @@
       // --------------------------------------------------//
       // Basic initialization needs to be done every time.
       
-      MapGuideJavaApiEx.MgInitializeWebTier(webconfigFilePath);
+      MapGuideJavaApi.mgInitializeWebTier(webconfigFilePath);
 
       // Get the user information using the session id,
       // and set up a connection to the site server.

Modified: sandbox/jng/vanilla_swig/Doc/samples/javasamples/index.jsp
===================================================================
--- sandbox/jng/vanilla_swig/Doc/samples/javasamples/index.jsp	2022-06-06 12:12:30 UTC (rev 9947)
+++ sandbox/jng/vanilla_swig/Doc/samples/javasamples/index.jsp	2022-06-20 09:10:56 UTC (rev 9948)
@@ -61,9 +61,9 @@
       Viewer Samples
     </h1>
       <ul>
-        <li><a href="../javaviewersample/dwfviewersample.jsp?SESSION=<?= $sessionId ?>&MAPNAME=<?= $mapName ?>" target="_blank">Using DWF Viewer</a></li>
-        <li><a href="../javaviewersample/ajaxviewersample.jsp?SESSION=<?= $sessionId ?>&MAPNAME=<?= $mapName ?>" target="_blank">Using Ajax Viewer</a></li>
-        <li><a href="../javaviewersample/ajaxtiledviewersample.jsp?SESSION=<?= $sessionId ?>&MAPNAME=<?= $mapName ?>" target="_blank">Using Tiled Ajax Viewer</a></li>
+        <li><a href="../javaviewersample/dwfviewersample.jsp?SESSION=<%= sessionId %>&MAPNAME=<%= mapName %>" target="_blank">Using DWF Viewer</a></li>
+        <li><a href="../javaviewersample/ajaxviewersample.jsp?SESSION=<%= sessionId %>&MAPNAME=<%= mapName %>" target="_blank">Using Ajax Viewer</a></li>
+        <li><a href="../javaviewersample/ajaxtiledviewersample.jsp?SESSION=<%= sessionId %>&MAPNAME=<%= mapName %>" target="_blank">Using Tiled Ajax Viewer</a></li>
       </ul>
     <%
     String helpDir = webExtensionsDirectory + "www/Help/";

Modified: sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp
===================================================================
--- sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp	2022-06-06 12:12:30 UTC (rev 9947)
+++ sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp	2022-06-20 09:10:56 UTC (rev 9948)
@@ -39,7 +39,7 @@
 
     try
     {
-      MapGuideJavaApiEx.MgInitializeWebTier(webconfigFilePath);
+      MapGuideJavaApi.mgInitializeWebTier(webconfigFilePath);
 
       // Get the user information using the session id,
       // and set up a connection to the site server.

Modified: sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp
===================================================================
--- sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp	2022-06-06 12:12:30 UTC (rev 9947)
+++ sandbox/jng/vanilla_swig/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp	2022-06-20 09:10:56 UTC (rev 9948)
@@ -51,7 +51,7 @@
       // the Web Extensions session identifier stored in PHP
       // session state.
 
-      MapGuideJavaApiEx.MgInitializeWebTier(webconfigFilePath);
+      MapGuideJavaApi.mgInitializeWebTier(webconfigFilePath);
 
       // Get the user information using the session id,
       // and set up a connection to the site server.
@@ -86,18 +86,15 @@
       "&MAPNAME=" + mapName + "\">Run again</a></p>");
 
     }
-    catch (MgLayerNotFoundException e)
-    {
-      out.println("<p>Layer not found</p>");
-    }
-    catch (MgObjectNotFoundException e)
-    {
-      out.println("<p>Layer not found</p>");
-    }
     catch (MgException e)
     {
-      out.println(e.getExceptionMessage());
-      out.println(e.getDetails());
+      if (e.getExceptionCode().equals(MgExceptionCodes.MgLayerNotFoundException)
+        || e.getExceptionCode().equals(MgExceptionCodes.MgObjectNotFoundException)) {
+        out.println("<p>Layer not found</p>");
+      } else {
+        out.println(e.getExceptionMessage());
+        out.println(e.getDetails());
+      }
     }
   %>
 

Modified: sandbox/jng/vanilla_swig/Doc/samples/javasamples/main.jsp
===================================================================
--- sandbox/jng/vanilla_swig/Doc/samples/javasamples/main.jsp	2022-06-06 12:12:30 UTC (rev 9947)
+++ sandbox/jng/vanilla_swig/Doc/samples/javasamples/main.jsp	2022-06-20 09:10:56 UTC (rev 9948)
@@ -30,7 +30,7 @@
     // Initialize web tier with the site configuration file.  The config
     // file should be in the same folder as this script.
     String configPath =  realpath + "webconfig.ini";
-    MapGuideJavaApiEx.MgInitializeWebTier( configPath );
+    MapGuideJavaApi.mgInitializeWebTier( configPath );
 
     MgUserInformation userInfo = new MgUserInformation("Author", "author");
     MgSite site = new MgSite();

Modified: sandbox/jng/vanilla_swig/Doc/samples/javaviewersample/utilityfunctions.jsp
===================================================================
--- sandbox/jng/vanilla_swig/Doc/samples/javaviewersample/utilityfunctions.jsp	2022-06-06 12:12:30 UTC (rev 9947)
+++ sandbox/jng/vanilla_swig/Doc/samples/javaviewersample/utilityfunctions.jsp	2022-06-20 09:10:56 UTC (rev 9948)
@@ -26,7 +26,7 @@
     // Initialize web tier with the site configuration file.  The config
     // file should be in the same folder as this script.
     String configPath =  realpath + "webconfig.ini";
-    MapGuideJavaApiEx.MgInitializeWebTier( configPath );
+    MapGuideJavaApi.mgInitializeWebTier( configPath );
 }
 
 String GetQueryXmlTemplatePath()

Modified: sandbox/jng/vanilla_swig/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- sandbox/jng/vanilla_swig/Web/src/viewerfiles/ajaxmappane.templ	2022-06-06 12:12:30 UTC (rev 9947)
+++ sandbox/jng/vanilla_swig/Web/src/viewerfiles/ajaxmappane.templ	2022-06-20 09:10:56 UTC (rev 9948)
@@ -1162,7 +1162,9 @@
         else if(item.type == 1)
         {
             var cmd = parent.commands[item.cmdIndex];
-            addMenuOption(menuObj, item.name, item.cmdIndex, 1, cmd.icon, cmd.iconDisabled, cmd.enabled);
+            if (cmd) {
+                addMenuOption(menuObj, item.name, item.cmdIndex, 1, cmd.icon, cmd.iconDisabled, cmd.enabled);
+            }
         }
         else  if(item.type == 3)
         {



More information about the mapguide-commits mailing list