/// <summary>
        /// Initializes a new instance of the <see cref="OperationOutputCellBase{TValue}"/> class.
        /// </summary>
        /// <param name="id">The cell's unique identifier.</param>
        /// <param name="columnsSpanned">The number of columns spanned or null if none (cell occupies a single column).</param>
        /// <param name="details">Details about the cell.</param>
        /// <param name="validation">The validation to perform.</param>
        /// <param name="validationEvents">The events that record the validation of this cell.</param>
        /// <param name="defaultAvailability">The default availability of the cell (before <paramref name="availabilityCheck"/> is run).</param>
        /// <param name="availabilityCheck">The availability check to perform.</param>
        /// <param name="availabilityCheckEvents">The events that record the availability checks on this cell.</param>
        /// <param name="operation">The operation.</param>
        /// <param name="operationExecutionEvents">The events that record the execution of <paramref name="operation"/>.</param>
        protected OperationOutputCellBase(
            string id,
            int?columnsSpanned,
            string details,
            Validation validation,
            IReadOnlyList <CellValidationEventBase> validationEvents,
            Availability defaultAvailability,
            AvailabilityCheck availabilityCheck,
            IReadOnlyList <CellAvailabilityCheckEventBase> availabilityCheckEvents,
            IReturningOperation <TValue> operation,
            IReadOnlyList <CellOpExecutionEventBase> operationExecutionEvents)
            : base(id, columnsSpanned, details, validation, validationEvents, defaultAvailability, availabilityCheck, availabilityCheckEvents)
        {
            if (operation == null)
            {
                throw new ArgumentNullException(nameof(operation));
            }

            if ((operationExecutionEvents != null) && operationExecutionEvents.Any(_ => _ == null))
            {
                throw new ArgumentException(Invariant($"{nameof(operationExecutionEvents)} contains a null element."));
            }

            this.Operation = operation;
            this.OperationExecutionEvents = operationExecutionEvents;
        }
