/// <summary>
 /// Creates a setup object for a standard URL control.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="placeholder">The hint word or phrase that will appear when the control has an empty value. Do not pass null.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static UrlControlSetup Create(
     DisplaySetup displaySetup             = null, ElementClassSet classes = null, string placeholder = "", string autoFillTokens = "",
     SpecifiedValue <FormAction> action    = null, FormAction valueChangedAction  = null, PageModificationValue <string> pageModificationValue = null,
     Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null)
 {
     return(new UrlControlSetup(
                new TextControlSetup(
                    displaySetup,
                    "url",
                    null,
                    null,
                    false,
                    classes,
                    false,
                    false,
                    placeholder,
                    autoFillTokens,
                    null,
                    null,
                    action,
                    null,
                    valueChangedAction,
                    pageModificationValue,
                    null,
                    validationPredicate,
                    validationErrorNotifier)));
 }
 /// <summary>
 /// Creates a setup object for an obscured (i.e. password) text control.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="widthOverride">The width of the control. This overrides any value that may be specified via CSS. If no width is specified via CSS and you
 /// pass null for this parameter, the width will be based on the maximum number of characters a user can input.</param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="placeholder">The hint word or phrase that will appear when the control has an empty value. Do not pass null.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 /// <returns></returns>
 public static TextControlSetup CreateObscured(
     DisplaySetup displaySetup = null, ContentBasedLength widthOverride = null, ElementClassSet classes       = null, string placeholder = "",
     string autoFillTokens     = "", SpecifiedValue <FormAction> action = null, FormAction valueChangedAction = null,
     PageModificationValue <string> pageModificationValue = null, Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null)
 {
     return(new TextControlSetup(
                displaySetup,
                "password",
                widthOverride,
                null,
                false,
                classes,
                true,
                false,
                placeholder,
                autoFillTokens,
                null,
                null,
                action,
                null,
                valueChangedAction,
                pageModificationValue,
                null,
                validationPredicate,
                validationErrorNotifier));
 }
 /// <summary>
 /// Creates a setup object for a standard text control.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="widthOverride">The width of the control. This overrides any value that may be specified via CSS. If no width is specified via CSS and you
 /// pass null for this parameter, the width will be based on the maximum number of characters a user can input.</param>
 /// <param name="numberOfRows">The number of lines in the text control. Must be one or more.</param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="disableTrimming">Pass true to disable white-space trimming.</param>
 /// <param name="placeholder">The hint word or phrase that will appear when the control has an empty value. Do not pass null.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="checksSpellingAndGrammar">Pass true to enable spelling and grammar checking, false to disable it, and null for default behavior.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action. Currently has no
 /// effect for multiline controls.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static TextControlSetup Create(
     DisplaySetup displaySetup             = null, ContentBasedLength widthOverride = null, int numberOfRows = 1, ElementClassSet classes = null,
     bool disableTrimming                  = false, string placeholder = "", string autoFillTokens = "", bool?checksSpellingAndGrammar    = null,
     SpecifiedValue <FormAction> action    = null, FormAction valueChangedAction  = null, PageModificationValue <string> pageModificationValue = null,
     Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null)
 {
     return(new TextControlSetup(
                displaySetup,
                numberOfRows == 1 ? "text" : "",
                widthOverride,
                numberOfRows,
                false,
                classes,
                disableTrimming,
                false,
                placeholder,
                autoFillTokens,
                null,
                checksSpellingAndGrammar,
                action,
                null,
                valueChangedAction,
                pageModificationValue,
                null,
                validationPredicate,
                validationErrorNotifier));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a setup object for a numeric-text control with auto-complete behavior.
 /// </summary>
 /// <param name="autoCompleteResource">The resource containing the auto-complete items. Do not pass null.</param>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="placeholder">The hint word or phrase that will appear when the control has an empty value. Do not pass null.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="triggersActionWhenItemSelected">Pass true to also trigger the action when the user selects an auto-complete item.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="numericPageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static NumericTextControlSetup CreateAutoComplete(
     ResourceInfo autoCompleteResource, DisplaySetup displaySetup = null, ElementClassSet classes = null, string placeholder = "", string autoFillTokens = "",
     SpecifiedValue <FormAction> action = null, bool triggersActionWhenItemSelected = false, FormAction valueChangedAction   = null,
     PageModificationValue <string> pageModificationValue = null, PageModificationValue <long?> numericPageModificationValue = null,
     Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null)
 {
     return(new NumericTextControlSetup(
                new TextControlSetup(
                    displaySetup,
                    "text",
                    null,
                    null,
                    false,
                    classes,
                    false,
                    true,
                    placeholder,
                    autoFillTokens,
                    autoCompleteResource,
                    null,
                    action,
                    triggersActionWhenItemSelected,
                    valueChangedAction,
                    pageModificationValue,
                    numericPageModificationValue,
                    validationPredicate,
                    validationErrorNotifier),
                validationErrorNotifier));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// For use by impersonation post back logic only. Assumes the user and impersonator (if one exists) are loaded.
        /// </summary>
        /// <param name="user">Pass null to end impersonation. Pass a value to begin impersonation for the specified user or an anonymous user.</param>
        internal void SetUserAndImpersonator(SpecifiedValue <User> user)
        {
            var impersonator = userAndImpersonator.Item2;

            userAndImpersonator = user != null
                                                      ? Tuple.Create(user.Value, impersonator ?? new SpecifiedValue <User>(userAndImpersonator.Item1))
                                                      : Tuple.Create(impersonator.Value, (SpecifiedValue <User>)null);
        }
 private RadioButtonSetup(
     DisplaySetup displaySetup, bool isReadOnly, ElementClassSet classes, SpecifiedValue <FormAction> action,
     PageModificationValue <bool> pageModificationValue)
 {
     DisplaySetup          = displaySetup;
     IsReadOnly            = isReadOnly;
     Classes               = classes;
     Action                = action != null ? action.Value : FormState.Current.FormControlDefaultAction;
     PageModificationValue = pageModificationValue ?? new PageModificationValue <bool>();
 }
Ejemplo n.º 7
0
 private EwfTableItemSetup(
     ElementClassSet classes, CssLength size, TextAlignment textAlignment, TableCellVerticalAlignment verticalAlignment,
     ElementActivationBehavior activationBehavior, SpecifiedValue <int> id, int?rankId) : base(
         classes,
         size,
         textAlignment,
         verticalAlignment,
         activationBehavior,
         id,
         rankId)
 {
 }
 internal DurationControlSetup(
     DisplaySetup displaySetup, bool isReadOnly, ElementClassSet classes, SpecifiedValue <FormAction> action, FormAction valueChangedAction,
     PageModificationValue <string> pageModificationValue, Func <bool, bool> validationPredicate, Action validationErrorNotifier)
 {
     DisplaySetup            = displaySetup;
     IsReadOnly              = isReadOnly;
     Classes                 = classes;
     Action                  = action != null ? action.Value : FormState.Current.FormControlDefaultAction;
     ValueChangedAction      = valueChangedAction;
     PageModificationValue   = pageModificationValue;
     ValidationPredicate     = validationPredicate;
     ValidationErrorNotifier = validationErrorNotifier;
 }
 /// <summary>
 /// Creates a setup object for a standard duration control.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control container.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static DurationControlSetup Create(
     DisplaySetup displaySetup = null, ElementClassSet classes = null, SpecifiedValue <FormAction> action = null, FormAction valueChangedAction = null,
     PageModificationValue <string> pageModificationValue = null, Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null)
 {
     return(new DurationControlSetup(
                displaySetup,
                false,
                classes,
                action,
                valueChangedAction,
                pageModificationValue,
                validationPredicate,
                validationErrorNotifier));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates a setup object for a checkbox list.
 /// </summary>
 /// <param name="items">The items in the list.</param>
 /// <param name="displaySetup"></param>
 /// <param name="includeSelectAndDeselectAllButtons"></param>
 /// <param name="minColumnWidth">The minimum width of each column in the list. Pass null to force a single column.</param>
 /// <param name="action">The action that will occur when the user hits Enter on any of the checkboxes. Pass null to use the current default action.</param>
 /// <param name="selectionChangedAction">The action that will occur when the selection is changed. Pass null for no action.</param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static CheckboxListSetup <ItemIdType> Create <ItemIdType>(
     IEnumerable <SelectListItem <ItemIdType> > items, DisplaySetup displaySetup = null, bool includeSelectAndDeselectAllButtons = false,
     ContentBasedLength minColumnWidth     = null, SpecifiedValue <FormAction> action = null, FormAction selectionChangedAction = null,
     Func <bool, bool> validationPredicate = null, Action validationErrorNotifier     = null)
 {
     return(new CheckboxListSetup <ItemIdType>(
                displaySetup,
                includeSelectAndDeselectAllButtons,
                items,
                minColumnWidth,
                action,
                selectionChangedAction,
                validationPredicate,
                validationErrorNotifier));
 }
 /// <summary>
 /// Creates a setup object for a standard date-and-time control.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="minuteInterval">Affects the slider but does not prevent other values from passing validation.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static DateAndTimeControlSetup Create(
     DisplaySetup displaySetup             = null, ElementClassSet classes = null, string autoFillTokens = "", int minuteInterval = 15,
     SpecifiedValue <FormAction> action    = null, FormAction valueChangedAction  = null, PageModificationValue <string> pageModificationValue = null,
     Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null)
 {
     return(new DateAndTimeControlSetup(
                displaySetup,
                false,
                classes,
                autoFillTokens,
                minuteInterval,
                action,
                valueChangedAction,
                pageModificationValue,
                validationPredicate,
                validationErrorNotifier));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates a setup object for a number control with auto-complete behavior.
 /// </summary>
 /// <param name="autoCompleteResource">The resource containing the auto-complete items. Do not pass null.</param>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="placeholder">The hint word or phrase that will appear when the control has an empty value. Do not pass null.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="triggersActionWhenItemSelected">Pass true to also trigger the action when the user selects an auto-complete item.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static NumberControlSetup CreateAutoComplete(
     ResourceInfo autoCompleteResource, DisplaySetup displaySetup = null, ElementClassSet classes = null, string placeholder = "", string autoFillTokens = "",
     SpecifiedValue <FormAction> action = null, bool triggersActionWhenItemSelected = false, FormAction valueChangedAction   = null,
     PageModificationValue <decimal?> pageModificationValue = null, Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null)
 {
     return(new NumberControlSetup(
                displaySetup,
                false,
                false,
                TextControlSetup.ElementClass.Add(classes ?? ElementClassSet.Empty),
                placeholder,
                autoFillTokens,
                autoCompleteResource,
                action,
                triggersActionWhenItemSelected,
                valueChangedAction,
                pageModificationValue ?? new PageModificationValue <decimal?>(),
                validationPredicate,
                validationErrorNotifier));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Executes the specified method with the specified data modifications being used for any validations that are created, and with the default action being
        /// available to form controls and buttons.
        /// </summary>
        /// <param name="dataModifications"></param>
        /// <param name="method"></param>
        /// <param name="defaultActionOverride">The default action. Pass null to use the post-back corresponding to the first of the data modifications.</param>
        /// <param name="formControlDefaultActionOverride">The form-control-specific default action. Pass null to use the same action for both form controls and
        /// buttons.</param>
        public static T ExecuteWithDataModificationsAndDefaultAction <T>(
            IEnumerable <DataModification> dataModifications, Func <T> method, NonPostBackFormAction defaultActionOverride = null,
            SpecifiedValue <NonPostBackFormAction> formControlDefaultActionOverride = null)
        {
            IReadOnlyCollection <DataModification> dmCollection = dataModifications.ToImmutableArray();

            if (dmCollection.Count == 0)
            {
                throw new ApplicationException("There must be at least one data modification.");
            }
            dataModificationAsserter(dmCollection);

            Current.stack.Push((defaultActionOverride, formControlDefaultActionOverride, new Stack <Func <bool> >(), dmCollection));
            try {
                return(method());
            }
            finally {
                Current.stack.Pop();
            }
        }
 /// <summary>
 /// Creates a setup object for a standard drop-down.
 /// </summary>
 /// <param name="items">The items in the list. There must be at least one.</param>
 /// <param name="displaySetup"></param>
 /// <param name="useNativeControl">Pass true to force the drop-down list to be a native control.</param>
 /// <param name="width">The width of the list. This overrides any value that may be specified via CSS. If no width is specified via CSS and you pass null
 /// for this parameter, the list will be just wide enough to show the selected item and will resize whenever the selected item is changed.</param>
 /// <param name="unlistedSelectedItemLabelGetter">A function that will be called if the selected item ID does not match any list item and is not the default
 /// value of the type. The function takes the selected item ID and returns the label of the unlisted selected item, which will appear before all other
 /// items in the list. The string " (invalid)" will be appended to the label.</param>
 /// <param name="placeholderText">The default-value placeholder's text. Do not pass null.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the drop-down list. Pass null to use the current default action.</param>
 /// <param name="selectionChangedAction">The action that will occur when the selection is changed. Pass null for no action.</param>
 /// <param name="itemIdPageModificationValue"></param>
 /// <param name="itemMatchPageModificationSetups"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static DropDownSetup <ItemIdType> Create <ItemIdType>(
     IEnumerable <SelectListItem <ItemIdType> > items, DisplaySetup displaySetup = null, bool useNativeControl = false, ContentBasedLength width                     = null,
     Func <ItemIdType, string> unlistedSelectedItemLabelGetter = null, string placeholderText = "Please select", string autoFillTokens                               = "",
     SpecifiedValue <FormAction> action = null, FormAction selectionChangedAction             = null, PageModificationValue <ItemIdType> itemIdPageModificationValue = null,
     IReadOnlyCollection <ListItemMatchPageModificationSetup <ItemIdType> > itemMatchPageModificationSetups = null, Func <bool, bool> validationPredicate = null,
     Action validationErrorNotifier = null) =>
 new DropDownSetup <ItemIdType>(
     displaySetup,
     useNativeControl,
     width,
     false,
     null,
     unlistedSelectedItemLabelGetter,
     placeholderText,
     items,
     autoFillTokens,
     action,
     selectionChangedAction,
     itemIdPageModificationValue,
     itemMatchPageModificationSetups,
     validationPredicate,
     validationErrorNotifier);
        /// <summary>
        /// Creates a change-based checkbox list, which is a checkbox list that is based on changes to the selections rather than the absolute set of selected
        /// items.
        /// </summary>
        /// <param name="items">The items in the list.</param>
        /// <param name="selectedItemIds">The selected-item IDs.</param>
        /// <param name="modificationMethod">A method that executes the change handlers of the items that were selected or deselected on this post back.</param>
        /// <param name="displaySetup"></param>
        /// <param name="includeSelectAndDeselectAllButtons"></param>
        /// <param name="minColumnWidth">The minimum width of each column in the list. Pass null to force a single column.</param>
        /// <param name="uiSelectedItemIds"></param>
        /// <param name="action">The action that will occur when the user hits Enter on any of the checkboxes. Pass null to use the current default action.</param>
        /// <param name="selectionChangedAction">The action that will occur when the selection is changed. Pass null for no action.</param>
        /// <param name="validationPredicate"></param>
        /// <param name="validationErrorNotifier"></param>
        public static CheckboxList <ItemIdType> Create <ItemIdType>(
            IEnumerable <ChangeBasedListItem <ItemIdType> > items, IEnumerable <ItemIdType> selectedItemIds, out Action modificationMethod,
            DisplaySetup displaySetup = null, bool includeSelectAndDeselectAllButtons             = false, ContentBasedLength minColumnWidth = null,
            IEnumerable <ItemIdType> uiSelectedItemIds = null, SpecifiedValue <FormAction> action = null, FormAction selectionChangedAction  = null,
            Func <bool, bool> validationPredicate      = null, Action validationErrorNotifier     = null)
        {
            items = items.Materialize();
            var selectedItemIdSet = selectedItemIds.ToImmutableHashSet();

            ImmutableHashSet <ItemIdType> selectedItemIdsInPostBack = null;

            modificationMethod = () => {
                if (selectedItemIdsInPostBack == null)
                {
                    return;
                }
                var changedItemIds = selectedItemIdsInPostBack.Except(selectedItemIdSet).Union(selectedItemIdSet.Except(selectedItemIdsInPostBack)).ToArray();
                foreach (var i in items.Where(i => changedItemIds.Contains(i.Item.Id)))
                {
                    i.ChangeHandler(selectedItemIdsInPostBack.Contains(i.Item.Id));
                }
            };

            return(new CheckboxList <ItemIdType>(
                       CheckboxListSetup.Create(
                           from i in items select i.Item,
                           displaySetup: displaySetup,
                           includeSelectAndDeselectAllButtons: includeSelectAndDeselectAllButtons,
                           minColumnWidth: minColumnWidth,
                           action: action,
                           selectionChangedAction: selectionChangedAction,
                           validationPredicate: validationPredicate,
                           validationErrorNotifier: validationErrorNotifier),
                       uiSelectedItemIds ?? selectedItemIdSet,
                       validationMethod: (postBackValue, validator) => selectedItemIdsInPostBack = postBackValue.ToImmutableHashSet()));
        }
 internal DateAndTimeControlSetup(
     DisplaySetup displaySetup, bool isReadOnly, ElementClassSet classes, string autoFillTokens, int?minuteInterval, SpecifiedValue <FormAction> action,
     FormAction valueChangedAction, PageModificationValue <string> pageModificationValue, Func <bool, bool> validationPredicate,
     Action validationErrorNotifier)
 {
     DisplaySetup            = displaySetup;
     IsReadOnly              = isReadOnly;
     Classes                 = classes;
     AutoFillTokens          = autoFillTokens;
     MinuteInterval          = minuteInterval;
     Action                  = action != null ? action.Value : FormState.Current.FormControlDefaultAction;
     ValueChangedAction      = valueChangedAction;
     PageModificationValue   = pageModificationValue;
     ValidationPredicate     = validationPredicate;
     ValidationErrorNotifier = validationErrorNotifier;
 }
 /// <summary>
 /// Creates a setup object for a standard radio button.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="pageModificationValue"></param>
 public static RadioButtonSetup Create(
     DisplaySetup displaySetup = null, ElementClassSet classes = null, SpecifiedValue <FormAction> action = null,
     PageModificationValue <bool> pageModificationValue = null)
 {
     return(new RadioButtonSetup(displaySetup, false, classes, action, pageModificationValue));
 }
 /// <summary>
 /// Creates a setup object for a standard checkbox.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 public static CheckboxSetup Create(
     DisplaySetup displaySetup = null, ElementClassSet classes = null, SpecifiedValue <FormAction> action = null, FormAction valueChangedAction = null,
     PageModificationValue <bool> pageModificationValue = null)
 {
     return(new CheckboxSetup(displaySetup, false, classes, action, valueChangedAction, pageModificationValue));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Creates an item setup object with a specified ID type.
 /// </summary>
 /// <param name="classes">The classes. When used on a column, sets the classes on every cell since most styles don't work on col elements.</param>
 /// <param name="size">The height or width. For an EWF table, this is the row height. For a column primary table, this is the column width. If you specify
 /// percentage widths for some or all columns in a table, these values need not add up to 100; they will be automatically scaled if necessary. The automatic
 /// scaling will not happen if there are any columns without a specified width.</param>
 /// <param name="textAlignment">The text alignment of the cells in this item.</param>
 /// <param name="verticalAlignment">The vertical alignment of the cells in this item.</param>
 /// <param name="activationBehavior">The activation behavior.</param>
 /// <param name="id">A value that uniquely identifies this item in table-level and group-level item actions. If you specify this, the item will have a
 /// checkbox that enables it to be included in the actions.</param>
 /// <param name="rankId">The rank ID for this item, which is used for item reordering.</param>
 public static EwfTableItemSetup <IdType> CreateWithIdType <IdType>(
     ElementClassSet classes = null, CssLength size = null, TextAlignment textAlignment = TextAlignment.NotSpecified,
     TableCellVerticalAlignment verticalAlignment = TableCellVerticalAlignment.NotSpecified, ElementActivationBehavior activationBehavior = null,
     SpecifiedValue <IdType> id = null, int?rankId = null) =>
 new EwfTableItemSetup <IdType>(classes, size, textAlignment, verticalAlignment, activationBehavior, id, rankId);
Ejemplo n.º 20
0
 internal ValueDelta(string valueName, T @new, SpecifiedValue <T> old)
 {
     ValueName = valueName;
     New       = @new;
     this.old  = old;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Creates a setup object for a standard radio button.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the container.</param>
 /// <param name="highlightedWhenSelected"></param>
 /// <param name="action">The action that will occur when the user hits Enter on the radio button. Pass null to use the current default action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="nestedContentGetter">A function that gets the content that will appear beneath the radio button.</param>
 /// <param name="nestedContentAlwaysDisplayed">Pass true to force the nested content to always be displayed instead of only when the button is selected.
 /// </param>
 public static FlowRadioButtonSetup Create(
     DisplaySetup displaySetup = null, ElementClassSet classes = null, bool highlightedWhenSelected = false, SpecifiedValue <FormAction> action = null,
     PageModificationValue <bool> pageModificationValue = null, Func <IReadOnlyCollection <FlowComponent> > nestedContentGetter = null,
     bool nestedContentAlwaysDisplayed = false)
 {
     return(new FlowRadioButtonSetup(
                displaySetup,
                classes,
                RadioButtonSetup.Create(action: action, pageModificationValue: pageModificationValue),
                highlightedWhenSelected,
                nestedContentGetter,
                nestedContentAlwaysDisplayed));
 }
 /// <summary>
 /// Creates a change-based checkbox list, which is a checkbox list that is based on changes to the selections rather than the absolute set of selected
 /// items.
 /// </summary>
 /// <param name="items">The items in the list.</param>
 /// <param name="modificationMethod">A method that executes the change handlers of the items that were selected or deselected on this post back.</param>
 /// <param name="displaySetup"></param>
 /// <param name="includeSelectAndDeselectAllButtons"></param>
 /// <param name="minColumnWidth">The minimum width of each column in the list. Pass null to force a single column.</param>
 /// <param name="action">The action that will occur when the user hits Enter on any of the checkboxes. Pass null to use the current default action.</param>
 /// <param name="selectionChangedAction">The action that will occur when the selection is changed. Pass null for no action.</param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static CheckboxList <ItemIdType> Create <ItemIdType>(
     IEnumerable <ChangeBasedListItemWithSelectionState <ItemIdType> > items, out Action modificationMethod, DisplaySetup displaySetup = null,
     bool includeSelectAndDeselectAllButtons = false, ContentBasedLength minColumnWidth    = null, SpecifiedValue <FormAction> action = null,
     FormAction selectionChangedAction       = null, Func <bool, bool> validationPredicate = null, Action validationErrorNotifier     = null)
 {
     items = items.Materialize();
     return(Create(
                from i in items select i.Item,
                from i in items where i.IsSelected select i.Item.Item.Id,
                out modificationMethod,
                displaySetup: displaySetup,
                includeSelectAndDeselectAllButtons: includeSelectAndDeselectAllButtons,
                minColumnWidth: minColumnWidth,
                uiSelectedItemIds: from i in items where i.IsSelectedInUi select i.Item.Item.Id,
                action: action,
                selectionChangedAction: selectionChangedAction,
                validationPredicate: validationPredicate,
                validationErrorNotifier: validationErrorNotifier));
 }
 /// <summary>
 /// Creates a setup object for a standard radio list.
 /// </summary>
 /// <param name="items">The items in the list. There must be at least one.</param>
 /// <param name="displaySetup"></param>
 /// <param name="useHorizontalLayout">Pass true if you want the radio buttons to be laid out horizontally instead of vertically.</param>
 /// <param name="classes">The classes on the list container.</param>
 /// <param name="unlistedSelectedItemLabelGetter">A function that will be called if the selected item ID does not match any list item and is not the default
 /// value of the type. The function takes the selected item ID and returns the label of the unlisted selected item, which will appear before all other
 /// items in the list. The string " (invalid)" will be appended to the label.</param>
 /// <param name="disableSingleButtonDetection">Pass true to allow just a single radio button to be displayed for this list. Use with caution, as this
 /// violates the HTML specification.</param>
 /// <param name="action">The action that will occur when the user hits Enter on a radio button. Pass null to use the current default action.</param>
 /// <param name="selectionChangedAction">The action that will occur when the selection is changed. Pass null for no action.</param>
 /// <param name="itemIdPageModificationValue"></param>
 /// <param name="itemMatchPageModificationSetups"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static RadioListSetup <ItemIdType> Create <ItemIdType>(
     IEnumerable <SelectListItem <ItemIdType> > items, DisplaySetup displaySetup = null, bool useHorizontalLayout = false, ElementClassSet classes            = null,
     Func <ItemIdType, string> unlistedSelectedItemLabelGetter = null, bool disableSingleButtonDetection          = false, SpecifiedValue <FormAction> action = null,
     FormAction selectionChangedAction = null, PageModificationValue <ItemIdType> itemIdPageModificationValue     = null,
     IReadOnlyCollection <ListItemMatchPageModificationSetup <ItemIdType> > itemMatchPageModificationSetups = null, Func <bool, bool> validationPredicate = null,
     Action validationErrorNotifier = null) =>
 new RadioListSetup <ItemIdType>(
     displaySetup,
     useHorizontalLayout,
     false,
     classes,
     unlistedSelectedItemLabelGetter,
     items,
     FreeFormRadioListSetup.Create(
         disableSingleButtonDetection: disableSingleButtonDetection,
         selectionChangedAction: selectionChangedAction,
         itemIdPageModificationValue: itemIdPageModificationValue,
         itemMatchPageModificationSetups: itemMatchPageModificationSetups,
         validationPredicate: validationPredicate,
         validationErrorNotifier: validationErrorNotifier),
     action);
