[mapguide-commits] r5421 - sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Dec 1 03:29:04 EST 2010


Author: jng
Date: 2010-12-01 00:29:04 -0800 (Wed, 01 Dec 2010)
New Revision: 5421

Modified:
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
Log:
3.0 sandbox changes:
 - Revert to original implementation (programmatically build the content) in ObjectFactory.CreateFlexibleLayout() as it turns out fusion in post 2.2 MapGuide trunk (which I had installed, testing recent installer changes) was just broken and giving me false positives.
 - Add API support for cloning IUIWidget instances
 - Add a vertical toolbar container (a copy of the secondary toolbar) in ObjectFactory.CreateFlexibleLayout() allowing for seamless transition between the 5 templates

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs	2010-12-01 03:03:54 UTC (rev 5420)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs	2010-12-01 08:29:04 UTC (rev 5421)
@@ -648,8 +648,32 @@
         }
     }
 
-    partial class UiWidgetType : IUIWidget { }
+    partial class UiWidgetType : IUIWidget 
+    {
+        IUIWidget IUIWidget.Clone()
+        {
+            var clone = new UiWidgetType()
+            {
+                Disabled = this.Disabled,
+                ImageClass = this.ImageClass,
+                ImageUrl = this.ImageUrl,
+                Label = this.Label,
+                Location = this.Location,
+                Name = this.Name,
+                StatusText = this.StatusText,
+                Tooltip = this.Tooltip,
+                Type = this.Type,
+                Extension = new CustomContentType() { Any = new XmlElement[0] }
+            };
 
+            var ext = this.GetAllValues();
+            if (ext.Count > 0)
+                clone.SetAllValues(ext);
+
+            return clone;
+        }
+    }
+
     partial class MapWidgetType : IMapWidget { }
 
     partial class MapViewType : IMapView { }

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs	2010-12-01 03:03:54 UTC (rev 5420)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinitionInterfaces.cs	2010-12-01 08:29:04 UTC (rev 5421)
@@ -1036,6 +1036,8 @@
         string StatusText { get; set; }
 
         string Disabled { get; set; }
+
+        IUIWidget Clone();
     }
 
     /// <summary>

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs	2010-12-01 03:03:54 UTC (rev 5420)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs	2010-12-01 08:29:04 UTC (rev 5421)
@@ -321,6 +321,14 @@
             KnownWidgetNames.ViewSize
         };
 
+        private static IUIWidget CreateVerticalWidget(IUIWidget widget)
+        {
+            var vert = widget.Clone();
+            vert.Name = "vert" + widget.Name;
+            vert.Label = string.Empty;
+            return vert;
+        }
+
         /// <summary>
         /// Creates a fusion flexible layout
         /// </summary>
@@ -330,6 +338,8 @@
         public static IApplicationDefinition CreateFlexibleLayout(IServerConnection owner, string templateName)
         {
             Check.NotNull(owner, "owner");
+
+            /*
             Check.Precondition(Array.IndexOf(owner.Capabilities.SupportedServices, (int)ServiceType.Fusion) >= 0, "Required Fusion service not supported on this connection");
 
             var fusionSvc = (IFusionService)owner.GetService((int)ServiceType.Fusion);
@@ -345,7 +355,8 @@
             }
             appDef.CurrentConnection = owner;
             return appDef;
-            /*
+            */ 
+            
             Check.Precondition(Array.IndexOf(owner.Capabilities.SupportedServices, (int)ServiceType.Fusion) >= 0, "Required Fusion service not supported on this connection");
             
             IApplicationDefinition appDef = new ApplicationDefinitionType()
@@ -371,12 +382,15 @@
             }
             else
             {
-                return DeserializeEmbeddedFlexLayout();
+                //NOTE: Depending on MapGuide Server version, this document may be 
+                //invalid (eg. References to widgets not available in that version)
+                return DeserializeEmbeddedFlexLayout(); 
             }
 
             //Toolbars, every template has them
             var toolbar = appDef.CreateContainer("Toolbar", containers.FindContainer("Toolbar"));
             var secToolbar = appDef.CreateContainer("ToolbarSecondary", containers.FindContainer("Toolbar"));
+            var vertToolbar = appDef.CreateContainer("ToolbarVertical", containers.FindContainer("Toolbar"));
 
             //Context menus, every template has them
             var mapContextMenu = appDef.CreateContainer("MapContextMenu", containers.FindContainer("ContextMenu"));
@@ -413,24 +427,36 @@
             zoomIn.SetValue("Factor", "2");
             zoomIn.StatusText = zoomIn.Tooltip = Res.ADF_Widget_ZoomIn_Desc;
             zoomIn.Label = Res.ADF_Widget_ZoomIn_Label;
-            
+            zoomIn.ImageUrl = "images/icons.png";
+            zoomIn.ImageClass = "zoom-in-fixed";
+            var vZoomIn = CreateVerticalWidget(zoomIn);
+
             //Zoom Out
             var zoomOut = (IUIWidget)appDef.CreateWidget("ZoomOut", widgets.FindWidget(KnownWidgetNames.ZoomOnClick));
             zoomOut.SetValue("Factor", "0.5");
             zoomOut.StatusText = zoomOut.Tooltip = Res.ADF_Widget_ZoomOut_Desc;
             zoomOut.Label = Res.ADF_Widget_ZoomOut_Label;
