Beispiel #1
0
 /// <summary>
 /// Creates a form item with these components.
 /// </summary>
 /// <param name="content">Do not pass null.</param>
 /// <param name="setup"></param>
 /// <param name="label">The form-item label.</param>
 /// <param name="validation"></param>
 public static FormItem ToFormItem(
     this IReadOnlyCollection <FlowComponent> content, FormItemSetup setup = null, IReadOnlyCollection <PhrasingComponent> label = null,
     EwfValidation validation = null)
 {
     label = label ?? Enumerable.Empty <PhrasingComponent>().Materialize();
     return(new FormItem(setup, label, content, validation != null ? validation.ToCollection() : Enumerable.Empty <EwfValidation>().Materialize()));
 }
Beispiel #2
0
 /// <summary>
 /// Creates a form item with this form control.
 /// </summary>
 /// <param name="formControl">Do not pass null.</param>
 /// <param name="setup"></param>
 /// <param name="label">The form-item label.</param>
 public static FormItem ToFormItem(
     this FormControl <FlowComponent> formControl, FormItemSetup setup = null, IReadOnlyCollection <PhrasingComponent> label = null)
 {
     label = label ?? Enumerable.Empty <PhrasingComponent>().Materialize();
     return(formControl.PageComponent.ToFormItem(
                setup: setup,
                label: label.Any() && formControl.Labeler != null ? formControl.Labeler.CreateLabel(label) : label,
                validation: formControl.Validation));
 }
Beispiel #3
0
 internal FormItem(
     FormItemSetup setup, IReadOnlyCollection <PhrasingComponent> label, IReadOnlyCollection <FlowComponent> content, EwfValidation validation)
 {
     Setup          = setup ?? new FormItemSetup();
     this.label     = label;
     this.content   = content;
     Validation     = validation;
     ErrorSourceSet = validation != null ? new ErrorSourceSet(validations: validation.ToCollection()) : null;
 }
Beispiel #4
0
 internal FormItem(
     FormItemSetup setup, IReadOnlyCollection <PhrasingComponent> label, IReadOnlyCollection <FlowComponent> content,
     IReadOnlyCollection <EwfValidation> validations)
 {
     Setup            = setup ?? new FormItemSetup();
     this.label       = label;
     this.content     = content;
     this.validations = validations;
     ErrorSourceSet   = validations.Any() ? new ErrorSourceSet(validations: validations) : null;
 }
Beispiel #5
0
 /// <summary>
 /// Creates a form item with this component.
 /// </summary>
 /// <param name="content">Do not pass null.</param>
 /// <param name="setup"></param>
 /// <param name="label">The form-item label.</param>
 /// <param name="validation"></param>
 public static FormItem ToFormItem(
     this FlowComponent content, FormItemSetup setup = null, IReadOnlyCollection <PhrasingComponent> label = null, EwfValidation validation = null) =>
 content.ToCollection().ToFormItem(setup: setup, label: label, validation: validation);