Ejemplo n.º 24
0
 /// <summary>
 /// Creates a setup object for a standard imprecise-number control.
 /// </summary>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the control.</param>
 /// <param name="autoFillTokens">A list of auto-fill detail tokens (see
 /// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens), or "off" to instruct the browser to disable auto-fill
 /// (see https://stackoverflow.com/a/23234498/35349 for an explanation of why this could be ignored). Do not pass null.</param>
 /// <param name="action">The action that will occur when the user hits Enter on the control. Pass null to use the current default action.</param>
 /// <param name="valueChangedAction">The action that will occur when the value is changed. Pass null for no action.</param>
 /// <param name="pageModificationValue"></param>
 /// <param name="validationPredicate"></param>
 /// <param name="validationErrorNotifier"></param>
 public static ImpreciseNumberControlSetup Create(
     DisplaySetup displaySetup      = null, ElementClassSet classes = null, string autoFillTokens = "", SpecifiedValue <FormAction> action = null,
     FormAction valueChangedAction  = null, PageModificationValue <decimal> pageModificationValue = null, Func <bool, bool> validationPredicate = null,
     Action validationErrorNotifier = null)
 {
     return(new ImpreciseNumberControlSetup(
                new NumberControlSetup(
                    displaySetup,
                    true,
                    false,
                    classes,
                    "",
                    autoFillTokens,
                    null,
                    action,
                    null,
                    valueChangedAction,
                    pageModificationValue ?? new PageModificationValue <decimal>(),
                    validationPredicate,
                    validationErrorNotifier)));
 }