-            
+            zoomOut.ImageUrl = "images/icons.png";
+            zoomOut.ImageClass = "zoom-out-fixed";
+            var vZoomOut = CreateVerticalWidget(zoomOut);
+
             //Previous View
             var prevView = (IUIWidget)appDef.CreateWidget("PreviousView", widgets.FindWidget(KnownWidgetNames.ExtentHistory));
             prevView.SetValue("Direction", "previous");
             prevView.StatusText = prevView.Tooltip = Res.ADF_Widget_PreviousView_Desc;
             prevView.Label = Res.ADF_Widget_PreviousView_Label;
+            prevView.ImageUrl = "images/icons.png";
+            prevView.ImageClass = "view-back";
+            var vPrevView = CreateVerticalWidget(prevView);
 
             //Next View
             var nextView = (IUIWidget)appDef.CreateWidget("NextView", widgets.FindWidget(KnownWidgetNames.ExtentHistory));
             nextView.SetValue("Direction", "next");
             nextView.StatusText = nextView.Tooltip = Res.ADF_Widget_NextView_Desc;
             nextView.Label = Res.ADF_Widget_NextView_Label;
+            nextView.ImageUrl = "images/icons.png";
+            nextView.ImageClass = "view-forward";
+            var vNextView = CreateVerticalWidget(nextView);
 
             //Buffer
             var buffer = (IUIWidget)appDef.CreateWidget("tbBuffer", widgets.FindWidget(KnownWidgetNames.BufferPanel));
@@ -497,6 +523,11 @@
             widgetSet.AddWidget(selInfo);
             widgetSet.AddWidget(viewSize);
 
+            widgetSet.AddWidget(vZoomIn);
+            widgetSet.AddWidget(vZoomOut);
+            widgetSet.AddWidget(vPrevView);
+            widgetSet.AddWidget(vNextView);
+
             //Now here's where things may diverge completely between templates
             //So let's try for something that is somewhat consistent
 
@@ -542,6 +573,23 @@
             secToolbar.AddItem(appDef.CreateWidgetReference(prevView.Name));
             secToolbar.AddItem(appDef.CreateWidgetReference(nextView.Name));
 
+            //Init vertical toolbar
+            widgetSet.AddWidget(CreateVerticalWidget((IUIWidget)appDef.CreateWidget(KnownWidgetNames.Select, widgets.FindWidget(KnownWidgetNames.Select))));
+            widgetSet.AddWidget(CreateVerticalWidget((IUIWidget)appDef.CreateWidget(KnownWidgetNames.Pan, widgets.FindWidget(KnownWidgetNames.Pan))));
+            widgetSet.AddWidget(CreateVerticalWidget((IUIWidget)appDef.CreateWidget(KnownWidgetNames.Zoom, widgets.FindWidget(KnownWidgetNames.Zoom))));
+            widgetSet.AddWidget(CreateVerticalWidget((IUIWidget)appDef.CreateWidget(KnownWidgetNames.InitialMapView, widgets.FindWidget(KnownWidgetNames.InitialMapView))));
+            widgetSet.AddWidget(CreateVerticalWidget((IUIWidget)appDef.CreateWidget(KnownWidgetNames.ZoomToSelection, widgets.FindWidget(KnownWidgetNames.ZoomToSelection))));
+
+            vertToolbar.AddItem(appDef.CreateWidgetReference("vert" + KnownWidgetNames.Select));
+            vertToolbar.AddItem(appDef.CreateWidgetReference("vert" + KnownWidgetNames.Pan));
+            vertToolbar.AddItem(appDef.CreateWidgetReference("vert" + KnownWidgetNames.Zoom));
+            vertToolbar.AddItem(appDef.CreateWidgetReference(vZoomIn.Name));
+            vertToolbar.AddItem(appDef.CreateWidgetReference(vZoomOut.Name));
+            vertToolbar.AddItem(appDef.CreateWidgetReference("vert" + KnownWidgetNames.InitialMapView));
+            vertToolbar.AddItem(appDef.CreateWidgetReference("vert" + KnownWidgetNames.ZoomToSelection));
+            vertToolbar.AddItem(appDef.CreateWidgetReference(vPrevView.Name));
+            vertToolbar.AddItem(appDef.CreateWidgetReference(vNextView.Name));
+
             //Main menu
             menu.AddItem(appDef.CreateWidgetReference(KnownWidgetNames.MapMenu));
 
@@ -613,6 +661,7 @@
             //Now add them all to the main widget set
             widgetSet.AddContainer(toolbar);
             widgetSet.AddContainer(secToolbar);
+            widgetSet.AddContainer(vertToolbar);
             widgetSet.AddContainer(menu);
             widgetSet.AddContainer(statusbar);
             widgetSet.AddContainer(mapContextMenu);
@@ -625,21 +674,9 @@
             statusbar.Position = "bottom";
             mapContextMenu.Position = "top";
             taskPaneMenu.Position = "top";
+            vertToolbar.Position = "left";
 
-            //TODO: MGStudio actually creates a redundant secondary toolbar container. That way it can seamlessly
-            //switch between templates.
-
-            //Depending on some templates the secondary toolbar requires renaming
-            if (templateName.Equals(FusionTemplateNames.Aqua) || 
-                templateName.Equals(FusionTemplateNames.Maroon) || 
-                templateName.Equals(FusionTemplateNames.TurquoiseYellow))
-            {
-                secToolbar.Name = "ToolbarVertical";
-                secToolbar.Position = "left";
-            }
-
             return appDef;
-             */
         }
 
         internal static IApplicationDefinition DeserializeEmbeddedFlexLayout()



More information about the mapguide-commits mailing list