[mapguide-commits] r8035 - in trunk/Tools/Maestro: Maestro.Base/Editor Maestro.Editors Maestro.Editors/Common Maestro.Editors/FeatureSource/Preview Maestro.Editors/LayerDefinition/Vector/Scales Maestro.Editors/LayerDefinition/Vector/Thematics MaestroFsPreview

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Apr 12 09:10:43 PDT 2014


Author: jng
Date: 2014-04-12 09:10:43 -0700 (Sat, 12 Apr 2014)
New Revision: 8035

Modified:
   trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.resx
   trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/SqlQueryCtrl.cs
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs
   trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.resx
   trunk/Tools/Maestro/MaestroFsPreview/MainForm.cs
   trunk/Tools/Maestro/MaestroFsPreview/Program.cs
Log:
#2259: Add support for creating LOOKUP() theme expressions in the Expression Editor.

Modified: trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -81,7 +81,7 @@
         {
             //TODO: We really want to do this as an external process
 
-            var dlg = new MaestroFsPreview.MainForm(_fsvc, _rsvc);
+            var dlg = new MaestroFsPreview.MainForm(_edsvc);
             dlg.FeatureSourceID = _fs.ResourceID;
             dlg.ShowDialog();
 

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -32,16 +32,17 @@
 using OSGeo.MapGuide.MaestroAPI.Schema;
 using Maestro.Editors.Common.Expression;
 using ICSharpCode.TextEditor.Gui.CompletionWindow;
+using Maestro.Editors.LayerDefinition.Vector.Thematics;
 
 namespace Maestro.Editors.Common
 {
     /// <summary>
     /// An expression editor dialog
     /// </summary>
-    public partial class ExpressionEditor : Form, IExpressionEditor
+    public partial class ExpressionEditor : Form, IExpressionEditor, ITextInserter
     {
         private ClassDefinition _cls;
-        private IFeatureService _featSvc;
+        private IEditorService _edSvc;
         private string m_featureSource = null;
         private FdoProviderCapabilities _caps;
         private ITextEditor _editor;
@@ -82,20 +83,22 @@
         /// <summary>
         /// Initializes the dialog.
         /// </summary>
-        /// <param name="featSvc">The feature service.</param>
+        /// <param name="edSvc">The editor service.</param>
         /// <param name="caps">The provider capabilities.</param>
         /// <param name="cls">The class definition.</param>
-        /// <param name="featuresSourceId">The features source id.</param>
+        /// <param name="featuresSourceId">The FeatureSource id.</param>
         /// <param name="attachStylizationFunctions">if set to <c>true</c> stylization functions are also attached</param>
-        public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
+        public void Initialize(IEditorService edSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
         {
             try
             {
                 _cls = cls;
-                _featSvc = featSvc;
+                _edSvc = edSvc;
                 m_featureSource = featuresSourceId;
                 _caps = caps;
 
+                insertThemeExpressionToolStripMenuItem.Enabled = attachStylizationFunctions;
+
                 SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
                 foreach (var col in _cls.Properties)
                 {
@@ -282,7 +285,7 @@
                 ColumnValue.Tag = null;
                 try
                 {
-                    using (var rdr = _featSvc.AggregateQueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new System.Collections.Specialized.NameValueCollection() { 
+                    using (var rdr = _edSvc.FeatureService.AggregateQueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new System.Collections.Specialized.NameValueCollection() { 
                             { "UNIQ_VALS", expr } //NOXLATE
                         }))
                     {
@@ -327,7 +330,7 @@
                         try
                         {
                             retry = false;
-                            using (var rd = _featSvc.QueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new string[] { ColumnName.Text }))
+                            using (var rd = _edSvc.FeatureService.QueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new string[] { ColumnName.Text }))
                             {
                                 while (rd.ReadNext())
                                 {
@@ -416,5 +419,18 @@
         {
             ExpressionText.ActiveTextAreaControl.TextArea.InsertString(text);
         }
+
+        private void insertThemeExpressionToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            using (var theme = new ThemeCreator(_edSvc, _cls, this))
+            {
+                theme.ShowDialog();
+            }
+        }
+
+        void ITextInserter.InsertText(string text)
+        {
+            this.InsertText(text);
+        }
     }
 }
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.designer.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.designer.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -46,6 +46,8 @@
             this.ColumnName = new System.Windows.Forms.ToolStripComboBox();
             this._autoCompleteTooltip = new System.Windows.Forms.ToolTip(this.components);
             this.ExpressionText = new ICSharpCode.TextEditor.TextEditorControl();
+            this.btnTools = new System.Windows.Forms.ToolStripDropDownButton();
+            this.insertThemeExpressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.panel1.SuspendLayout();
             this.toolStrip1.SuspendLayout();
             this.SuspendLayout();
@@ -81,7 +83,8 @@
             this.toolStripSeparator1,
             this.ColumnValue,
             this.LookupValues,
-            this.ColumnName});
+            this.ColumnName,
+            this.btnTools});
             resources.ApplyResources(this.toolStrip1, "toolStrip1");
             this.toolStrip1.Name = "toolStrip1";
             // 
@@ -165,6 +168,20 @@
             this.ExpressionText.ShowLineNumbers = false;
             this.ExpressionText.ShowVRuler = false;
             // 
+            // btnTools
+            // 
+            this.btnTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.insertThemeExpressionToolStripMenuItem});
+            this.btnTools.Image = global::Maestro.Editors.Properties.Resources.gear;
+            resources.ApplyResources(this.btnTools, "btnTools");
+            this.btnTools.Name = "btnTools";
+            // 
+            // insertThemeExpressionToolStripMenuItem
+            // 
+            this.insertThemeExpressionToolStripMenuItem.Name = "insertThemeExpressionToolStripMenuItem";
+            resources.ApplyResources(this.insertThemeExpressionToolStripMenuItem, "insertThemeExpressionToolStripMenuItem");
+            this.insertThemeExpressionToolStripMenuItem.Click += new System.EventHandler(this.insertThemeExpressionToolStripMenuItem_Click);
+            // 
             // ExpressionEditor
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -200,5 +217,7 @@
         private System.Windows.Forms.ToolStripDropDownButton btnProperties;
         private System.Windows.Forms.ToolStripDropDownButton btnFunctions;
         private ICSharpCode.TextEditor.TextEditorControl ExpressionText;
+        private System.Windows.Forms.ToolStripDropDownButton btnTools;
+        private System.Windows.Forms.ToolStripMenuItem insertThemeExpressionToolStripMenuItem;
     }
 }
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.resx	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.resx	2014-04-12 16:10:43 UTC (rev 8035)
@@ -123,7 +123,7 @@
   </data>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="OKBtn.Location" type="System.Drawing.Point, System.Drawing">