Пример #2
0
        /// <summary>
        /// Builds an <see cref="AvailabilityCheck"/>.
        /// </summary>
        /// <param name="operation">The operation to execute to check the availability of the subject.</param>
        /// <param name="messageFormatKind">OPTIONAL kind of format to apply to the message that is emitted about the availability of the subject.  DEFAULT is to omit this specification.</param>
        /// <param name="details">OPTIONAL details about this availability check.  DEFAULT is to omit any details.</param>
        /// <returns>
        /// The validation.
        /// </returns>
        public static AvailabilityCheck CreateAvailabilityCheck(
            this IReturningOperation <AvailabilityCheckResult> operation,
            MessageFormatKind?messageFormatKind = null,
            string details = null)
        {
            var result = new AvailabilityCheck(operation, messageFormatKind, details);

            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NullCellBase"/> class.
 /// </summary>
 /// <param name="id">Unique identifier of the cell.</param>
 /// <param name="columnsSpanned">Number of columns spanned or null if none (cell occupies a single column).</param>
 /// <param name="details">Details about the cell.</param>
 /// <param name="validation">The validation to perform.</param>
 /// <param name="validationEvents">The events that record the validation of this cell.</param>
 /// <param name="defaultAvailability">The default availability of the cell (before <paramref name="availabilityCheck"/> is run).</param>
 /// <param name="availabilityCheck">The availability check to perform.</param>
 /// <param name="availabilityCheckEvents">The events that record the availability checks on this cell.</param>
 protected NullCellBase(
     string id,
     int?columnsSpanned,
     string details,
     Validation validation,
     IReadOnlyList <CellValidationEventBase> validationEvents,
     Availability defaultAvailability,
     AvailabilityCheck availabilityCheck,
     IReadOnlyList <CellAvailabilityCheckEventBase> availabilityCheckEvents)
     : base(id, columnsSpanned, details, validation, validationEvents, defaultAvailability, availabilityCheck, availabilityCheckEvents)
 {
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConstOutputCellBase{TValue}"/> class.
 /// </summary>
 /// <param name="id">The cell's unique identifier.</param>
 /// <param name="columnsSpanned">The number of columns spanned or null if none (cell occupies a single column).</param>
 /// <param name="details">Details about the cell.</param>
 /// <param name="validation">The validation to perform.</param>
 /// <param name="validationEvents">The events that record the validation of this cell.</param>
 /// <param name="defaultAvailability">The default availability of the cell (before <paramref name="availabilityCheck"/> is run).</param>
 /// <param name="availabilityCheck">The availability check to perform.</param>
 /// <param name="availabilityCheckEvents">The events that record the availability checks on this cell.</param>
 /// <param name="value">The cell's value.</param>
 protected ConstOutputCellBase(
     string id,
     int?columnsSpanned,
     string details,
     Validation validation,
     IReadOnlyList <CellValidationEventBase> validationEvents,
     Availability defaultAvailability,
     AvailabilityCheck availabilityCheck,
     IReadOnlyList <CellAvailabilityCheckEventBase> availabilityCheckEvents,
     TValue value)
     : base(id, columnsSpanned, details, validation, validationEvents, defaultAvailability, availabilityCheck, availabilityCheckEvents)
 {
     this.Value = value;
 }
Пример #5
0
        /// <summary>
        /// Builds a disabled <see cref="IConstOutputCell{TValue}"/>.
        /// </summary>
        /// <typeparam name="TValue">The type of value.</typeparam>
        /// <param name="id">OPTIONAL unique identifier of the cell.  DEFAULT is a cell with no unique identifier.</param>
        /// <param name="columnsSpanned">OPTIONAL number of columns spanned or null if none (cell occupies a single column).  DEFAULT is none.</param>
        /// <param name="details">OPTIONAL details about the cell.  DEFAULT is to omit any details.</param>
        /// <param name="validation">OPTIONAL validation to perform.  DEFAULT is no validation.</param>
        /// <param name="availabilityCheck">OPTIONAL availability check to perform.  DEFAULT is a cell with no availability check.</param>
        /// <param name="valueFormat">OPTIONAL format to apply to the cell value.  DEFAULT is to leave the format unchanged.</param>
        /// <param name="format">OPTIONAL format to apply to the cell.  DEFAULT is to leave the format unchanged.</param>
        /// <param name="hoverOver">OPTIONAL hover-over for the cell.  DEFAULT is no hover-over.</param>
        /// <returns>
        /// The cell.
        /// </returns>
        public static InputCell <TValue> CreateDisabledInput <TValue>(
            string id             = null,
            int?columnsSpanned    = null,
            string details        = null,
            Validation validation = null,
            AvailabilityCheck availabilityCheck   = null,
            ICellValueFormat <TValue> valueFormat = null,
            CellFormat format    = null,
            IHoverOver hoverOver = null)
        {
            var result = new InputCell <TValue>(id, columnsSpanned, details, validation, null, Availability.Disabled, availabilityCheck, null, null, valueFormat, format, hoverOver);

            return(result);
        }
Пример #6
0
        public override NotSlottedCellBase DeepCloneWithAvailabilityCheck(AvailabilityCheck availabilityCheck)
        {
            var result = new NullCell(
                this.Id?.DeepClone(),
                this.ColumnsSpanned?.DeepClone(),
                this.Details?.DeepClone(),
                this.Validation?.DeepClone(),
                this.ValidationEvents?.DeepClone(),
                this.DefaultAvailability.DeepClone(),
                availabilityCheck,
                this.AvailabilityCheckEvents?.DeepClone(),
                this.Format?.DeepClone(),
                this.HoverOver?.DeepClone(),
                this.Link?.DeepClone());

            return(result);
        }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NullCell"/> class.
 /// </summary>
 /// <param name="id">OPTIONAL unique identifier of the cell.  DEFAULT is a cell with no unique identifier.</param>
 /// <param name="columnsSpanned">OPTIONAL number of columns spanned or null if none (cell occupies a single column).  DEFAULT is none.</param>
 /// <param name="details">OPTIONAL details about the cell.  DEFAULT is to omit any details.</param>
 /// <param name="validation">OPTIONAL validation to perform.  DEFAULT is no validation.</param>
 /// <param name="validationEvents">OPTIONAL events that record the validation of this cell.  DEFAULT is a cell that has not yet been validated.</param>
 /// <param name="defaultAvailability">OPTIONAL default availability of the cell (before <paramref name="availabilityCheck"/> is run).  DEFAULT is an enabled cell.</param>
 /// <param name="availabilityCheck">OPTIONAL availability check to perform.  DEFAULT is a cell with no availability check.</param>
 /// <param name="availabilityCheckEvents">OPTIONAL events that record the availability checks on this cell.  DEFAULT is a cell that has not yet had an availability check.</param>
 /// <param name="format">OPTIONAL format to apply to the cell.  DEFAULT is to leave the format unchanged.</param>
 /// <param name="hoverOver">OPTIONAL hover-over for the cell.  DEFAULT is no hover-over.</param>
 /// <param name="link">OPTIONAL link to some resource.  DEFAULT is no link.</param>
 public NullCell(
     string id             = null,
     int?columnsSpanned    = null,
     string details        = null,
     Validation validation = null,
     IReadOnlyList <CellValidationEventBase> validationEvents = null,
     Availability defaultAvailability    = Availability.Enabled,
     AvailabilityCheck availabilityCheck = null,
     IReadOnlyList <CellAvailabilityCheckEventBase> availabilityCheckEvents = null,
     CellFormat format    = null,
     IHoverOver hoverOver = null,
     ILink link           = null)
     : base(id, columnsSpanned, details, validation, validationEvents, defaultAvailability, availabilityCheck, availabilityCheckEvents)
 {
     this.Format    = format;
     this.HoverOver = hoverOver;
     this.Link      = link;
 }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InputCellBase{TValue}"/> class.
        /// </summary>
        /// <param name="id">The cell's unique identifier.</param>
        /// <param name="columnsSpanned">The number of columns spanned or null if none (cell occupies a single column).</param>
        /// <param name="details">Details about the cell.</param>
        /// <param name="validation">The validation to perform.</param>
        /// <param name="validationEvents">The events that record the validation of this cell.</param>
        /// <param name="defaultAvailability">The default availability of the cell (before <paramref name="availabilityCheck"/> is run).</param>
        /// <param name="availabilityCheck">The availability check to perform.</param>
        /// <param name="availabilityCheckEvents">The events that record the availability checks on this cell.</param>
        /// <param name="inputEvents">The events that record the manipulation of this cell's value.</param>
        protected InputCellBase(
            string id,
            int?columnsSpanned,
            string details,
            Validation validation,
            IReadOnlyList <CellValidationEventBase> validationEvents,
            Availability defaultAvailability,
            AvailabilityCheck availabilityCheck,
            IReadOnlyList <CellAvailabilityCheckEventBase> availabilityCheckEvents,
            IReadOnlyList <CellInputEventBase> inputEvents)
            : base(id, columnsSpanned, details, validation, validationEvents, defaultAvailability, availabilityCheck, availabilityCheckEvents)
        {
            if ((inputEvents != null) && inputEvents.Any(_ => _ == null))
            {
                throw new ArgumentException(Invariant($"{nameof(inputEvents)} contains a null element."));
            }

            this.InputEvents = inputEvents;
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotSlottedCellBase"/> class.
        /// </summary>
        /// <param name="id">The cell's unique identifier.</param>
        /// <param name="columnsSpanned">The number of columns spanned or null if none (cell occupies a single column).</param>
        /// <param name="details">Details about the cell.</param>
        /// <param name="validation">The validation to perform.</param>
        /// <param name="validationEvents">The events that record the validation of this cell.</param>
        /// <param name="defaultAvailability">The default availability of the cell (before <paramref name="availabilityCheck"/> is run).</param>
        /// <param name="availabilityCheck">The availability check to perform.</param>
        /// <param name="availabilityCheckEvents">The events that record the availability checks on this cell.</param>
        protected NotSlottedCellBase(
            string id,
            int?columnsSpanned,
            string details,
            Validation validation,
            IReadOnlyList <CellValidationEventBase> validationEvents,
            Availability defaultAvailability,
            AvailabilityCheck availabilityCheck,
            IReadOnlyList <CellAvailabilityCheckEventBase> availabilityCheckEvents)
            : base(id, columnsSpanned, details)
        {
            if ((validationEvents != null) && validationEvents.Any(_ => _ == null))
            {
                throw new ArgumentException(Invariant($"{nameof(validationEvents)} contains a null element."));
            }

            if ((validation == null) && (validationEvents != null) && validationEvents.Any())
            {
                throw new ArgumentException(Invariant($"There is no {nameof(validation)} specified, however one or more {nameof(validationEvents)} exists."));
            }

            if ((defaultAvailability != Availability.Enabled) && (defaultAvailability != Availability.Disabled))
            {
                throw new ArgumentOutOfRangeException(Invariant($"{nameof(defaultAvailability)} is neither {nameof(Availability)}.{nameof(Availability.Enabled)} nor {nameof(Availability)}.{nameof(Availability.Disabled)}."));
            }

            if ((availabilityCheckEvents != null) && availabilityCheckEvents.Any(_ => _ == null))
            {
                throw new ArgumentException(Invariant($"{nameof(availabilityCheckEvents)} contains a null element."));
            }

            if ((availabilityCheck == null) && (availabilityCheckEvents != null) && availabilityCheckEvents.Any())
            {
                throw new ArgumentException(Invariant($"There is no {nameof(availabilityCheck)} specified, however one or more {nameof(availabilityCheckEvents)} exists."));
            }

            this.Validation              = validation;
            this.ValidationEvents        = validationEvents;
            this.DefaultAvailability     = defaultAvailability;
            this.AvailabilityCheck       = availabilityCheck;
            this.AvailabilityCheckEvents = availabilityCheckEvents;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OperationCell{TValue}"/> class.
 /// </summary>
 /// <param name="operation">The operation.</param>
 /// <param name="id">OPTIONAL unique identifier of the cell.  DEFAULT is a cell with no unique identifier.</param>
 /// <param name="columnsSpanned">OPTIONAL number of columns spanned or null if none (cell occupies a single column).  DEFAULT is none.</param>
 /// <param name="details">OPTIONAL details about the cell.  DEFAULT is to omit any details.</param>
 /// <param name="validation">OPTIONAL validation to perform.  DEFAULT is no validation.</param>
 /// <param name="validationEvents">OPTIONAL events that record the validation of this cell.  DEFAULT is a cell that has not yet been validated.</param>
 /// <param name="defaultAvailability">OPTIONAL default availability of the cell (before <paramref name="availabilityCheck"/> is run).  DEFAULT is an enabled cell.</param>
 /// <param name="availabilityCheck">OPTIONAL availability check to perform.  DEFAULT is a cell with no availability check.</param>
 /// <param name="availabilityCheckEvents">OPTIONAL events that record the availability checks on this cell.  DEFAULT is a cell that has not yet had an availability check.</param>
 /// <param name="operationExecutionEvents">OPTIONAL events that record the execution of <paramref name="operation"/>.  DEFAULT is a cell who's operation has not yet been executed.</param>
 /// <param name="valueFormat">OPTIONAL format to apply to the cell value.  DEFAULT is to leave the format unchanged.</param>
 /// <param name="format">OPTIONAL format to apply to the cell.  DEFAULT is to leave the format unchanged.</param>
 /// <param name="hoverOver">OPTIONAL hover-over for the cell.  DEFAULT is no hover-over.</param>
 /// <param name="link">OPTIONAL link to some resource.  DEFAULT is no link.</param>
 public OperationCell(
     IReturningOperation <TValue> operation,
     string id             = null,
     int?columnsSpanned    = null,
     string details        = null,
     Validation validation = null,
     IReadOnlyList <CellValidationEventBase> validationEvents = null,
     Availability defaultAvailability    = Availability.Enabled,
     AvailabilityCheck availabilityCheck = null,
     IReadOnlyList <CellAvailabilityCheckEventBase> availabilityCheckEvents = null,
     IReadOnlyList <CellOpExecutionEventBase> operationExecutionEvents      = null,
     ICellValueFormat <TValue> valueFormat = null,
     CellFormat format    = null,
     IHoverOver hoverOver = null,
     ILink link           = null)
     : base(id, columnsSpanned, details, validation, validationEvents, defaultAvailability, availabilityCheck, availabilityCheckEvents, operation, operationExecutionEvents)
 {
     this.ValueFormat = valueFormat;
     this.Format      = format;
     this.HoverOver   = hoverOver;
     this.Link        = link;
 }
Пример #11
0
 public virtual NotSlottedCellBase DeepCloneWithAvailabilityCheck(AvailabilityCheck availabilityCheck)
 {
     throw new NotImplementedException("This method should be abstract.  It was generated as virtual so that you aren't forced to override it when you create a new model that derives from this model.  It will be overridden in the generated designer file.");
 }