[mapguide-commits] r5632 - in trunk/Tools/Maestro/Maestro.Base: .
Commands/SiteExplorer Properties UI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Mar 16 07:04:41 EDT 2011
Author: jng
Date: 2011-03-16 04:04:41 -0700 (Wed, 16 Mar 2011)
New Revision: 5632
Added:
trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.Designer.cs
trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.cs
trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.resx
Modified:
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/NewFolderCommand.cs
trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
Log:
Fix #1595: New folder improvement
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/NewFolderCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/NewFolderCommand.cs 2011-03-16 10:47:26 UTC (rev 5631)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/NewFolderCommand.cs 2011-03-16 11:04:41 UTC (rev 5632)
@@ -22,6 +22,7 @@
using System.Text;
using ICSharpCode.Core;
using Maestro.Base.Services;
+using Maestro.Base.UI;
namespace Maestro.Base.Commands.SiteExplorer
{
@@ -46,14 +47,27 @@
counter++;
name = defaultName + counter;
}
- //conn.ResourceService.CreateFolder(item.ResourceId + name);
- conn.ResourceService.SetResourceXmlData(item.ResourceId + name + "/", null);
- var path = item.Model.GetPath(item);
- item.Model.RaiseStructureChanged(new Aga.Controls.Tree.TreeModelEventArgs(path, new object[0]));
- //Expand so user can see this new folder
- exp.ExpandNode(item.ResourceId);
- exp.SelectNode(item.ResourceId + name + "/");
+ List<string> folderNames = new List<string>();
+ foreach (var child in item.Children)
+ {
+ if (child.IsFolder)
+ folderNames.Add(child.Name);
+ }
+
+ var diag = new NewFolderDialog(name, folderNames.ToArray());
+ if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ name = diag.FolderName;
+ //conn.ResourceService.CreateFolder(item.ResourceId + name);
+ conn.ResourceService.SetResourceXmlData(item.ResourceId + name + "/", null);
+ var path = item.Model.GetPath(item);
+ item.Model.RaiseStructureChanged(new Aga.Controls.Tree.TreeModelEventArgs(path, new object[0]));
+
+ //Expand so user can see this new folder
+ exp.ExpandNode(item.ResourceId);
+ exp.SelectNode(item.ResourceId + name + "/");
+ }
}
}
}
Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2011-03-16 10:47:26 UTC (rev 5631)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2011-03-16 11:04:41 UTC (rev 5632)
@@ -259,6 +259,12 @@
<Compile Include="UI\MessageViewer.Designer.cs">
<DependentUpon>MessageViewer.cs</DependentUpon>
</Compile>
+ <Compile Include="UI\NewFolderDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="UI\NewFolderDialog.Designer.cs">
+ <DependentUpon>NewFolderDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="UI\NewResourceDialog.cs">
<SubType>Form</SubType>
</Compile>
@@ -457,6 +463,9 @@
<DependentUpon>MessageViewer.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="UI\NewFolderDialog.resx">
+ <DependentUpon>NewFolderDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="UI\NewResourceDialog.resx">
<DependentUpon>NewResourceDialog.cs</DependentUpon>
<SubType>Designer</SubType>
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-03-16 10:47:26 UTC (rev 5631)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-03-16 11:04:41 UTC (rev 5632)
@@ -663,6 +663,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Folder name already exists.
+ /// </summary>
+ internal static string FolderNameExists {
+ get {
+ return ResourceManager.GetString("FolderNameExists", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Error.
/// </summary>
internal static string Global_ErrorText {
@@ -1202,6 +1211,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Required.
+ /// </summary>
+ internal static string Required {
+ get {
+ return ResourceManager.GetString("Required", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to This resource is already opened in another editor.
/// </summary>
internal static string ResourceAlreadyOpened {
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-03-16 10:47:26 UTC (rev 5631)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-03-16 11:04:41 UTC (rev 5632)
@@ -844,4 +844,10 @@
<data name="DefaultSymbolName" xml:space="preserve">
<value>MySymbol</value>
</data>
+ <data name="Required" xml:space="preserve">
+ <value>Required</value>
+ </data>
+ <data name="FolderNameExists" xml:space="preserve">
+ <value>Folder name already exists</value>
+ </data>
</root>
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.Designer.cs 2011-03-16 11:04:41 UTC (rev 5632)
@@ -0,0 +1,116 @@
+namespace Maestro.Base.UI
+{
+ partial class NewFolderDialog
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtName = new System.Windows.Forms.TextBox();
+ this.btnCreate = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(13, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(67, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Folder Name";
+ //
+ // txtName
+ //
+ this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtName.Location = new System.Drawing.Point(16, 30);
+ this.txtName.Name = "txtName";
+ this.txtName.Size = new System.Drawing.Size(252, 20);
+ this.txtName.TabIndex = 1;
+ this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
+ //
+ // btnCreate
+ //
+ this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnCreate.Enabled = false;
+ this.btnCreate.Location = new System.Drawing.Point(112, 56);
+ this.btnCreate.Name = "btnCreate";
+ this.btnCreate.Size = new System.Drawing.Size(75, 23);
+ this.btnCreate.TabIndex = 2;
+ this.btnCreate.Text = "Create";
+ this.btnCreate.UseVisualStyleBackColor = true;
+ this.btnCreate.Click += new System.EventHandler(this.btnCreate_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(193, 56);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 3;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // errorProvider
+ //
+ this.errorProvider.ContainerControl = this;
+ //
+ // NewFolderDialog
+ //
+ this.AcceptButton = this.btnCreate;
+ 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(293, 88);
+ this.ControlBox = false;
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnCreate);
+ this.Controls.Add(this.txtName);
+ this.Controls.Add(this.label1);
+ this.Name = "NewFolderDialog";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Create New Folder";
+ ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtName;
+ private System.Windows.Forms.Button btnCreate;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.ErrorProvider errorProvider;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.cs 2011-03-16 11:04:41 UTC (rev 5632)
@@ -0,0 +1,71 @@
+#region Disclaimer / License
+// Copyright (C) 2011, 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.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Maestro.Base.UI
+{
+ public partial class NewFolderDialog : Form
+ {
+ private List<string> _folderNames;
+
+ public NewFolderDialog(string name, string [] folderNames)
+ {
+ InitializeComponent();
+ _folderNames = new List<string>(folderNames);
+ txtName.Text = name;
+ }
+
+ public string FolderName { get { return txtName.Text; } }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ }
+
+ private void btnCreate_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ }
+
+ private void txtName_TextChanged(object sender, EventArgs e)
+ {
+ errorProvider.Clear();
+ btnCreate.Enabled = false;
+ if (string.IsNullOrEmpty(txtName.Text))
+ {
+ errorProvider.SetError(txtName, Properties.Resources.Required);
+ return;
+ }
+ else if (_folderNames.Contains(txtName.Text))
+ {
+ errorProvider.SetError(txtName, Properties.Resources.FolderNameExists);
+ return;
+ }
+
+ btnCreate.Enabled = true;
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/UI/NewFolderDialog.resx 2011-03-16 11:04:41 UTC (rev 5632)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list