-    <value>368, 6</value>
+    <value>473, 6</value>
   </data>
   <data name="OKBtn.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
@@ -151,7 +151,7 @@
     <value>Bottom, Right</value>
   </data>
   <data name="CancelBtn.Location" type="System.Drawing.Point, System.Drawing">
-    <value>449, 6</value>
+    <value>554, 6</value>
   </data>
   <data name="CancelBtn.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
@@ -178,10 +178,10 @@
     <value>Bottom</value>
   </data>
   <data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>0, 244</value>
+    <value>0, 279</value>
   </data>
   <data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
-    <value>536, 40</value>
+    <value>641, 40</value>
   </data>
   <data name="panel1.TabIndex" type="System.Int32, mscorlib">
     <value>4</value>
@@ -219,24 +219,6 @@
   <data name="btnFunctions.Text" xml:space="preserve">
     <value>Functions</value>
   </data>
-  <data name="btnCondition.Size" type="System.Drawing.Size, System.Drawing">
-    <value>127, 22</value>
-  </data>
-  <data name="btnCondition.Text" xml:space="preserve">
-    <value>Condition</value>
-  </data>
-  <data name="btnSpatial.Size" type="System.Drawing.Size, System.Drawing">
-    <value>127, 22</value>
-  </data>
-  <data name="btnSpatial.Text" xml:space="preserve">
-    <value>Spatial</value>
-  </data>
-  <data name="btnDistance.Size" type="System.Drawing.Size, System.Drawing">
-    <value>127, 22</value>
-  </data>
-  <data name="btnDistance.Text" xml:space="preserve">
-    <value>Distance</value>
-  </data>
   <data name="btnFilter.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
     <value>Magenta</value>
   </data>
@@ -273,11 +255,26 @@
   <data name="ColumnName.ToolTipText" xml:space="preserve">
     <value>Select the column to read values from</value>
   </data>
+  <data name="insertThemeExpressionToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
+    <value>201, 22</value>
+  </data>
+  <data name="insertThemeExpressionToolStripMenuItem.Text" xml:space="preserve">
+    <value>Insert Theme Expression</value>
+  </data>
+  <data name="btnTools.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnTools.Size" type="System.Drawing.Size, System.Drawing">
+    <value>65, 22</value>
+  </data>
+  <data name="btnTools.Text" xml:space="preserve">
+    <value>Tools</value>
+  </data>
   <data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
     <value>0, 0</value>
   </data>
   <data name="toolStrip1.Size" type="System.Drawing.Size, System.Drawing">
-    <value>536, 25</value>
+    <value>641, 25</value>
   </data>
   <data name="toolStrip1.TabIndex" type="System.Int32, mscorlib">
     <value>5</value>
@@ -297,6 +294,24 @@
   <data name=">>toolStrip1.ZOrder" xml:space="preserve">
     <value>1</value>
   </data>
+  <data name="btnCondition.Size" type="System.Drawing.Size, System.Drawing">
+    <value>152, 22</value>
+  </data>
+  <data name="btnCondition.Text" xml:space="preserve">
+    <value>Condition</value>
+  </data>
+  <data name="btnSpatial.Size" type="System.Drawing.Size, System.Drawing">
+    <value>152, 22</value>
+  </data>
+  <data name="btnSpatial.Text" xml:space="preserve">
+    <value>Spatial</value>
+  </data>
+  <data name="btnDistance.Size" type="System.Drawing.Size, System.Drawing">
+    <value>152, 22</value>
+  </data>
+  <data name="btnDistance.Text" xml:space="preserve">
+    <value>Distance</value>
+  </data>
   <metadata name="_autoCompleteTooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>116, 17</value>
   </metadata>
@@ -307,7 +322,7 @@
     <value>0, 25</value>
   </data>
   <data name="ExpressionText.Size" type="System.Drawing.Size, System.Drawing">
-    <value>536, 219</value>
+    <value>641, 254</value>
   </data>
   <data name="ExpressionText.TabIndex" type="System.Int32, mscorlib">
     <value>6</value>
@@ -328,7 +343,7 @@
     <value>True</value>
   </metadata>
   <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
