Ewl » Canonical The canonical version of EWL Read More
Clone URL:  
Pushed to 3 repositories · View In Graph Contained in tip and canonical

Created NavFormControl to replace LookupBoxSetup and support multiple control
types.

Changeset 8d3f573d52e9

Parent b15f8b01739b

by Profile picture of William GrossWilliam Gross

Changes to 13 files · Browse files at 8d3f573d52e9 Showing diff from parent b15f8b01739b Diff from another changeset...

Change 1 of 2 Show Entire File Core/​Core.csproj Stacked
 
403
404
405
 
 
 
406
407
408
 
601
602
603
604
605
606
607
 
403
404
405
406
407
408
409
410
411
 
604
605
606
 
607
608
609
@@ -403,6 +403,9 @@
  <Compile Include="EnterpriseWebFramework\Form Controls\Lists\EwfCheckBoxList.cs" />   <Compile Include="EnterpriseWebFramework\Form Controls\Lists\List Items\SelectListItem.cs" />   <Compile Include="EnterpriseWebFramework\Form Controls\Lists\ListItemMatchPageModificationSetup.cs" /> + <Compile Include="EnterpriseWebFramework\Form Controls\Navigational Form Control\NavFormControl.cs" /> + <Compile Include="EnterpriseWebFramework\Form Controls\Navigational Form Control\NavFormControlSetup.cs" /> + <Compile Include="EnterpriseWebFramework\Form Controls\Navigational Form Control\NavFormControlValidationResult.cs" />   <Compile Include="EnterpriseWebFramework\Form Controls\Numeric Text Control\NumericTextControl.cs" />   <Compile Include="EnterpriseWebFramework\Form Controls\Numeric Text Control\NumericTextControlSetup.cs" />   <Compile Include="EnterpriseWebFramework\Form Controls\RadioButtonGroup.cs" /> @@ -601,7 +604,6 @@
  <Compile Include="EnterpriseWebFramework\Ui\Entity\EwfUiEntitySetupInfo.cs" />   <Compile Include="EnterpriseWebFramework\Ui\Entity\UiEntitySetupBase.cs" />   <Compile Include="EnterpriseWebFramework\Ui\EwfUiStatics.cs" /> - <Compile Include="EnterpriseWebFramework\Ui\LookupBoxSetup.cs" />   <Compile Include="EnterpriseWebFramework\EwfExtensionMethods.cs" />   <Compile Include="EnterpriseWebFramework\Ui\Entity\TabMode.cs" />   <Compile Include="EnterpriseWebFramework\UserManagement\FormsAuthStatics.cs" />
 
33
34
35
 
36
37
38
 
33
34
35
36
37
38
39
@@ -33,6 +33,7 @@
  <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=EnterpriseWebFramework_005CForm_0020Controls_005CLists/@EntryIndexedValue">True</s:Boolean>   <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=EnterpriseWebFramework_005CForm_0020Controls_005CLists_005CList_0020Items/@EntryIndexedValue">True</s:Boolean>   <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=EnterpriseWebFramework_005CForm_0020Controls_005CLists_005CSelect_0020List/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=enterprisewebframework_005Cform_0020controls_005Cnavigational_0020form_0020control/@EntryIndexedValue">True</s:Boolean>   <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=enterprisewebframework_005Cform_0020controls_005Cnumeric_0020text_0020control/@EntryIndexedValue">True</s:Boolean>   <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=enterprisewebframework_005Cform_0020controls_005Ctelephone_0020number_0020control/@EntryIndexedValue">True</s:Boolean>   <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=EnterpriseWebFramework_005CForm_0020Controls_005CText_0020Box/@EntryIndexedValue">True</s:Boolean>
Change 1 of 1 Show Entire File Core/​EnterpriseWebFramework/​Form Controls/​Navigational Form Control/​NavFormControl.cs Stacked
renamed from Core/EnterpriseWebFramework/Ui/LookupBoxSetup.cs
 
1
2
3
 
 
 
