[mapguide-commits] r5282 - in sandbox/maestro-3.0/Maestro.Editors: Common Properties

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 13 04:42:53 EDT 2010


Author: jng
Date: 2010-10-13 01:42:52 -0700 (Wed, 13 Oct 2010)
New Revision: 5282

Modified:
   sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx
   sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx
Log:
3.0 sandbox changes:
 - Clean up the resource picker to be more simplified and behaviourally consistent.

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs	2010-10-13 08:12:24 UTC (rev 5281)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs	2010-10-13 08:42:52 UTC (rev 5282)
@@ -44,9 +44,15 @@
             this.label3 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
             this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            this.label2 = new System.Windows.Forms.Label();
+            this.txtFolder = new System.Windows.Forms.TextBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.txtName = new System.Windows.Forms.TextBox();
+            this.resIdComponentPanel = new System.Windows.Forms.Panel();
             this.splitContainer1.Panel1.SuspendLayout();
             this.splitContainer1.Panel2.SuspendLayout();
             this.splitContainer1.SuspendLayout();
+            this.resIdComponentPanel.SuspendLayout();
             this.SuspendLayout();
             // 
             // trvFolders
@@ -66,7 +72,7 @@
             this.trvFolders.NodeControls.Add(this.nodeIcon1);
             this.trvFolders.NodeControls.Add(this.nodeTextBox1);
             this.trvFolders.SelectedNode = null;
-            this.trvFolders.Size = new System.Drawing.Size(168, 237);
+            this.trvFolders.Size = new System.Drawing.Size(160, 241);
             this.trvFolders.TabIndex = 0;
             this.trvFolders.SelectionChanged += new System.EventHandler(this.trvFolders_SelectionChanged);
             this.trvFolders.Expanding += new System.EventHandler<Aga.Controls.Tree.TreeViewAdvEventArgs>(this.trvFolders_Expanding);
@@ -95,7 +101,7 @@
             this.lstResources.Location = new System.Drawing.Point(3, 31);
             this.lstResources.MultiSelect = false;
             this.lstResources.Name = "lstResources";
-            this.lstResources.Size = new System.Drawing.Size(348, 237);
+            this.lstResources.Size = new System.Drawing.Size(426, 241);
             this.lstResources.SmallImageList = this.resImageList;
             this.lstResources.TabIndex = 1;
             this.lstResources.UseCompatibleStateImageBehavior = false;
@@ -120,7 +126,7 @@
             // 
             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(382, 317);
+            this.btnOK.Location = new System.Drawing.Point(452, 341);
             this.btnOK.Name = "btnOK";
             this.btnOK.Size = new System.Drawing.Size(75, 23);
             this.btnOK.TabIndex = 2;
@@ -132,7 +138,7 @@
             // 
             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(463, 317);
+            this.btnCancel.Location = new System.Drawing.Point(533, 341);
             this.btnCancel.Name = "btnCancel";
             this.btnCancel.Size = new System.Drawing.Size(75, 23);
             this.btnCancel.TabIndex = 3;
@@ -144,7 +150,7 @@
             // 
             this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(12, 291);
+            this.label1.Location = new System.Drawing.Point(12, 315);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(67, 13);
             this.label1.TabIndex = 4;
@@ -154,7 +160,7 @@
             // 
             this.lblFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
             this.lblFilter.AutoSize = true;
-            this.lblFilter.Location = new System.Drawing.Point(12, 317);
+            this.lblFilter.Location = new System.Drawing.Point(12, 341);
             this.lblFilter.Name = "lblFilter";
             this.lblFilter.Size = new System.Drawing.Size(29, 13);
             this.lblFilter.TabIndex = 5;
@@ -164,10 +170,10 @@
             // 
             this.txtResourceId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                         | System.Windows.Forms.AnchorStyles.Right)));
-            this.txtResourceId.Location = new System.Drawing.Point(85, 288);
+            this.txtResourceId.Location = new System.Drawing.Point(85, 312);
             this.txtResourceId.Name = "txtResourceId";
             this.txtResourceId.ReadOnly = true;
-            this.txtResourceId.Size = new System.Drawing.Size(453, 20);
+            this.txtResourceId.Size = new System.Drawing.Size(523, 20);
             this.txtResourceId.TabIndex = 6;
             // 
             // cmbResourceFilter
@@ -176,10 +182,11 @@
                         | System.Windows.Forms.AnchorStyles.Right)));
             this.cmbResourceFilter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.cmbResourceFilter.FormattingEnabled = true;
-            this.cmbResourceFilter.Location = new System.Drawing.Point(85, 314);
+            this.cmbResourceFilter.Location = new System.Drawing.Point(85, 338);
             this.cmbResourceFilter.Name = "cmbResourceFilter";