-    <value>536, 284</value>
+    <value>641, 319</value>
   </data>
   <data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
     <value>500, 300</value>
@@ -405,6 +420,18 @@
   <data name=">>_autoCompleteTooltip.Type" xml:space="preserve">
     <value>System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
+  <data name=">>btnTools.Name" xml:space="preserve">
+    <value>btnTools</value>
+  </data>
+  <data name=">>btnTools.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>insertThemeExpressionToolStripMenuItem.Name" xml:space="preserve">
+    <value>insertThemeExpressionToolStripMenuItem</value>
+  </data>
+  <data name=">>insertThemeExpressionToolStripMenuItem.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name=">>$this.Name" xml:space="preserve">
     <value>ExpressionEditor</value>
   </data>

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -31,17 +31,17 @@
     /// <summary>
     /// The expression editor interface
     /// </summary>
-    public interface IExpressionEditor
+    internal interface IExpressionEditor
     {
         /// <summary>
         /// Initializes the expression editor
         /// </summary>
-        /// <param name="featSvc"></param>
+        /// <param name="edSvc"></param>
         /// <param name="caps"></param>
         /// <param name="cls"></param>
         /// <param name="featuresSourceId"></param>
         /// <param name="attachStylizationFunctions"></param>
-        void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions);
+        void Initialize(IEditorService edSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions);
 
         /// <summary>
         /// Gets or sets the FDO expression
@@ -55,6 +55,14 @@
         System.Windows.Forms.DialogResult ShowDialog();
     }
 
+    /// <summary>
+    /// An interface for inserting text
+    /// </summary>
+    public interface ITextInserter
+    {
+        void InsertText(string text);
+    }
+
     internal static class FdoExpressionEditorFactory
     {
         public static IExpressionEditor Create()

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -47,6 +47,8 @@
             this.ColumnName = new System.Windows.Forms.ToolStripComboBox();
             this.ExpressionText = new System.Windows.Forms.TextBox();
             this._autoCompleteTooltip = new System.Windows.Forms.ToolTip(this.components);
+            this.btnTools = new System.Windows.Forms.ToolStripDropDownButton();
+            this.insertThemeExpressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.panel1.SuspendLayout();
             this.toolStrip1.SuspendLayout();
             this.SuspendLayout();
@@ -88,7 +90,8 @@
             this.toolStripSeparator1,
             this.ColumnValue,
             this.LookupValues,
-            this.ColumnName});
+            this.ColumnName,
+            this.btnTools});
             resources.ApplyResources(this.toolStrip1, "toolStrip1");
             this.toolStrip1.Name = "toolStrip1";
             // 
@@ -172,6 +175,20 @@
             this.ExpressionText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ExpressionText_KeyDown);
             this.ExpressionText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ExpressionText_KeyUp);
             // 
+            // btnTools
+            // 
+            this.btnTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.insertThemeExpressionToolStripMenuItem});
+            this.btnTools.Image = global::Maestro.Editors.Properties.Resources.gear;
+            resources.ApplyResources(this.btnTools, "btnTools");
+            this.btnTools.Name = "btnTools";
+            // 
+            // insertThemeExpressionToolStripMenuItem
+            // 
+            this.insertThemeExpressionToolStripMenuItem.Name = "insertThemeExpressionToolStripMenuItem";
+            resources.ApplyResources(this.insertThemeExpressionToolStripMenuItem, "insertThemeExpressionToolStripMenuItem");
+            this.insertThemeExpressionToolStripMenuItem.Click += new System.EventHandler(this.insertThemeExpressionToolStripMenuItem_Click);
+            // 
             // MonoCompatibleExpressionEditor
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -209,5 +226,7 @@
         private System.Windows.Forms.ToolStripComboBox ColumnValue;
         private System.Windows.Forms.ToolStripDropDownButton btnProperties;
         private System.Windows.Forms.ToolStripDropDownButton btnFunctions;
+        private System.Windows.Forms.ToolStripDropDownButton btnTools;
+        private System.Windows.Forms.ToolStripMenuItem insertThemeExpressionToolStripMenuItem;
     }
 }
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -30,6 +30,7 @@
 using OSGeo.MapGuide.MaestroAPI.Exceptions;
 using Maestro.Shared.UI;
 using OSGeo.MapGuide.MaestroAPI.Schema;
