Esempio n. 1
0
        public FluentTagBuilder Render(FluentTagBuilder tbody, IList <T> items)
        {
            var columns          = gridModel_.VisibleColumns.ToList();
            FluentTagBuilder tag = null;

            foreach (var item in items)
            {
                var innerTr = Tag.Tr;
                foreach (var column in gridModel_.HiddenColumns)
                {
                    innerTr.Html(GetContent(column, item));
                }

                foreach (var column in columns)
                {
                    var index = columns.IndexOf(column);
                    var nextColumnIsMerged = index < columns.Count - 1 && columns[index + 1].IsMerged;

                    if (!column.IsMerged)
                    {
                        tag = column.GetContentTag(item);
                    }

                    tag.Html(GetContent(column, item));

                    if (!nextColumnIsMerged)
                    {
                        innerTr.Html(tag);
                    }
                }

                tbody.Html(innerTr);
            }
            return(tbody);
        }
        private void ContentFor(Cell cell, FluentTagBuilder tagBuilder)
        {
            var dummyTagBuilder = new FluentTagBuilder("dummy");

            if (!ClassesFor(cell, dummyTagBuilder))
            {
                tagBuilder.Html(Encode(cell.Text));
                return;
            }

            var spanTagBuilder = Tag.Span;

            ClassesFor(cell, spanTagBuilder);
            spanTagBuilder.Html(Encode(cell.Text));

            tagBuilder.Html(spanTagBuilder);
        }
        private void MakeTableRow(Row row, FluentTagBuilder tagBuilder)
        {
            var rowTagBuilder = Tag.Tr;

            MakeTableHeaders(row, rowTagBuilder);
            MakeTableCells(row, rowTagBuilder);

            tagBuilder.Html(rowTagBuilder);
        }
        public object Make(Report report, bool addHeader = false)
        {
            var tagBuilder = new FluentTagBuilder(FluentTagBuilder.Div);

#if DEBUGGING_ON
            FluentTagBuilder styleTagBuilder = new FluentTagBuilder(FluentTagBuilder.Style);
            styleTagBuilder.Attributes.Add(FluentTagBuilder.Type, "text/css");
            styleTagBuilder.Html(string.Format("th {{ text-align:left; font-weight:normal;background: #97BF0D; border:1px solid #496D2D;color: #fff;}}"));
            styleTagBuilder.Html(string.Format("td {{ font-weight:normal;border:1px solid #496D2D;}}"));
            styleTagBuilder.Html(string.Format(".horizontalAlignRight {{ float:right; }}"));
            styleTagBuilder.Html(string.Format(".fontWeightBold {{ font-weight:bold;}}"));
            styleTagBuilder.Html(string.Format(".noborder {{  border:none;}}"));
            tagBuilder.Html(styleTagBuilder);
#endif

            MakeReport(report, tagBuilder);

            return(MvcHtmlString.Create(tagBuilder.ToString()));
        }
        private void MakeTableCell(Cell cell, string tag, FluentTagBuilder tagBuilder)
        {
            var cellTagBuilder = new FluentTagBuilder(tag);

            ColSpanFor(cell, cellTagBuilder);
            BorderFor(cell, cellTagBuilder);
            ContentFor(cell, cellTagBuilder);

            tagBuilder.Html(cellTagBuilder);
        }
        private void MakeTable(Table table, FluentTagBuilder tagBuilder)
        {
            var tableTagBuilder = Tag.Table
                                  .Style(string.Format("width:{0}%", table.TotalWidth));

            MakeTableColumns(table, tableTagBuilder);
            MakeTableRows(table, tableTagBuilder);

            tagBuilder
            .Html(tableTagBuilder)
            .Html(Tag.Br);
        }
Esempio n. 7
0
 public FluentTagBuilder RenderToolBar(FluentTagBuilder tag)
 {
     return(tag.Html(toolBarRenderer_.ToString()));
 }
 private void MakeTableColumn(int relativeWidth, FluentTagBuilder tagBuilder)
 {
     //FluentTagBuilder colTagBuilder = new FluentTagBuilder(FluentTagBuilder.Col);
     //colTagBuilder.Attributes.Add(FluentTagBuilder.Style, string.Format("width:{0}%", relativeWidth));
     tagBuilder.Html(string.Format("<col style=\"width:{0}%\">", relativeWidth));
 }