Skip to content
Permalink
Browse files

Expanding on TreeSelector help texts, ensuring only required fields a…

…re marked as required.
  • Loading branch information
mawtex committed Nov 27, 2019
1 parent 0caf503 commit 44ba5aebb619d7db4a1f703708bf8284a0f17bf7
@@ -111,9 +111,9 @@ public Control BuildWebControl()

_userControl.SelectedKey = this.SelectedKey;
_userControl.ElementProvider = this.ElementProvider;
_userControl.SelectableElementPropertyName = this.SelectableElementPropertyName;
_userControl.SelectableElementPropertyValue = this.SelectableElementPropertyValue;
_userControl.SelectableElementReturnValue = this.SelectableElementReturnValue;
_userControl.SelectableElementPropertyName = string.IsNullOrEmpty(this.SelectableElementPropertyName) ? this.SelectableElementReturnValue : this.SelectableElementPropertyName;
_userControl.SelectableElementPropertyValue = this.SelectableElementPropertyValue;
_userControl.SerializedSearchToken = this.SerializedSearchToken;
_userControl.Required = this.Required;

@@ -35,39 +35,40 @@ private void SetParameterProfiles()
"Element Provider", new HelpDefinition("The name of a tree element provider (as defined in Composite.config)")));

base.AddParameterProfile(
new ParameterProfile("SelectableElementPropertyName",
new ParameterProfile("SelectableElementReturnValue",
typeof(string),
true,
new ConstantValueProvider(string.Empty),
new ConstantValueProvider("EntityToken"),
StandardWidgetFunctions.TextBoxWidget,
null,
"Selectable Element Property Name", new HelpDefinition("The name of a property used to identify a selectable tree element by")));
"Element field to return", new HelpDefinition("The name of the element field whose value to return for selection. Typical values here can be DataId (for data trees), Uri (for linkable elements), or EntityToken (for any element). Element providers may provide more fields.")));

base.AddParameterProfile(
new ParameterProfile("SelectableElementPropertyValue",
new ParameterProfile("SelectableElementPropertyName",
typeof(string),
false,
new ConstantValueProvider(string.Empty),
StandardWidgetFunctions.TextBoxWidget,
null,
"Selectable Element Property Value", new HelpDefinition("The value of the property optionally used (if provided) to further identify a selectable tree element by")));
"Selection filter, Property Name", new HelpDefinition("An element must have this field to be selectable.")));

base.AddParameterProfile(
new ParameterProfile("SelectableElementReturnValue",
new ParameterProfile("SelectableElementPropertyValue",
typeof(string),
false,
new ConstantValueProvider(string.Empty),
StandardWidgetFunctions.TextBoxWidget,
null,
"Selectable Element Return Value", new HelpDefinition("The value to return for the selected tree element")));
"Selection filter, Property Value", new HelpDefinition("The value of the property optionally used (if provided) to further identify a selectable tree element by. Seperate multiple values with spaces.")));

base.AddParameterProfile(
new ParameterProfile("SerializedSearchToken",
typeof(string),
false,
new ConstantValueProvider(string.Empty),
StandardWidgetFunctions.TextBoxWidget,
null,
"Serialized Search Token", new HelpDefinition("A search token to filter tree elements by")));
"Search Token", new HelpDefinition("A search token, seriallized, to filter which tree elements is shown. To filter what is selectable, use the 'Selection filter' properties.")));

This comment has been minimized.

Copy link
@burningice2866

burningice2866 Nov 28, 2019

Contributor

Typo in seriallized, should be serialized

base.AddParameterProfile(
new ParameterProfile("Required",
typeof(bool),
@@ -85,7 +86,7 @@ public override XElement GetWidgetMarkup(ParameterList parameters, string label,
XElement formElement = base.BuildBasicWidgetMarkup("TreeSelector", "SelectedKey", label, helpDefinition, bindingSourceName);
foreach (var propertyName in new []
{
"ElementProvider", "SelectableElementPropertyName", "SelectableElementPropertyValue", "SelectableElementReturnValue", "SerializedSearchToken", "Required"
"ElementProvider", "SelectableElementReturnValue", "SelectableElementPropertyName", "SelectableElementPropertyValue", "SerializedSearchToken", "Required"

This comment has been minimized.

Copy link
@burningice2866

burningice2866 Nov 28, 2019

Contributor

´This still ought to be using nameof() for proper refactoring support and static type checking

})
{
string propertyValue = parameters.GetParameter<string>(propertyName);

0 comments on commit 44ba5ae

Please sign in to comment.
You can’t perform that action at this time.