+using Maestro.Editors.LayerDefinition.Vector.Thematics;
 
 namespace Maestro.Editors.Common
 {
@@ -74,11 +75,11 @@
     /// <summary>
     /// An expression editor dialog
     /// </summary>
-    public partial class MonoCompatibleExpressionEditor : Form, IExpressionEditor
+    public partial class MonoCompatibleExpressionEditor : Form, IExpressionEditor, ITextInserter
     {
         private ClassDefinition _cls;
 
-        private IFeatureService _featSvc;
+        private IEditorService _edSvc;
         private string m_featureSource = null;
 
         /// <summary>
@@ -103,19 +104,21 @@
         /// <summary>
         /// Initializes the dialog.
         /// </summary>
-        /// <param name="featSvc">The feature service.</param>
+        /// <param name="edSvc">The editor service.</param>
         /// <param name="caps">The provider capabilities.</param>
         /// <param name="cls">The class definition.</param>
         /// <param name="featuresSourceId">The features source id.</param>
         /// <param name="attachStylizationFunctions">If true, Stylization FDO functions will be included</param>
-        public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
+        public void Initialize(IEditorService edSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
         {
             try
             {
                 _cls = cls;
-                _featSvc = featSvc;
+                _edSvc = edSvc;
                 m_featureSource = featuresSourceId;
 
+                insertThemeExpressionToolStripMenuItem.Enabled = attachStylizationFunctions;
+
                 //TODO: Perhaps add column type and indication of primary key
                 SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
                 foreach (var col in _cls.Properties)
@@ -982,7 +985,7 @@
                 ColumnValue.Tag = null;
                 try
                 {
-                    using (var rdr = _featSvc.AggregateQueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new System.Collections.Specialized.NameValueCollection() { 
+                    using (var rdr = _edSvc.FeatureService.AggregateQueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new System.Collections.Specialized.NameValueCollection() { 
                             { "UNIQ_VALS", expr }
                         }))
                     {
@@ -1033,7 +1036,7 @@
                         try
                         {
                             retry = false;
-                            using (var rd = _featSvc.QueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new string[] { ColumnName.Text }))
+                            using (var rd = _edSvc.FeatureService.QueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new string[] { ColumnName.Text }))
                             {
                                 while (rd.ReadNext())
                                 {
@@ -1112,6 +1115,19 @@
                 }
             }
         }
+
+        private void insertThemeExpressionToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            using (var theme = new ThemeCreator(_edSvc, _cls, this))
+            {
+                theme.ShowDialog();
+            }
+        }
+
+        void ITextInserter.InsertText(string text)
+        {
+            this.InsertText(text);
+        }
     }
 
     // ImageListBoxItem class 

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx	2014-04-12 16:10:43 UTC (rev 8035)
@@ -123,7 +123,7 @@
   </data>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="OKBtn.Location" type="System.Drawing.Point, System.Drawing">
-    <value>342, 6</value>
+    <value>490, 6</value>
   </data>
   <data name="OKBtn.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
@@ -151,7 +151,7 @@
     <value>Bottom, Right</value>
   </data>
   <data name="CancelBtn.Location" type="System.Drawing.Point, System.Drawing">
-    <value>423, 6</value>
+    <value>571, 6</value>
   </data>
   <data name="CancelBtn.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
@@ -205,10 +205,10 @@
     <value>Bottom</value>
   </data>
   <data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>0, 249</value>
+    <value>0, 306</value>
   </data>
   <data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
-    <value>510, 40</value>
+    <value>658, 40</value>
   </data>
   <data name="panel1.TabIndex" type="System.Int32, mscorlib">
     <value>4</value>
@@ -300,11 +300,26 @@
   <data name="ColumnName.ToolTipText" xml:space="preserve">
     <value>Select the column to read values from</value>
   </data>
+  <data name="insertThemeExpressionToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
+    <value>201, 22</value>
+  </data>
+  <data name="insertThemeExpressionToolStripMenuItem.Text" xml:space="preserve">
+    <value>Insert Theme Expression</value>
+  </data>
+  <data name="btnTools.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnTools.Size" type="System.Drawing.Size, System.Drawing">
+    <value>65, 22</value>
+  </data>
+  <data name="btnTools.Text" xml:space="preserve">
+    <value>Tools</value>
+  </data>
   <data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
     <value>0, 0</value>
   </data>
   <data name="toolStrip1.Size" type="System.Drawing.Size, System.Drawing">
-    <value>510, 25</value>
+    <value>658, 25</value>
   </data>
   <data name="toolStrip1.TabIndex" type="System.Int32, mscorlib">
     <value>5</value>
@@ -337,7 +352,7 @@
     <value>True</value>
   </data>
   <data name="ExpressionText.Size" type="System.Drawing.Size, System.Drawing">
-    <value>510, 224</value>
+    <value>658, 281</value>
   </data>
   <data name="ExpressionText.TabIndex" type="System.Int32, mscorlib">
     <value>6</value>
@@ -361,7 +376,7 @@
     <value>True</value>
   </metadata>
   <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
-    <value>510, 289</value>
+    <value>658, 346</value>
   </data>
   <data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
     <value>500, 300</value>
@@ -438,6 +453,18 @@
   <data name=">>_autoCompleteTooltip.Type" xml:space="preserve">
     <value>System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
+  <data name=">>btnTools.Name" xml:space="preserve">
+    <value>btnTools</value>
+  </data>
+  <data name=">>btnTools.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>insertThemeExpressionToolStripMenuItem.Name" xml:space="preserve">
+    <value>insertThemeExpressionToolStripMenuItem</value>
+  </data>
+  <data name=">>insertThemeExpressionToolStripMenuItem.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name=">>$this.Name" xml:space="preserve">
     <value>MonoCompatibleExpressionEditor</value>
   </data>

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -45,15 +45,15 @@
             InitializeComponent();
         }
 
-        private IFeatureService _fsvc;
+        private IEditorService _edSvc;
 
         /// <summary>
         /// Initializes this instance
         /// </summary>
-        /// <param name="featureService">The feature service.</param>
-        public void Init(IFeatureService featureService)
+        /// <param name="editorService">The feature service.</param>
+        public void Init(IEditorService editorService)
         {
-            _fsvc = featureService;
+            _edSvc = editorService;
         }
 
         const int IDX_SCHEMA = 0;
@@ -122,7 +122,7 @@
             ClearPreviewPanes();
             trvSchema.Nodes.Clear();
 
-            string[] schemaNames = _fsvc.GetSchemas(currentFsId);
+            string[] schemaNames = _edSvc.FeatureService.GetSchemas(currentFsId);
             foreach (var s in schemaNames)
             {
                 var schemaNode = new TreeNode(s);
@@ -256,7 +256,7 @@
             {
                 if (!hasSql)
                 {
-                    var pane = new PreviewPane(currentFsId, mode, cls, _fsvc, _caps);
+                    var pane = new PreviewPane(currentFsId, mode, cls, _edSvc, _caps);
                     var page = new TabPage();
                     page.Text = Strings.SQLQuery;
                     page.Tag = mode;
@@ -269,7 +269,7 @@
             }
             else
             {
-                var pane = new PreviewPane(currentFsId, mode, cls, _fsvc, _caps);
+                var pane = new PreviewPane(currentFsId, mode, cls, _edSvc, _caps);
                 var page = new TabPage();
                 page.Text = Strings.StandardQuery + " - " + cls.QualifiedName; //NOXLATE
                 page.Tag = mode;
@@ -368,7 +368,7 @@
 
                 e.Node.Nodes.Clear();
 
-                var classNames = _fsvc.GetClassNames(currentFsId, schTag.SchemaName);
+                var classNames = _edSvc.FeatureService.GetClassNames(currentFsId, schTag.SchemaName);
                 foreach (var qClsName in classNames)
                 {
                     var clsName = qClsName.Split(':')[1]; //NOXLATE
@@ -388,7 +388,7 @@
                 if (clsTag.Loaded)
                     return;
 
-                var cls = _fsvc.GetClassDefinition(currentFsId, clsTag.QualifiedName);
+                var cls = _edSvc.FeatureService.GetClassDefinition(currentFsId, clsTag.QualifiedName);
                 clsTag.Class = cls;
                 UpdateClassNode(e.Node, cls);
             }

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -47,23 +47,23 @@
         private IFeatureService _featSvc;
         private string _fsId;
 
-        public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IFeatureService featSvc, FdoProviderCapabilities caps)
+        public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IEditorService edSvc, FdoProviderCapabilities caps)
             : this()
         {
             _fsId = fsId;
             _mode = mode;
             _cls = cls;
-            _featSvc = featSvc;
+            _featSvc = edSvc.FeatureService;
 
             IQueryControl ctrl = null;
             switch (_mode)
             {
                 case QueryMode.SQL:
-                    ctrl = new SqlQueryCtrl(fsId, featSvc);
+                    ctrl = new SqlQueryCtrl(fsId, edSvc);
                     _inner = ctrl;
                     break;
                 case QueryMode.Standard:
-                    ctrl = new StandardQueryCtrl(fsId, featSvc, cls, caps);
+                    ctrl = new StandardQueryCtrl(fsId, edSvc, cls, caps);
                     _inner = ctrl;
                     break;
             }

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/SqlQueryCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/SqlQueryCtrl.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/SqlQueryCtrl.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -37,19 +37,19 @@
             InitializeComponent();
         }
 
-        private IFeatureService _featSvc;
+        private IEditorService _edSvc;
         private string _fsId;
 
-        public SqlQueryCtrl(string fsId, IFeatureService featSvc)
+        public SqlQueryCtrl(string fsId, IEditorService edSvc)
             : this()
         {
             _fsId = fsId;
-            _featSvc = featSvc;
+            _edSvc = edSvc;
         }
 
         public IReader ExecuteQuery()
         {
-            return _featSvc.ExecuteSqlQuery(_fsId, txtSql.Text);
+            return _edSvc.FeatureService.ExecuteSqlQuery(_fsId, txtSql.Text);
         }
 
         public Control Content

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -42,7 +42,7 @@
             InitializeComponent();
         }
 
-        private IFeatureService _featSvc;
+        private IEditorService _edSvc;
         private string _fsId;
         private ClassDefinition _cls;
         private FdoProviderCapabilities _caps;
@@ -51,14 +51,14 @@
         /// Initializes a new instance of the <see cref="StandardQueryCtrl"/> class.
         /// </summary>
         /// <param name="fsId">The fs id.</param>
-        /// <param name="featSvc">The feat SVC.</param>
+        /// <param name="edSvc">The editor service.</param>
         /// <param name="cls">The CLS.</param>
         /// <param name="caps">The caps.</param>
-        public StandardQueryCtrl(string fsId, IFeatureService featSvc, ClassDefinition cls, FdoProviderCapabilities caps)
+        public StandardQueryCtrl(string fsId, IEditorService edSvc, ClassDefinition cls, FdoProviderCapabilities caps)
             : this()
         {
             _fsId = fsId;
-            _featSvc = featSvc;
+            _edSvc = edSvc;
             _cls = cls;
             _caps = caps;
             foreach (var prop in cls.Properties)
@@ -73,7 +73,7 @@
         /// <returns></returns>
         public IReader ExecuteQuery()
         {
-            return _featSvc.QueryFeatureSource(_fsId, _cls.QualifiedName, txtFilter.Text, GetProperties(), GetComputedColumns());
+            return _edSvc.FeatureService.QueryFeatureSource(_fsId, _cls.QualifiedName, txtFilter.Text, GetProperties(), GetComputedColumns());
         }
 
         private NameValueCollection GetComputedColumns()
@@ -109,7 +109,7 @@
         private void txtFilter_Click(object sender, EventArgs e)
         {
             var ed = FdoExpressionEditorFactory.Create(); //new ExpressionEditor();
-            ed.Initialize(_featSvc, _caps, _cls, _fsId, false);
+            ed.Initialize(_edSvc, _caps, _cls, _fsId, false);
             ed.Expression = txtFilter.Text;
             if (ed.ShowDialog() == DialogResult.OK)
             {
@@ -136,7 +136,7 @@
         private void btnAdd_Click(object sender, EventArgs e)
         {
             var ed = FdoExpressionEditorFactory.Create();// new ExpressionEditor();
-            ed.Initialize(_featSvc, _caps, _cls, _fsId, false);
+            ed.Initialize(_edSvc, _caps, _cls, _fsId, false);
             if (ed.ShowDialog() == DialogResult.OK)
             {
                 grdExpressions.Rows.Add(GenerateAlias(), ed.Expression);

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -169,7 +169,7 @@
         {
             try
             {
-                object owner = null;
+                IVectorStyle owner = null;
 
                 if (m_point != null)
                     owner = m_point;

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -51,6 +51,7 @@
         const int MAX_NUMERIC_THEME_RULES = 100000;
         const int MAX_INDIVIDUAL_THEME_RULES = 100;
         const int THEME_RULE_WARNING_LIMIT = 1000;
+        const int THEME_RULE_EXPRESSION_WARNING_LIMIT = 20;
 
         private static List<ColorBrewer> m_colorBrewer;
 
@@ -67,9 +68,9 @@
         }
 
         private List<LookupPair> m_lookupValues;
-        
-        private object m_ruleCollection;
 
+        private IVectorStyle m_ruleCollection;
+
         private static readonly Type[] NUMERIC_TYPES = null;
 
         private bool m_isUpdating = false;
@@ -86,6 +87,8 @@
                 this.Label = Label;
                 this.Color = Color;
             }
+
+            public string IndividualValue;
         }
 
         static ThemeCreator ()
@@ -95,19 +98,43 @@
 
         private ILayerElementFactory2 _factory;
 
-        public ThemeCreator(IEditorService editor, ILayerDefinition layer, ClassDefinition schema, object ruleCollection)
+        enum ThemeSource
+        {
+            LayerDefinition,
+            ExpressionEditor
+        }
+
+        private ThemeSource _themeSource;
+        private ITextInserter _inserter;
+
+        public ThemeCreator(IEditorService editor, ILayerDefinition layer, ClassDefinition classDef, IVectorStyle style)
             : this()
         {
             m_editor = editor;
             m_layer = layer;
-            m_featureClass = schema;
-            m_ruleCollection = ruleCollection;
-
+            m_featureClass = classDef;
+            m_ruleCollection = style;
+            _themeSource = ThemeSource.LayerDefinition;
             _factory = (ILayerElementFactory2)editor.GetEditedResource();
 
             ColorBrewerColorSet.SetCustomRender(new CustomCombo.RenderCustomItem(DrawColorSetPreview));
         }
 
+        public ThemeCreator(IEditorService editor, ClassDefinition classDef, ITextInserter inserter)
+            : this()
+        {
+            m_editor = editor;
+            m_featureClass = classDef;
+            _themeSource = ThemeSource.ExpressionEditor;
+            _inserter = inserter;
+
+            rdValuesFromLookup.Enabled = false;
+            grpValuesFromLookup.Enabled = false;
+            rdValuesFromClass.Checked = true;
+
+            ColorBrewerColorSet.SetCustomRender(new CustomCombo.RenderCustomItem(DrawColorSetPreview));
+        }
+
         private bool DrawColorSetPreview(DrawItemEventArgs args, object o)
         {
             if (o is ColorBrewer.ColorBrewerListItem)
@@ -233,15 +260,34 @@
                 string filter = null; //Attempt raw reading initially
                 Exception rawEx = null; //Original exception
                 bool retry = true;
-
+                string fsId = null;
                 while (retry)
                 {
                     retry = false;
                     try
                     {
-                        IVectorLayerDefinition vl = (IVectorLayerDefinition)m_layer.SubLayer;
-                        if (!string.IsNullOrEmpty(vl.Filter))
-                            filter = vl.Filter;
+                        //If the theming source is layer, get its filter
+                        if (_themeSource == ThemeSource.LayerDefinition)
+                        {
+                            IVectorLayerDefinition vl = (IVectorLayerDefinition)m_layer.SubLayer;
+                            fsId = vl.ResourceId;
+                            if (!string.IsNullOrEmpty(vl.Filter))
+                                filter = vl.Filter;
+                        }
+                        else
+                        {
+                            //In stylization context, the edited resource has to be a layer definition
+                            var ldf = (ILayerDefinition)m_editor.GetEditedResource();
+                            var vl = ldf.SubLayer as IVectorLayerDefinition;
+                            if (vl == null)
+                            {
+                                MessageBox.Show(Strings.ThemingNotAVectorLayer);
+                                return;
+                            }
+                            fsId = vl.ResourceId;
+                            if (!string.IsNullOrEmpty(vl.Filter))
+                                filter = vl.Filter;
+                        }
                         try
                         {
                             //Either UNIQUE() is an undocumented FDO expression function (!!!)
@@ -249,7 +295,7 @@
                             //flag in the SELECTAGGREGATES operation that's exposed over HTTP. Either
                             //case, try this method first.
                             using (var rd = m_editor.FeatureService.AggregateQueryFeatureSource(
-                                                    vl.ResourceId,
+                                                    fsId,
                                                     m_featureClass.QualifiedName,
                                                     filter,
                                                     new NameValueCollection() {
@@ -273,7 +319,7 @@
                         catch
                         {
 
-                            using (var rd = m_editor.FeatureService.QueryFeatureSource(vl.ResourceId, m_featureClass.QualifiedName, filter, new string[] { col.Name }))
+                            using (var rd = m_editor.FeatureService.QueryFeatureSource(fsId, m_featureClass.QualifiedName, filter, new string[] { col.Name }))
                             {
                                 while (rd.ReadNext() && m_values.Count < MAX_NUMERIC_THEME_RULES) //No more than 100.000 records in memory
                                 {
@@ -572,17 +618,27 @@
                     items.Sort(); //Handles types correctly
 
                     for (int i = 0; i < colors.Length; i++)
+                    {
+                        RuleItem r = null;
                         if (items[i] is string)
-                            result.Add(new RuleItem(
+                        {
+                            r = new RuleItem(
                                 string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"{0}\" = '{1}'", ColumnCombo.Text, items[i]),
                                 string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", items[i]),
-                                colors[i]));
+                                colors[i]);
+                            r.IndividualValue = "'" + items[i].ToString() + "'";
+                            result.Add(r);
+                        }
                         else
-                            result.Add(new RuleItem(
+                        {
+                            r = new RuleItem(
                                 string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"{0}\" = {1}", ColumnCombo.Text, items[i]),
                                 string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", items[i]),
-                                colors[i]));
-
+                                colors[i]);
+                            r.IndividualValue = items[i].ToString();
+                            result.Add(r);
+                        }
+                    }
                 }
             }
             else if (rdValuesFromLookup.Checked)
@@ -850,35 +906,61 @@
             try
             {
                 List<RuleItem> rules = CalculateRuleSet();
-
-                if (rules.Count > THEME_RULE_WARNING_LIMIT)
+                int limit = _themeSource == ThemeSource.LayerDefinition ? THEME_RULE_WARNING_LIMIT : THEME_RULE_EXPRESSION_WARNING_LIMIT;
+                if (rules.Count > limit)
                 {
                     if (MessageBox.Show(this, Strings.TooManyRulesWarning, Application.ProductName, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
                         return;
                 }
+                if (_themeSource == ThemeSource.LayerDefinition)
+                {
+                    IPointVectorStyle pts = m_ruleCollection as IPointVectorStyle;
+                    ILineVectorStyle lts = m_ruleCollection as ILineVectorStyle;
+                    IAreaVectorStyle ats = m_ruleCollection as IAreaVectorStyle;
+                    ICompositeTypeStyle cts = m_ruleCollection as ICompositeTypeStyle;
 
-                IPointVectorStyle pts = m_ruleCollection as IPointVectorStyle;
-                ILineVectorStyle lts = m_ruleCollection as ILineVectorStyle;
-                IAreaVectorStyle ats = m_ruleCollection as IAreaVectorStyle;
-                ICompositeTypeStyle cts = m_ruleCollection as ICompositeTypeStyle;
-
-                if (pts != null)
-                {
-                    GeneratePointThemeRules(rules, pts);
+                    if (pts != null)
+                    {
+                        GeneratePointThemeRules(rules, pts);
+                    }
+                    else if (lts != null)
+                    {
+                        GenerateLineThemeRules(rules, lts);
+                    }
+                    else if (ats != null)
+                    {
+                        GenerateAreaThemeRules(rules, ats);
+                    }
+                    else if (cts != null)
+                    {
+                        GenerateCompositeThemeRules(rules, cts);
+                    }
                 }
-                else if (lts != null)
+                else
                 {
-                    GenerateLineThemeRules(rules, lts);
+                    if (AggregateCombo.SelectedIndex != 3)
+                    {
+                        MessageBox.Show(Strings.ThemeExpressionOnlySupportsIndividualValues);
+                        return;
+                    }
+
+                    List<string> strings = new List<string>();
+                    RuleItem defaultRule = null;
+                    foreach (var rule in rules)
+                    {
+                        if (rule.IndividualValue == "''")
+                            defaultRule = rule;
+                        else
+                            strings.Add(string.Format("{0}, ARGB({1}, {2}, {3}, {4})", rule.IndividualValue, rule.Color.A, rule.Color.R, rule.Color.G, rule.Color.B));
+                    }
+                    _inserter.InsertText(string.Format("LOOKUP({0}, ARGB({1}, {2}, {3}, {4}), {5})",
+                        ColumnCombo.Text,
+                        defaultRule.Color.A,
+                        defaultRule.Color.R,
+                        defaultRule.Color.G,
+                        defaultRule.Color.B,
+                        string.Join(", ", strings.ToArray())));
                 }
-                else if (ats != null)
-                {
-                    GenerateAreaThemeRules(rules, ats);
-                }
-                else if (cts != null)
-                {
-                    GenerateCompositeThemeRules(rules, cts);
-                }
-
                 this.DialogResult = DialogResult.OK;
                 this.Close();
             }

Modified: trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -96,7 +96,7 @@
         {
             var ed = FdoExpressionEditorFactory.Create(); new ExpressionEditor();
             var caps = this.FeatureService.GetProviderCapabilities(providerName);
-            ed.Initialize(this.FeatureService, caps, classDef, featureSourceId, attachStylizationFunctions);
+            ed.Initialize(this, caps, classDef, featureSourceId, attachStylizationFunctions);
             ed.Expression = currentExpr;
             if (ed.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -2594,6 +2594,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Only individual values is supported when generating a theme expression.
+        /// </summary>
+        internal static string ThemeExpressionOnlySupportsIndividualValues {
+            get {
+                return ResourceManager.GetString("ThemeExpressionOnlySupportsIndividualValues", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Property not selected. Please select the Property which connects to the selected Key Property in the external class.
         /// </summary>
         internal static string ThemePrimaryKeyPropertyNotSelected {
@@ -2603,6 +2612,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to The layer being themed is not a vector layer.
+        /// </summary>
+        internal static string ThemingNotAVectorLayer {
+            get {
+                return ResourceManager.GetString("ThemingNotAVectorLayer", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Buffer Units.
         /// </summary>
         internal static string TitleBufferUnits {

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2014-04-12 16:10:43 UTC (rev 8035)
@@ -1572,4 +1572,10 @@
   <data name="LayerChangedFeatureClass" xml:space="preserve">
     <value>You have changed the Feature Class for this layer. Styles made for the previous Feature Class may no longer be applicable to this Feature Class. You should review such style settings (eg. Settings involving FDO expressions) to see if anything needs to be changed.</value>
   </data>
+  <data name="ThemeExpressionOnlySupportsIndividualValues" xml:space="preserve">
+    <value>Only individual values is supported when generating a theme expression</value>
+  </data>
+  <data name="ThemingNotAVectorLayer" xml:space="preserve">
+    <value>The layer being themed is not a vector layer</value>
+  </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/MaestroFsPreview/MainForm.cs
===================================================================
--- trunk/Tools/Maestro/MaestroFsPreview/MainForm.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/MaestroFsPreview/MainForm.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -28,6 +28,7 @@
 using OSGeo.MapGuide.MaestroAPI;
 using OSGeo.MapGuide.MaestroAPI.Services;
 using OSGeo.MapGuide.ObjectModels.FeatureSource;
+using Maestro.Editors;
 
 namespace MaestroFsPreview
 {
@@ -38,20 +39,18 @@
             InitializeComponent();
         }
 
-        public MainForm(IFeatureService featSvc, IResourceService resSvc)
+        public MainForm(IEditorService edSvc)
             : this()
         {
-            this.featSvc = featSvc;
-            this.resSvc = resSvc;
-            localFsPreviewCtrl.Init(featSvc);
+            _edSvc = edSvc;
+            localFsPreviewCtrl.Init(edSvc);
         }
 
-        private IFeatureService featSvc;
-        private IResourceService resSvc;
+        private IEditorService _edSvc;
 
         private void btnBrowse_Click(object sender, EventArgs e)
         {
-            using (var picker = new ResourcePicker(resSvc, ResourceTypes.FeatureSource, ResourcePickerMode.OpenResource))
+            using (var picker = new ResourcePicker(_edSvc.ResourceService, ResourceTypes.FeatureSource, ResourcePickerMode.OpenResource))
             {
                 if (picker.ShowDialog() == DialogResult.OK)
                 {
@@ -74,8 +73,8 @@
 
         private void InitPreview()
         {
-            _fs = (IFeatureSource)resSvc.GetResource(this.FeatureSourceID);
-            var caps = featSvc.GetProviderCapabilities(_fs.Provider);
+            _fs = (IFeatureSource)_edSvc.ResourceService.GetResource(this.FeatureSourceID);
+            var caps = _edSvc.FeatureService.GetProviderCapabilities(_fs.Provider);
             localFsPreviewCtrl.SupportsSQL = caps.Connection.SupportsSQL;
             localFsPreviewCtrl.ReloadTree(this.FeatureSourceID, caps);
         }

Modified: trunk/Tools/Maestro/MaestroFsPreview/Program.cs
===================================================================
--- trunk/Tools/Maestro/MaestroFsPreview/Program.cs	2014-04-12 12:10:24 UTC (rev 8034)
+++ trunk/Tools/Maestro/MaestroFsPreview/Program.cs	2014-04-12 16:10:43 UTC (rev 8035)
@@ -22,11 +22,53 @@
 using System.Windows.Forms;
 using OSGeo.MapGuide.MaestroAPI;
 using Maestro.Login;
+using Maestro.Editors;
+using System.Diagnostics;
 
 namespace MaestroFsPreview
 {
     static class Program
     {
+        class EditorServiceImpl : ResourceEditorServiceBase
+        {
+            public EditorServiceImpl(IServerConnection conn)
+                : base("Session://", conn)
+            {
+
+            }
+
+            public override void OpenResource(string resourceId)
+            {
+                throw new NotImplementedException();
+            }
+
+            public override void OpenUrl(string url)
+            {
+                Process.Start(url);
+            }
+
+            public override void RequestRefresh(string folderId)
+            {
+                throw new NotImplementedException();
+            }
+
+            public override void RequestRefresh()
+            {
+                throw new NotImplementedException();
+            }
+
+            public override void RunProcess(string processName, params string[] args)
+            {
+                throw new NotImplementedException();
+            }
+
+            public override string SelectUnmanagedData(string startPath, System.Collections.Specialized.NameValueCollection fileTypes)
+            {
+                throw new NotImplementedException();
+            }
+        }
+
+
         /// <summary>
         /// The main entry point for the application.
         /// </summary>
@@ -56,7 +98,7 @@
             if (conn == null)
                 return;
 
-            Application.Run(new MainForm(conn.FeatureService, conn.ResourceService));
+            Application.Run(new MainForm(new EditorServiceImpl(conn)));
         }
     }
 }



More information about the mapguide-commits mailing list