[mapguide-commits] r5292 - in sandbox/maestro-3.0:
Maestro.Editors/FeatureSource/Extensions
Maestro.Editors/FeatureSource/Providers
Maestro.Editors/FeatureSource/Providers/Sdf
Maestro.Editors/FeatureSource/Providers/Shp
Maestro.Editors/LayerDefinition
Maestro.Editors/LayerDefinition/Drawing
Maestro.Editors/LayerDefinition/Vector
Maestro.Editors/LayerDefinition/Vector/Scales
Maestro.Editors/LayerDefinition/Vector/StyleEditors
Maestro.Editors/LoadProcedure Maestro.Editors/MapDefinition
Maestro.Editors/WebLayout Maestro.Editors/WebLayout/Commands
Maestro.Shared.UI OSGeo.MapGuide.MaestroAPI
OSGeo.MapGuide.MaestroAPI/ObjectModels
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Oct 18 09:36:58 EDT 2010
Author: jng
Date: 2010-10-18 06:36:58 -0700 (Mon, 18 Oct 2010)
New Revision: 5292
Added:
sandbox/maestro-3.0/Maestro.Shared.UI/ComboBoxBinder.cs
sandbox/maestro-3.0/Maestro.Shared.UI/NumericBinder.cs
Modified:
sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs
sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs
sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Sdf/SdfFileCtrl.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Shp/ShpFileCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Drawing/DrawingLayerSettingsCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/VectorLayerEditorCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/InvokeURLCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/SearchCmdCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/WebLayout/WebLayoutSettingsCtrl.cs
sandbox/maestro-3.0/Maestro.Shared.UI/Maestro.Shared.UI.csproj
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
Log:
3.0 sandbox changes:
- Implement instant-update binders for ComboBox and NumericUpDown controls to behaviourally line up with the the databound text boxes and check boxes.
- Ensure all UI components are using these binders
- Fix un-implemented browse unmanaged button for SDF and SHP feature source editors
- Fix default fill style to be White FG and BG.
- Fix some Layer Definition Editor issues
- Rules in control not being reset when Theme is generated
- Implement clone methods for layer elements that need cloning (workaround Utility.XmlDeepCopy() not working with interfaces)
- Fix Property list not being updated when Feature Class changes.
Modified: sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/ExtendedClassSettings.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -44,9 +44,8 @@
cmbBaseClass.ValueMember = "QualifiedNameDecoded";
cmbBaseClass.DataSource = classes;
- //txtExtendedName.DataBindings.Add("Text", ext, "Name");
TextBoxBinder.BindText(txtExtendedName, ext, "Name");
- cmbBaseClass.DataBindings.Add("SelectedValue", ext, "FeatureClass");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbBaseClass, "SelectedValue", ext, "FeatureClass");
ext.PropertyChanged += (sender, e) => { OnResourceChanged(); };
}
Modified: sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -59,7 +59,7 @@
UpdateJoinClass();
CheckBoxBinder.BindChecked(chkForceOneToOne, _rel, "ForceOneToOne");
- var bin = cmbFeatureClass.DataBindings.Add("SelectedValue", _rel, "AttributeClass");
+ var bin = ComboBoxBinder.BindSelectedIndexChanged(cmbFeatureClass, "SelectedValue", _rel, "AttributeClass");
bin.ReadValue();
//UpdateSecondary();
Modified: sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.Designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.Designer.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -102,6 +102,7 @@
this.btnBrowseAlias.TabIndex = 7;
this.btnBrowseAlias.Text = "...";
this.btnBrowseAlias.UseVisualStyleBackColor = true;
+ this.btnBrowseAlias.Click += new System.EventHandler(this.btnBrowseAlias_Click);
//
// unmanagedPanel
//
Modified: sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/FileBasedCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -48,9 +48,12 @@
resDataCtrl.Enabled = false;
}
+ private IEditorService _service;
+
public override void Bind(IEditorService service)
{
- service.RegisterCustomNotifier(this);
+ _service = service;
+ _service.RegisterCustomNotifier(this);
resDataCtrl.Init(service);
resDataCtrl.DataListChanged += (sender, e) => { OnResourceChanged(); };
resDataCtrl.ResourceDataMarked += (sender, e) => { OnResourceMarked(e); };
@@ -60,5 +63,22 @@
{
}
+
+ private void btnBrowseAlias_Click(object sender, EventArgs e)
+ {
+ using (var picker = new UnmanagedFileBrowser(_service.ResourceService))
+ {
+ picker.SelectFoldersOnly = CanSelectFolders();
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ txtAlias.Text = picker.SelectedItem;
+ }
+ }
+ }
+
+ protected virtual bool CanSelectFolders()
+ {
+ return false;
+ }
}
}
Modified: sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Sdf/SdfFileCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Sdf/SdfFileCtrl.Designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Sdf/SdfFileCtrl.Designer.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -35,6 +35,9 @@
// contentPanel
//
this.contentPanel.Controls.Add(this.chkReadOnly);
+ this.contentPanel.Controls.SetChildIndex(this.resDataCtrl, 0);
+ this.contentPanel.Controls.SetChildIndex(this.rdManaged, 0);
+ this.contentPanel.Controls.SetChildIndex(this.rdUnmanaged, 0);
this.contentPanel.Controls.SetChildIndex(this.chkReadOnly, 0);
//
// chkReadOnly
Modified: sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Shp/ShpFileCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Shp/ShpFileCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/FeatureSource/Providers/Shp/ShpFileCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -79,5 +79,10 @@
if (!newValue.Equals(currValue))
_fs.SetConnectionProperty("DefaultFileLocation", newValue);
}
+
+ protected override bool CanSelectFolders()
+ {
+ return true;
+ }
}
}
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Drawing/DrawingLayerSettingsCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Drawing/DrawingLayerSettingsCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Drawing/DrawingLayerSettingsCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -52,12 +52,12 @@
_dlayer = lyr.SubLayer as IDrawingLayerDefinition;
Debug.Assert(_dlayer != null);
- txtDrawingSource.DataBindings.Add("Text", _dlayer, "ResourceId");
+ TextBoxBinder.BindText(txtDrawingSource, _dlayer, "ResourceId");
var sheets = _service.DrawingService.EnumerateDrawingSections(_dlayer.ResourceId);
cmbSheet.DisplayMember = "Title";
cmbSheet.ValueMember = "Name";
- cmbSheet.DataBindings.Add("SelectedValue", _dlayer, "Sheet");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbSheet, "SelectedValue", _dlayer, "Sheet");
cmbSheet.DataSource = sheets.Section;
var minBinding = new Binding("Text", _dlayer, "MinScale");
@@ -94,8 +94,8 @@
ce.Value = val;
};
- txtMinScale.DataBindings.Add(minBinding);
- txtMaxScale.DataBindings.Add(maxBinding);
+ TextBoxBinder.BindText(txtMinScale, minBinding);
+ TextBoxBinder.BindText(txtMaxScale, maxBinding);
//This is not the root object so no change listeners have been subscribed
_dlayer.PropertyChanged += (sender, e) => { OnResourceChanged(); };
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -69,8 +69,12 @@
}
}
- private void PopulatePropertyList()
+ internal void PopulatePropertyList()
{
+ if (string.IsNullOrEmpty(_vl.FeatureName))
+ return;
+
+ //TODO: Should just fetch the class definition
var desc = _edsvc.FeatureService.DescribeFeatureSource(_vl.ResourceId);
foreach (var sc in desc.Classes)
{
@@ -151,7 +155,9 @@
{
if (nsp == null)
{
- _props.Add(_parent.CreatePair(propertyName, displayName));
+ var pair = _parent.CreatePair(propertyName, displayName);
+ _props.Add(pair);
+ _vl.AddPropertyMapping(pair);
}
}
else //Turned off
@@ -159,6 +165,7 @@
if (nsp != null)
{
_props.Remove(nsp);
+ _vl.RemovePropertyMapping(nsp);
}
}
}
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -159,6 +159,16 @@
owner);
if (dlg.ShowDialog(this) == DialogResult.OK)
{
+ var area = owner as IAreaVectorStyle;
+ var point = owner as IPointVectorStyle;
+ var line = owner as ILineVectorStyle;
+ if (area != null)
+ SetItem(m_parent, area);
+ else if (point != null)
+ SetItem(m_parent, point);
+ else if (line != null)
+ SetItem(m_parent, line);
+
m_owner.HasChanged();
m_owner.UpdateDisplay();
}
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -136,22 +136,22 @@
if (isLabel)
{
uc = new FontStyleEditor(m_owner.Editor, m_owner.Schema, m_owner.FeatureSourceId);
- ((FontStyleEditor)uc).Item = (ITextSymbol)Utility.DeepCopy(m_label);
+ ((FontStyleEditor)uc).Item = m_label == null ? null : (ITextSymbol)m_label.Clone(); //(ITextSymbol)Utility.DeepCopy(m_label);
}
else if (isPoint)
{
uc = new PointFeatureStyleEditor(m_owner.Editor, m_owner.Schema, m_owner.FeatureSourceId);
- ((PointFeatureStyleEditor)uc).Item = (IPointSymbolization2D)Utility.XmlDeepCopy(m_point);
+ ((PointFeatureStyleEditor)uc).Item = m_point == null ? null : (IPointSymbolization2D)m_point.Clone(); //(IPointSymbolization2D)Utility.XmlDeepCopy(m_point);
}
else if (isLine)
{
uc = new LineFeatureStyleEditor(m_owner.Editor, m_owner.Schema, m_owner.FeatureSourceId, _factory);
- ((LineFeatureStyleEditor)uc).Item = (IList<IStroke>)Utility.XmlDeepCopy(m_line);
+ ((LineFeatureStyleEditor)uc).Item = m_line == null ? null : LayerElementCloningUtil.CloneStrokes(m_line);//(IList<IStroke>)Utility.XmlDeepCopy(m_line);
}
else if (isArea)
{
uc = new AreaFeatureStyleEditor(m_owner.Editor, m_owner.Schema, m_owner.FeatureSourceId);
- ((AreaFeatureStyleEditor)uc).Item = (IAreaSymbolizationFill)Utility.XmlDeepCopy(m_area);
+ ((AreaFeatureStyleEditor)uc).Item = m_area == null ? null : (IAreaSymbolizationFill)m_area.Clone(); //(IAreaSymbolizationFill)Utility.XmlDeepCopy(m_area);
}
if (uc != null)
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -29,11 +29,6 @@
namespace Maestro.Editors.LayerDefinition.Vector.StyleEditors
{
- internal static class MaestroLegacyCompatibility
- {
-
- }
-
/// <summary>
/// Summary description for AreaFeatureStyleEditor.
/// </summary>
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -59,8 +59,8 @@
TextBoxBinder.BindText(txtFeatureSource, _vl, "ResourceId");
- cmbSchema.DataBindings.Add("Text", _vl, "FeatureName");
- cmbGeometry.DataBindings.Add("Text", _vl, "Geometry");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbSchema, "SelectedItem", _vl, "FeatureName");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbGeometry, "SelectedItem", _vl, "Geometry");
TextBoxBinder.BindText(txtFilter, _vl, "Filter");
TextBoxBinder.BindText(txtHyperlink, _vl, "Url");
TextBoxBinder.BindText(txtTooltip, _vl, "ToolTip");
@@ -115,9 +115,19 @@
break;
}
}
+ OnFeatureClassChanged();
}
}
+ internal event EventHandler FeatureClassChanged;
+
+ private void OnFeatureClassChanged()
+ {
+ var handler = this.FeatureClassChanged;
+ if (handler != null)
+ handler(this, EventArgs.Empty);
+ }
+
private void btnBrowseFeatureSource_Click(object sender, EventArgs e)
{
var picker = new ResourcePicker(_edsvc.ResourceService, ResourceTypes.FeatureSource, ResourcePickerMode.OpenResource);
Modified: sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/VectorLayerEditorCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/VectorLayerEditorCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LayerDefinition/VectorLayerEditorCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -16,8 +16,14 @@
public VectorLayerEditorCtrl()
{
InitializeComponent();
+ resSettings.FeatureClassChanged += new EventHandler(OnFeatureClassChanged);
}
+ void OnFeatureClassChanged(object sender, EventArgs e)
+ {
+ layerProperties.PopulatePropertyList();
+ }
+
private IEditorService _edsvc;
private IVectorLayerDefinition _vl;
@@ -29,10 +35,16 @@
service.RegisterCustomNotifier(this);
resSettings.Bind(service);
layerProperties.Bind(service);
-
layerStyles.Owner = this;
layerStyles.Bind(service);
+ }
+ protected override void OnLoad(EventArgs e)
+ {
+ //HACK: Maybe the controls were still in the process of databinding which
+ //is why the feature class would still be empty. Nevertheless, it will be
+ //set at this point so it's safe to call here.
+ layerProperties.PopulatePropertyList();
}
internal IEditorService Editor
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -52,9 +52,9 @@
var sdflp = lp.SubType as ISdfLoadProcedure;
TextBoxBinder.BindText(txtCoordinateSystem, sdflp, "CoordinateSystem");
- numGeneralizePercentage.DataBindings.Add("Value", sdflp, "Generalization");
+ NumericBinder.BindValueChanged(numGeneralizePercentage, sdflp, "Generalization");
cmbSdfConflictStrategy.DataSource = Enum.GetValues(typeof(SdfKeyTreatmentType));
- //cmbSdfConflictStrategy.DataBindings.Add("SelectedItem", sdflp, "SdfKeyTreatement");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbSdfConflictStrategy, "SelectedItem", sdflp, "SdfKeyTreatement");
}
private void btnBrowseCs_Click(object sender, EventArgs e)
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -52,7 +52,7 @@
var shplp = lp.SubType as IShpLoadProcedure;
TextBoxBinder.BindText(txtCoordinateSystem, shplp, "CoordinateSystem");
- numGeneralizePercentage.DataBindings.Add("Value", shplp, "Generalization");
+ NumericBinder.BindValueChanged(numGeneralizePercentage, shplp, "Generalization");
CheckBoxBinder.BindChecked(chkConvertToSdf, shplp, "ConvertToSdf");
}
}
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -26,6 +26,7 @@
using System.Windows.Forms;
using Maestro.Editors.Common;
using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+using Maestro.Shared.UI;
namespace Maestro.Editors.LoadProcedure
{
@@ -45,8 +46,8 @@
var lp = service.GetEditedResource() as ILoadProcedure;
var slp = lp.SubType as ISqliteLoadProcedure;
- txtCoordinateSystem.DataBindings.Add("Text", slp, "CoordinateSystem");
- numGeneralizePercentage.DataBindings.Add("Value", slp, "Generalization");
+ TextBoxBinder.BindText(txtCoordinateSystem, slp, "CoordinateSystem");
+ NumericBinder.BindValueChanged(numGeneralizePercentage, slp, "Generalization");
}
private void btnBrowseCs_Click(object sender, EventArgs e)
Modified: sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -72,9 +72,7 @@
}
}
};
- //txtDescription.DataBindings.Add(bmeta);
TextBoxBinder.BindText(txtDescription, bmeta);
- //txtCoordinateSystem.DataBindings.Add("Text", _map, "CoordinateSystem");
TextBoxBinder.BindText(txtCoordinateSystem, _map, "CoordinateSystem");
//ColorComboBox requires custom databinding
Modified: sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/InvokeURLCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/InvokeURLCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/InvokeURLCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -52,7 +52,7 @@
TextBoxBinder.BindText(txtUrl, invokeUrlCommandType, "URL");
TextBoxBinder.BindText(txtFrame, invokeUrlCommandType, "TargetFrame");
- cmbTargetFrame.DataBindings.Add("SelectedItem", invokeUrlCommandType, "Target");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbTargetFrame, "SelectedItem", invokeUrlCommandType, "Target");
CheckBoxBinder.BindChecked(chkDisableIfEmpty, invokeUrlCommandType, "DisableIfSelectionEmpty");
grdParameters.DataSource = invokeUrlCommandType.AdditionalParameter;
lstLayers.DataSource = invokeUrlCommandType.LayerSet;
Modified: sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/SearchCmdCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/SearchCmdCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/WebLayout/Commands/SearchCmdCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -64,11 +64,11 @@
LoadLayers();
- cmbLayers.DataBindings.Add("Text", _cmd, "Layer");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbLayers, "Text", _cmd, "Layer");
TextBoxBinder.BindText(txtFilter, _cmd, "Filter");
TextBoxBinder.BindText(txtPrompt, _cmd, "Prompt");
- numLimit.DataBindings.Add("Value", _cmd, "MatchLimit");
+ NumericBinder.BindValueChanged(numLimit, _cmd, "MatchLimit");
UpdateColumns();
grdOutputColumns.DataSource = _cmd.ResultColumns;
Modified: sandbox/maestro-3.0/Maestro.Editors/WebLayout/WebLayoutSettingsCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/WebLayout/WebLayoutSettingsCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Editors/WebLayout/WebLayoutSettingsCtrl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -85,7 +85,7 @@
CheckBoxBinder.BindChecked(chkToolbar, _wl.ToolBar, "Visible");
CheckBoxBinder.BindChecked(chkZoomControl, _wl.ZoomControl, "Visible");
- cmbHyperlinkTarget.DataBindings.Add("SelectedItem", _wl.Map, "HyperlinkTarget");
+ ComboBoxBinder.BindSelectedIndexChanged(cmbHyperlinkTarget, "SelectedItem", _wl.Map, "HyperlinkTarget");
TextBoxBinder.BindText(txtHyperlinkFrame, _wl.Map, "HyperlinkTargetFrame");
TextBoxBinder.BindText(numInfoPaneWidth, _wl.InformationPane, "Width");
Added: sandbox/maestro-3.0/Maestro.Shared.UI/ComboBoxBinder.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Shared.UI/ComboBoxBinder.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Shared.UI/ComboBoxBinder.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -0,0 +1,53 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Maestro.Shared.UI
+{
+ /// <summary>
+ /// Helper class to bind object properties to <see cref="ComboBox"/> derived classes for
+ /// immediate updates as opposed to updates on loss of focus.
+ /// </summary>
+ public static class ComboBoxBinder
+ {
+ // We need to force WriteValue() on SelectedIndexChanged otherwise it will only call WriteValue()
+ // on loss of focus.
+ // http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
+
+ public static Binding BindSelectedIndexChanged(ComboBox cmb, Binding b)
+ {
+ cmb.DataBindings.Add(b);
+ cmb.SelectedIndexChanged += (sender, e) => { b.WriteValue(); };
+
+ return b;
+ }
+
+ public static Binding BindSelectedIndexChanged(ComboBox cmb, string cmbProperty, object dataSource, string dataMember)
+ {
+ var binding = cmb.DataBindings.Add(cmbProperty, dataSource, dataMember);
+ cmb.SelectedIndexChanged += (sender, e) => { binding.WriteValue(); };
+
+ return binding;
+ }
+ }
+}
Modified: sandbox/maestro-3.0/Maestro.Shared.UI/Maestro.Shared.UI.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Shared.UI/Maestro.Shared.UI.csproj 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/Maestro.Shared.UI/Maestro.Shared.UI.csproj 2010-10-18 13:36:58 UTC (rev 5292)
@@ -46,7 +46,9 @@
<Compile Include="CollapsiblePanel.designer.cs">
<DependentUpon>CollapsiblePanel.cs</DependentUpon>
</Compile>
+ <Compile Include="ComboBoxBinder.cs" />
<Compile Include="DialogFactory.cs" />
+ <Compile Include="NumericBinder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
Added: sandbox/maestro-3.0/Maestro.Shared.UI/NumericBinder.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Shared.UI/NumericBinder.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Shared.UI/NumericBinder.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -0,0 +1,54 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Maestro.Shared.UI
+{
+ /// <summary>
+ /// Helper class to bind object properties to <see cref="NumericUpDown"/> derived classes for
+ /// immediate updates as opposed to updates on loss of focus.
+ /// </summary>
+ public static class NumericBinder
+ {
+ // We need to force WriteValue() on CheckedChanged otherwise it will only call WriteValue()
+ // on loss of focus.
+ // http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
+
+
+ public static Binding BindValueChanged(NumericUpDown num, Binding b)
+ {
+ num.DataBindings.Add(b);
+ num.ValueChanged += (sender, e) => { b.WriteValue(); };
+
+ return b;
+ }
+
+ public static Binding BindValueChanged(NumericUpDown num, object dataSource, string dataMember)
+ {
+ var binding = num.DataBindings.Add("Value", dataSource, dataMember);
+ num.ValueChanged += (sender, e) => { binding.WriteValue(); };
+
+ return binding;
+ }
+ }
+}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -183,7 +183,7 @@
public IFill CreateDefaultFill()
{
- return CreateFill("Solid", Color.White, Color.Black);
+ return CreateFill("Solid", Color.White, Color.White);
}
public IMarkSymbol CreateDefaultMarkSymbol()
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -152,6 +152,25 @@
Raster
}
+ public interface ICloneableLayerElement<T>
+ {
+ T Clone();
+ }
+
+ public static class LayerElementCloningUtil
+ {
+ public static IList<IStroke> CloneStrokes(IEnumerable<IStroke> strokes)
+ {
+ Check.NotNull(strokes, "strokes");
+ var list = new List<IStroke>();
+ foreach (var st in strokes)
+ {
+ list.Add(st.Clone());
+ }
+ return list;
+ }
+ }
+
/// <summary>
/// Factory interface to assist in creating common layer definition elements
/// </summary>
@@ -676,7 +695,7 @@
/// <summary>
/// Encapsulates the stylization of a line
/// </summary>
- public interface IStroke
+ public interface IStroke : ICloneableLayerElement<IStroke>
{
/// <summary>
/// Gets or sets the line style
@@ -702,7 +721,7 @@
/// <summary>
/// Symbolization characteristics for areas.
/// </summary>
- public interface IAreaSymbolizationFill
+ public interface IAreaSymbolizationFill : ICloneableLayerElement<IAreaSymbolizationFill>
{
/// <summary>
/// Gets or sets the style of the polygon fill.
@@ -799,7 +818,7 @@
double ScaleLimit { get; set; }
}
- public interface ITextSymbol : ISymbol
+ public interface ITextSymbol : ISymbol, ICloneableLayerElement<ITextSymbol>
{
/// <summary>
/// Gets or sets the textual content
@@ -860,7 +879,7 @@
/// <summary>
/// Stylization of a predefined shape (ShapeType)
/// </summary>
- public interface IMarkSymbol : ISymbol
+ public interface IMarkSymbol : ISymbol, ICloneableLayerElement<IMarkSymbol>
{
/// <summary>
/// Gets or sets the type of shape
@@ -881,7 +900,7 @@
/// <summary>
/// Symbols that are specified by a font and character.
/// </summary>
- public interface IFontSymbol : ISymbol
+ public interface IFontSymbol : ISymbol, ICloneableLayerElement<IFontSymbol>
{
/// <summary>
/// Gets or sets the name of the font. If the font is not installed, the actual font used is application dependent.
@@ -917,7 +936,7 @@
/// <summary>
/// Represents a DWF-based W2D symbol
/// </summary>
- public interface IW2DSymbol : ISymbol
+ public interface IW2DSymbol : ISymbol, ICloneableLayerElement<IW2DSymbol>
{
/// <summary>
/// Gets or sets the reference to the symbol
@@ -943,7 +962,7 @@
/// <summary>
/// Symbols that are comprised of a raster.
/// </summary>
- public interface IImageSymbol : ISymbol
+ public interface IImageSymbol : ISymbol, ICloneableLayerElement<IImageSymbol>
{
IBaseImageSymbol Image { get; set; }
}
@@ -962,7 +981,7 @@
/// <summary>
/// Represents a reference to a symbol library item image
/// </summary>
- public interface ISymbolReference : IBaseImageSymbol
+ public interface ISymbolReference : IBaseImageSymbol, ICloneableLayerElement<ISymbolReference>
{
string ResourceId { get; set; }
@@ -972,7 +991,7 @@
/// <summary>
/// Represents an inline symbol image
/// </summary>
- public interface IInlineImageSymbol : IBaseImageSymbol
+ public interface IInlineImageSymbol : IBaseImageSymbol, ICloneableLayerElement<IInlineImageSymbol>
{
/// <summary>
/// Gets or sets the BinHex data for image
@@ -983,7 +1002,7 @@
/// <summary>
/// Represents a block symbol
/// </summary>
- public interface IBlockSymbol : ISymbol
+ public interface IBlockSymbol : ISymbol, ICloneableLayerElement<IBlockSymbol>
{
/// <summary>
/// Gets or sets the name of the drawing
@@ -1009,7 +1028,7 @@
/// <summary>
/// Symbolization characteristics for points.
/// </summary>
- public interface IPointSymbolization2D
+ public interface IPointSymbolization2D : ICloneableLayerElement<IPointSymbolization2D>
{
ISymbol Symbol { get; set; }
}
@@ -1017,7 +1036,7 @@
/// <summary>
/// Represents a fill
/// </summary>
- public interface IFill
+ public interface IFill : ICloneableLayerElement<IFill>
{
/// <summary>
/// Gets or sets the fill pattern
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -243,11 +243,21 @@
partial class StrokeType : IStroke
{
internal StrokeType() { }
+
+ IStroke ICloneableLayerElement<IStroke>.Clone()
+ {
+ return StrokeType.Deserialize(this.Serialize());
+ }
}
partial class FillType : IFill
{
- internal FillType() { }
+ internal FillType() { }
+
+ IFill ICloneableLayerElement<IFill>.Clone()
+ {
+ return FillType.Deserialize(this.Serialize());
+ }
}
partial class AreaTypeStyleType : IAreaVectorStyle
@@ -385,6 +395,11 @@
get { return (ISymbol)this.Item; }
set { this.Item = (SymbolType)value; }
}
+
+ IPointSymbolization2D ICloneableLayerElement<IPointSymbolization2D>.Clone()
+ {
+ return PointSymbolization2DType.Deserialize(this.Serialize());
+ }
}
partial class LineTypeStyleType : ILineVectorStyle
@@ -624,10 +639,15 @@
}
}
- PointSymbolType ISymbol.Type
+ public override PointSymbolType Type
{
get { return PointSymbolType.Font; }
}
+
+ ITextSymbol ICloneableLayerElement<ITextSymbol>.Clone()
+ {
+ return TextSymbolType.Deserialize(this.Serialize());
+ }
}
partial class MarkSymbolType : IMarkSymbol
@@ -671,10 +691,15 @@
}
}
- PointSymbolType ISymbol.Type
+ public override PointSymbolType Type
{
get { return PointSymbolType.Mark; }
}
+
+ IMarkSymbol ICloneableLayerElement<IMarkSymbol>.Clone()
+ {
+ return MarkSymbolType.Deserialize(this.Serialize());
+ }
}
internal class ImageBinaryContainer : IInlineImageSymbol
@@ -689,6 +714,20 @@
{
get { return ImageSymbolReferenceType.Inline; }
}
+
+ IInlineImageSymbol ICloneableLayerElement<IInlineImageSymbol>.Clone()
+ {
+ byte[] array = null;
+ if (this.Content != null)
+ {
+ array = new byte[this.Content.Length];
+ Array.Copy(this.Content, array, this.Content.Length);
+ }
+ return new ImageBinaryContainer()
+ {
+ Content = array
+ };
+ }
}
@@ -718,13 +757,18 @@
}
}
- PointSymbolType ISymbol.Type
+ public override PointSymbolType Type
{
get { return PointSymbolType.Image; }
}
+
+ IImageSymbol ICloneableLayerElement<IImageSymbol>.Clone()
+ {
+ return ImageSymbolType.Deserialize(this.Serialize());
+ }
}
- partial class SymbolType : ISymbol
+ abstract partial class SymbolType : ISymbol
{
[XmlIgnore]
LengthUnitType ISymbol.Unit
@@ -880,10 +924,7 @@
}
}
- PointSymbolType ISymbol.Type
- {
- get { throw new NotImplementedException(); }
- }
+ public abstract PointSymbolType Type { get; }
}
partial class FontSymbolType : IFontSymbol
@@ -990,10 +1031,15 @@
}
}
- PointSymbolType ISymbol.Type
+ public override PointSymbolType Type
{
get { return PointSymbolType.Font; }
}
+
+ IFontSymbol ICloneableLayerElement<IFontSymbol>.Clone()
+ {
+ return FontSymbolType.Deserialize(this.Serialize());
+ }
}
partial class BlockSymbolType : IBlockSymbol
@@ -1050,10 +1096,15 @@
}
}
- PointSymbolType ISymbol.Type
+ public override PointSymbolType Type
{
get { return PointSymbolType.Block; }
}
+
+ IBlockSymbol ICloneableLayerElement<IBlockSymbol>.Clone()
+ {
+ return BlockSymbolType.Deserialize(this.Serialize());
+ }
}
partial class W2DSymbolType : IW2DSymbol
@@ -1110,10 +1161,15 @@
}
}
- PointSymbolType ISymbol.Type
+ public override PointSymbolType Type
{
get { return PointSymbolType.W2D; }
}
+
+ IW2DSymbol ICloneableLayerElement<IW2DSymbol>.Clone()
+ {
+ return W2DSymbolType.Deserialize(this.Serialize());
+ }
}
partial class W2DSymbolTypeW2DSymbol : ISymbolReference
@@ -1146,6 +1202,11 @@
{
get { return ImageSymbolReferenceType.SymbolReference; }
}
+
+ ISymbolReference ICloneableLayerElement<ISymbolReference>.Clone()
+ {
+ return W2DSymbolTypeW2DSymbol.Deserialize(this.Serialize());
+ }
}
partial class ImageSymbolTypeImage : ISymbolReference
@@ -1180,6 +1241,11 @@
{
get { return ImageSymbolReferenceType.SymbolReference; }
}
+
+ ISymbolReference ICloneableLayerElement<ISymbolReference>.Clone()
+ {
+ return ImageSymbolTypeImage.Deserialize(this.Serialize());
+ }
}
partial class TextSymbolTypeAdvancedPlacement : IAdvancedPlacement
@@ -1214,6 +1280,11 @@
this.Stroke = (StrokeType)value;
}
}
+
+ IAreaSymbolizationFill ICloneableLayerElement<IAreaSymbolizationFill>.Clone()
+ {
+ return AreaSymbolizationFillType.Deserialize(this.Serialize());
+ }
}
partial class LayerDefinition : ILayerDefinition
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-10-18 10:21:07 UTC (rev 5291)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-10-18 13:36:58 UTC (rev 5292)
@@ -1547,6 +1547,8 @@
protected virtual OSGeo.MapGuide.ObjectModels.Common.IEnvelope GetSpatialExtent(string resourceID, string schema, string geometry, string filter, bool allowFallbackToContextInformation)
{
+ Check.NotEmpty(schema, "schema");
+ Check.NotEmpty(geometry, "geometry");
try
{
System.Collections.Specialized.NameValueCollection fun = new System.Collections.Specialized.NameValueCollection();
More information about the mapguide-commits
mailing list