private void init(EwfTableCell headerCell, Unit width, string cssClass)
 {
     ColumnSetup = new ColumnSetup {
         Width = width, CssClassOnAllCells = cssClass ?? ""
     };
     HeaderCell = headerCell;
 }
Пример #2
0
        private static TableCell buildCell(EwfTableCell ewfCell, RowSetup rowSetup, ColumnSetup columnSetup, bool tableIsColumnPrimary)
        {
            var colSpan = tableIsColumnPrimary ? ewfCell.ItemSpan : ewfCell.FieldSpan;
            var rowSpan = tableIsColumnPrimary ? ewfCell.FieldSpan : ewfCell.ItemSpan;

            var underlyingCell = (rowSetup.IsHeader || columnSetup.IsHeader) ? new TableHeaderCell() : new TableCell();

            underlyingCell.AddControlsReturnThis(ewfCell.Controls);
            if (colSpan == 1)
            {
                underlyingCell.Width = columnSetup.Width;
            }
            underlyingCell.CssClass = StringTools.ConcatenateWithDelimiter(
                " ",
                EwfTable.CssElementCreator.AllCellAlignmentsClass,
                columnSetup.CssClassOnAllCells,
                ewfCell.CssClass);
            if (ewfCell.ClickScript != null)
            {
                ewfCell.ClickScript.SetUpClickableControl(underlyingCell);
            }

            if (!ewfCell.ToolTip.IsNullOrWhiteSpace() || ewfCell.ToolTipControl != null || !columnSetup.ToolTipOnCells.IsNullOrWhiteSpace())
            {
                var toolTipControl = ewfCell.ToolTipControl ??
                                     ToolTip.GetToolTipTextControl(!ewfCell.ToolTip.IsNullOrWhiteSpace() ? ewfCell.ToolTip : columnSetup.ToolTipOnCells);
                // NOTE: This comment is no longer accurate.
                // It is very important that we add the tool tip to the cell so that the tool tip is hidden if the row/cell is hidden.
                new ToolTip(toolTipControl, underlyingCell);
            }

            if (colSpan != 1)
            {
                underlyingCell.ColumnSpan = colSpan;
            }
            if (rowSpan != 1)
            {
                underlyingCell.RowSpan = rowSpan;
            }
            return(underlyingCell);
        }