[mapguide-commits] r4948 - in sandbox/maestro-2.5: Maestro.Base Maestro.Base/Commands Maestro.Base/Properties Maestro.Base/Services Maestro.Base/Templates Maestro.Base/UI Maestro.Editors Maestro.Editors/Common Maestro.Editors/Properties Maestro.Editors/Resources OSGeo.MapGuide.MaestroAPI/Resource

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jun 16 09:12:10 EDT 2010


Author: jng
Date: 2010-06-16 13:12:09 +0000 (Wed, 16 Jun 2010)
New Revision: 4948

Added:
   sandbox/maestro-2.5/Maestro.Base/Templates/
   sandbox/maestro-2.5/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/DrawingSourceItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/FeatureSourceItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/ItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/LayerDefinitionItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/MapDefinitionItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/PrintLayoutItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/SymbolDefinitionItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/UserItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Base/Templates/WebLayoutItemTemplate.cs
   sandbox/maestro-2.5/Maestro.Editors/Resources/server.png
Modified:
   sandbox/maestro-2.5/Maestro.Base/Commands/NewItemCommand.cs
   sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin
   sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj
   sandbox/maestro-2.5/Maestro.Base/Properties/Resources.Designer.cs
   sandbox/maestro-2.5/Maestro.Base/Properties/Resources.resx
   sandbox/maestro-2.5/Maestro.Base/Services/NewItemTemplateService.cs
   sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.Designer.cs
   sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.cs
   sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs
   sandbox/maestro-2.5/Maestro.Editors/Common/ResourcePicker.cs
   sandbox/maestro-2.5/Maestro.Editors/Maestro.Editors.csproj
   sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.Designer.cs
   sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.resx
   sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs
Log:
This submission includes the following changes:
 - Modify the resource picker so that the root folder is also visible (and selectable when selecting folders)
 - Added some new APIs to ResourceIdentifier
 - Fleshed out the NewResourceDialog and the ItemTemplate API. The CreateItem method of these ItemTemplate subclasses has not been implemented yet.
 - Activated and implemented the NewItemCommand

Modified: sandbox/maestro-2.5/Maestro.Base/Commands/NewItemCommand.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Commands/NewItemCommand.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/Commands/NewItemCommand.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -20,10 +20,30 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using ICSharpCode.Core;
+using Maestro.Base.UI;
+using Maestro.Base.Services;
 
 namespace Maestro.Base.Commands
 {
-    internal class NewItemCommand : NotImplementedCommand
+    internal class NewItemCommand : AbstractMenuCommand
     {
+        public override void Run()
+        {
+            var wb = Workbench.Instance;
+            var mgr = ServiceRegistry.GetService<ServerConnectionManager>();
+            var orm = ServiceRegistry.GetService<OpenResourceManager>();
+            var conn = mgr.GetConnection(wb.ActiveSiteExplorer.ConnectionName);
+            var nits = ServiceRegistry.GetService<NewItemTemplateService>();
+
+            var dlg = new NewResourceDialog(conn.ResourceService, nits);
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                var tpl = dlg.SelectedTemplate;
+                tpl.CreateItem(conn.ResourceService, dlg.ResourceID);
+                var ri = new IRepositoryItemImpl(dlg.ResourceID);
+                orm.Open(new RepositoryItem(ri), conn, false);
+            }
+        }
     }
 }

Modified: sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/Maestro.Base.addin	2010-06-16 13:12:09 UTC (rev 4948)
@@ -33,7 +33,7 @@
             <MenuItem id="NewItem"
                       label="${res:Menu_File_NewResource}"
                       icon="document__plus"
-                      class="Maestro.Base.Commands.NotImplementedCommand" />
+                      class="Maestro.Base.Commands.NewItemCommand" />
             <MenuItem type="Separator" />
             <MenuItem id="Menu_File_Quit"
                       label="${res:Menu_File_Quit}"
@@ -141,7 +141,7 @@
                          icon="document__plus"
                          label="${res:Menu_File_NewResource}"
                          tooltip="${res:Menu_File_NewResource}"
-                         class="Maestro.Base.Commands.NotImplementedCommand" />
+                         class="Maestro.Base.Commands.NewItemCommand" />
             <ToolbarItem type="Separator" />
             <ToolbarItem id="CopyItem"
                          icon="document_copy"
