[mapguide-commits] r7650 - in trunk/Tools/Maestro/Maestro.Editors: . FeatureSource FeatureSource/Extensions
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Jun 27 23:38:23 PDT 2013
Author: jng
Date: 2013-06-27 23:38:22 -0700 (Thu, 27 Jun 2013)
New Revision: 7650
Modified:
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.resx
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.resx
Log:
#2290: Guard against entering Extended Feature Classes of the same name.
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.Designer.cs 2013-06-28 03:03:42 UTC (rev 7649)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.Designer.cs 2013-06-28 06:38:22 UTC (rev 7650)
@@ -28,11 +28,14 @@
/// </summary>
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExtendedClassSettings));
this.label1 = new System.Windows.Forms.Label();
this.txtExtendedName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.cmbBaseClass = new System.Windows.Forms.ComboBox();
+ this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
this.SuspendLayout();
//
// label1
@@ -44,6 +47,7 @@
//
resources.ApplyResources(this.txtExtendedName, "txtExtendedName");
this.txtExtendedName.Name = "txtExtendedName";
+ this.txtExtendedName.TextChanged += new System.EventHandler(this.txtExtendedName_TextChanged);
//
// label2
//
@@ -57,6 +61,10 @@
this.cmbBaseClass.FormattingEnabled = true;
this.cmbBaseClass.Name = "cmbBaseClass";
//
+ // errorProvider
+ //
+ this.errorProvider.ContainerControl = this;
+ //
// ExtendedClassSettings
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -66,6 +74,7 @@
this.Controls.Add(this.label1);
this.Name = "ExtendedClassSettings";
resources.ApplyResources(this, "$this");
+ ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -77,5 +86,6 @@
private System.Windows.Forms.TextBox txtExtendedName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cmbBaseClass;
+ private System.Windows.Forms.ErrorProvider errorProvider;
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs 2013-06-28 03:03:42 UTC (rev 7649)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs 2013-06-28 06:38:22 UTC (rev 7650)
@@ -39,26 +39,25 @@
InitializeComponent();
}
- public ExtendedClassSettings(IEnumerable<string> qualifiedClassNames, IFeatureSourceExtension ext)
+ private IFeatureSourceExtension _ext;
+ private IFeatureSource _fs;
+
+ public ExtendedClassSettings(IFeatureSource fs, IEnumerable<string> qualifiedClassNames, IFeatureSourceExtension ext)
: this()
{
+ _fs = fs;
+ _ext = ext;
var names = new List<string>(qualifiedClassNames);
cmbBaseClass.DataSource = names;
ext.PropertyChanged += (sender, e) => { OnResourceChanged(); };
//HACK
- if (string.IsNullOrEmpty(ext.FeatureClass))
- ext.FeatureClass = names[0];
+ if (string.IsNullOrEmpty(_ext.FeatureClass))
+ _ext.FeatureClass = names[0];
- TextBoxBinder.BindText(txtExtendedName, ext, "Name"); //NOXLATE
ComboBoxBinder.BindSelectedIndexChanged(cmbBaseClass, "SelectedItem", ext, "FeatureClass"); //NOXLATE
}
- //private void txtExtendedName_TextChanged(object sender, EventArgs e)
- //{
- // txtExtendedName.DataBindings[0].WriteValue();
- //}
-
public void Bind(IEditorService service)
{
service.RegisterCustomNotifier(this);
@@ -72,5 +71,31 @@
}
public event EventHandler ResourceChanged;
+
+ private int GetExtensionCount(string name)
+ {
+ int count = 0;
+ foreach (var ext in _fs.Extension)
+ {
+ if (ext.Name == name)
+ count++;
+ }
+ return count;
+ }
+
+ private void txtExtendedName_TextChanged(object sender, EventArgs e)
+ {
+ //Before we apply, check if the new name matches any existing feature classes
+ string newName = txtExtendedName.Text;
+ if (GetExtensionCount(newName) > 0)
+ {
+ errorProvider.SetError(txtExtendedName, string.Format(Strings.ExtendedFeatureClassAlreadyExists, newName));
+ }
+ else
+ {
+ errorProvider.Clear();
+ _ext.Name = txtExtendedName.Text;
+ }
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.resx 2013-06-28 03:03:42 UTC (rev 7649)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.resx 2013-06-28 06:38:22 UTC (rev 7650)
@@ -112,16 +112,16 @@
<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>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.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>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
- <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>14, 16</value>
</data>
@@ -138,7 +138,7 @@
<value>label1</value>
</data>
<data name=">>label1.Type" xml:space="preserve">
- <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name=">>label1.Parent" xml:space="preserve">
<value>$this</value>
@@ -146,7 +146,7 @@
<data name=">>label1.ZOrder" xml:space="preserve">
<value>3</value>
</data>
- <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtExtendedName.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
@@ -154,7 +154,7 @@
<value>17, 32</value>
</data>
<data name="txtExtendedName.Size" type="System.Drawing.Size, System.Drawing">
- <value>289, 20</value>
+ <value>282, 20</value>
</data>
<data name="txtExtendedName.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@@ -163,7 +163,7 @@
<value>txtExtendedName</value>
</data>
<data name=">>txtExtendedName.Type" xml:space="preserve">
- <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name=">>txtExtendedName.Parent" xml:space="preserve">
<value>$this</value>
@@ -190,7 +190,7 @@
<value>label2</value>
</data>
<data name=">>label2.Type" xml:space="preserve">
- <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name=">>label2.Parent" xml:space="preserve">
<value>$this</value>
@@ -205,7 +205,7 @@
<value>17, 89</value>
</data>
<data name="cmbBaseClass.Size" type="System.Drawing.Size, System.Drawing">
- <value>289, 21</value>
+ <value>282, 21</value>
</data>
<data name="cmbBaseClass.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
@@ -214,7 +214,7 @@
<value>cmbBaseClass</value>
</data>
<data name=">>cmbBaseClass.Type" xml:space="preserve">
- <value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name=">>cmbBaseClass.Parent" xml:space="preserve">
<value>$this</value>
@@ -222,16 +222,25 @@
<data name=">>cmbBaseClass.ZOrder" xml:space="preserve">
<value>0</value>
</data>
- <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>327, 212</value>
</data>
+ <data name=">>errorProvider.Name" xml:space="preserve">
+ <value>errorProvider</value>
+ </data>
+ <data name=">>errorProvider.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ErrorProvider, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
<data name=">>$this.Name" xml:space="preserve">
<value>ExtendedClassSettings</value>
</data>
<data name=">>$this.Type" xml:space="preserve">
- <value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs 2013-06-28 03:03:42 UTC (rev 7649)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs 2013-06-28 06:38:22 UTC (rev 7650)
@@ -312,7 +312,7 @@
var calc = e.Node.Tag as ICalculatedProperty;
if (ext != null)
{
- var ctl = new ExtendedClassSettings(GetAllClassNames(), ext);
+ var ctl = new ExtendedClassSettings(_fs, GetAllClassNames(), ext);
ctl.Dock = DockStyle.Fill;
//If editing to something valid, update the toolbar
ctl.ResourceChanged += (s, evt) =>
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2013-06-28 03:03:42 UTC (rev 7649)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2013-06-28 06:38:22 UTC (rev 7650)
@@ -592,6 +592,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to An extended feature class named ({0}) already exist. Please choose a different name.
+ /// </summary>
+ internal static string ExtendedFeatureClassAlreadyExists {
+ get {
+ return ResourceManager.GetString("ExtendedFeatureClassAlreadyExists", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Map extents calculation completed. Click Accept to use the calculated extents..
/// </summary>
internal static string ExtentsCalculationCompleted {
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2013-06-28 03:03:42 UTC (rev 7649)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2013-06-28 06:38:22 UTC (rev 7650)
@@ -1524,4 +1524,7 @@
<data name="GroupAlreadyExists" xml:space="preserve">
<value>A group named "{0}" already exists. Choose a different name</value>
</data>
+ <data name="ExtendedFeatureClassAlreadyExists" xml:space="preserve">
+ <value>An extended feature class named ({0}) already exist. Please choose a different name</value>
+ </data>
</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list