[mapguide-commits] r6356 - in trunk/Tools/Maestro: Generated
Maestro.Editors/WebLayout OSGeo.MapGuide.MaestroAPI/ObjectModels
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Dec 22 22:53:43 EST 2011
Author: jng
Date: 2011-12-22 19:53:43 -0800 (Thu, 22 Dec 2011)
New Revision: 6356
Modified:
trunk/Tools/Maestro/Generated/WebLayout-1.0.0.designer.cs
trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.resx
trunk/Tools/Maestro/Maestro.Editors/WebLayout/MenuEditorCtrl.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
Log:
#1893: Web Layout editor fixes for custom commands
Modified: trunk/Tools/Maestro/Generated/WebLayout-1.0.0.designer.cs
===================================================================
--- trunk/Tools/Maestro/Generated/WebLayout-1.0.0.designer.cs 2011-12-23 02:41:11 UTC (rev 6355)
+++ trunk/Tools/Maestro/Generated/WebLayout-1.0.0.designer.cs 2011-12-23 03:53:43 UTC (rev 6356)
@@ -3862,14 +3862,14 @@
}
}
- public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+ //public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
- public virtual void OnPropertyChanged(string info) {
- System.ComponentModel.PropertyChangedEventHandler handler = this.PropertyChanged;
- if ((handler != null)) {
- handler(this, new System.ComponentModel.PropertyChangedEventArgs(info));
- }
- }
+ //public virtual void OnPropertyChanged(string info) {
+ // System.ComponentModel.PropertyChangedEventHandler handler = this.PropertyChanged;
+ // if ((handler != null)) {
+ // handler(this, new System.ComponentModel.PropertyChangedEventArgs(info));
+ // }
+ //}
#region Serialize/Deserialize
/// <summary>
Modified: trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.Designer.cs 2011-12-23 02:41:11 UTC (rev 6355)
+++ trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.Designer.cs 2011-12-23 03:53:43 UTC (rev 6356)
@@ -118,6 +118,7 @@
//
resources.ApplyResources(this.txtDescription, "txtDescription");
this.txtDescription.Name = "txtDescription";
+ this.txtDescription.TextChanged += new System.EventHandler(this.txtDescription_TextChanged);
//
// label4
//
@@ -128,6 +129,7 @@
//
resources.ApplyResources(this.txtTooltip, "txtTooltip");
this.txtTooltip.Name = "txtTooltip";
+ this.txtTooltip.TextChanged += new System.EventHandler(this.txtTooltip_TextChanged);
//
// label3
//
@@ -138,6 +140,7 @@
//
resources.ApplyResources(this.txtTitle, "txtTitle");
this.txtTitle.Name = "txtTitle";
+ this.txtTitle.TextChanged += new System.EventHandler(this.txtTitle_TextChanged);
//
// label2
//
@@ -148,6 +151,7 @@
//
resources.ApplyResources(this.txtName, "txtName");
this.txtName.Name = "txtName";
+ this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
//
// label1
//
Modified: trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.cs 2011-12-23 02:41:11 UTC (rev 6355)
+++ trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.cs 2011-12-23 03:53:43 UTC (rev 6356)
@@ -45,51 +45,69 @@
_edsvc = service;
}
+ private bool _init = false;
+ private ICommand _cmd;
+
internal void Bind(ICommand command, IEditorService service)
{
Bind(service);
+ try
+ {
+ _init = false;
+ _cmd = command;
+ //TextBoxBinder.BindText(txtDescription, command, "Description");
+ //TextBoxBinder.BindText(txtDisabledIcon, command, "DisabledImageURL");
+ //TextBoxBinder.BindText(txtEnabledIcon, command, "ImageURL");
+ //TextBoxBinder.BindText(txtName, command, "Name");
+ //TextBoxBinder.BindText(txtTitle, command, "Label");
+ //TextBoxBinder.BindText(txtTooltip, command, "Tooltip");
- TextBoxBinder.BindText(txtDescription, command, "Description");
- TextBoxBinder.BindText(txtDisabledIcon, command, "DisabledImageURL");
- TextBoxBinder.BindText(txtEnabledIcon, command, "ImageURL");
- TextBoxBinder.BindText(txtName, command, "Name");
- TextBoxBinder.BindText(txtTitle, command, "Label");
- TextBoxBinder.BindText(txtTooltip, command, "Tooltip");
+ txtDescription.Text = command.Description;
+ txtDisabledIcon.Text = command.DisabledImageURL;
+ txtEnabledIcon.Text = command.ImageURL;
+ txtName.Text = command.Name;
+ txtTitle.Text = command.Label;
+ txtTooltip.Text = command.Tooltip;
- if (typeof(IInvokeScriptCommand).IsAssignableFrom(command.GetType()))
- {
- var ctrl = new InvokeScriptCtrl();
- ctrl.Bind((IInvokeScriptCommand)command, service);
- ctrl.Dock = DockStyle.Fill;
- TAB_ADVANCED.Controls.Add(ctrl);
+ if (typeof(IInvokeScriptCommand).IsAssignableFrom(command.GetType()))
+ {
+ var ctrl = new InvokeScriptCtrl();
+ ctrl.Bind((IInvokeScriptCommand)command, service);
+ ctrl.Dock = DockStyle.Fill;
+ TAB_ADVANCED.Controls.Add(ctrl);
+ }
+ else if (typeof(IInvokeUrlCommand).IsAssignableFrom(command.GetType()))
+ {
+ var ctrl = new InvokeURLCtrl();
+ ctrl.Bind((IInvokeUrlCommand)command, service);
+ ctrl.Dock = DockStyle.Fill;
+ TAB_ADVANCED.Controls.Add(ctrl);
+ }
+ else if (typeof(ISearchCommand).IsAssignableFrom(command.GetType()))
+ {
+ var ctrl = new SearchCmdCtrl();
+ ctrl.Bind((ISearchCommand)command, service);
+ ctrl.Dock = DockStyle.Fill;
+ TAB_ADVANCED.Controls.Add(ctrl);
+ }
+ else
+ {
+ //Not editable
+ txtTooltip.ReadOnly = false;
+ txtDescription.ReadOnly = false;
+ txtDisabledIcon.ReadOnly = false;
+ txtEnabledIcon.ReadOnly = false;
+ txtName.ReadOnly = true;
+ txtTitle.ReadOnly = false;
+ txtTooltip.ReadOnly = false;
+
+ tabProperties.TabPages.Remove(TAB_ADVANCED);
+ }
}
- else if (typeof(IInvokeUrlCommand).IsAssignableFrom(command.GetType()))
+ finally
{
- var ctrl = new InvokeURLCtrl();
- ctrl.Bind((IInvokeUrlCommand)command, service);
- ctrl.Dock = DockStyle.Fill;
- TAB_ADVANCED.Controls.Add(ctrl);
+ _init = true;
}
- else if (typeof(ISearchCommand).IsAssignableFrom(command.GetType()))
- {
- var ctrl = new SearchCmdCtrl();
- ctrl.Bind((ISearchCommand)command, service);
- ctrl.Dock = DockStyle.Fill;
- TAB_ADVANCED.Controls.Add(ctrl);
- }
- else
- {
- //Not editable
- txtTooltip.ReadOnly = false;
- txtDescription.ReadOnly = false;
- txtDisabledIcon.ReadOnly = false;
- txtEnabledIcon.ReadOnly = false;
- txtName.ReadOnly = true;
- txtTitle.ReadOnly = false;
- txtTooltip.ReadOnly = false;
-
- tabProperties.TabPages.Remove(TAB_ADVANCED);
- }
}
private void txtEnabledIcon_TextChanged(object sender, EventArgs e)
@@ -103,6 +121,9 @@
{
imgEnabled.Image = Properties.Resources.cross_circle_frame;
}
+
+ if (!_init) return;
+ _cmd.ImageURL = txtEnabledIcon.Text;
}
private void txtDisabledIcon_TextChanged(object sender, EventArgs e)
@@ -116,6 +137,33 @@
{
imgDisabled.Image = Properties.Resources.cross_circle_frame;
}
+
+ if (!_init) return;
+ _cmd.DisabledImageURL = txtDisabledIcon.Text;
}
+
+ private void txtName_TextChanged(object sender, EventArgs e)
+ {
+ if (!_init) return;
+ _cmd.Name = txtName.Text;
+ }
+
+ private void txtTitle_TextChanged(object sender, EventArgs e)
+ {
+ if (!_init) return;
+ _cmd.Label = txtTitle.Text;
+ }
+
+ private void txtTooltip_TextChanged(object sender, EventArgs e)
+ {
+ if (!_init) return;
+ _cmd.Tooltip = txtTooltip.Text;
+ }
+
+ private void txtDescription_TextChanged(object sender, EventArgs e)
+ {
+ if (!_init) return;
+ _cmd.Description = txtDescription.Text;
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.resx 2011-12-23 02:41:11 UTC (rev 6355)
+++ trunk/Tools/Maestro/Maestro.Editors/WebLayout/CustomCommandPropertyCtrl.resx 2011-12-23 03:53:43 UTC (rev 6356)
@@ -562,6 +562,6 @@
<value>CustomCommandPropertyCtrl</value>
</data>
<data name=">>$this.Type" xml:space="preserve">
- <value>Maestro.Editors.EditorBase, Maestro.Editors, Version=3.0.0.5334, Culture=neutral, PublicKeyToken=null</value>
+ <value>Maestro.Editors.EditorBase, Maestro.Editors, Version=4.0.0.6282, Culture=neutral, PublicKeyToken=f526c48929fda856</value>
</data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/WebLayout/MenuEditorCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/WebLayout/MenuEditorCtrl.cs 2011-12-23 02:41:11 UTC (rev 6355)
+++ trunk/Tools/Maestro/Maestro.Editors/WebLayout/MenuEditorCtrl.cs 2011-12-23 03:53:43 UTC (rev 6356)
@@ -201,6 +201,16 @@
var cmd = (ICommand)tsi.Tag;
var ci = _wl.CreateCommandItem(cmd.Name);
+ //Reg property listener
+ PropertyChangedEventHandler handler = (s, evt) =>
+ {
+ if (evt.PropertyName == "Name")
+ {
+ ci.Command = cmd.Name;
+ trvMenuItems.Refresh();
+ }
+ };
+ cmd.PropertyChanged += handler;
if (trvMenuItems.SelectedNode != null)
{
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs 2011-12-23 02:41:11 UTC (rev 6355)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs 2011-12-23 03:53:43 UTC (rev 6356)
@@ -659,16 +659,38 @@
return cmd;
}
+ private string GenerateUniqueName(string prefix)
+ {
+ int counter = 0;
+ string name = prefix + counter;
+
+ Dictionary<string, string> ids = new Dictionary<string, string>();
+ foreach (var cmd in this.CommandSet)
+ {
+ ids.Add(cmd.Name, cmd.Name);
+ }
+
+ while (ids.ContainsKey(name))
+ {
+ counter++;
+ name = prefix + counter;
+ }
+
+ return name;
+ }
+
public IInvokeUrlCommand CreateInvokeUrlCommand()
{
return new InvokeURLCommandType()
{
+ Name = GenerateUniqueName("InvokeUrlCommand"),
Target = TargetType.TaskPane,
DisableIfSelectionEmpty = false,
ImageURL = "../stdicons/icon_invokeurl.gif",
DisabledImageURL = "../stdicons/icon_invokeurl_disabled.gif",
TargetViewer = TargetViewerType.All,
AdditionalParameter = new BindingList<ParameterPairType>(),
+ URL = "",
LayerSet = new BindingList<string>()
};
}
@@ -677,11 +699,13 @@
{
return new SearchCommandType()
{
+ Name = GenerateUniqueName("SearchCommand"),
ResultColumns = new System.ComponentModel.BindingList<ResultColumnType>(),
Target = TargetType.TaskPane,
TargetViewer = TargetViewerType.All,
DisabledImageURL = "../stdicons/icon_search_disabled.gif",
ImageURL = "../stdicons/icon_search.gif",
+ Layer = string.Empty,
Filter = string.Empty,
MatchLimit = "100",
Prompt = string.Empty
@@ -692,9 +716,11 @@
{
return new InvokeScriptCommandType()
{
+ Name = GenerateUniqueName("InvokeScriptCommand"),
DisabledImageURL = "../stdicons/icon_invokescript_disabled.gif",
ImageURL = "../stdicons/icon_invokescript.gif",
- TargetViewer = TargetViewerType.All
+ TargetViewer = TargetViewerType.All,
+ Script = "//Enter your script code here. You can use AJAX viewer API calls here. This code is called from the viewer's main frame"
};
}
More information about the mapguide-commits
mailing list