-            this.cmbResourceFilter.Size = new System.Drawing.Size(255, 21);
+            this.cmbResourceFilter.Size = new System.Drawing.Size(325, 21);
             this.cmbResourceFilter.TabIndex = 7;
+            this.cmbResourceFilter.SelectedIndexChanged += new System.EventHandler(this.cmbResourceFilter_SelectedIndexChanged);
             // 
             // label3
             // 
@@ -201,7 +208,9 @@
             // 
             // splitContainer1
             // 
-            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Top;
+            this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                        | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
             this.splitContainer1.Location = new System.Drawing.Point(0, 0);
             this.splitContainer1.Name = "splitContainer1";
             // 
@@ -214,18 +223,72 @@
             // 
             this.splitContainer1.Panel2.Controls.Add(this.lstResources);
             this.splitContainer1.Panel2.Controls.Add(this.label4);
-            this.splitContainer1.Size = new System.Drawing.Size(550, 282);
-            this.splitContainer1.SplitterDistance = 183;
+            this.splitContainer1.Size = new System.Drawing.Size(620, 275);
+            this.splitContainer1.SplitterDistance = 175;
             this.splitContainer1.TabIndex = 10;
             // 
+            // label2
+            // 
+            this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(12, 5);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(36, 13);
+            this.label2.TabIndex = 11;
+            this.label2.Text = "Folder";
+            // 
+            // txtFolder
+            // 
+            this.txtFolder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtFolder.Location = new System.Drawing.Point(85, 2);
+            this.txtFolder.Name = "txtFolder";
+            this.txtFolder.ReadOnly = true;
+            this.txtFolder.Size = new System.Drawing.Size(235, 20);
+            this.txtFolder.TabIndex = 12;
+            this.txtFolder.TextChanged += new System.EventHandler(this.txtFolder_TextChanged);
+            // 
+            // label5
+            // 
+            this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(323, 5);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(35, 13);
+            this.label5.TabIndex = 13;
+            this.label5.Text = "Name";
+            // 
+            // txtName
+            // 
+            this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtName.Location = new System.Drawing.Point(364, 2);
+            this.txtName.Name = "txtName";
+            this.txtName.Size = new System.Drawing.Size(244, 20);
+            this.txtName.TabIndex = 14;
+            this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
+            // 
+            // resIdComponentPanel
+            // 
+            this.resIdComponentPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.resIdComponentPanel.Controls.Add(this.txtName);
+            this.resIdComponentPanel.Controls.Add(this.label5);
+            this.resIdComponentPanel.Controls.Add(this.label2);
+            this.resIdComponentPanel.Controls.Add(this.txtFolder);
+            this.resIdComponentPanel.Location = new System.Drawing.Point(0, 281);
+            this.resIdComponentPanel.Name = "resIdComponentPanel";
+            this.resIdComponentPanel.Size = new System.Drawing.Size(620, 25);
+            this.resIdComponentPanel.TabIndex = 10;
+            // 
             // ResourcePicker
             // 
             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(550, 352);
+            this.ClientSize = new System.Drawing.Size(620, 376);
             this.ControlBox = false;
+            this.Controls.Add(this.resIdComponentPanel);
             this.Controls.Add(this.splitContainer1);
             this.Controls.Add(this.cmbResourceFilter);
             this.Controls.Add(this.txtResourceId);
@@ -242,6 +305,8 @@
             this.splitContainer1.Panel2.ResumeLayout(false);
             this.splitContainer1.Panel2.PerformLayout();
             this.splitContainer1.ResumeLayout(false);
+            this.resIdComponentPanel.ResumeLayout(false);
+            this.resIdComponentPanel.PerformLayout();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -263,5 +328,10 @@
         private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBox1;
         private System.Windows.Forms.ImageList resImageList;
         private System.Windows.Forms.SplitContainer splitContainer1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox txtFolder;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.TextBox txtName;
+        private System.Windows.Forms.Panel resIdComponentPanel;
     }
 }
\ No newline at end of file

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs	2010-10-13 08:12:24 UTC (rev 5281)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs	2010-10-13 08:42:52 UTC (rev 5282)
@@ -101,7 +101,6 @@
             private set
             {
                 _mode = value;
-                txtResourceId.ReadOnly = true;
                 switch (_mode)
                 {
                     case ResourcePickerMode.OpenFolder:
@@ -113,7 +112,6 @@
                     case ResourcePickerMode.SaveResource:
                         {
                             this.Text = Properties.Resources.SaveResource;
-                            txtResourceId.ReadOnly = false;
                         }
                         break;
                 }
@@ -187,6 +185,9 @@
                     this.UseFilter = false;
 
                 splitContainer1.Panel2Collapsed = value;
+                resIdComponentPanel.Visible = !value;
+                if (value)
+                    txtResourceId.Text = string.Empty;
             }
         }
 