@@ -213,7 +213,7 @@
             <ToolbarItem id="NewItem"
                          label="${res:Menu_File_NewResource}"
                          icon="document__plus"
-                         class="Maestro.Base.Commands.NotImplementedCommand" />
+                         class="Maestro.Base.Commands.NewItemCommand" />
             <ToolbarItem type="Separator" />
             <Condition action="Disable" name="SelectedItem">
                 <ToolbarItem id="DeleteItem"

Modified: sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/Maestro.Base.csproj	2010-06-16 13:12:09 UTC (rev 4948)
@@ -144,6 +144,18 @@
     <Compile Include="Services\ServiceRegistry.cs" />
     <Compile Include="Services\UrlLauncher.cs" />
     <Compile Include="Services\ViewContentManager.cs" />
+    <Compile Include="Templates\ApplicationDefinitionItemTemplate.cs" />
+    <Compile Include="Templates\DrawingSourceItemTemplate.cs" />
+    <Compile Include="Templates\FeatureSourceItemTemplate.cs" />
+    <Compile Include="Templates\ItemTemplate.cs" />
+    <Compile Include="Templates\LayerDefinitionItemTemplate.cs" />
+    <Compile Include="Templates\MapDefinitionItemTemplate.cs" />
+    <Compile Include="Templates\PrintLayoutItemTemplate.cs" />
+    <Compile Include="Templates\SdfLoadProcedureItemTemplate.cs" />
+    <Compile Include="Templates\ShpLoadProcedureItemTemplate.cs" />
+    <Compile Include="Templates\SymbolDefinitionItemTemplate.cs" />
+    <Compile Include="Templates\UserItemTemplate.cs" />
+    <Compile Include="Templates\WebLayoutItemTemplate.cs" />
     <Compile Include="UI\AboutDialog.cs">
       <SubType>Form</SubType>
     </Compile>

Modified: sandbox/maestro-2.5/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Properties/Resources.Designer.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/Properties/Resources.Designer.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -796,5 +796,203 @@
                 return ((System.Drawing.Bitmap)(obj));
             }
         }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Fusion Application Definition (Flexible Layout).
