[mapguide-commits] r5037 - in sandbox/maestro-3.0: Maestro.Editors/Common MaestroAPITests OSGeo.MapGuide.MaestroAPI/Commands OSGeo.MapGuide.MaestroAPI/ObjectModels OSGeo.MapGuide.MaestroAPI/Properties OSGeo.MapGuide.MaestroAPI/Resource

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jul 19 09:36:22 EDT 2010


Author: jng
Date: 2010-07-19 13:36:22 +0000 (Mon, 19 Jul 2010)
New Revision: 5037

Modified:
   sandbox/maestro-3.0/Maestro.Editors/Common/SymbolPicker.cs
   sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
Log:
This submission includes the following changes:
 - Make the constructors of all resource classes internal, moving creation to the ObjectFactory class. Eventually, all classes generated from the xsds will all have internal constructors and the only way to create them is through the ObjectFactory class.
 - Update ObjectFactory so that CreateWebLayout() programmatically creates a WebLayout object that effectively matches the default new web layout template.
 - Update unit tests to use ObjectFactory

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/SymbolPicker.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/SymbolPicker.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/SymbolPicker.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -54,7 +54,7 @@
         {
             //Extract the symbols.dwf resource data and copy to a session based drawing source
             var dwf = _conn.ResourceService.GetResourceData(txtSymbolLibrary.Text, "symbols.dwf");
-            var ds = new Obj.DrawingSource();
+            var ds = OSGeo.MapGuide.MaestroAPI.ObjectModels.ObjectFactory.CreateDrawingSource(_conn);
             ds.SourceName = "symbols.dwf";
             ds.ResourceID = "Session:" + _conn.SessionID + "//" + Guid.NewGuid() + ".DrawingSource";
             _conn.ResourceService.SaveResource(ds);

Modified: sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs
===================================================================
--- sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -35,6 +35,7 @@
 using OSGeo.MapGuide.MaestroAPI.Resource;
 using OSGeo.MapGuide.ObjectModels.Common;
 using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.ObjectModels;
 
 namespace MaestroAPITests
 {
@@ -88,9 +89,10 @@
         [Test]
         public void TestValidResourceIdentifiers()
         {
+            var conn = _mocks.NewMock<IServerConnection>();
             //Verify that only valid resource identifiers can be assigned to certain resource types.
 
-            IResource res = new FeatureSourceType();
+            IResource res = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SDF");
             #region Feature Source
             try
             {
@@ -123,7 +125,7 @@
             }
             #endregion
 
-            res = new DrawingSource();
+            res = ObjectFactory.CreateDrawingSource(conn);
             #region Drawing Source
             try
             {
@@ -156,7 +158,7 @@
             }
             #endregion
 
-            res = new MapDefinition();
+            res = ObjectFactory.CreateMapDefinition(conn);
             #region Map Definition
             try
             {
@@ -189,7 +191,7 @@
             }
             #endregion
 
-            res = new WebLayoutType();
+            res = ObjectFactory.CreateWebLayout(conn, "Library://Test.MapDefinition");
             #region Web Layout
             try
             {
@@ -222,7 +224,7 @@
             }
             #endregion
 
-            res = new ApplicationDefinitionType();
+            res = ObjectFactory.CreateFlexibleLayout(conn);
             #region Application Definition
             try
             {
@@ -255,7 +257,7 @@
             }
             #endregion
 
-            res = new SymbolLibraryType();
+            res = ObjectFactory.CreateSymbolLibrary(conn);
             #region Symbol Library
             try
             {
@@ -288,7 +290,7 @@
             }
             #endregion
 
-            res = new SimpleSymbolDefinition();
+            res = ObjectFactory.CreateSimpleSymbol(conn);
             #region Simple Symbol Definition
             try
             {
@@ -321,7 +323,7 @@
             }
             #endregion
 
-            res = new CompoundSymbolDefinition();
+            res = ObjectFactory.CreateCompoundSymbol(conn);
             #region Compound Symbol Definition
             try
             {
@@ -354,8 +356,8 @@
             }
             #endregion
 
-            res = new SymbolLibraryType();
-            #region Symbol Library
+            res = ObjectFactory.CreateLoadProcedure(conn);
+            #region Load Procedure
             try
             {
                 res.ResourceID = "dklgjlahekjedjfd";
@@ -379,7 +381,7 @@
 
             try
             {
-                res.ResourceID = "Library://UnitTests/Test.SymbolLibrary";
+                res.ResourceID = "Library://UnitTests/Test.LoadProcedure";
             }
             catch (Exception)
             {
@@ -387,7 +389,7 @@
             }
             #endregion
 
-            res = new PrintLayout();
+            res = ObjectFactory.CreatePrintLayout(conn);
             #region Print Layout
             try
             {
@@ -425,43 +427,44 @@
         public void TestNoConversionOnIdenticalVersion()
         {
             //Verify origial reference is returned if we're converting a resource to the same version
+            var conn = _mocks.NewMock<IServerConnection>();
 
             var conv = new ResourceConverter(new List<IResourceConverter>());
             var targetVer = new Version(1, 0, 0);
 
-            var app = new ApplicationDefinitionType();
+            var app = ObjectFactory.CreateFlexibleLayout(conn);
             var app2 = conv.Upgrade(app, targetVer);
             Assert.AreSame(app, app2);
 
-            var fs = new FeatureSourceType();
+            var fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SDF");
             var fs2 = conv.Upgrade(fs, targetVer);
             Assert.AreSame(fs, fs2);
 
-            var ld = new LayerDefinition();
+            var ld = ObjectFactory.CreateLayerDefinition(conn);
             var ld2 = conv.Upgrade(ld, targetVer);
             Assert.AreSame(ld, ld2);
 
-            var md = new MapDefinition();
+            var md = ObjectFactory.CreateMapDefinition(conn);
             var md2 = conv.Upgrade(md, targetVer);
             Assert.AreSame(md, md2);
 
-            var wl = new WebLayoutType();
+            var wl = ObjectFactory.CreateWebLayout(conn, "Library://Test.MapDefinition");
             var wl2 = conv.Upgrade(wl, targetVer);
             Assert.AreSame(wl, wl2);
 
-            var sl = new SymbolLibraryType();
+            var sl = ObjectFactory.CreateSymbolLibrary(conn);
             var sl2 = conv.Upgrade(sl, targetVer);
             Assert.AreSame(sl, sl2);
 
-            var ssd = new SimpleSymbolDefinition();
+            var ssd = ObjectFactory.CreateSimpleSymbol(conn);
             var ssd2 = conv.Upgrade(ssd, targetVer);
             Assert.AreSame(ssd, ssd2);
 
-            var csd = new CompoundSymbolDefinition();
+            var csd = ObjectFactory.CreateCompoundSymbol(conn);
             var csd2 = conv.Upgrade(csd, targetVer);
             Assert.AreSame(csd, csd2);
 
-            var pl = new PrintLayout();
+            var pl = ObjectFactory.CreatePrintLayout(conn);
             var pl2 = conv.Upgrade(pl, targetVer);
             Assert.AreSame(pl, pl2);
         }
@@ -601,13 +604,52 @@
         }
 
         [Test]
+        public void TestWebLayout()
+        {
+            var conn = _mocks.NewMock<IServerConnection>();
+
+            var wl = ObjectFactory.CreateWebLayout(conn, "Library://Test.MapDefinition");
+            Assert.IsNotNull(wl.CommandSet);
+            Assert.IsNotNull(wl.ContextMenu);
+            Assert.IsNotNull(wl.InformationPane);
+            Assert.IsNotNull(wl.Map);
+            Assert.IsNotNull(wl.StatusBar);
+            Assert.IsNotNull(wl.TaskPane);
+            Assert.IsNotNull(wl.ToolBar);
+            Assert.IsNotNull(wl.ZoomControl);
+
+            Assert.IsTrue(wl.CommandSet.Count > 0);
+            Assert.IsTrue(wl.ContextMenu.MenuItem.Count > 0);
+            Assert.IsTrue(wl.ToolBar.Button.Count > 0);
+
+            Assert.AreEqual(wl.Map.ResourceId, "Library://Test.MapDefinition");
+
+            //Verify all built-in commands are available
+            Array cmdNames = Enum.GetValues(typeof(BuiltInCommandType));
+            foreach (var cmdName in cmdNames)
+            {
+                bool found = false;
+                foreach (var cmd in wl.CommandSet)
+                {
+                    if (cmd.Name == cmdName.ToString())
+                    {
+                        found = true;
+                    }
+                }
+                Console.WriteLine("Found command (" + cmdName.ToString() + "): " + found);
+                Assert.IsTrue(found);
+            }
+        }
+
+        [Test]
         public void TestFeatureSource()
         {
-            var fs = new FeatureSourceType();
+            var conn = _mocks.NewMock<IServerConnection>();
+
+            var fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SDF");
             Assert.IsTrue(fs.ConnectionString.Length == 0);
 
-            fs.Provider = "OSGeo.SDF";
-            fs.ConnectionString = "File=%MG_DATA_FILE_PATH%Foo.sdf";
+            fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SDF", "File=%MG_DATA_FILE_PATH%Foo.sdf");
 
             Assert.IsTrue(fs.UsesEmbeddedDataFiles);
             Assert.IsFalse(fs.UsesAliasedDataFiles);
@@ -615,9 +657,7 @@
             Assert.Catch<InvalidOperationException>(() => fs.GetAliasedFileName());
             Assert.Catch<InvalidOperationException>(() => fs.GetAliasName());
 
-            fs = new FeatureSourceType();
-            fs.Provider = "OSGeo.SDF";
-            fs.ConnectionString = "File=%MG_DATA_FILE_PATH%Bar.sdf;ReadOnly=TRUE";
+            fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SDF", "File=%MG_DATA_FILE_PATH%Bar.sdf;ReadOnly=TRUE");
 
             Assert.IsTrue(fs.UsesEmbeddedDataFiles);
             Assert.IsFalse(fs.UsesAliasedDataFiles);
@@ -625,9 +665,7 @@
             Assert.Catch<InvalidOperationException>(() => fs.GetAliasedFileName());
             Assert.Catch<InvalidOperationException>(() => fs.GetAliasName());
 
-            fs = new FeatureSourceType();
-            fs.Provider = "OSGeo.SHP";
-            fs.ConnectionString = "DefaultFileLocation=%MG_DATA_PATH_ALIAS[foobar]%";
+            fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SHP", "DefaultFileLocation=%MG_DATA_PATH_ALIAS[foobar]%");
 
             Assert.IsTrue(fs.UsesAliasedDataFiles);
             Assert.IsFalse(fs.UsesEmbeddedDataFiles);
@@ -635,9 +673,7 @@
             Assert.IsEmpty(fs.GetAliasedFileName());
             Assert.Catch<InvalidOperationException>(() => fs.GetEmbeddedDataName());
 
-            fs = new FeatureSourceType();
-            fs.Provider = "OSGeo.SDF";
-            fs.ConnectionString = "DefaultFileLocation=%MG_DATA_PATH_ALIAS[foobar]%Test.sdf";
+            fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SDF", "DefaultFileLocation=%MG_DATA_PATH_ALIAS[foobar]%Test.sdf");
 
             Assert.IsTrue(fs.UsesAliasedDataFiles);
             Assert.IsFalse(fs.UsesEmbeddedDataFiles);
@@ -645,9 +681,7 @@
             Assert.AreEqual(fs.GetAliasedFileName(), "Test.sdf");
             Assert.Catch<InvalidOperationException>(() => fs.GetEmbeddedDataName());
 
-            fs = new FeatureSourceType();
-            fs.Provider = "OSGeo.SDF";
-            fs.ConnectionString = "DefaultFileLocation=%MG_DATA_PATH_ALIAS[foobar]%Test.sdf;ReadOnly=TRUE";
+            fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SDF", "DefaultFileLocation=%MG_DATA_PATH_ALIAS[foobar]%Test.sdf;ReadOnly=TRUE");
 
             Assert.IsTrue(fs.UsesAliasedDataFiles);
             Assert.IsFalse(fs.UsesEmbeddedDataFiles);
@@ -655,9 +689,7 @@
             Assert.AreEqual(fs.GetAliasedFileName(), "Test.sdf");
             Assert.Catch<InvalidOperationException>(() => fs.GetEmbeddedDataName());
 
-            fs = new FeatureSourceType();
-            fs.Provider = "OSGeo.SQLServerSpatial";
-            fs.ConnectionString = "Service=(local)\\SQLEXPRESS;DataStore=TEST";
+            fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SQLServerSpatial", "Service=(local)\\SQLEXPRESS;DataStore=TEST");
 
             Assert.IsFalse(fs.UsesEmbeddedDataFiles);
             Assert.IsFalse(fs.UsesAliasedDataFiles);

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -256,10 +256,8 @@
                             // 4. If no spatial contexts are detected, assign a default one from the load procedure and save the modified feature source.
 
                             //Step 1: Create feature source document
-                            FeatureSourceType fs = new FeatureSourceType();
+                            FeatureSourceType fs = ObjectFactory.CreateFeatureSource(this.Parent, "OSGeo.SHP", "DefaultFileLocation=%MG_DATA_FILE_PATH%" + dataName);
                             fs.ResourceID = fsId;
-                            fs.Provider = "OSGeo.SHP";
-                            fs.Parameter.Add(new NameValuePairType() { Name = "DefaultFileLocation", Value = "%MG_DATA_FILE_PATH%" + dataName });
 
                             this.Parent.ResourceService.SaveResource(fs);
                             resCreatedOrUpdated.Add(fsId);
@@ -357,7 +355,7 @@
 
                                 if (clsDef != null && geom != null)
                                 {
-                                    OSGeo.MapGuide.ObjectModels.LayerDefinition.LayerDefinition ld = ObjectFactory.CreateLayerDefinition();
+                                    OSGeo.MapGuide.ObjectModels.LayerDefinition.LayerDefinition ld = ObjectFactory.CreateLayerDefinition(this.Parent);
 
                                     //Step 3: Assign default properties
                                     ld.ResourceID = lyrId;
@@ -468,10 +466,8 @@
                             // 4. If no spatial contexts are detected, assign a default one from the load procedure and save the modified feature source.
 
                             //Step 1: Create feature source document
-                            FeatureSourceType fs = new FeatureSourceType();
+                            FeatureSourceType fs = ObjectFactory.CreateFeatureSource(this.Parent, "OSGeo.SDF", "File=%MG_DATA_FILE_PATH%" + dataName);
                             fs.ResourceID = fsId;
-                            fs.Provider = "OSGeo.SDF";
-                            fs.Parameter.Add(new NameValuePairType() { Name = "File", Value = "%MG_DATA_FILE_PATH%" + dataName });
 
                             this.Parent.ResourceService.SaveResource(fs);
                             resCreatedOrUpdated.Add(fsId);
@@ -558,7 +554,7 @@
 
                                 if (clsDef != null && geom != null)
                                 {
-                                    LayerDefinition ld = ObjectFactory.CreateLayerDefinition();
+                                    LayerDefinition ld = ObjectFactory.CreateLayerDefinition(this.Parent);
 
                                     //Step 3: Assign default properties
                                     ld.ResourceID = lyrId;

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -28,6 +28,8 @@
 {
     partial class ApplicationDefinitionType : IResource
     {
+        internal ApplicationDefinitionType() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -28,6 +28,8 @@
 {
     partial class DrawingSource : IResource
     {
+        internal DrawingSource() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -28,6 +28,8 @@
 {
     partial class FeatureSourceType : IResource
     {
+        internal FeatureSourceType() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -34,6 +34,8 @@
 
     partial class LayerDefinition : ILayerDefinition
     {
+        internal LayerDefinition() { } 
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -28,6 +28,8 @@
 {
     partial class LoadProcedure : IResource
     {
+        internal LoadProcedure() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -29,6 +29,8 @@
 {
     partial class MapDefinitionType
     {
+        internal MapDefinitionType() { }
+
         [XmlIgnore]
         public Color BackgroundColor
         {
@@ -46,6 +48,8 @@
 
     partial class MapDefinition : IResource
     {
+        internal MapDefinition() { } 
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -42,56 +42,532 @@
     /// </summary>
     public static class ObjectFactory
     {
-        public static LayerDefinition CreateLayerDefinition()
+        public static LayerDefinition CreateLayerDefinition(IServerConnection owner)
         {
-            return new LayerDefinition();
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new LayerDefinition() { CurrentConnection = owner };
         }
 
-        public static FeatureSourceType CreateFeatureSource(string provider, string connectionString)
+        public static DrawingSource CreateDrawingSource(IServerConnection owner)
         {
-            var fs = new FeatureSourceType()
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new DrawingSource() { CurrentConnection = owner };
+        }
+
+        public static FeatureSourceType CreateFeatureSource(IServerConnection owner, string provider)
+        {
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new FeatureSourceType()
             {
-                Provider = provider,
-                ConnectionString = connectionString
+                CurrentConnection = owner,
+                Provider = provider
             };
+        }
+
+        public static FeatureSourceType CreateFeatureSource(IServerConnection owner, string provider, string connectionString)
+        {
+            var fs = CreateFeatureSource(owner, provider);
+            fs.ConnectionString = connectionString;
+
             return fs;
         }
 
-        public static MapDefinition CreateMapDefinition()
+        public static MapDefinition CreateMapDefinition(IServerConnection owner)
         {
-            return new MapDefinition();
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new MapDefinition() { 
+                CurrentConnection = owner,
+                MapLayer = new System.ComponentModel.BindingList<MapLayerType>(),
+                MapLayerGroup = new System.ComponentModel.BindingList<MapLayerGroupType>(),
+            };
         }
 
-        public static WebLayoutType CreateWebLayout()
+        public static MapDefinition CreateMapDefinition(IServerConnection owner, string coordinateSystemWkt)
         {
-            return new WebLayoutType();
+            var map = CreateMapDefinition(owner);
+            map.CoordinateSystem = coordinateSystemWkt;
+
+            return map;
         }
 
-        public static SimpleSymbolDefinition CreateSimpleSymbol()
+        public static MapDefinition CreateMapDefinition(IServerConnection owner, string coordinateSystemWkt, Envelope env)
         {
-            return new SimpleSymbolDefinition();
+            var map = CreateMapDefinition(owner, coordinateSystemWkt);
+            map.Extents = new Box2DType() { MinX = env.MinY, MaxX = env.MaxX, MinY = env.MinY, MaxY = env.MaxY };
+
+            return map;
         }
 
-        public static CompoundSymbolDefinition CreateCompoundSymbol()
+        #region WebLayout helpers
+
+        private static BasicCommandType CreateBasicCommand(string label, string tooltip, string description, string iconName, TargetViewerType targets, BasicCommandActionType action)
         {
-            return new CompoundSymbolDefinition();
+            var cmd = new BasicCommandType()
+            {
+                Name = action.ToString(),
+                Label = label,
+                Tooltip = tooltip,
+                Description = description,
+                
+                TargetViewer = targets,
+                Action = action
+            };
+
+            if (!string.IsNullOrEmpty(iconName))
+            {
+                cmd.ImageURL = "../stdicons/" + iconName + ".gif";
+                cmd.DisabledImageURL = "../stdicons/" + iconName + "_disabled.gif";
+            }
+
+            return cmd;
         }
 
-        public static ApplicationDefinitionType CreateFlexibleLayout()
+        private static T CreateTargetedCommand<T>(string name, string label, string tooltip, string description, string iconName, TargetViewerType targets, TargetType target, string targetFrame) where T : TargetedCommandType, new()
         {
-            return new ApplicationDefinitionType();
+            var cmd = new T()
+            {
+                Name = name,
+                Label = label,
+                Tooltip = tooltip,
+                Description = description,
+                TargetViewer = targets,
+                Target = target,
+            };
+
+            if (!string.IsNullOrEmpty(targetFrame) && target == TargetType.SpecifiedFrame)
+            {
+                cmd.TargetFrame = targetFrame;
+            }
+
+            if (!string.IsNullOrEmpty(iconName))
+            {
+                cmd.ImageURL = "../stdicons/" + iconName + ".gif";
+                cmd.DisabledImageURL = "../stdicons/" + iconName + "_disabled.gif";
+            }
+
+            return cmd;
         }
 
-        public static PrintLayout CreatePrintLayout()
+        private static OSGeo.MapGuide.ObjectModels.WebLayout.FlyoutItemType CreateFlyout(
+            string label,
+            string tooltip,
+            string description,
+            string imageUrl,
+            string disabledImageUrl,
+            params UIItemType[] subItems)
         {
-            return new PrintLayout();
+            return new OSGeo.MapGuide.ObjectModels.WebLayout.FlyoutItemType()
+            {
+                Function = UIItemFunctionType.Flyout,
+                Description = description,
+                DisabledImageURL = disabledImageUrl,
+                ImageURL = imageUrl,
+                Label = label,
+                SubItem = new System.ComponentModel.BindingList<UIItemType>(subItems),
+                Tooltip = tooltip
+            };
         }
 
-        public static LoadProcedure CreateLoadProcedure()
+        private static T CreateCommand<T>(string cmdName) where T : CommandItemType, new()
         {
-            return new LoadProcedure();
+            return new T() { Function = UIItemFunctionType.Command, Command = cmdName };
         }
 
+        private static OSGeo.MapGuide.ObjectModels.WebLayout.SeparatorItemType CreateSeparator()
+        {
+            return new OSGeo.MapGuide.ObjectModels.WebLayout.SeparatorItemType() { Function = UIItemFunctionType.Separator };
+        }
+
+#endregion
+
+        public static WebLayoutType CreateWebLayout(IServerConnection owner, string mapDefinitionId)
+        {
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            var wl = new WebLayoutType()
+            {
+                CurrentConnection = owner,
+                CommandSet = new System.ComponentModel.BindingList<CommandType>()
+                {
+                    CreateBasicCommand("Pan", 
+                                       "Pan Mode",
+                                       "Drag the map to view areas out of range",
+                                       "icon_pan",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.Pan),
+                    CreateBasicCommand("Pan Up",
+                                       "Pan Up",
+                                       "Pan up by a preset increment",
+                                       "icon_panup",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.PanUp),
+                    CreateBasicCommand("Pan Down",
+                                       "Pan Down",
+                                       "Pan down by a preset increment",
+                                       "icon_pandown",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.PanDown),
+                    CreateBasicCommand("Pan Right",
+                                       "Pan Right",
+                                       "Pan right by a preset increment",
+                                       "icon_panright",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.PanRight),
+                    CreateBasicCommand("Pan Left",
+                                       "Pan Left",
+                                       "Pan left by a preset increment",
+                                       "icon_panleft",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.PanLeft),
+                    CreateBasicCommand("Zoom",
+                                       "Zoom Dynamic",
+                                       "Zoom dynamically by clicking and dragging",
+                                       "icon_zoom",
+                                       TargetViewerType.Dwf,
+                                       BasicCommandActionType.Zoom),
+                    CreateBasicCommand("Zoom In",
+                                       "Zoom In",
+                                       "Zoom in by a preset increment",
+                                       "icon_zoomin",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.ZoomIn),
+                    CreateBasicCommand("Zoom Out",
+                                       "Zoom Out",
+                                       "Zoom out by a preset increment",
+                                       "icon_zoomout",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.ZoomOut),
+                    CreateBasicCommand("Zoom Rectangle",
+                                       "Zoom Rectangle",
+                                       "Zoom in on an area",
+                                       "icon_zoomrect",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.ZoomRectangle),
+                    CreateBasicCommand("Zoom Selection",
+                                       "Zoom to selection",
+                                       "Zoom to extents of selected features",
+                                       "icon_zoomselect",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.ZoomToSelection),
+                    CreateBasicCommand("Initial Map View",
+                                       "Initial Map View",
+                                       "Fit the extents of the map to the window",
+                                       "icon_fitwindow",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.FitToWindow),
+                    CreateBasicCommand("Previous View",
+                                       "Previous View",
+                                       "Go to previous view",
+                                       "icon_zoomprev",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.PreviousView),
+                    CreateBasicCommand("Next View",
+                                       "Next View",
+                                       "Go to next view",
+                                       "icon_zoomnext",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.NextView),
+                    CreateBasicCommand("Initial Center and Scale",
+                                       "Initial Center and Scale",
+                                       "Zoom to initial map center and scale",
+                                       "icon_restorecenter.gif",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.RestoreView),
+                    CreateBasicCommand("Select",
+                                       "Select Mode",
+                                       "Select features by clicking and dragging",
+                                       "icon_select",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.Select),
+                    CreateBasicCommand("Select Radius",
+                                       "Select Radius",
+                                       "Click and drag to select all features inside the circle",
+                                       "icon_selectradius",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.SelectRadius),
+                    CreateBasicCommand("Select Polygon",
+                                       "Select Polygon",
+                                       "Create a polygon to select all features that fall within",
+                                       "icon_selectpolygon",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.SelectPolygon),
+                    CreateBasicCommand("Clear Selection",
+                                       "Clear Selection",
+                                       "Clear the current selections",
+                                       "icon_clearselect",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.ClearSelection),
+                    CreateBasicCommand("Refresh Map",
+                                       "Refresh Map",
+                                       "Refresh map to reload all layers keeping current center and scale",
+                                       "icon_refreshmap",
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.Refresh),
+                    CreateBasicCommand("Copy",
+                                       "Copy",
+                                       "Copy current view of map to clipboard",
+                                       "icon_copy",
+                                       TargetViewerType.Dwf,
+                                       BasicCommandActionType.CopyMap),
+                    CreateBasicCommand("About",
+                                       "About",
+                                       "Display information about this application",
+                                       null,
+                                       TargetViewerType.All,
+                                       BasicCommandActionType.About),
+                    CreateTargetedCommand<BufferCommandType>(BuiltInCommandType.Buffer.ToString(),
+                                                             "Buffer",
+                                                             "Buffer",
+                                                             "Create buffers around the selected features",
+                                                             "icon_buffer",
+                                                             TargetViewerType.All,
+                                                             TargetType.TaskPane, 
+                                                             null),
+                    CreateTargetedCommand<SelectWithinCommandType>(BuiltInCommandType.SelectWithin.ToString(),
+                                                             "Select Within",
+                                                             "Select Within",
+                                                             "Select features that fall within currently selected areas",
+                                                             "icon_selectwithin",
+                                                             TargetViewerType.All,
+                                                             TargetType.TaskPane, 
+                                                             null),
+                    CreateTargetedCommand<MeasureCommandType>(BuiltInCommandType.Measure.ToString(),
+                                                              "Measure",
+                                                              "Measure",
+                                                              "Measure distances on the map",
+                                                              "icon_measure",
+                                                              TargetViewerType.All,
+                                                              TargetType.TaskPane,
+                                                              null),
+                    new PrintCommandType() 
+                    {
+                        Name = "Print",
+                        Label = "Print",
+                        Tooltip = "Print",
+                        Description = "Print with optional layout",
+                        ImageURL = "../stdicons/icon_print.gif",
+                        DisabledImageURL = "../stdicons/icon_print_disabled.gif",
+                        TargetViewer = TargetViewerType.Dwf
+                    },
+                    CreateTargetedCommand<ViewOptionsCommandType>(BuiltInCommandType.ViewOptions.ToString(),
+                                                                  "View Options",
+                                                                  "View Options",
+                                                                  "View Options",
+                                                                  "icon_viewoptions",
+                                                                  TargetViewerType.All, 
+                                                                  TargetType.TaskPane,
+                                                                  null),
+                    CreateTargetedCommand<GetPrintablePageCommandType>(BuiltInCommandType.GetPrintablePage.ToString(),
+                                                                  "Get Printable Page",
+                                                                  "Get Printable Page",
+                                                                  "Get Printer-friendly page",
+                                                                  "icon_printablepage",
+                                                                  TargetViewerType.Ajax,
+                                                                  TargetType.NewWindow,
+                                                                  null),
+                    new HelpCommandType()
+                    {
+                        Name = BuiltInCommandType.Help.ToString(),
+                        Label = "Help",
+                        Tooltip = "Help",
+                        Description = "Launch help for this application", 
+                        ImageURL = "../stdicons/icon_help.gif",
+                        DisabledImageURL = "../stdicons/icon_help_disabled.gif",
+                        TargetViewer = TargetViewerType.All,
+                        Target = TargetType.TaskPane
+                    },
+
+                },
+                ContextMenu = new ContextMenuType()
+                {
+                    Visible = true,
+                    MenuItem = new System.ComponentModel.BindingList<UIItemType>()
+                    {
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Select.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ClearSelection.ToString()),
+                        CreateFlyout("Select More", null, null, null, null, 
+                            CreateCommand<CommandItemType>(BuiltInCommandType.SelectRadius.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.SelectPolygon.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.SelectWithin.ToString())
+                        ),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Pan.ToString()),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ZoomRectangle.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ZoomIn.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ZoomOut.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Zoom.ToString()),
+                        CreateFlyout("Zoom", null, null, null, null,
+                            CreateCommand<CommandItemType>(BuiltInCommandType.PreviousView.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.NextView.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.FitToWindow.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.RestoreView.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.ZoomToSelection.ToString())
+                        ),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Measure.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Buffer.ToString()),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Refresh.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.CopyMap.ToString()),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Print.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.GetPrintablePage.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ViewOptions.ToString()),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Help.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.About.ToString())
+                    }
+                },
+                InformationPane = new InformationPaneType()
+                {
+                    LegendVisible = true,
+                    PropertiesVisible = true,
+                    Visible = true,
+                    Width = 200
+                },
+                Map = new OSGeo.MapGuide.ObjectModels.WebLayout.MapType()
+                {
+                    HyperlinkTarget = TargetType.TaskPane,
+                    ResourceId = mapDefinitionId,
+                    //null InitialView = Use map's initial view
+                },
+                StatusBar = new StatusBarType()
+                {
+                    Visible = true
+                },
+                TaskPane = new TaskPaneType()
+                {
+                    TaskBar = new TaskBarType()
+                    {
+                        Back = new TaskButtonType()
+                        {
+                            Name = "Back",
+                            Tooltip = "Return to previous task page",
+                            Description = "Return to previous task page",
+                            ImageURL = "../stdicons/icon_back.gif",
+                            DisabledImageURL = "../stdicons/icon_back_disabled.gif"
+                        },
+                        Forward = new TaskButtonType()
+                        {
+                            Name = "Forward",
+                            Tooltip = "Forward to next task page",
+                            Description = "Forward to next task page",
+                            ImageURL = "../stdicons/icon_forward.gif",
+                            DisabledImageURL = "../stdicons/icon_forward_disabled.gif"
+                        },
+                        Home = new TaskButtonType()
+                        {
+                            Name = "Home",
+                            Tooltip = "Return to home task page",
+                            Description = "Return to home task page",
+                            ImageURL = "../stdicons/icon_home.gif",
+                            DisabledImageURL = "../stdicons/icon_home_disabled.gif"
+                        },
+                        //Task Pane menu buttons
+                        MenuButton = new System.ComponentModel.BindingList<UIItemType>(),
+                        Tasks = new TaskButtonType()
+                        {
+                            Name = "Tasks",
+                            Tooltip = "Task list",
+                            Description = "View a list of available tasks",
+                            ImageURL = "../stdicons/icon_tasks.gif",
+                            DisabledImageURL = "../stdicons/icon_tasks_disabled.gif"
+                        },
+                        Visible = true,
+                    },
+                    Visible = true,
+                    Width = 250,
+                },
+                Title = string.Empty,
+                ToolBar = new ToolBarType()
+                {
+                    Visible = true,
+                    Button = new System.ComponentModel.BindingList<UIItemType>()
+                    {
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Print.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.GetPrintablePage.ToString()),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Measure.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Buffer.ToString()),
+                        CreateSeparator(),
+                        CreateFlyout("Zoom", null, null, null, null,
+                            CreateCommand<CommandItemType>(BuiltInCommandType.PreviousView.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.NextView.ToString()),
+                            CreateCommand<CommandItemType>(BuiltInCommandType.RestoreView.ToString())
+                        ),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ZoomRectangle.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ZoomIn.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.ZoomOut.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Zoom.ToString()),
+                        CreateSeparator(),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Select.ToString()),
+                        CreateCommand<CommandItemType>(BuiltInCommandType.Pan.ToString())
+                    }
+                },
+                ZoomControl = new ZoomControlType()
+                {
+                    Visible = true
+                },
+            };
+
+            return wl;
+        }
+
+        public static SimpleSymbolDefinition CreateSimpleSymbol(IServerConnection owner)
+        {
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new SimpleSymbolDefinition() { CurrentConnection = owner };
+        }
+
+        public static CompoundSymbolDefinition CreateCompoundSymbol(IServerConnection owner)
+        {
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new CompoundSymbolDefinition() { CurrentConnection = owner };
+        }
+
+        public static SymbolLibraryType CreateSymbolLibrary(IServerConnection conn)
+        {
+            return new SymbolLibraryType() { CurrentConnection = conn };
+        }
+
+        public static ApplicationDefinitionType CreateFlexibleLayout(IServerConnection owner)
+        {
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new ApplicationDefinitionType() { CurrentConnection = owner };
+        }
+
+        public static PrintLayout CreatePrintLayout(IServerConnection owner)
+        {
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new PrintLayout() { CurrentConnection = owner };
+        }
+
+        public static LoadProcedure CreateLoadProcedure(IServerConnection owner)
+        {
+            if (owner == null)
+                throw new ArgumentNullException("owner");
+
+            return new LoadProcedure() { CurrentConnection = owner };
+        }
+
         /// <summary>
         /// Creates an empty resource document header metadata object
         /// </summary>

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -28,6 +28,8 @@
 {
     partial class PrintLayout : IResource
     {
+        internal PrintLayout() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -28,6 +28,8 @@
 {
     partial class SimpleSymbolDefinition : IResource
     {
+        internal SimpleSymbolDefinition() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]
@@ -99,6 +101,8 @@
 
     partial class CompoundSymbolDefinition : IResource
     {
+        internal CompoundSymbolDefinition() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -28,6 +28,8 @@
 {
     partial class SymbolLibraryType : IResource
     {
+        internal SymbolLibraryType() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -26,8 +26,50 @@
 
 namespace OSGeo.MapGuide.ObjectModels.WebLayout
 {
-    partial class WebLayoutType : IResource
+    /// <summary>
+    /// Encompasses all built-in commands usable by the web layout (AJAX and DWF)
+    /// </summary>
+    public enum BuiltInCommandType : int
     {
+        Pan = BasicCommandActionType.Pan,
+        PanUp = BasicCommandActionType.PanUp,
+        PanDown = BasicCommandActionType.PanDown,
+        PanRight = BasicCommandActionType.PanRight,
+        PanLeft=  BasicCommandActionType.PanLeft,
+        Zoom = BasicCommandActionType.Zoom,
+        ZoomIn = BasicCommandActionType.ZoomIn,
+        ZoomOut = BasicCommandActionType.ZoomOut,
+        ZoomRectangle = BasicCommandActionType.ZoomRectangle,
+        ZoomToSelection = BasicCommandActionType.ZoomToSelection,
+        FitToWindow = BasicCommandActionType.FitToWindow,
+        PreviousView = BasicCommandActionType.PreviousView,
+        NextView = BasicCommandActionType.NextView,
+        RestoreView = BasicCommandActionType.RestoreView,
+        Select = BasicCommandActionType.Select,
+        SelectRadius = BasicCommandActionType.SelectRadius,
+        SelectPolygon = BasicCommandActionType.SelectPolygon,
+        ClearSelection = BasicCommandActionType.ClearSelection,
+        Refresh = BasicCommandActionType.Refresh,
+        CopyMap = BasicCommandActionType.CopyMap,
+        About = BasicCommandActionType.About,
+        Buffer,
+        SelectWithin,
+        Print,
+        GetPrintablePage,
+        Measure,
+        ViewOptions,
+        Help,
+    }
+
+    public interface IWebLayout : IResource
+    {
+        
+    }
+
+    partial class WebLayoutType : IWebLayout
+    {
+        internal WebLayoutType() { }
+
         private static readonly Version RES_VERSION = new Version(1, 0, 0);
 
         [XmlIgnore]

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -122,5 +122,14 @@
                 return ResourceManager.GetString("ERR_NO_UPGRADE_PATH", resourceCulture);
             }
         }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to No connection attached to this resource.
+        /// </summary>
+        internal static string ERR_RESOURCE_NOT_ATTACHED {
+            get {
+                return ResourceManager.GetString("ERR_RESOURCE_NOT_ATTACHED", resourceCulture);
+            }
+        }
     }
 }

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx	2010-07-19 13:36:22 UTC (rev 5037)
@@ -138,4 +138,7 @@
   <data name="ERR_NO_UPGRADE_PATH" xml:space="preserve">
     <value>There is no upgrade path to the desired resource version</value>
   </data>
+  <data name="ERR_RESOURCE_NOT_ATTACHED" xml:space="preserve">
+    <value>No connection attached to this resource</value>
+  </data>
 </root>
\ No newline at end of file

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs	2010-07-19 11:20:33 UTC (rev 5036)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs	2010-07-19 13:36:22 UTC (rev 5037)
@@ -67,6 +67,9 @@
         /// <returns></returns>
         public static ResourceDataListResourceData[] EnumerateResourceData(this IResource res)
         {
+            if (res.CurrentConnection == null)
+                throw new ArgumentException(Properties.Resources.ERR_RESOURCE_NOT_ATTACHED);
+
             return res.CurrentConnection.ResourceService.EnumerateResourceData(res.ResourceID).ResourceData.ToArray();
         }
 
@@ -78,6 +81,9 @@
         /// <returns></returns>
         public static MemoryStream GetResourceData(this IResource res, string dataName)
         {
+            if (res.CurrentConnection == null)
+                throw new ArgumentException(Properties.Resources.ERR_RESOURCE_NOT_ATTACHED);
+
             return res.CurrentConnection.ResourceService.GetResourceData(res.ResourceID, dataName);
         }
 
@@ -90,6 +96,9 @@
         /// <param name="inputStream"></param>
         public static void SetResourceData(this IResource res, string dataName, ResourceDataType dataType, Stream inputStream)
         {
+            if (res.CurrentConnection == null)
+                throw new ArgumentException(Properties.Resources.ERR_RESOURCE_NOT_ATTACHED);
+
             res.CurrentConnection.ResourceService.SetResourceData(res.ResourceID, dataName, dataType, inputStream);
         }
 
@@ -100,6 +109,9 @@
         /// <param name="dataName"></param>
         public static void DeleteResourceData(this IResource res, string dataName)
         {
+            if (res.CurrentConnection == null)
+                throw new ArgumentException(Properties.Resources.ERR_RESOURCE_NOT_ATTACHED);
+
             res.CurrentConnection.ResourceService.DeleteResourceData(res.ResourceID, dataName);
         }
     }



More information about the mapguide-commits mailing list