WebControl ActionControlStyle.SetUpControl(WebControl control, string defaultText) { control.CssClass = control.CssClass.ConcatenateWithSpace( ActionComponentCssElementCreator.AllStylesClass.ClassName + " " + ActionComponentCssElementCreator.TextStyleClass.ClassName); return(control.AddControlsReturnThis(ActionComponentIcon.GetIconAndTextComponents(icon, Text.Any() ? Text : defaultText).GetControls())); }
WebControl ActionControlStyle.SetUpControl(WebControl control, string defaultText) { control.CssClass = control.CssClass.ConcatenateWithSpace( ActionComponentCssElementCreator.AllStylesClass.ClassName + " " + ActionComponentCssElementCreator.ImageStyleClass.ClassName); if (rolloverImageInfo != null && rolloverImageInfo.GetUrl() != imageInfo.GetUrl()) { control.AddJavaScriptEventScript( JavaScriptWriting.JsWritingMethods.onmouseover, "$( this ).children().attr( 'src', '{0}' )".FormatWith(rolloverImageInfo.GetUrl())); control.AddJavaScriptEventScript( JavaScriptWriting.JsWritingMethods.onmouseout, "$( this ).children().attr( 'src', '{0}' )".FormatWith(imageInfo.GetUrl())); } control.AddControlsReturnThis( new EwfImage( new ImageSetup( AlternateText, sizesToAvailableWidth: SizesToAvailableWidth, classes: SizesToAvailableWidth ? new ElementClass("ewfBlockContainer") : ElementClassSet.Empty), imageInfo).ToCollection().GetControls()); return(null); }
WebControl ActionControlStyle.SetUpControl(WebControl control, string defaultText) { var cssElement = ActionComponentCssElementCreator.NormalButtonStyleClass.ClassName; if (buttonSize == ButtonSize.ShrinkWrap) { cssElement = ActionComponentCssElementCreator.ShrinkWrapButtonStyleClass.ClassName; } else if (buttonSize == ButtonSize.Large) { cssElement = ActionComponentCssElementCreator.LargeButtonStyleClass.ClassName; } control.CssClass = control.CssClass.ConcatenateWithSpace(ActionComponentCssElementCreator.AllStylesClass.ClassName + " " + cssElement); return(control.AddControlsReturnThis(ActionComponentIcon.GetIconAndTextComponents(icon, text.Any() ? text : defaultText).GetControls())); }
WebControl ActionControlStyle.SetUpControl(WebControl control, string defaultText, Unit width, Unit height, Action <Unit> widthSetter) { widthSetter(width); var cssElement = CssElementCreator.NormalButtonStyleClass; if (buttonSize == ButtonSize.ShrinkWrap) { cssElement = CssElementCreator.ShrinkWrapButtonStyleClass; } else if (buttonSize == ButtonSize.Large) { cssElement = CssElementCreator.LargeButtonStyleClass; } control.CssClass = control.CssClass.ConcatenateWithSpace(CssElementCreator.AllStylesClass + " " + cssElement); return(control.AddControlsReturnThis(ActionControlIcon.GetIconAndTextControls(icon, text.Any() ? text : defaultText))); }
WebControl ActionControlStyle.SetUpControl(WebControl control, string defaultText, Unit width, Unit height, Action <Unit> widthSetter) { control.CssClass = control.CssClass.ConcatenateWithSpace(CssElementCreator.AllStylesClass + " " + CssElementCreator.TextStyleClass); return(control.AddControlsReturnThis((Text.Length > 0 ? Text : defaultText).GetLiteralControl())); }
WebControl ActionControlStyle.SetUpControl(WebControl control, string defaultText, Unit width, Unit height, Action <Unit> widthSetter) { control.CssClass = control.CssClass.ConcatenateWithSpace(CssElementCreator.AllStylesClass + " " + CssElementCreator.TextStyleClass); return(control.AddControlsReturnThis(ActionControlIcon.GetIconAndTextControls(icon, Text.Any() ? Text : defaultText))); }
internal static IEnumerable <Control> BuildRows( List <List <CellPlaceholder> > cellPlaceholderListsForRows, IReadOnlyList <EwfTableFieldOrItemSetup> rowSetups, bool?useContrastForFirstRow, IReadOnlyList <EwfTableFieldOrItemSetup> columns, int firstDataColumnIndex, bool tableIsColumnPrimary) { return(cellPlaceholderListsForRows.Select( (row, rowIndex) => { var rowControl = new WebControl(HtmlTextWriterTag.Tr); var rowClickScript = rowSetups[rowIndex].ClickScript; if (rowClickScript != null) { rowClickScript.SetUpClickableControl(rowControl); } rowControl.Height = rowSetups[rowIndex].Size; rowControl.CssClass = rowControl.CssClass.ConcatenateWithSpace( useContrastForFirstRow.HasValue && ((rowIndex % 2 == 1) ^ useContrastForFirstRow.Value) ? EwfTable.CssElementCreator.ContrastClass : ""); rowControl.CssClass = rowControl.CssClass.ConcatenateWithSpace(StringTools.ConcatenateWithDelimiter(" ", rowSetups[rowIndex].Classes.ToArray())); return new NamingPlaceholder( rowControl.AddControlsReturnThis( row.Select((cell, colIndex) => new { Cell = cell as EwfTableCell, ColumnIndex = colIndex }) .Where(cellAndIndex => cellAndIndex.Cell != null) .Select( cellAndIndex => { var cellControl = new WebControl(cellAndIndex.ColumnIndex < firstDataColumnIndex ? HtmlTextWriterTag.Th : HtmlTextWriterTag.Td); var rowSpan = tableIsColumnPrimary ? cellAndIndex.Cell.Setup.FieldSpan : cellAndIndex.Cell.Setup.ItemSpan; if (rowSpan != 1) { cellControl.Attributes.Add("rowspan", rowSpan.ToString()); } var colSpan = tableIsColumnPrimary ? cellAndIndex.Cell.Setup.ItemSpan : cellAndIndex.Cell.Setup.FieldSpan; if (colSpan != 1) { cellControl.Attributes.Add("colspan", colSpan.ToString()); } var rowSetup = rowSetups[rowIndex]; var columnSetup = columns[cellAndIndex.ColumnIndex]; var clickScript = cellAndIndex.Cell.Setup.ClickScript ?? (tableIsColumnPrimary || rowSetup.ClickScript == null ? columnSetup.ClickScript : null); if (clickScript != null) { clickScript.SetUpClickableControl(cellControl); } var columnClassString = StringTools.ConcatenateWithDelimiter(" ", columnSetup.Classes.ToArray()); var cellClassString = StringTools.ConcatenateWithDelimiter(" ", cellAndIndex.Cell.Setup.Classes.ToArray()); cellControl.CssClass = StringTools.ConcatenateWithDelimiter( " ", cellControl.CssClass, EwfTable.CssElementCreator.AllCellAlignmentsClass, textAlignmentClass(cellAndIndex.Cell, rowSetup, columnSetup), verticalAlignmentClass(rowSetup, columnSetup), columnClassString, cellClassString); if ((rowSetup.ToolTipControl != null || rowSetup.ToolTip.Length > 0) && cellAndIndex.ColumnIndex == 0) { new ToolTip(rowSetup.ToolTipControl ?? ToolTip.GetToolTipTextControl(rowSetup.ToolTip), rowControl); } if (columnSetup.ToolTipControl != null) { throw new ApplicationException("A column cannot have a tool tip control because there is no way to clone this control to put it on every cell."); } if (columnSetup.ToolTip.Length > 0) { new ToolTip(ToolTip.GetToolTipTextControl(columnSetup.ToolTip), cellControl); } if (cellAndIndex.Cell.Setup.ToolTipControl != null || cellAndIndex.Cell.Setup.ToolTip.Length > 0) { new ToolTip(cellAndIndex.Cell.Setup.ToolTipControl ?? ToolTip.GetToolTipTextControl(cellAndIndex.Cell.Setup.ToolTip), cellControl); } return cellControl.AddControlsReturnThis(cellAndIndex.Cell.Controls) as Control; })).ToSingleElementArray()); })); }