4
5
 
6
7
 
8
9
10
11
12
13
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
16
17
 
18
19
20
21
22
23
24
25
26
27
28
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
50
51
 
 
 
 
 
1
2
3
4
 
5
6
 
7
8
 
 
 
 
 
 
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
29
30
 
 
 
 
 
 
 
 
 
 
 
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
141
142
 
@@ -1,51 +1,142 @@
-using System; -using System.Web.UI.WebControls; -using EnterpriseWebLibrary.EnterpriseWebFramework.Controls; +using System; +using EnterpriseWebLibrary.InputValidation; +using Humanizer;   -namespace EnterpriseWebLibrary.EnterpriseWebFramework.Ui { +namespace EnterpriseWebLibrary.EnterpriseWebFramework {   /// <summary> - /// Represents a textbox that appears in the navigation bar allowing users to lookup a record by number. + /// A form control that navigates to a resource using the entered value as a parameter.   /// </summary> - public class LookupBoxSetup { - private readonly int pixelWidth; - private readonly string defaultText; - private readonly PageInfo autoCompleteService; - private readonly string postBackId; - private readonly Func<string, ResourceInfo> handler; + public class NavFormControl { + /// <summary> + /// Creates a text control. + /// </summary> + /// <param name="setup">The setup object for the control. Do not pass null.</param> + /// <param name="validationMethod">A function that validates the value entered by the user and returns a result. Do not pass null.</param> + public static NavFormControl CreateText( NavFormControlSetup setup, Func<string, NavFormControlValidationResult> validationMethod ) => + new NavFormControl( + setup, + validationResultHandler => { + return new TextControl( + "", + false, + setup: setup.AutoCompleteResource != null + ? TextControlSetup.CreateAutoComplete( setup.AutoCompleteResource, placeholder: setup.Placeholder, triggersActionWhenItemSelected: true ) + : TextControlSetup.Create( placeholder: setup.Placeholder ), + validationMethod: ( postBackValue, validator ) => validationResultHandler( validationMethod( postBackValue ), validator ) ); + } );     /// <summary> - /// Creates a lookup box. + /// Creates an email-address control.   /// </summary> - /// <param name="pixelWidth"></param> - /// <param name="defaultText">Text displayed when the LookupBox does not have focus. Do not pass null.</param> - /// <param name="postBackId"></param> - /// <param name="handler">Supplies the string entered into the LookupBox from the user. Returns the resource the user will be redirected to.</param> - /// <param name="autoCompleteService"></param> - public LookupBoxSetup( int pixelWidth, string defaultText, string postBackId, Func<string, ResourceInfo> handler, PageInfo autoCompleteService = null ) { - this.pixelWidth = pixelWidth; - this.defaultText = defaultText; - this.autoCompleteService = autoCompleteService; - this.postBackId = postBackId; - this.handler = handler; + /// <param name="setup">The setup object for the control. Do not pass null.</param> + /// <param name="validationMethod">A function that validates the value entered by the user and returns a result. Do not pass null.</param> + public static NavFormControl CreateEmail( NavFormControlSetup setup, Func<string, NavFormControlValidationResult> validationMethod ) => + new NavFormControl( + setup, + validationResultHandler => { + return new EmailAddressControl( + "", + false, + setup: setup.AutoCompleteResource != null + ? EmailAddressControlSetup.CreateAutoComplete( + setup.AutoCompleteResource, + placeholder: setup.Placeholder, + triggersActionWhenItemSelected: true ) + : EmailAddressControlSetup.Create( placeholder: setup.Placeholder ), + validationMethod: ( postBackValue, validator ) => validationResultHandler( validationMethod( postBackValue ), validator ) ); + } ); + + /// <summary> + /// Creates a numeric-text control with the value expressed as a string. + /// </summary> + /// <param name="setup">The setup object for the control. Do not pass null.</param> + /// <param name="validationMethod">A function that validates the value entered by the user and returns a result. Do not pass null.</param> + public static NavFormControl CreateNumericTextAsString( NavFormControlSetup setup, Func<string, NavFormControlValidationResult> validationMethod ) => + new NavFormControl( + setup, + validationResultHandler => { + return new NumericTextControl( + "", + false, + setup: setup.AutoCompleteResource != null + ? NumericTextControlSetup.CreateAutoComplete( + setup.AutoCompleteResource, + placeholder: setup.Placeholder, + triggersActionWhenItemSelected: true ) + : NumericTextControlSetup.Create( placeholder: setup.Placeholder ), + validationMethod: ( postBackValue, validator ) => validationResultHandler( validationMethod( postBackValue ), validator ) ); + } ); + + /// <summary> + /// Creates a numeric-text control with the value expressed as an int. + /// </summary> + /// <param name="setup">The setup object for the control. Do not pass null.</param> + /// <param name="validationMethod">A function that validates the value entered by the user and returns a result. Do not pass null.</param> + public static NavFormControl CreateNumericTextAsInt( NavFormControlSetup setup, Func<int, NavFormControlValidationResult> validationMethod ) => + new NavFormControl( + setup, + validationResultHandler => { + var val = new DataValue<int>(); + return val.ToTextControl( + setup: setup.AutoCompleteResource != null + ? NumericTextControlSetup.CreateAutoComplete( + setup.AutoCompleteResource, + placeholder: setup.Placeholder, + triggersActionWhenItemSelected: true ) + : NumericTextControlSetup.Create( placeholder: setup.Placeholder ), + additionalValidationMethod: validator => validationResultHandler( validationMethod( val.Value ), validator ) ); + } ); + + /// <summary> + /// Creates a numeric-text control with the value expressed as a long. + /// </summary> + /// <param name="setup">The setup object for the control. Do not pass null.</param> + /// <param name="validationMethod">A function that validates the value entered by the user and returns a result. Do not pass null.</param> + public static NavFormControl CreateNumericTextAsLong( NavFormControlSetup setup, Func<long, NavFormControlValidationResult> validationMethod ) => + new NavFormControl( + setup, + validationResultHandler => { + var val = new DataValue<long>(); + return val.ToTextControl( + setup: setup.AutoCompleteResource != null + ? NumericTextControlSetup.CreateAutoComplete( + setup.AutoCompleteResource, + placeholder: setup.Placeholder, + triggersActionWhenItemSelected: true ) + : NumericTextControlSetup.Create( placeholder: setup.Placeholder ), + additionalValidationMethod: validator => validationResultHandler( validationMethod( val.Value ), validator ) ); + } ); + + private readonly Func<string, FormItem> formItemGetter; + + private NavFormControl( + NavFormControlSetup setup, Func<Action<NavFormControlValidationResult, Validator>, FormControl<PhrasingComponent>> formControlGetter ) { + formItemGetter = postBackId => { + var destination = new DataValue<ResourceInfo>(); + var postBack = PostBack.CreateFull( id: postBackId, actionGetter: () => new PostBackAction( destination.Value ) ); + return FormState.ExecuteWithDataModificationsAndDefaultAction( + postBack.ToCollection(), + () => { + var formControl = formControlGetter( + ( result, validator ) => { + if( result.Destination != null ) + destination.Value = result.Destination; + else + validator.NoteErrorAndAddMessage( result.ErrorMessage ); + } ); + return new DisplayableElement( + context => new DisplayableElementData( + null, + () => new DisplayableElementLocalData( + "div", + focusDependentData: new DisplayableElementFocusDependentData( + attributes: Tuple.Create( "style", "width: {0}".FormatWith( ( (CssLength)setup.Width ).Value ) ).ToCollection() ) ), + children: formControl.PageComponent.ToCollection() ) ).ToCollection() + .ToFormItem( validation: formControl.Validation ); + } ); + };   }   - /// <summary> - /// Builds this LookupBox and returns the panel. - /// </summary> - public WebControl BuildLookupBoxPanel() { - var val = new DataValue<string>(); - var postBack = PostBack.CreateFull( id: postBackId, actionGetter: () => new PostBackAction( handler( val.Value ) ) ); - return FormState.ExecuteWithDataModificationsAndDefaultAction( - postBack.ToCollection(), - () => new Block( - val.ToTextControl( - true, - setup: autoCompleteService != null - ? TextControlSetup.CreateAutoComplete( autoCompleteService, placeholder: defaultText, triggersActionWhenItemSelected: true ) - : TextControlSetup.Create( placeholder: defaultText ), - value: "" ) - .ToFormItem() - .ToControl() ) { CssClass = "ewfLookupBox", Width = Unit.Pixel( pixelWidth ) } ); - } + public FormItem GetFormItem( string postBackId ) => formItemGetter( postBackId );   }  } \ No newline at end of file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
@@ -0,0 +1,22 @@
+namespace EnterpriseWebLibrary.EnterpriseWebFramework { + /// <summary> + /// The configuration for a navigational form control. + /// </summary> + public class NavFormControlSetup { + public ContentBasedLength Width { get; } + public string Placeholder { get; } + public ResourceInfo AutoCompleteResource { get; } + + /// <summary> + /// Creates a navigational-form-control setup object. + /// </summary> + /// <param name="width">The width of the control. Do not pass null.</param> + /// <param name="placeholder">The hint word or phrase that will appear when the control has an empty value. Do not pass null or the empty string.</param> + /// <param name="autoCompleteResource">The resource containing the auto-complete items. Do not pass null.</param> + public NavFormControlSetup( ContentBasedLength width, string placeholder, ResourceInfo autoCompleteResource = null ) { + Width = width; + Placeholder = placeholder; + AutoCompleteResource = autoCompleteResource; + } + } +} \ No newline at end of file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
@@ -0,0 +1,22 @@
+namespace EnterpriseWebLibrary.EnterpriseWebFramework { + public class NavFormControlValidationResult { + internal ResourceInfo Destination { get; } + internal string ErrorMessage { get; } + + /// <summary> + /// Creates a successful-validation result. + /// </summary> + /// <param name="destination">Do not pass null.</param> + public NavFormControlValidationResult( ResourceInfo destination ) { + Destination = destination; + } + + /// <summary> + /// Creates a failed-validation result. + /// </summary> + /// <param name="errorMessage">Do not pass null or the empty string.</param> + public NavFormControlValidationResult( string errorMessage ) { + ErrorMessage = errorMessage; + } + } +} \ No newline at end of file
 
1
2
3
4
5
6
7
 
23
24
25
26
 
27
28
29
30
31
 
32
33
34
35
 
36
37
38
 
1
2
3
 
4
5
6
 
22
23
24
 
25
26
27
28
29
 
30
31
 
 
 
32
33
34
35
@@ -1,7 +1,6 @@
 using System.Collections.Generic;  using System.Linq;  using System.Web.UI; -using EnterpriseWebLibrary.EnterpriseWebFramework.Ui;    namespace EnterpriseWebLibrary.EnterpriseWebFramework {   /// <summary> @@ -23,16 +22,14 @@
  }     /// <summary> - /// Gets the global nav action controls. + /// Gets the global navigational action components.   /// </summary>   public virtual IReadOnlyCollection<ActionComponentSetup> GetGlobalNavActions() => Enumerable.Empty<ActionComponentSetup>().Materialize();     /// <summary> - /// Gets the global nav lookup box setups. + /// Gets the global navigational form controls.   /// </summary> - public virtual List<LookupBoxSetup> GetGlobalNavLookupBoxSetups() { - return new List<LookupBoxSetup>(); - } + public virtual IReadOnlyCollection<NavFormControl> GetGlobalNavFormControls() => Enumerable.Empty<NavFormControl>().Materialize();     /// <summary>   /// Gets whether items in the global nav control list are separated with a pipe character.
 
1
2
3
4
5
 
7
8
9
10
 
11
12
13
14
15
 
16
17
 
18
19
20
 
21
22
23
 
1
 
2
3
4
 
6
7
8
 
9
10
11
12
13
 
14
15
 
16
17
18
 
19
20
21
22
@@ -1,5 +1,4 @@
 using System.Collections.Generic; -using EnterpriseWebLibrary.EnterpriseWebFramework.Ui;    namespace EnterpriseWebLibrary.EnterpriseWebFramework {   /// <summary> @@ -7,17 +6,17 @@
  /// </summary>   public interface UiEntitySetupBase: EntitySetupBase {   /// <summary> - /// Creates and returns navigation button setup information. + /// Gets the navigational action components.   /// </summary>   IReadOnlyCollection<ActionComponentSetup> GetNavActions();     /// <summary> - /// Creates and returns lookup box setup information. + /// Gets the navigational form controls.   /// </summary> - List<LookupBoxSetup> CreateLookupBoxSetups(); + IReadOnlyCollection<NavFormControl> GetNavFormControls();     /// <summary> - /// Creates and returns action button setup information. + /// Gets the action components.   /// </summary>   IReadOnlyCollection<ActionComponentSetup> GetActions();   }
 
1
2
3
4
5
6
7
 
29
30
31
32
 
33
34
35
 
 
1
2
3
 
4
5
6
 
28
29
30
 
31
32
33
34
 
@@ -1,7 +1,6 @@
 using System.Collections.Generic;  using System.Linq;  using System.Web.UI; -using EnterpriseWebLibrary.EnterpriseWebFramework.Ui;  using EnterpriseWebLibrary.EnterpriseWebFramework.UserManagement;    namespace EnterpriseWebLibrary.EnterpriseWebFramework.EnterpriseWebLibrary.WebSite.Admin { @@ -29,7 +28,7 @@
  void EntitySetupBase.LoadData() {}     IReadOnlyCollection<ActionComponentSetup> UiEntitySetupBase.GetNavActions() => Enumerable.Empty<ActionComponentSetup>().Materialize(); - List<LookupBoxSetup> UiEntitySetupBase.CreateLookupBoxSetups() => new List<LookupBoxSetup>(); + IReadOnlyCollection<NavFormControl> UiEntitySetupBase.GetNavFormControls() => Enumerable.Empty<NavFormControl>().Materialize();   IReadOnlyCollection<ActionComponentSetup> UiEntitySetupBase.GetActions() => Enumerable.Empty<ActionComponentSetup>().Materialize();   }  } \ No newline at end of file
 
9
10
11
12
13
14
15
 
109
110
111
112
 
 
113
114
115
 
262
263
264
265
266
267
 
 
 
 
268
269
270
271
272
273
 
 
 
 
 
 
 
274
275
276
 
312
313
314
315
316
317
 
 
 
 
 
318
319
 
320
321
322
323
324
 
 
 
 
 
 
 
325
326
327
 
332
333
334
335
336
 
337
338
339
 
352
353
354
355
356
 
357
358
359
 
455
456
457
458
 
459
460
461
 
9
10
11
 
12
13
14
 
108
109
110
 
111
112
113
114
115
 
262
263
264
 
 
 
265
266
267
268
269
270
 
 
 
 
271
272
273
274
275
276
277
278
279
280
 
316
317
318
 
 
 
319
320
321
322
323
324
325
326
327
 
 
 
 
328
329
330
331
332
333
334
335
336
337
 
342
343
344
 
 
345
346
347
348
 
361
362
363
 
 
364
365
366
367
 
463
464
465
 
466
467
468
469
@@ -9,7 +9,6 @@
 using EnterpriseWebLibrary.EnterpriseWebFramework.Ui.Entity;  using EnterpriseWebLibrary.WebSessionState;  using Humanizer; -using MoreLinq;    namespace EnterpriseWebLibrary.EnterpriseWebFramework.EnterpriseWebLibrary.WebSite {   public partial class EwfUi: MasterPage, ControlTreeDataLoader, AppEwfUiMasterPage { @@ -109,7 +108,8 @@
  ControlLine.CssElementCreator.Selectors.Select( i => entityAndTabAndContentBlockSelector + " " + i + "." + EntityNavListCssClass ).ToArray() ),   new CssElement(   "UiEntityActionControlList", - ControlLine.CssElementCreator.Selectors.Select( i => entityAndTabAndContentBlockSelector + " " + i + "." + EntityActionListCssClass ).ToArray() ), + ControlLine.CssElementCreator.Selectors.Select( i => entityAndTabAndContentBlockSelector + " " + i + "." + EntityActionListCssClass ) + .ToArray() ),   new CssElement( "UiEntitySummaryBlock", entityAndTabAndContentBlockSelector + " " + "div." + EntitySummaryBlockCssClass )   };   } @@ -262,15 +262,19 @@
  if( ConfigurationStatics.IsIntermediateInstallation && !AppRequestState.Instance.IntermediateUserExists )   return null;   - var controls = getActionControls( EwfUiStatics.AppProvider.GetGlobalNavActions() ) - .Concat( from i in EwfUiStatics.AppProvider.GetGlobalNavLookupBoxSetups() select i.BuildLookupBoxPanel() ) - .ToArray(); + var formItems = EwfUiStatics.AppProvider.GetGlobalNavFormControls() + .Select( ( control, index ) => control.GetFormItem( PostBack.GetCompositeId( "global", "nav", index.ToString() ) ) ) + .Materialize(); + var controls = getActionControls( EwfUiStatics.AppProvider.GetGlobalNavActions() ).Concat( formItems.Select( i => i.Control ) ).ToArray();   if( !controls.Any() )   return null; - return new Block( new ControlLine( controls ) { ItemsSeparatedWithPipe = EwfUiStatics.AppProvider.GlobalNavItemsSeparatedWithPipe() } ) - { - CssClass = CssElementCreator.GlobalNavBlockCssClass - }; + + return new Block( + new ControlLine( controls ) { ItemsSeparatedWithPipe = EwfUiStatics.AppProvider.GlobalNavItemsSeparatedWithPipe() }.ToCollection() + .Concat( + new FlowErrorContainer( new ErrorSourceSet( validations: formItems.Select( i => i.Validation ) ), new ListErrorDisplayStyle() ).ToCollection() + .GetControls() ) + .ToArray() ) { CssClass = CssElementCreator.GlobalNavBlockCssClass };   }     private Control getEntityAndTopTabBlock() { @@ -312,16 +316,22 @@
  private EwfTableCell getEntityNavCell() {   if( uiEntitySetup == null )   return null; - var controls = getActionControls( uiEntitySetup.GetNavActions() ) - .Concat( from i in uiEntitySetup.CreateLookupBoxSetups() select i.BuildLookupBoxPanel() ) - .ToArray(); + + var formItems = uiEntitySetup.GetNavFormControls() + .Select( ( control, index ) => control.GetFormItem( PostBack.GetCompositeId( "entity", "nav", index.ToString() ) ) ) + .Materialize(); + var controls = getActionControls( uiEntitySetup.GetNavActions() ).Concat( formItems.Select( i => i.Control ) ).ToArray();   if( !controls.Any() )   return null; +   return new ControlLine( controls ) - { - CssClass = CssElementCreator.EntityNavListCssClass, - ItemsSeparatedWithPipe = EwfUiStatics.AppProvider.EntityNavAndActionItemsSeparatedWithPipe() - }; + { + CssClass = CssElementCreator.EntityNavListCssClass, ItemsSeparatedWithPipe = EwfUiStatics.AppProvider.EntityNavAndActionItemsSeparatedWithPipe() + }.ToCollection() + .Concat( + new FlowErrorContainer( new ErrorSourceSet( validations: formItems.Select( i => i.Validation ) ), new ListErrorDisplayStyle() ).ToCollection() + .GetControls() ) + .ToCell();   }     private EwfTableCell getEntityActionCell() { @@ -332,8 +342,7 @@
  return null;   return new ControlLine( actionControls )   { - CssClass = CssElementCreator.EntityActionListCssClass, - ItemsSeparatedWithPipe = EwfUiStatics.AppProvider.EntityNavAndActionItemsSeparatedWithPipe() + CssClass = CssElementCreator.EntityActionListCssClass, ItemsSeparatedWithPipe = EwfUiStatics.AppProvider.EntityNavAndActionItemsSeparatedWithPipe()   }.ToCell( new TableCellSetup( textAlignment: TextAlignment.Right ) );   }   @@ -352,8 +361,7 @@
  return new Block(   new ControlLine( getTabControlsForResources( resourceGroup, false ).ToArray() )   { - CssClass = CssElementCreator.TopTabCssClass, - VerticalAlignment = TableCellVerticalAlignment.Bottom + CssClass = CssElementCreator.TopTabCssClass, VerticalAlignment = TableCellVerticalAlignment.Bottom   } ) { CssClass = CssElementCreator.TopTabCssClass };   }   @@ -455,7 +463,7 @@
  controls.AddRange(   new Paragraph(   "Powered by the ".ToComponents() - .Concat( new EwfHyperlink( ewlWebSite.ToHyperlinkNewTabBehavior(), new StandardHyperlinkStyle( EwlStatics.EwlName ) ) ) + .Append( new EwfHyperlink( ewlWebSite.ToHyperlinkNewTabBehavior(), new StandardHyperlinkStyle( EwlStatics.EwlName ) ) )   .Concat(   " ({0} version)".FormatWith( TimeZoneInfo.ConvertTime( EwlStatics.EwlBuildDateTime, TimeZoneInfo.Local ).ToMonthYearString() )   .ToComponents() )
 
1
2
3
4
5
6
7
 
24
25
26
27
 
28
29
30
 
 
1
2
3
 
4
5
6
 
23
24
25
 
26
27
28
29
 
@@ -1,7 +1,6 @@
 using System.Collections.Generic;  using System.Linq;  using System.Web.UI; -using EnterpriseWebLibrary.EnterpriseWebFramework.Ui;    // Parameter: string returnAndDestinationUrl   @@ -24,7 +23,7 @@
  IReadOnlyCollection<ActionComponentSetup> UiEntitySetupBase.GetNavActions() =>   new HyperlinkSetup( new ExternalResourceInfo( info.ReturnAndDestinationUrl ), "Back" ).ToCollection();   - List<LookupBoxSetup> UiEntitySetupBase.CreateLookupBoxSetups() => new List<LookupBoxSetup>(); + IReadOnlyCollection<NavFormControl> UiEntitySetupBase.GetNavFormControls() => Enumerable.Empty<NavFormControl>().Materialize();   IReadOnlyCollection<ActionComponentSetup> UiEntitySetupBase.GetActions() => Enumerable.Empty<ActionComponentSetup>().Materialize();   }  } \ No newline at end of file
 
1
2
3
4
5
6
 
28
29
30
31
32
 
 
33
34
 
35
36
37
38
 
 
 
 
 
 
 
 
 
39
40
41
 
 
1
2
 
3
4
5
 
27
28
29
 
 
30
31
32
 
33
34
 
 
 
35
36
37
38
39
40
41
42
43
44
45
46
 
@@ -1,6 +1,5 @@
 using System.Collections.Generic;  using EnterpriseWebLibrary.EnterpriseWebFramework; -using EnterpriseWebLibrary.EnterpriseWebFramework.Ui;  using EnterpriseWebLibrary.WebSessionState;    namespace EnterpriseWebLibrary.WebSite.Providers { @@ -28,14 +27,20 @@
  return navButtonSetups;   }   - public override List<LookupBoxSetup> GetGlobalNavLookupBoxSetups() { - var lookupBoxSetups = new List<LookupBoxSetup>(); + public override IReadOnlyCollection<NavFormControl> GetGlobalNavFormControls() { + var controls = new List<NavFormControl>();   if( CreateSystem.GetInfo().IsIdenticalToCurrent() ) - return lookupBoxSetups; + return controls;   - lookupBoxSetups.Add( new LookupBoxSetup( 100, "test", "lookup1", delegate { return null; } ) ); - lookupBoxSetups.Add( new LookupBoxSetup( 100, "test", "lookup2", delegate { return null; } ) ); - return lookupBoxSetups; + controls.Add( + NavFormControl.CreateText( + new NavFormControlSetup( 100.ToPixels(), "test" ), + v => new NavFormControlValidationResult( "This doesn’t actually work." ) ) ); + controls.Add( + NavFormControl.CreateText( + new NavFormControlSetup( 100.ToPixels(), "test" ), + v => new NavFormControlValidationResult( "This doesn’t actually work." ) ) ); + return controls;   }   }  } \ No newline at end of file
 
1
2
3
4
5
6
7
8
 
9
10
11
 
86
87
88
89
90
91
 
 
 
 
 
92
93
94
 
1
2
 
3
4
5
 
6
7
8
9
10
 
85
86
87
 
 
 
88
89
90
91
92
93
94
95
@@ -1,11 +1,10 @@
 using System;  using System.Collections.Generic; -using System.Linq;  using System.Web.UI;  using EnterpriseWebLibrary.EnterpriseWebFramework;  using EnterpriseWebLibrary.EnterpriseWebFramework.Controls; -using EnterpriseWebLibrary.EnterpriseWebFramework.Ui;  using EnterpriseWebLibrary.WebSessionState; +using Humanizer;    // OptionalParameter: string someText   @@ -86,9 +85,11 @@
  .Append( new ButtonSetup( "Modal Window", behavior: new OpenModalBehavior( two ) ) )   .Materialize();   - List<LookupBoxSetup> UiEntitySetupBase.CreateLookupBoxSetups() => - new LookupBoxSetup( 100, "Lookup!", "lookup", text => { throw new DataModificationException( "Lookup '" + text + "' failed." ); } ).ToCollection() - .ToList(); + IReadOnlyCollection<NavFormControl> UiEntitySetupBase.GetNavFormControls() => + NavFormControl.CreateText( + new NavFormControlSetup( 100.ToPixels(), "Lookup!" ), + v => new NavFormControlValidationResult( "Lookup '{0}' failed.".FormatWith( v ) ) ) + .ToCollection();     IReadOnlyCollection<ActionComponentSetup> UiEntitySetupBase.GetActions() =>   new ButtonSetup(
 
3
4
5
6
7
8
9
 
30
31
32
33
 
34
35
36
 
 
3
4
5
 
6
7
8
 
29
30
31
 
32
33
34
35
 
@@ -3,7 +3,6 @@
 using System.Web.UI;  using EnterpriseWebLibrary.EnterpriseWebFramework;  using EnterpriseWebLibrary.EnterpriseWebFramework.Controls; -using EnterpriseWebLibrary.EnterpriseWebFramework.Ui;  using EnterpriseWebLibrary.EnterpriseWebFramework.Ui.Entity;    namespace EnterpriseWebLibrary.WebSite.TestPages.SubFolder { @@ -30,7 +29,7 @@
  }     IReadOnlyCollection<ActionComponentSetup> UiEntitySetupBase.GetNavActions() => Enumerable.Empty<ActionComponentSetup>().Materialize(); - List<LookupBoxSetup> UiEntitySetupBase.CreateLookupBoxSetups() => new List<LookupBoxSetup>(); + IReadOnlyCollection<NavFormControl> UiEntitySetupBase.GetNavFormControls() => Enumerable.Empty<NavFormControl>().Materialize();   IReadOnlyCollection<ActionComponentSetup> UiEntitySetupBase.GetActions() => Enumerable.Empty<ActionComponentSetup>().Materialize();   }  } \ No newline at end of file