@@ -198,6 +199,27 @@
             get { return txtResourceId.Text; }
         }
 
+        private void UpdateResourceId()
+        {
+            btnOK.Enabled = false;
+            if (this.SelectFoldersOnly)
+            {
+                txtResourceId.Text = txtFolder.Text;
+                if (!string.IsNullOrEmpty(txtFolder.Text) && ResourceIdentifier.IsFolderResource(txtResourceId.Text))
+                {
+                    btnOK.Enabled = true;
+                }
+            }
+            else
+            {
+                txtResourceId.Text = txtFolder.Text + txtName.Text + "." + cmbResourceFilter.SelectedItem.ToString();
+                if (!ResourceIdentifier.IsFolderResource(txtResourceId.Text) && !string.IsNullOrEmpty(txtName.Text))
+                {
+                    btnOK.Enabled = true;
+                }
+            }
+        }
+
         private void btnCancel_Click(object sender, EventArgs e)
         {
             this.DialogResult = DialogResult.Cancel;
@@ -227,6 +249,12 @@
                             return;
                         }
                     }
+
+                    if (_resSvc.ResourceExists(txtResourceId.Text))
+                    {
+                        if (MessageBox.Show(Properties.Resources.OverwriteResource, Properties.Resources.SaveResource, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
+                            return;
+                    }
                 }
             }
             this.DialogResult = DialogResult.OK;
@@ -234,19 +262,19 @@
 
         private void trvFolders_SelectionChanged(object sender, EventArgs e)
         {
+            UpdateDocumentList();
+        }
+
+        private void UpdateDocumentList()
+        {
             var node = trvFolders.SelectedNode;
             if (node != null)
             {
                 RepositoryFolder folder = node.Tag as RepositoryFolder;
-                btnOK.Enabled = false;
+                txtFolder.Text = folder.ResourceId;
 
-                if (this.SelectFoldersOnly || _mode == ResourcePickerMode.SaveResource)
+                if (!this.SelectFoldersOnly)
                 {
-                    txtResourceId.Text = folder.ResourceId;
-                    btnOK.Enabled = true;
-                }
-                else
-                {
                     ResourceList list = null;
                     if (!this.UseFilter)
                         list = _resSvc.GetRepositoryResources(folder.ResourceId, 1);
@@ -315,15 +343,13 @@
 
         private void lstResources_SelectedIndexChanged(object sender, EventArgs e)
         {
-            btnOK.Enabled = false;
             if (lstResources.SelectedItems.Count == 1)
             {
                 var item = lstResources.SelectedItems[0];
                 var doc = item.Tag as ResourceListResourceDocument;
                 if (doc != null)
                 {
-                    txtResourceId.Text = doc.ResourceId;
-                    btnOK.Enabled = true;
+                    txtName.Text = ResourceIdentifier.GetName(doc.ResourceId);
                 }
             }
         }
@@ -357,6 +383,22 @@
                 this.Cursor = Cursors.Default;
             }
         }
+
+        private void txtName_TextChanged(object sender, EventArgs e)
+        {
+            UpdateResourceId();
+        }
+
+        private void txtFolder_TextChanged(object sender, EventArgs e)
+        {
+            UpdateResourceId();
+        }
+
+        private void cmbResourceFilter_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            UpdateResourceId();
+            UpdateDocumentList();
+        }
     }
 
     public enum ResourcePickerMode

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx	2010-10-13 08:12:24 UTC (rev 5281)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx	2010-10-13 08:42:52 UTC (rev 5282)
@@ -125,7 +125,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADQ
-        EQAAAk1TRnQBSQFMAgEBCQEAAXABAAFwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+        EQAAAk1TRnQBSQFMAgEBCQEAAaABAAGgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
         AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
         AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
         AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

Modified: sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs	2010-10-13 08:12:24 UTC (rev 5281)
+++ sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs	2010-10-13 08:42:52 UTC (rev 5282)
@@ -1595,6 +1595,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to This resource already exists, continue with save?.
+        /// </summary>
+        internal static string OverwriteResource {
+            get {
+                return ResourceManager.GetString("OverwriteResource", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to An error occured while building package: {0}.
         /// </summary>
         internal static string PackageBuildError {

Modified: sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx	2010-10-13 08:12:24 UTC (rev 5281)
+++ sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx	2010-10-13 08:42:52 UTC (rev 5282)
@@ -921,4 +921,8 @@
   <data name="StandardQuery" xml:space="preserve">
     <value>Standard Query</value>
   </data>
+  <data name="OverwriteResource" xml:space="preserve">
+    <value>This resource already exists, continue with save?</value>
+    <comment>Question similar to the standard response of saving to an exisiting file using the regular save file dialog</comment>
+  </data>
 </root>
\ No newline at end of file



More information about the mapguide-commits mailing list