// NOTE: Change table actions to be IEnumerable<namedType> rather than IEnumerable<Tuple<>>. private EwfTable( bool hideIfEmpty, EwfTableStyle style, IEnumerable <string> classes, string postBackIdBase, string caption, string subCaption, bool allowExportToExcel, IEnumerable <Tuple <string, Action> > tableActions, IEnumerable <EwfTableField> fields, IEnumerable <EwfTableItem> headItems, DataRowLimit defaultItemLimit, bool disableEmptyFieldDetection, IEnumerable <EwfTableItemGroup> itemGroups, IEnumerable <TailUpdateRegion> tailUpdateRegions) { this.hideIfEmpty = hideIfEmpty; this.style = style; this.classes = (classes ?? new string[0]).ToList().AsReadOnly(); this.postBackIdBase = PostBack.GetCompositeId("ewfTable", postBackIdBase); this.caption = caption; this.subCaption = subCaption; this.allowExportToExcel = allowExportToExcel; this.tableActions = (tableActions ?? new Tuple <string, Action> [0]).ToList().AsReadOnly(); if (fields != null) { if (!fields.Any()) { throw new ApplicationException("If fields are specified, there must be at least one of them."); } specifiedFields = fields.ToArray(); } this.headItems = (headItems ?? new EwfTableItem[0]).ToList(); this.defaultItemLimit = defaultItemLimit; this.disableEmptyFieldDetection = disableEmptyFieldDetection; this.itemGroups = itemGroups.ToImmutableArray(); this.tailUpdateRegions = tailUpdateRegions != null?tailUpdateRegions.ToImmutableArray() : ImmutableArray <TailUpdateRegion> .Empty; }
// NOTE: Change table actions to be IEnumerable<namedType> rather than IEnumerable<Tuple<>>. private EwfTable( bool hideIfEmpty, EwfTableStyle style, IEnumerable <string> classes, string postBackIdBase, string caption, string subCaption, bool allowExportToExcel, IEnumerable <Tuple <string, Action> > tableActions, IEnumerable <EwfTableField> fields, IEnumerable <EwfTableItem> headItems, DataRowLimit defaultItemLimit, bool disableEmptyFieldDetection, IEnumerable <EwfTableItemGroup> itemGroups, IEnumerable <TailUpdateRegion> tailUpdateRegions) { this.hideIfEmpty = hideIfEmpty; this.style = style; this.classes = (classes ?? new string[0]).ToList().AsReadOnly(); this.postBackIdBase = PostBack.GetCompositeId("ewfTable", postBackIdBase); this.caption = caption; this.subCaption = subCaption; this.allowExportToExcel = allowExportToExcel; this.tableActions = (tableActions ?? new Tuple <string, Action> [0]).ToList().AsReadOnly(); if (fields != null) { if (!fields.Any()) { throw new ApplicationException("If fields are specified, there must be at least one of them."); } specifiedFields = fields.ToArray(); } this.headItems = (headItems ?? new EwfTableItem[0]).ToList(); this.defaultItemLimit = defaultItemLimit; this.disableEmptyFieldDetection = disableEmptyFieldDetection; this.itemGroups = itemGroups.ToImmutableArray(); this.tailUpdateRegions = tailUpdateRegions?.ToImmutableArray() ?? ImmutableArray <TailUpdateRegion> .Empty; // When we migrate EwfTable to the new component model, consider having ElementComponent (or ElementNode) store the current DMs and execute the // elementDataGetter with them. This would save developers from having to manually do this when creating intermediate post-backs for click scripts. dataModifications = FormState.Current.DataModifications; }
/// <summary> /// Creates a table with multiple item groups. /// </summary> /// <param name="hideIfEmpty">Set to true if you want this table to hide itself if it has no content rows.</param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action link to appear. This will only work if the table consists of simple /// text (no controls).</param> /// <param name="tableActions">Table action buttons. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="fields">The table's fields. Do not pass an empty array.</param> /// <param name="headItems">The table's head items.</param> /// <param name="firstDataFieldIndex">The index of the first data field.</param> /// <param name="itemGroups">The item groups.</param> // NOTE: Change the Tuple for tableActions to a named type. public ColumnPrimaryTable( bool hideIfEmpty = false, EwfTableStyle style = EwfTableStyle.Standard, IEnumerable <string> classes = null, string caption = "", string subCaption = "", bool allowExportToExcel = false, IEnumerable <Tuple <string, Action> > tableActions = null, IEnumerable <EwfTableField> fields = null, IEnumerable <EwfTableItem> headItems = null, int firstDataFieldIndex = 0, IEnumerable <ColumnPrimaryItemGroup> itemGroups = null) { this.hideIfEmpty = hideIfEmpty; this.style = style; this.classes = (classes ?? new string[0]).ToList().AsReadOnly(); this.caption = caption; this.subCaption = subCaption; this.allowExportToExcel = allowExportToExcel; this.tableActions = (tableActions ?? new Tuple <string, Action> [0]).ToList().AsReadOnly(); if (fields != null) { if (!fields.Any()) { throw new ApplicationException("If fields are specified, there must be at least one of them."); } specifiedFields = fields.ToArray(); } this.headItems = (headItems ?? new EwfTableItem[0]).ToList().AsReadOnly(); this.firstDataFieldIndex = firstDataFieldIndex; this.itemGroups = (itemGroups ?? new ColumnPrimaryItemGroup[0]).ToList(); }
internal static void SetUpTableAndCaption(WebControl table, EwfTableStyle style, ReadOnlyCollection <string> classes, string caption, string subCaption) { table.CssClass = StringTools.ConcatenateWithDelimiter(" ", new[] { getTableStyleClass(style) }.Concat(classes).ToArray()); // NOTE: Axe this when we cut support for IE7. table.Attributes.Add("cellspacing", "0"); addCaptionIfNecessary(table, caption, subCaption); }
private static string getTableStyleClass(EwfTableStyle style) { switch (style) { case EwfTableStyle.StandardLayoutOnly: return(CssElementCreator.StandardLayoutOnlyStyleClass); case EwfTableStyle.StandardExceptLayout: return(CssElementCreator.StandardExceptLayoutStyleClass); case EwfTableStyle.Standard: return(CssElementCreator.StandardStyleClass); default: return(""); } }
/// <summary> /// Creates a table with one item group. /// </summary> /// <param name="hideIfEmpty">Set to true if you want this table to hide itself if it has no content rows.</param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action link to appear. This will only work if the table consists of simple /// text (no controls).</param> /// <param name="tableActions">Table action buttons. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="fields">The table's fields. Do not pass an empty array.</param> /// <param name="headItems">The table's head items.</param> /// <param name="firstDataFieldIndex">The index of the first data field.</param> /// <param name="items">The items.</param> public ColumnPrimaryTable( bool hideIfEmpty = false, EwfTableStyle style = EwfTableStyle.Standard, IEnumerable<string> classes = null, string caption = "", string subCaption = "", bool allowExportToExcel = false, IEnumerable<Tuple<string, Action>> tableActions = null, IEnumerable<EwfTableField> fields = null, IEnumerable<EwfTableItem> headItems = null, int firstDataFieldIndex = 0, IEnumerable<EwfTableItem> items = null) : this(hideIfEmpty, style, classes, caption, subCaption, allowExportToExcel, tableActions, fields, headItems, firstDataFieldIndex, items != null ? new List<ColumnPrimaryItemGroup> { new ColumnPrimaryItemGroup( null, items: items ) } : null) { }
/// <summary> /// Creates a table with one item group. /// </summary> /// <param name="hideIfEmpty">Set to true if you want this table to hide itself if it has no content rows.</param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action link to appear. This will only work if the table consists of simple /// text (no controls).</param> /// <param name="tableActions">Table action buttons. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="fields">The table's fields. Do not pass an empty array.</param> /// <param name="headItems">The table's head items.</param> /// <param name="firstDataFieldIndex">The index of the first data field.</param> /// <param name="items">The items.</param> public ColumnPrimaryTable( bool hideIfEmpty = false, EwfTableStyle style = EwfTableStyle.Standard, IEnumerable <string> classes = null, string caption = "", string subCaption = "", bool allowExportToExcel = false, IEnumerable <Tuple <string, Action> > tableActions = null, IEnumerable <EwfTableField> fields = null, IEnumerable <EwfTableItem> headItems = null, int firstDataFieldIndex = 0, IEnumerable <EwfTableItem> items = null) : this( hideIfEmpty, style, classes, caption, subCaption, allowExportToExcel, tableActions, fields, headItems, firstDataFieldIndex, items != null ? new List <ColumnPrimaryItemGroup> { new ColumnPrimaryItemGroup(null, items : items) } : null) { }
/// <summary> /// Creates a table with no item groups. /// </summary> /// <param name="hideIfEmpty">Set to true if you want this table to hide itself if it has no content rows.</param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="postBackIdBase">Do not pass null.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action link to appear. This will only work if the table consists of simple /// text (no controls).</param> /// <param name="tableActions">Table action buttons. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="fields">The table's fields. Do not pass an empty array.</param> /// <param name="headItems">The table's head items.</param> /// <param name="defaultItemLimit">The maximum number of result items that will be shown. Default is DataRowLimit.Unlimited. A default item limit of /// anything other than Unlimited will cause the table to show a control allowing the user to select how many results they want to see, as well as an /// indicator of the total number of results that would be shown if there was no limit.</param> /// <param name="disableEmptyFieldDetection">Set to true if you want to disable the "at least one cell per field" assertion. Use with caution.</param> public static EwfTable Create( bool hideIfEmpty = false, EwfTableStyle style = EwfTableStyle.Standard, IEnumerable <string> classes = null, string postBackIdBase = "", string caption = "", string subCaption = "", bool allowExportToExcel = false, IEnumerable <Tuple <string, Action> > tableActions = null, IEnumerable <EwfTableField> fields = null, IEnumerable <EwfTableItem> headItems = null, DataRowLimit defaultItemLimit = DataRowLimit.Unlimited, bool disableEmptyFieldDetection = false) { return(new EwfTable( hideIfEmpty, style, classes, postBackIdBase, caption, subCaption, allowExportToExcel, tableActions, fields, headItems, defaultItemLimit, disableEmptyFieldDetection, null)); }
/// <summary> /// Creates a table with a specified item ID type. /// </summary> /// <param name="displaySetup"></param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="postBackIdBase">Do not pass null.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action component to appear. This will only work if the table consists of /// simple text (no controls).</param> /// <param name="tableActions">Table action components. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="selectedItemActions">Table selected-item actions. Passing one or more of these will add a new row to the table containing a checkbox for /// each item with an ID. If you would like the table to support item-group-level selected-item actions, you must pass a collection here even if it is /// empty.</param> /// <param name="fields">The table's fields. Do not pass an empty collection.</param> /// <param name="headItems">The table's head items.</param> /// <param name="firstDataFieldIndex">The index of the first data field.</param> /// <param name="enableItemReordering">Pass true to add a row to the table containing controls for reordering items. Every item must have a rank ID, with /// the exception of item groups in which none of the items have rank IDs.</param> /// <param name="etherealContent"></param> public static ColumnPrimaryTable <ItemIdType> CreateWithItemIdType <ItemIdType>( DisplaySetup displaySetup = null, EwfTableStyle style = EwfTableStyle.Standard, ElementClassSet classes = null, string postBackIdBase = "", string caption = "", string subCaption = "", bool allowExportToExcel = false, IReadOnlyCollection <ActionComponentSetup> tableActions = null, IReadOnlyCollection <SelectedItemAction <ItemIdType> > selectedItemActions = null, IReadOnlyCollection <EwfTableField> fields = null, IReadOnlyCollection <EwfTableItem> headItems = null, int firstDataFieldIndex = 0, bool enableItemReordering = false, IReadOnlyCollection <EtherealComponent> etherealContent = null) => new ColumnPrimaryTable <ItemIdType>( displaySetup, style, classes, postBackIdBase, caption, subCaption, allowExportToExcel, tableActions, selectedItemActions, fields, headItems, firstDataFieldIndex, enableItemReordering, etherealContent);
private ColumnPrimaryTable( DisplaySetup displaySetup, EwfTableStyle style, ElementClassSet classes, string postBackIdBase, string caption, string subCaption, bool allowExportToExcel, IReadOnlyCollection <ActionComponentSetup> tableActions, IReadOnlyCollection <SelectedItemAction <int> > selectedItemActions, IReadOnlyCollection <EwfTableField> fields, IReadOnlyCollection <EwfTableItem> headItems, int firstDataFieldIndex, bool enableItemReordering, IReadOnlyCollection <EtherealComponent> etherealContent) : base( displaySetup, style, classes, postBackIdBase, caption, subCaption, allowExportToExcel, tableActions, selectedItemActions, fields, headItems, firstDataFieldIndex, enableItemReordering, etherealContent) { }
/// <summary> /// Creates a table with one item group that contains the specified items. /// </summary> /// <param name="items">The items. Do not pass null.</param> /// <param name="hideIfEmpty">Set to true if you want this table to hide itself if it has no content rows.</param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="postBackIdBase">Do not pass null.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action link to appear. This will only work if the table consists of simple /// text (no controls).</param> /// <param name="tableActions">Table action buttons. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="fields">The table's fields. Do not pass an empty array.</param> /// <param name="headItems">The table's head items.</param> /// <param name="defaultItemLimit">The maximum number of result items that will be shown. Default is DataRowLimit.Unlimited. A default item limit of /// anything other than Unlimited will cause the table to show a control allowing the user to select how many results they want to see, as well as an /// indicator of the total number of results that would be shown if there was no limit.</param> /// <param name="disableEmptyFieldDetection">Set to true if you want to disable the "at least one cell per field" assertion. Use with caution.</param> /// <param name="tailUpdateRegions">The tail update regions.</param> public static EwfTable CreateWithItems( IEnumerable <Func <EwfTableItem> > items, bool hideIfEmpty = false, EwfTableStyle style = EwfTableStyle.Standard, IEnumerable <string> classes = null, string postBackIdBase = "", string caption = "", string subCaption = "", bool allowExportToExcel = false, IEnumerable <Tuple <string, Action> > tableActions = null, IEnumerable <EwfTableField> fields = null, IEnumerable <EwfTableItem> headItems = null, DataRowLimit defaultItemLimit = DataRowLimit.Unlimited, bool disableEmptyFieldDetection = false, IEnumerable <TailUpdateRegion> tailUpdateRegions = null) { return(new EwfTable( hideIfEmpty, style, classes, postBackIdBase, caption, subCaption, allowExportToExcel, tableActions, fields, headItems, defaultItemLimit, disableEmptyFieldDetection, new EwfTableItemGroup(() => new EwfTableItemGroupRemainingData(null, tailUpdateRegions: tailUpdateRegions), items).ToCollection(), null)); }
private EwfTable( DisplaySetup displaySetup, EwfTableStyle style, ElementClassSet classes, string postBackIdBase, string caption, string subCaption, bool allowExportToExcel, IReadOnlyCollection <ActionComponentSetup> tableActions, IReadOnlyCollection <SelectedItemAction <int> > selectedItemActions, IReadOnlyCollection <EwfTableField> fields, IReadOnlyCollection <EwfTableItem> headItems, DataRowLimit defaultItemLimit, bool enableItemReordering, bool disableEmptyFieldDetection, IReadOnlyCollection <TailUpdateRegion> tailUpdateRegions, IReadOnlyCollection <EtherealComponent> etherealContent) : base( displaySetup, style, classes, postBackIdBase, caption, subCaption, allowExportToExcel, tableActions, selectedItemActions, fields, headItems, defaultItemLimit, enableItemReordering, disableEmptyFieldDetection, tailUpdateRegions, etherealContent) { }
/// <summary> /// Creates a table with a specified item ID type. /// </summary> /// <param name="displaySetup"></param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="postBackIdBase">Do not pass null.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action component to appear. This will only work if the table consists of /// simple text (no controls).</param> /// <param name="tableActions">Table action components. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="selectedItemActions">Table selected-item actions. Passing one or more of these will add a new column to the table containing a checkbox for /// each item with an ID. If you would like the table to support item-group-level selected-item actions, you must pass a collection here even if it is /// empty.</param> /// <param name="fields">The table's fields. Do not pass an empty collection.</param> /// <param name="headItems">The table's head items.</param> /// <param name="defaultItemLimit">The maximum number of result items that will be shown. Default is DataRowLimit.Unlimited. A default item limit of /// anything other than Unlimited will cause the table to show a control allowing the user to select how many results they want to see, as well as an /// indicator of the total number of results that would be shown if there was no limit.</param> /// <param name="enableItemReordering">Pass true to add a column to the table containing controls for reordering items. Every item must have a rank ID, with /// the exception of item groups in which none of the items have rank IDs.</param> /// <param name="disableEmptyFieldDetection">Set to true if you want to disable the "at least one cell per field" assertion. Use with caution.</param> /// <param name="tailUpdateRegions">The tail update regions for the table, which will operate on the item level if you add items, or the item-group level if /// you add item groups.</param> /// <param name="etherealContent"></param> public static EwfTable <ItemIdType> CreateWithItemIdType <ItemIdType>( DisplaySetup displaySetup = null, EwfTableStyle style = EwfTableStyle.Standard, ElementClassSet classes = null, string postBackIdBase = "", string caption = "", string subCaption = "", bool allowExportToExcel = false, IReadOnlyCollection <ActionComponentSetup> tableActions = null, IReadOnlyCollection <SelectedItemAction <ItemIdType> > selectedItemActions = null, IReadOnlyCollection <EwfTableField> fields = null, IReadOnlyCollection <EwfTableItem> headItems = null, DataRowLimit defaultItemLimit = DataRowLimit.Unlimited, bool enableItemReordering = false, bool disableEmptyFieldDetection = false, IReadOnlyCollection <TailUpdateRegion> tailUpdateRegions = null, IReadOnlyCollection <EtherealComponent> etherealContent = null) => new EwfTable <ItemIdType>( displaySetup, style, classes, postBackIdBase, caption, subCaption, allowExportToExcel, tableActions, selectedItemActions, fields, headItems, defaultItemLimit, enableItemReordering, disableEmptyFieldDetection, tailUpdateRegions, etherealContent);
internal static void SetUpTableAndCaption(WebControl table, EwfTableStyle style, ReadOnlyCollection <string> classes, string caption, string subCaption) { table.CssClass = StringTools.ConcatenateWithDelimiter(" ", new[] { getTableStyleClass(style) }.Concat(classes).ToArray()); addCaptionIfNecessary(table, caption, subCaption); }
/// <summary> /// Creates a table with multiple item groups. /// </summary> /// <param name="hideIfEmpty">Set to true if you want this table to hide itself if it has no content rows.</param> /// <param name="style">The table's style.</param> /// <param name="classes">The classes on the table.</param> /// <param name="caption">The caption that appears above the table. Do not pass null. Setting this to the empty string means the table will have no caption. /// </param> /// <param name="subCaption">The sub caption that appears directly under the caption. Do not pass null. Setting this to the empty string means there will be /// no sub caption.</param> /// <param name="allowExportToExcel">Set to true if you want an Export to Excel action link to appear. This will only work if the table consists of simple /// text (no controls).</param> /// <param name="tableActions">Table action buttons. This could be used to add a new customer or other entity to the table, for example.</param> /// <param name="fields">The table's fields. Do not pass an empty array.</param> /// <param name="headItems">The table's head items.</param> /// <param name="firstDataFieldIndex">The index of the first data field.</param> /// <param name="itemGroups">The item groups.</param> // NOTE: Change the Tuple for tableActions to a named type. public ColumnPrimaryTable( bool hideIfEmpty = false, EwfTableStyle style = EwfTableStyle.Standard, IEnumerable<string> classes = null, string caption = "", string subCaption = "", bool allowExportToExcel = false, IEnumerable<Tuple<string, Action>> tableActions = null, IEnumerable<EwfTableField> fields = null, IEnumerable<EwfTableItem> headItems = null, int firstDataFieldIndex = 0, IEnumerable<ColumnPrimaryItemGroup> itemGroups = null) { this.hideIfEmpty = hideIfEmpty; this.style = style; this.classes = ( classes ?? new string[ 0 ] ).ToList().AsReadOnly(); this.caption = caption; this.subCaption = subCaption; this.allowExportToExcel = allowExportToExcel; this.tableActions = ( tableActions ?? new Tuple<string, Action>[ 0 ] ).ToList().AsReadOnly(); if( fields != null ) { if( !fields.Any() ) throw new ApplicationException( "If fields are specified, there must be at least one of them." ); specifiedFields = fields.ToArray(); } this.headItems = ( headItems ?? new EwfTableItem[ 0 ] ).ToList().AsReadOnly(); this.firstDataFieldIndex = firstDataFieldIndex; this.itemGroups = ( itemGroups ?? new ColumnPrimaryItemGroup[ 0 ] ).ToList(); }