/// <summary> /// Initializes a new instance of the <see cref="RowBase"/> class. /// </summary> /// <param name="cells">Cells in the row.</param> /// <param name="id">OPTIONAL row identifier. DEFAULT is a row without an identifier.</param> /// <param name="format">OPTIONAL format to apply to the whole row. DEFAULT is to leave the format unchanged.</param> protected RowBase( IReadOnlyList <ICell> cells, string id = null, RowFormat format = null) { if (cells == null) { throw new ArgumentNullException(nameof(cells)); } if (!cells.Any()) { throw new ArgumentException(Invariant($"{nameof(cells)} is an empty enumerable.")); } if (cells.Any(_ => _ == null)) { throw new ArgumentException(Invariant($"{nameof(cells)} contains at least one null element.")); } if ((id != null) && string.IsNullOrWhiteSpace(id)) { throw new ArgumentException(Invariant($"{nameof(id)} is white space")); } this.Id = id; this.Cells = cells; this.Format = format; }
/// <summary> /// Initializes a new instance of the <see cref="FlatRow"/> class. /// </summary> /// <param name="cells">Cells in the row.</param> /// <param name="id">OPTIONAL row identifier. DEFAULT is a row without an identifier.</param> /// <param name="format">OPTIONAL format to apply to the whole row. DEFAULT is to leave the format unchanged.</param> public FlatRow( IReadOnlyList <ICell> cells, string id = null, RowFormat format = null) : base(cells, id, format) { }
/// <summary> /// Initializes a new instance of the <see cref="HeaderRowsFormat"/> class. /// </summary> /// <param name="outerBorders">OPTIONAL borders to apply to the outside of the header rows, in the order that they should be applied. DEFAULT is no border.</param> /// <param name="innerBorders">OPTIONAL borders to apply to the cells inside the header rows, in the order that they should be applied. DEFAULT is no border.</param> /// <param name="rowsFormat">OPTIONAL format to apply to all header rows, individually. DEFAULT is to leave the format unchanged.</param> public HeaderRowsFormat( IReadOnlyList <OuterBorder> outerBorders = null, IReadOnlyList <InnerBorder> innerBorders = null, RowFormat rowsFormat = null) : base(outerBorders, innerBorders) { this.RowsFormat = rowsFormat; }
public HeaderRowsFormat DeepCloneWithRowsFormat(RowFormat rowsFormat) { var result = new HeaderRowsFormat( this.OuterBorders?.DeepClone(), this.InnerBorders?.DeepClone(), rowsFormat); return(result); }
public override RowBase DeepCloneWithFormat(RowFormat format) { var result = new FlatRow( this.Cells?.DeepClone(), this.Id?.DeepClone(), format); return(result); }
public DataRowsFormat DeepCloneWithRowsFormat(RowFormat rowsFormat) { var result = new DataRowsFormat( this.OuterBorders?.DeepClone(), this.InnerBorders?.DeepClone(), rowsFormat, this.RowsRepeatingFormat?.DeepClone()); return(result); }
public TableRows DeepCloneWithRowsFormat(RowFormat rowsFormat) { var result = new TableRows( this.HeaderRows?.DeepClone(), this.DataRows?.DeepClone(), this.FooterRows?.DeepClone(), rowsFormat); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="TableRows"/> class. /// </summary> /// <param name="headerRows">OPTIONAL header rows. DEFAULT is no headers rows.</param> /// <param name="dataRows">OPTIONAL data rows. DEFAULT is no data rows.</param> /// <param name="footerRows">OPTIONAL footer rows. DEFAULT is no footer rows.</param> /// <param name="rowsFormat">OPTIONAL format to apply to all rows, individually. DEFAULT is to leave the format unchanged.</param> public TableRows( HeaderRows headerRows = null, DataRows dataRows = null, FooterRows footerRows = null, RowFormat rowsFormat = null) { this.HeaderRows = headerRows; this.DataRows = dataRows; this.FooterRows = footerRows; this.RowsFormat = rowsFormat; }
public override RowBase DeepCloneWithFormat(RowFormat format) { var result = new Row( this.Cells?.DeepClone(), this.Id?.DeepClone(), format, this.ChildRows?.DeepClone(), this.ExpandedSummaryRows?.DeepClone(), this.CollapsedSummaryRows?.DeepClone()); return(result); }
/// <summary> /// Creates a single-cell <see cref="Row"/>. /// </summary> /// <param name="cell">The cell.</param> /// <param name="id">OPTIONAL row identifier. DEFAULT is a row without an identifier.</param> /// <param name="format">OPTIONAL format to apply to the whole row. DEFAULT is to leave the format unchanged.</param> /// <returns> /// The single-cell <see cref="Row"/>. /// </returns> public static Row ToRow( this ICell cell, string id = null, RowFormat format = null) { if (cell == null) { throw new ArgumentNullException(nameof(cell)); } var result = new Row(new[] { cell }, id, format); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="Row"/> class. /// </summary> /// <param name="cells">Cells in the row.</param> /// <param name="id">OPTIONAL row identifier. DEFAULT is a row without an identifier.</param> /// <param name="format">OPTIONAL format to apply to the whole row. DEFAULT is to leave the format unchanged.</param> /// <param name="childRows">OPTIONAL child rows. DEFAULT is none.</param> /// <param name="expandedSummaryRows">OPTIONAL rows that summarizes the children (e.g. a Total row) when this row is expanded. DEFAULT is to forgo summary rows when this row is expanded.</param> /// <param name="collapsedSummaryRows">OPTIONAL rows that summarizes the children (e.g. a Total row) when this row is collapsed. DEFAULT is to forgo summary rows when this row is collapsed.</param> public Row( IReadOnlyList <ICell> cells, string id = null, RowFormat format = null, IReadOnlyList <Row> childRows = null, IReadOnlyList <FlatRow> expandedSummaryRows = null, IReadOnlyList <FlatRow> collapsedSummaryRows = null) : base(cells, id, format) { if ((childRows != null) && childRows.Any(_ => _ == null)) { throw new ArgumentException(Invariant($"{nameof(childRows)} contains at least one null element.")); } if (expandedSummaryRows != null) { if (expandedSummaryRows.Any(_ => _ == null)) { throw new ArgumentException(Invariant($"{nameof(expandedSummaryRows)} contains a null element.")); } if (expandedSummaryRows.Any() && ((childRows == null) || (!childRows.Any()))) { throw new ArgumentException(Invariant($"{nameof(expandedSummaryRows)} is specified when there are no rows in {nameof(childRows)}.")); } } if (collapsedSummaryRows != null) { if (collapsedSummaryRows.Any(_ => _ == null)) { throw new ArgumentException(Invariant($"{nameof(collapsedSummaryRows)} contains a null element.")); } if (collapsedSummaryRows.Any() && ((childRows == null) || (!childRows.Any()))) { throw new ArgumentException(Invariant($"{nameof(collapsedSummaryRows)} is specified when there are no rows in {nameof(childRows)}.")); } } this.ChildRows = childRows; this.ExpandedSummaryRows = expandedSummaryRows; this.CollapsedSummaryRows = collapsedSummaryRows; }
/// <summary> /// Initializes a new instance of the <see cref="DataRowsFormat"/> class. /// </summary> /// <param name="outerBorders">OPTIONAL borders to apply to the outside of the data rows, in the order that they should be applied. DEFAULT is no border.</param> /// <param name="innerBorders">OPTIONAL borders to apply to the cells inside the data rows, in the order that they should be applied. DEFAULT is no border.</param> /// <param name="rowsFormat">OPTIONAL format to apply to all data rows, individually. DEFAULT is to leave the format unchanged.</param> /// <param name="rowsRepeatingFormat">OPTIONAL formats to apply in order for successive data rows, that repeat after the last format is applied. For example, this can be used to achieve a zebra striped table by specifying two <see cref="RowFormat"/> objects having different background colors.</param> public DataRowsFormat( IReadOnlyList <OuterBorder> outerBorders = null, IReadOnlyList <InnerBorder> innerBorders = null, RowFormat rowsFormat = null, IReadOnlyList <RowFormat> rowsRepeatingFormat = null) : base(outerBorders, innerBorders) { if (rowsRepeatingFormat != null) { if (!rowsRepeatingFormat.Any()) { throw new ArgumentException(Invariant($"{nameof(rowsRepeatingFormat)} is an empty enumerable.")); } if (rowsRepeatingFormat.Any(_ => _ == null)) { throw new ArgumentException(Invariant($"{nameof(rowsRepeatingFormat)} contains at least one null element.")); } } this.RowsFormat = rowsFormat; this.RowsRepeatingFormat = rowsRepeatingFormat; }
public virtual RowBase DeepCloneWithFormat(RowFormat format) { 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."); }