+        /// </summary>
+        internal static string TPL_ADF_DESC {
+            get {
+                return ResourceManager.GetString("TPL_ADF_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Application Definition.
+        /// </summary>
+        internal static string TPL_ADF_NAME {
+            get {
+                return ResourceManager.GetString("TPL_ADF_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Default.
+        /// </summary>
+        internal static string TPL_CATEGORY_DEFAULT {
+            get {
+                return ResourceManager.GetString("TPL_CATEGORY_DEFAULT", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to User Defined.
+        /// </summary>
+        internal static string TPL_CATEGORY_USERDEF {
+            get {
+                return ResourceManager.GetString("TPL_CATEGORY_USERDEF", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Drawing Source.
+        /// </summary>
+        internal static string TPL_DS_DESC {
+            get {
+                return ResourceManager.GetString("TPL_DS_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Drawing Source.
+        /// </summary>
+        internal static string TPL_DS_NAME {
+            get {
+                return ResourceManager.GetString("TPL_DS_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Feature Source.
+        /// </summary>
+        internal static string TPL_FS_DESC {
+            get {
+                return ResourceManager.GetString("TPL_FS_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Feature Source.
+        /// </summary>
+        internal static string TPL_FS_NAME {
+            get {
+                return ResourceManager.GetString("TPL_FS_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Layer Definition.
+        /// </summary>
+        internal static string TPL_LDF_DESC {
+            get {
+                return ResourceManager.GetString("TPL_LDF_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Layer Definition.
+        /// </summary>
+        internal static string TPL_LDF_NAME {
+            get {
+                return ResourceManager.GetString("TPL_LDF_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new SDF Load Procedure.
+        /// </summary>
+        internal static string TPL_LP_SDF_DESC {
+            get {
+                return ResourceManager.GetString("TPL_LP_SDF_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to SDF Load Procedure.
+        /// </summary>
+        internal static string TPL_LP_SDF_NAME {
+            get {
+                return ResourceManager.GetString("TPL_LP_SDF_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new SHP Load Procedure.
+        /// </summary>
+        internal static string TPL_LP_SHP_DESC {
+            get {
+                return ResourceManager.GetString("TPL_LP_SHP_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to SHP Load Procedure.
+        /// </summary>
+        internal static string TPL_LP_SHP_NAME {
+            get {
+                return ResourceManager.GetString("TPL_LP_SHP_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Map Definition.
+        /// </summary>
+        internal static string TPL_MDF_DESC {
+            get {
+                return ResourceManager.GetString("TPL_MDF_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Map Definition.
+        /// </summary>
+        internal static string TPL_MDF_NAME {
+            get {
+                return ResourceManager.GetString("TPL_MDF_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Print Layout.
+        /// </summary>
+        internal static string TPL_PL_DESC {
+            get {
+                return ResourceManager.GetString("TPL_PL_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Print Layout.
+        /// </summary>
+        internal static string TPL_PL_NAME {
+            get {
+                return ResourceManager.GetString("TPL_PL_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Symbol Definition.
+        /// </summary>
+        internal static string TPL_SDF_DESC {
+            get {
+                return ResourceManager.GetString("TPL_SDF_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Symbol Definition.
+        /// </summary>
+        internal static string TPL_SDF_NAME {
+            get {
+                return ResourceManager.GetString("TPL_SDF_NAME", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Create a new Web Layout.
+        /// </summary>
+        internal static string TPL_WL_DESC {
+            get {
+                return ResourceManager.GetString("TPL_WL_DESC", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Web Layout.
+        /// </summary>
+        internal static string TPL_WL_NAME {
+            get {
+                return ResourceManager.GetString("TPL_WL_NAME", resourceCulture);
+            }
+        }
     }
 }

Modified: sandbox/maestro-2.5/Maestro.Base/Properties/Resources.resx
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Properties/Resources.resx	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/Properties/Resources.resx	2010-06-16 13:12:09 UTC (rev 4948)
@@ -394,4 +394,70 @@
   <data name="Menu_File_ValidateResource" xml:space="preserve">
     <value>Validate Resource</value>
   </data>
+  <data name="TPL_ADF_DESC" xml:space="preserve">
+    <value>Create a new Fusion Application Definition (Flexible Layout)</value>
+  </data>
+  <data name="TPL_ADF_NAME" xml:space="preserve">
+    <value>Application Definition</value>
+  </data>
+  <data name="TPL_CATEGORY_DEFAULT" xml:space="preserve">
+    <value>Default</value>
+  </data>
+  <data name="TPL_CATEGORY_USERDEF" xml:space="preserve">
+    <value>User Defined</value>
+  </data>
+  <data name="TPL_DS_DESC" xml:space="preserve">
+    <value>Create a new Drawing Source</value>
+  </data>
+  <data name="TPL_DS_NAME" xml:space="preserve">
+    <value>Drawing Source</value>
+  </data>
+  <data name="TPL_FS_DESC" xml:space="preserve">
+    <value>Create a new Feature Source</value>
+  </data>
+  <data name="TPL_FS_NAME" xml:space="preserve">
+    <value>Feature Source</value>
+  </data>
+  <data name="TPL_LDF_DESC" xml:space="preserve">
+    <value>Create a new Layer Definition</value>
+  </data>
+  <data name="TPL_LDF_NAME" xml:space="preserve">
+    <value>Layer Definition</value>
+  </data>
+  <data name="TPL_LP_SDF_DESC" xml:space="preserve">
+    <value>Create a new SDF Load Procedure</value>
+  </data>
+  <data name="TPL_LP_SDF_NAME" xml:space="preserve">
+    <value>SDF Load Procedure</value>
+  </data>
+  <data name="TPL_LP_SHP_DESC" xml:space="preserve">
+    <value>Create a new SHP Load Procedure</value>
+  </data>
+  <data name="TPL_LP_SHP_NAME" xml:space="preserve">
+    <value>SHP Load Procedure</value>
+  </data>
+  <data name="TPL_MDF_DESC" xml:space="preserve">
+    <value>Create a new Map Definition</value>
+  </data>
+  <data name="TPL_MDF_NAME" xml:space="preserve">
+    <value>Map Definition</value>
+  </data>
+  <data name="TPL_PL_DESC" xml:space="preserve">
+    <value>Create a new Print Layout</value>
+  </data>
+  <data name="TPL_PL_NAME" xml:space="preserve">
+    <value>Print Layout</value>
+  </data>
+  <data name="TPL_SDF_DESC" xml:space="preserve">
+    <value>Create a new Symbol Definition</value>
+  </data>
+  <data name="TPL_SDF_NAME" xml:space="preserve">
+    <value>Symbol Definition</value>
+  </data>
+  <data name="TPL_WL_DESC" xml:space="preserve">
+    <value>Create a new Web Layout</value>
+  </data>
+  <data name="TPL_WL_NAME" xml:space="preserve">
+    <value>Web Layout</value>
+  </data>
 </root>
\ No newline at end of file

Modified: sandbox/maestro-2.5/Maestro.Base/Services/NewItemTemplateService.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Services/NewItemTemplateService.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/Services/NewItemTemplateService.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -21,24 +21,15 @@
 using System.Collections.Generic;
 using System.Text;
 using ICSharpCode.Core;
+using OSGeo.MapGuide.MaestroAPI;
+using System.Drawing;
+using OSGeo.MapGuide.MaestroAPI.Services;
 
 namespace Maestro.Base.Services
 {
-    public class ItemTemplate
-    {
-        public string Name { get; set; }
+    using Res = Properties.Resources;
+    using Maestro.Base.Templates;
 
-        public string Description { get; set; }
-
-        public string Category { get; set; }
-
-        public string ResourceType { get; set; }
-    }
-
-    public class DefaultItemTemplate : ItemTemplate { }
-
-    public class UserItemTemplate : ItemTemplate { }
-
     public class NewItemTemplateService : ServiceBase
     {
         public override void Initialize()
@@ -49,12 +40,33 @@
 
         public string[] GetCategories()
         {
-            return new string[0];
+            return new string[] {
+                Res.TPL_CATEGORY_DEFAULT,
+                Res.TPL_CATEGORY_USERDEF 
+            };
         }
 
         public ItemTemplate[] GetItemTemplates(string category)
         {
-            return new ItemTemplate[0];
+            if (category == Res.TPL_CATEGORY_DEFAULT)
+            {
+                return new ItemTemplate[] 
+                {
+                    new SdfLoadProcedureItemTemplate(),
+                    new ShpLoadProcedureItemTemplate(),
+                    new FeatureSourceItemTemplate(),
+                    new LayerDefinitionItemTemplate(),
+                    new MapDefinitionItemTemplate(),
+                    new WebLayoutItemTemplate(),
+                    new ApplicationDefinitionItemTemplate(),
+                    new PrintLayoutItemTemplate(),
+                    new SymbolDefinitionItemTemplate()
+                };
+            }
+            else
+            {
+                return new ItemTemplate[0];
+            }
         }
     }
 }

Added: sandbox/maestro-2.5/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/ApplicationDefinitionItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class ApplicationDefinitionItemTemplate : ItemTemplate
+    {
+        public ApplicationDefinitionItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.applications_stack;
+            Description = Res.TPL_ADF_DESC;
+            Name = Res.TPL_ADF_NAME;
+            ResourceType = ResourceTypes.ApplicationDefinition.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/DrawingSourceItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/DrawingSourceItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/DrawingSourceItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class DrawingSourceItemTemplate : ItemTemplate
+    {
+        public DrawingSourceItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.blueprints;
+            Description = Res.TPL_DS_DESC;
+            Name = Res.TPL_DS_NAME;
+            ResourceType = ResourceTypes.DrawingSource.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/FeatureSourceItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/FeatureSourceItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/FeatureSourceItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class FeatureSourceItemTemplate : ItemTemplate
+    {
+        public FeatureSourceItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.database_share;
+            Description = Res.TPL_FS_DESC;
+            Name = Res.TPL_FS_NAME;
+            ResourceType = ResourceTypes.FeatureSource.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/ItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/ItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/ItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,43 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+using System.Drawing;
+
+namespace Maestro.Base.Templates
+{
+    public abstract class ItemTemplate
+    {
+        public string Name { get; set; }
+
+        public string Description { get; set; }
+
+        public string Category { get; protected set; }
+
+        public string ResourceType { get; protected set; }
+
+        public Image Icon { get; protected set; }
+
+        public abstract void CreateItem(IResourceService resSvc, string resourceID);
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/LayerDefinitionItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/LayerDefinitionItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/LayerDefinitionItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class LayerDefinitionItemTemplate : ItemTemplate
+    {
+        public LayerDefinitionItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.layer;
+            Description = Res.TPL_LDF_DESC;
+            Name = Res.TPL_LDF_NAME;
+            ResourceType = ResourceTypes.LayerDefinition.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/MapDefinitionItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/MapDefinitionItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/MapDefinitionItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class MapDefinitionItemTemplate : ItemTemplate
+    {
+        public MapDefinitionItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.map;
+            Description = Res.TPL_MDF_DESC;
+            Name = Res.TPL_MDF_NAME;
+            ResourceType = ResourceTypes.MapDefinition.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/PrintLayoutItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/PrintLayoutItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/PrintLayoutItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class PrintLayoutItemTemplate : ItemTemplate
+    {
+        public PrintLayoutItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.printer;
+            Description = Res.TPL_PL_DESC;
+            Name = Res.TPL_PL_NAME;
+            ResourceType = ResourceTypes.PrintLayout.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class SdfLoadProcedureItemTemplate : ItemTemplate
+    {
+        public SdfLoadProcedureItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            //Icon = Res.document;
+            Description = Res.TPL_LP_SDF_DESC;
+            Name = Res.TPL_LP_SDF_NAME;
+            ResourceType = ResourceTypes.LoadProcedure.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class ShpLoadProcedureItemTemplate : ItemTemplate
+    {
+        public ShpLoadProcedureItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            //Icon = Res.document;
+            Description = Res.TPL_LP_SHP_DESC;
+            Name = Res.TPL_LP_SHP_NAME;
+            ResourceType = ResourceTypes.LoadProcedure.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/SymbolDefinitionItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/SymbolDefinitionItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/SymbolDefinitionItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class SymbolDefinitionItemTemplate : ItemTemplate
+    {
+        public SymbolDefinitionItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.images_stack;
+            Description = Res.TPL_SDF_DESC;
+            Name = Res.TPL_SDF_NAME;
+            ResourceType = ResourceTypes.SymbolDefinition.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/UserItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/UserItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/UserItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,36 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class UserItemTemplate : ItemTemplate
+    {
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Added: sandbox/maestro-2.5/Maestro.Base/Templates/WebLayoutItemTemplate.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Templates/WebLayoutItemTemplate.cs	                        (rev 0)
+++ sandbox/maestro-2.5/Maestro.Base/Templates/WebLayoutItemTemplate.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+
+namespace Maestro.Base.Templates
+{
+    public class WebLayoutItemTemplate : ItemTemplate
+    {
+        public WebLayoutItemTemplate()
+        {
+            Category = Res.TPL_CATEGORY_DEFAULT;
+            Icon = Res.application_browser;
+            Description = Res.TPL_WL_DESC;
+            Name = Res.TPL_WL_NAME;
+            ResourceType = ResourceTypes.WebLayout.ToString();
+        }
+
+        public override void CreateItem(IResourceService resSvc, string resourceID)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Modified: sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.Designer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.Designer.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.Designer.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -37,7 +37,7 @@
             this.txtName = new System.Windows.Forms.TextBox();
             this.txtParentFolder = new System.Windows.Forms.TextBox();
             this.txtType = new System.Windows.Forms.TextBox();
-            this.textBox4 = new System.Windows.Forms.TextBox();
+            this.txtDescription = new System.Windows.Forms.TextBox();
             this.label5 = new System.Windows.Forms.Label();
             this.btnOK = new System.Windows.Forms.Button();
             this.btnCancel = new System.Windows.Forms.Button();
@@ -47,10 +47,13 @@
             // lstTemplates
             // 
             this.lstTemplates.Location = new System.Drawing.Point(163, 37);
+            this.lstTemplates.MultiSelect = false;
             this.lstTemplates.Name = "lstTemplates";
             this.lstTemplates.Size = new System.Drawing.Size(433, 225);
             this.lstTemplates.TabIndex = 0;
             this.lstTemplates.UseCompatibleStateImageBehavior = false;
+            this.lstTemplates.View = System.Windows.Forms.View.SmallIcon;
+            this.lstTemplates.SelectedIndexChanged += new System.EventHandler(this.lstTemplates_SelectedIndexChanged);
             // 
             // lstCategories
             // 
@@ -59,6 +62,7 @@
             this.lstCategories.Name = "lstCategories";
             this.lstCategories.Size = new System.Drawing.Size(145, 225);
             this.lstCategories.TabIndex = 1;
+            this.lstCategories.SelectedIndexChanged += new System.EventHandler(this.lstCategories_SelectedIndexChanged);
             // 
             // label1
             // 
@@ -102,6 +106,7 @@
             this.txtName.Name = "txtName";
             this.txtName.Size = new System.Drawing.Size(156, 20);
             this.txtName.TabIndex = 6;
+            this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
             // 
             // txtParentFolder
             // 
@@ -110,6 +115,7 @@
             this.txtParentFolder.ReadOnly = true;
             this.txtParentFolder.Size = new System.Drawing.Size(495, 20);
             this.txtParentFolder.TabIndex = 7;
+            this.txtParentFolder.TextChanged += new System.EventHandler(this.txtParentFolder_TextChanged);
             // 
             // txtType
             // 
@@ -119,13 +125,13 @@
             this.txtType.Size = new System.Drawing.Size(326, 20);
             this.txtType.TabIndex = 8;
             // 
-            // textBox4
+            // txtDescription
             // 
-            this.textBox4.Location = new System.Drawing.Point(12, 268);
-            this.textBox4.Name = "textBox4";
-            this.textBox4.ReadOnly = true;
-            this.textBox4.Size = new System.Drawing.Size(584, 20);
-            this.textBox4.TabIndex = 9;
+            this.txtDescription.Location = new System.Drawing.Point(12, 268);
+            this.txtDescription.Name = "txtDescription";
+            this.txtDescription.ReadOnly = true;
+            this.txtDescription.Size = new System.Drawing.Size(584, 20);
+            this.txtDescription.TabIndex = 9;
             // 
             // label5
             // 
@@ -139,22 +145,26 @@
             // btnOK
             // 
             this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.btnOK.Enabled = false;
             this.btnOK.Location = new System.Drawing.Point(440, 359);
             this.btnOK.Name = "btnOK";
             this.btnOK.Size = new System.Drawing.Size(75, 23);
             this.btnOK.TabIndex = 11;
             this.btnOK.Text = "Add";
             this.btnOK.UseVisualStyleBackColor = true;
+            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
             // 
             // btnCancel
             // 
             this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
             this.btnCancel.Location = new System.Drawing.Point(521, 359);
             this.btnCancel.Name = "btnCancel";
             this.btnCancel.Size = new System.Drawing.Size(75, 23);
             this.btnCancel.TabIndex = 12;
             this.btnCancel.Text = "Cancel";
             this.btnCancel.UseVisualStyleBackColor = true;
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
             // 
             // btnBrowse
             // 
@@ -164,18 +174,21 @@
             this.btnBrowse.TabIndex = 13;
             this.btnBrowse.Text = "...";
             this.btnBrowse.UseVisualStyleBackColor = true;
+            this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
             // 
             // NewResourceDialog
             // 
+            this.AcceptButton = this.btnOK;
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.CancelButton = this.btnCancel;
             this.ClientSize = new System.Drawing.Size(608, 394);
             this.ControlBox = false;
             this.Controls.Add(this.btnBrowse);
             this.Controls.Add(this.btnCancel);
             this.Controls.Add(this.btnOK);
             this.Controls.Add(this.label5);
-            this.Controls.Add(this.textBox4);
+            this.Controls.Add(this.txtDescription);
             this.Controls.Add(this.txtType);
             this.Controls.Add(this.txtParentFolder);
             this.Controls.Add(this.txtName);
@@ -205,7 +218,7 @@
         private System.Windows.Forms.TextBox txtName;
         private System.Windows.Forms.TextBox txtParentFolder;
         private System.Windows.Forms.TextBox txtType;
-        private System.Windows.Forms.TextBox textBox4;
+        private System.Windows.Forms.TextBox txtDescription;
         private System.Windows.Forms.Label label5;
         private System.Windows.Forms.Button btnOK;
         private System.Windows.Forms.Button btnCancel;

Modified: sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/UI/NewResourceDialog.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -24,14 +24,147 @@
 using System.Drawing;
 using System.Text;
 using System.Windows.Forms;
+using Maestro.Editors.Generic;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Maestro.Base.Services;
+using Maestro.Base.Templates;
 
 namespace Maestro.Base.UI
 {
     public partial class NewResourceDialog : Form
     {
-        public NewResourceDialog()
+        private NewResourceDialog()
         {
             InitializeComponent();
         }
+
+        private IResourceService _resSvc;
+        private NewItemTemplateService _nits;
+
+        public NewResourceDialog(IResourceService resSvc, NewItemTemplateService nits) : this()
+        {
+            _resSvc = resSvc;
+            _nits = nits;
+        }
+
+        protected override void OnLoad(EventArgs e)
+        {
+            lstCategories.DataSource = _nits.GetCategories();
+        }
+
+        private void btnBrowse_Click(object sender, EventArgs e)
+        {
+            var picker = new ResourcePicker(_resSvc);
+            picker.SelectFoldersOnly = true;
+            if (picker.ShowDialog() == DialogResult.OK)
+            {
+                txtParentFolder.Text = picker.ResourceID;
+            }
+        }
+
+        private void btnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+        }
+
+        private void lstCategories_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            if (lstCategories.SelectedItem != null)
+            {
+                string cat = lstCategories.SelectedItem.ToString();
+                LoadTemplates(_nits.GetItemTemplates(cat));
+            }
+        }
+
+        private ImageList tplImgList = new ImageList();
+
+        private void LoadTemplates(ItemTemplate[] templates)
+        {
+            lstTemplates.Clear();
+            tplImgList.Images.Clear();
+            tplImgList.Images.Add(Properties.Resources.document);
+            foreach (var tpl in templates)
+            {
+                var li = new ListViewItem();
+                li.Name = tpl.Name;
+                li.Text = tpl.Name;
+                li.ToolTipText = tpl.Description;
+
+                if (tpl.Icon == null)
+                {
+                    li.ImageIndex = 0;
+                }
+                else
+                {
+                    tplImgList.Images.Add(tpl.Icon);
+                    li.ImageIndex = tplImgList.Images.Count - 1;
+                }
+
+                li.Tag = tpl;
+
+                lstTemplates.Items.Add(li);
+            }
+            lstTemplates.SmallImageList = tplImgList;
+        }
+
+        private void lstTemplates_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            txtType.Text = "";
+            txtDescription.Text = "";
+            if (lstTemplates.SelectedItems.Count == 1)
+            {
+                var li = lstTemplates.SelectedItems[0];
+                var tpl = (ItemTemplate)li.Tag;
+
+                txtType.Text = tpl.ResourceType;
+                txtDescription.Text = tpl.Description;
+            }
+        }
+
+        private void CheckButtonState()
+        {
+            btnOK.Enabled = !string.IsNullOrEmpty(txtName.Text) && !string.IsNullOrEmpty(txtParentFolder.Text);
+        }
+
+        private void txtName_TextChanged(object sender, EventArgs e)
+        {
+            CheckButtonState();
+        }
+
+        private void txtParentFolder_TextChanged(object sender, EventArgs e)
+        {
+            CheckButtonState();
+        }
+
+        private void btnOK_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.OK;
+        }
+
+        /// <summary>
+        /// Gets the selected template
+        /// </summary>
+        public ItemTemplate SelectedTemplate
+        {
+            get
+            {
+                if (lstTemplates.SelectedItems.Count == 1)
+                {
+                    return (ItemTemplate)lstTemplates.SelectedItems[0].Tag;
+                }
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Gets the location where this new resource will be created
+        /// </summary>
+        public string ResourceID
+        {
+            get
+            {
+                return txtParentFolder.Text + txtName.Text + "." + txtType.Text;
+            }
+        }
     }
 }

Modified: sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -25,10 +25,66 @@
 using OSGeo.MapGuide.ObjectModels.Common;
 using System.Drawing;
 using System.Diagnostics;
+using OSGeo.MapGuide.MaestroAPI.Resource;
 
 namespace Maestro.Base.UI
 {
     /// <summary>
+    /// Stub implementation
+    /// </summary>
+    internal class IRepositoryItemImpl : IRepositoryItem
+    {
+        private ResourceIdentifier _rid;
+
+        public IRepositoryItemImpl(string resourceid)
+        {
+            this.ResourceId = resourceid;
+            _rid = new ResourceIdentifier(resourceid);
+        }
+
+        public string Name
+        {
+            get { return _rid.Name; }
+        }
+
+        public string ResourceId
+        {
+            get;
+            private set;
+        }
+
+        public ResourceTypes ResourceType
+        {
+            get { return _rid.ResourceType; }
+        }
+
+        public bool IsFolder
+        {
+            get { return _rid.IsFolder; }
+        }
+
+        public bool HasChildren
+        {
+            get { return false; }
+        }
+
+        public string Owner
+        {
+            get { return string.Empty; }
+        }
+
+        public DateTime CreatedDate
+        {
+            get { return DateTime.Now; }
+        }
+
+        public DateTime ModifiedDate
+        {
+            get { return DateTime.Now; }
+        }
+    }
+
+    /// <summary>
     /// Models an object in the repository
     /// </summary>
     public class RepositoryItem

Modified: sandbox/maestro-2.5/Maestro.Editors/Common/ResourcePicker.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Editors/Common/ResourcePicker.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Editors/Common/ResourcePicker.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -286,8 +286,23 @@
 
         public Image Icon
         {
-            get { return Properties.Resources.folder_horizontal; }
+            get
+            {
+                if (IsRoot)
+                {
+                    return Properties.Resources.server;
+                }
+                else
+                {
+                    return Properties.Resources.folder_horizontal;
+                }
+            }
         }
+
+        public bool IsRoot
+        {
+            get { return this.ResourceId == "Library://"; }
+        }
     }
 
     internal class RepositoryFolderTreeModel : ITreeModel
@@ -318,7 +333,7 @@
         {
             if (treePath.IsEmpty())
             {
-                var list = _resSvc.GetRepositoryResources("Library://", ResourceTypes.Folder.ToString(), 1);
+                var list = _resSvc.GetRepositoryResources("Library://", 0);
                 return GetSorted(list);
             }
             else

Modified: sandbox/maestro-2.5/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- sandbox/maestro-2.5/Maestro.Editors/Maestro.Editors.csproj	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Editors/Maestro.Editors.csproj	2010-06-16 13:12:09 UTC (rev 4948)
@@ -809,6 +809,9 @@
     <None Include="Resources\globe--minus.png" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="Resources\server.png" />
+  </ItemGroup>
+  <ItemGroup>
     <Folder Include="DrawingSource\Preview\" />
     <Folder Include="FeatureSource\Providers\Rdbms\" />
     <Folder Include="LayerDefinition\Geometry\" />

Modified: sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.Designer.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.Designer.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -396,6 +396,13 @@
             }
         }
         
+        internal static System.Drawing.Bitmap server {
+            get {
+                object obj = ResourceManager.GetObject("server", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         internal static System.Drawing.Bitmap sort_number {
             get {
                 object obj = ResourceManager.GetObject("sort-number", resourceCulture);

Modified: sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.resx
===================================================================
--- sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.resx	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/Maestro.Editors/Properties/Resources.resx	2010-06-16 13:12:09 UTC (rev 4948)
@@ -300,4 +300,7 @@
   <data name="globe--minus" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\globe--minus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <data name="server" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\server.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
 </root>
\ No newline at end of file

Added: sandbox/maestro-2.5/Maestro.Editors/Resources/server.png
===================================================================
(Binary files differ)


Property changes on: sandbox/maestro-2.5/Maestro.Editors/Resources/server.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs	2010-06-16 10:58:52 UTC (rev 4947)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs	2010-06-16 13:12:09 UTC (rev 4948)
@@ -203,6 +203,14 @@
         }
 
         /// <summary>
+        /// Gets the resource type
+        /// </summary>
+        public ResourceTypes ResourceType
+        {
+            get { return GetResourceType(m_id); }
+        }
+
+        /// <summary>
         /// Gets the length of the resource identifier as a string
         /// </summary>
         public int Length { get { return m_id == null ? 0 : m_id.Length; } }



More information about the mapguide-commits mailing list