/*
处理renderType
gridCompColumn对象，index为第几列
begin为起始行，length为行数（增加行数时使用）
194694
function renderTypeByColumn(gridCompColumn, i, begin, length, isFixedColumn) {
    var oThis = this,
        renderType = gridCompColumn.options.renderType,
        sumCol = gridCompColumn.options.sumCol,
        sumRenderType = gridCompColumn.options.sumRenderType,
        dataType = gridCompColumn.options.dataType,
        precision = gridCompColumn.options.precision,
        format = gridCompColumn.options.format,
        field = gridCompColumn.options.field,
        end = begin,
        idSuffix = isFixedColumn === true ? '_content_fixed_tbody' : '_content_tbody',
        idStr = isFixedColumn === true ? 'fixed_' : '',
        visibleColIndex = this.getVisibleIndexOfColumn(gridCompColumn);

    if (length > 0) {
        end = parseInt(begin + length - 1);
    }
    this.realtimeTableRows = $('#' + this.options.id + idSuffix).find('tr[role="row"]');
    // this.realtimeTableRows = document.getElementById(oThis.options.id + idSuffix).children;
    // 记录role不是row的行
    var notRowIndex = -1;
    // for (var k = 0; k < oThis.realtimeTableRows.length; k++) {
    //     if (oThis.realtimeTableRows[k].getAttribute("role") != "row") {
    //         notRowIndex = k
    //     }
    // }
    $.each(oThis.dataSourceObj.rows, function (j) {
        if (begin >= 0 && j >= begin && j <= end || isNaN(begin)) {
            //如果当前修改此列则将变量重置
            if (oThis.editColIndex == visibleColIndex && oThis.eidtRowIndex == j && oThis.options.editType == 'default') {
                oThis.editColIndex = -1;
                oThis.eidtRowIndex = -1;
            }
            var trIndex = j;
            if (notRowIndex != -1 && j >= notRowIndex) {
                trIndex++;
            }
            var tr = oThis.realtimeTableRows[trIndex],
                td = tr.children[i];
            if (oThis.iconSpan) {
                var iconSpan = oThis.iconSpan;
            }

            if (td) {
                if (td.children[0].innerHTML.indexOf('u-grid-content-tree-span') != -1) {
                    var span = td.children[0].children[1];
                } else {
                    // td.innerHTML = '<div class="u-grid-content-td-div"></div>'; //如果是树表的话第一列显示会有问题，等出现其他问题之后再修改此处
                    var span = td.children[0];
                }
                if (span) {
                    var v = $(this.value).attr(field);
                    if (typeof renderType == 'function' || dataType == 'Date' || dataType == 'Datetime' || dataType == 'Int' || dataType == 'Float') {
                        span.innerHTML = '';
                        if (typeof renderType == 'function') {
                            v = oThis.getString(v, '');
                            var obj = {};
                            obj.value = v;
                            obj.element = span;
                            obj.gridObj = oThis;
                            obj.row = this;
                            obj.gridCompColumn = gridCompColumn;
                            obj.rowIndex = j;
                            renderType.call(oThis, obj);
                        } else if (dataType == 'Date' || dataType == 'Datetime') {
                            if (v == null || v == undefined || v == 'null' || v == 'undefined' || v == "") {
                                v = "";
                            }
                            if (dataType == 'Date') {
                                v = u.dateRender(v);
                            } else {
                                v = u.dateTimeRender(v);
                            }
                            span.innerHTML = v;
                            span.title = v;
                        } else if (dataType == 'Int') {
                            v = parseInt(v);
                            if (!isNaN(v)) {
                                span.innerHTML = v;
                                span.title = v;
                            } else {
                                span.innerHTML = "";
                                span.title = "";
                            }
                        } else if (dataType == 'Float') {
                            if (precision) {
                                var o = {};
                                o.value = v;
                                o.precision = precision;
                                v = oThis.DicimalFormater(o);
                            } else {
                                v = parseFloat(v);
                            }
                            if (!isNaN(v)) {
                                span.innerHTML = v;
                                span.title = v;
                            } else {
                                span.innerHTML = "";
                                span.title = "";
                            }
                        } else {
                            //此处逻辑放到渲染处，减少render执行次数。
                            v = oThis.getString(v, '');
                            var v1 = v.replace(/\</g, '\<');
                            v1 = v1.replace(/\>/g, '\>');
                            span.title = v;
                            v = v.replace(/\</g, '&lt;');
                            v = v.replace(/\>/g, '&gt;');
                            span.innerHTML = v;
                        }
                    } else {
                        v = oThis.getString(v, '');
                        var v1 = v.replace(/\</g, '\<');
                        v1 = v1.replace(/\>/g, '\>');
                        span.title = v;
                        v = v.replace(/\</g, '&lt;');
                        v = v.replace(/\>/g, '&gt;');
                        if (i == 0 && iconSpan) {
                            v = iconSpan += v;
                        }
                        span.innerHTML = v;
                    }

                    /* 增加处理判断是否需要显示... */
                    var obj = {
                        span: span,
                        column: gridCompColumn
                    };
                    var colum_maxlength = gridCompColumn.options.maxLength,
                        overFlag = false;
                    if (colum_maxlength && colum_maxlength > 0) {
                        //控制表格列显示...
                        overFlag = span.innerHTML.length > colum_maxlength ? true : false;
                    } else {
                        overFlag = oThis.getRenderOverFlag(obj);
                    }
                    if (overFlag) {
                        $(span).addClass('u-grid-content-td-div-over');
                    }
                }
            }
        }
        oThis.renderTypeGroupSumRow(gridCompColumn, i, isFixedColumn, this);
    });
    this.renderTypeSumRow(gridCompColumn, i, begin, length, isFixedColumn);
}
1119597
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WStyledText text = (WStyledText) component;
		XmlStringBuilder xml = renderContext.getWriter();
		String textString = text.getText();

		if (textString != null && textString.length() > 0) {
			xml.appendTagOpen("ui:text");

			xml.appendOptionalAttribute("class", component.getHtmlClass());
			switch (text.getType()) {
				case EMPHASISED:
					xml.appendAttribute("type", "emphasised");
					break;

				case HIGH_PRIORITY:
					xml.appendAttribute("type", "highPriority");
					break;

				case LOW_PRIORITY:
					xml.appendAttribute("type", "lowPriority");
					break;

				case MEDIUM_PRIORITY:
					xml.appendAttribute("type", "mediumPriority");
					break;

				case ACTIVE_INDICATOR:
					xml.appendAttribute("type", "activeIndicator");
					break;

				case MATCH_INDICATOR:
					xml.appendAttribute("type", "matchIndicator");
					break;

				case INSERT:
					xml.appendAttribute("type", "insert");
					break;

				case DELETE:
					xml.appendAttribute("type", "delete");
					break;

				case MANDATORY_INDICATOR:
					xml.appendAttribute("type", "mandatoryIndicator");
					break;

				case PLAIN:
				default:
					xml.appendAttribute("type", "plain");
					break;
			}

			switch (text.getWhitespaceMode()) {
				case PARAGRAPHS:
					xml.appendAttribute("space", "paragraphs");
					break;

				case PRESERVE:
					xml.appendAttribute("space", "preserve");
					break;

				case DEFAULT:
					break;

				default:
					throw new IllegalArgumentException("Unknown white space mode: " + text.
							getWhitespaceMode());
			}

			xml.appendClose();

			if (WStyledText.WhitespaceMode.PARAGRAPHS.equals(text.getWhitespaceMode())) {
				textString = text.isEncodeText() ? WebUtilities.encode(textString) : HtmlToXMLUtil.unescapeToXML(textString);
				writeParagraphs(textString, xml);
			} else {
				xml.append(textString, text.isEncodeText());
			}

			xml.appendEndTag("ui:text");
		}
	}
82181
function renderToString(vnode, context, opts, inner, isSvgMode) {
	if (vnode==null || typeof vnode==='boolean') {
		return '';
	}

	let nodeName = vnode.type,
		attributes = vnode.props,
		isComponent = false;
	context = context || {};
	opts = opts || {};

	let pretty = opts.pretty,
		indentChar = typeof pretty==='string' ? pretty : '\t';

	// #text nodes
	if (typeof vnode!=='object' && !nodeName) {
		return encodeEntities(vnode);
	}

	// components
	if (typeof nodeName==='function') {
		isComponent = true;
		if (opts.shallow && (inner || opts.renderRootComponent===false)) {
			nodeName = getComponentName(nodeName);
		}
		else {
			let props = getNodeProps(vnode),
				rendered;

			if (!nodeName.prototype || typeof nodeName.prototype.render!=='function') {
				// stateless functional components
				rendered = nodeName(props, context);
			}
			else {
				// class-based components
				let c = new nodeName(props, context);
				// turn off stateful re-rendering:
				c._disable = c.__x = true;
				c.props = props;
				c.context = context;
				if (c.componentWillMount) c.componentWillMount();
				rendered = c.render(c.props, c.state, c.context);

				if (c.getChildContext) {
					context = assign(assign({}, context), c.getChildContext());
				}
			}

			return renderToString(rendered, context, opts, opts.shallowHighOrder!==false);
		}
	}

	// render JSX to HTML
	let s = '', html;

	if (attributes) {
		let attrs = objectKeys(attributes);

		// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)
		if (opts && opts.sortAttributes===true) attrs.sort();

		for (let i=0; i<attrs.length; i++) {
			let name = attrs[i],
				v = attributes[name];
			if (name==='children') continue;

			if (name.match(/[\s\n\\/='"\0<>]/)) continue;

			if (!(opts && opts.allAttributes) && (name==='key' || name==='ref')) continue;

			if (name==='className') {
				if (attributes.class) continue;
				name = 'class';
			}
			else if (isSvgMode && name.match(/^xlink:?./)) {
				name = name.toLowerCase().replace(/^xlink:?/, 'xlink:');
			}

			if (name==='style' && v && typeof v==='object') {
				v = styleObjToCss(v);
			}

			let hooked = opts.attributeHook && opts.attributeHook(name, v, context, opts, isComponent);
			if (hooked || hooked==='') {
				s += hooked;
				continue;
			}

			if (name==='dangerouslySetInnerHTML') {
				html = v && v.__html;
			}
			else if ((v || v===0 || v==='') && typeof v!=='function') {
				if (v===true || v==='') {
					v = name;
					// in non-xml mode, allow boolean attributes
					if (!opts || !opts.xml) {
						s += ' ' + name;
						continue;
					}
				}
				s += ` ${name}="${encodeEntities(v)}"`;
			}
		}
	}

	// account for >1 multiline attribute
	let sub = s.replace(/^\n\s*/, ' ');
	if (sub!==s && !~sub.indexOf('\n')) s = sub;
	else if (pretty && ~s.indexOf('\n')) s += '\n';

	s = `<${nodeName}${s}>`;
	if (String(nodeName).match(/[\s\n\\/='"\0<>]/)) throw s;

	let isVoid = String(nodeName).match(VOID_ELEMENTS);
	if (isVoid) s = s.replace(/>$/, ' />');

	let pieces = [];
	if (html) {
		// if multiline, indent.
		if (pretty && isLargeString(html)) {
			html = '\n' + indentChar + indent(html, indentChar);
		}
		s += html;
	}
	else if (vnode.props.children) {
        let hasLarge = ~s.indexOf('\n');
        let children = vnode.props.children;
        if (!Array.isArray(children)) {
            children = [children]
        }
        for (let i=0; i< children.length; i++) {
            let child = children[i];
            if (child!=null && child!==false) {
                let childSvgMode = nodeName==='svg' ? true : nodeName==='foreignObject' ? false : isSvgMode,
                    ret = renderToString(child, context, opts, true, childSvgMode);
                if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
                if (ret) pieces.push(ret);
            }
        }

		if (pretty && hasLarge) {
			for (let i=pieces.length; i--; ) {
				pieces[i] = '\n' + indentChar + indent(pieces[i], indentChar);
			}
		}
	}

	if (pieces.length) {
		s += pieces.join('');
	}
	else if (opts && opts.xml) {
		return s.substring(0, s.length-1) + ' />';
	}

	if (!isVoid) {
		if (pretty && ~s.indexOf('\n')) s += '\n';
		s += `</${nodeName}>`;
	}

	return s;
}
304691
function(){
			var oThis = this,
				w = 0;
			this.firstColumn = true;

			$.each(this.gridCompColumnArr,function(){
				if(this.options.visible){
					w+=parseInt(this.options.width);
					this.firstColumn = oThis.firstColumn;
					oThis.firstColumn = false;
					oThis.lastVisibleColumn = this;
					oThis.lastVisibleColumnWidth = this.options.width;
				}
			});
			this.contentRealWidth = w;
		}
887423
function ()
	{
		var that = this;
		var dt = this.s.dt;

		// Find how many columns are hidden
		var hiddenColumns = dt.columns().indexes().filter( function ( idx ) {
			var col = dt.column( idx );

			if ( col.visible() ) {
				return null;
			}

			// Only counts as hidden if it doesn't have the `never` class
			return $( col.header() ).hasClass( 'never' ) ? null : idx;
		} );
		var haveHidden = true;

		if ( hiddenColumns.length === 0 || ( hiddenColumns.length === 1 && this.s.columns[ hiddenColumns[0] ].control ) ) {
			haveHidden = false;
		}

		if ( haveHidden ) {
			// Show all existing child rows
			dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
				var row = dt.row( idx );

				if ( row.child() ) {
					var info = that.c.details.renderer( dt, row[0] );

					// The renderer can return false to have no child row
					if ( info === false ) {
						row.child.hide();
					}
					else {
						row.child( info, 'child' ).show();
					}
				}
			} );
		}
		else {
			// Hide all existing child rows
			dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
				dt.row( idx ).child.hide();
			} );
		}
	}
383157
private void doPaintRows(final WDataTable table, final WebXmlRenderContext renderContext) {
		TableDataModel model = table.getDataModel();
		WRepeater repeater = table.getRepeater();
		List<?> beanList = repeater.getBeanList();
		final int rowCount = beanList.size();
		WComponent row = repeater.getRepeatedComponent();

		for (int i = 0; i < rowCount; i++) {
			if (model instanceof TreeTableDataModel) {
				Integer nodeIdx = (Integer) beanList.get(i);
				TableTreeNode node = ((TreeTableDataModel) model).getNodeAtLine(nodeIdx);

				if (node.getLevel() != 1) {
					// Handled by the layout, so don't paint the row.
					continue;
				}
			}

			// Each row has its own context. This is why we can reuse the same
			// WComponent instance for each row.
			UIContext rowContext = repeater.getRowContext(beanList.get(i), i);

			UIContextHolder.pushContext(rowContext);

			try {
				row.paint(renderContext);
			} finally {
				UIContextHolder.popContext();
			}
		}
	}
821969
public function renderChildIntoParentColumn(
        $columns,
        &$child,
        &$parentGridData,
        &$parentRecordNumbers,
        $typoScriptSetup = []
    ) {
        $column_number = (int)$child['tx_gridelements_columns'];
        $columnKey = $column_number . '.';
        $columnSetupKey = isset($typoScriptSetup['columns.'][$columnKey]) ? $columnKey : 'default.';

        if ($child['uid'] <= 0) {
            return;
        }
        // update SYS_LASTCHANGED if necessary
        $this->cObj->lastChanged($child['tstamp']);
        $this->cObj->start(array_merge($child, $parentGridData), 'tt_content');

        $parentRecordNumbers[$columnKey]++;
        $this->cObj->parentRecordNumber = $parentRecordNumbers[$columnKey];

        // we render each child into the children key to provide them prerendered for usage with your own templating
        $child = $this->cObj->cObjGetSingle(
            $typoScriptSetup['columns.'][$columnSetupKey]['renderObj'],
            $typoScriptSetup['columns.'][$columnSetupKey]['renderObj.']
        );
        // then we assign the prerendered child to the appropriate column
        if (isset($columns[$column_number])) {
            $parentGridData['tx_gridelements_view_columns'][$column_number] .= $child;
        }
    }
1031337
function Renderer(options) {
  var defaults = {
    headers: {
      included: true,
      downcase: true,
      upcase: true
    },

    delimiter: 'tab',
    decimalSign: 'comma',
    outputDataType: 'json',
    columnDelimiter: "\t",
    rowDelimiter: '\n',

    inputHeader: {},
    outputHeader: {},
    dataSelect: {},

    outputText: '',

    newline: '\n',
    indent: '  ',

    commentLine: '//',
    commentLineEnd: '',
    tableName: 'converter',

    useUnderscores: true,
    includeWhiteSpace: true,
    useTabsForIndent: false
  };

  this.options = merge({}, defaults, options);
  if (this.options.includeWhiteSpace) {
    this.options.newline = '\n';
  } else {
    this.options.indent = '';
    this.options.newline = '';
  }
}
1025693
private void renderTypeNode() {
        if (jjtGetNumChildren() == 1) {
            SimpleNode tNode = new BSHType(ParserTreeConstants.JJTTYPE);
            Node ambigName = jjtGetChild(0);
            while (ambigName.jjtGetNumChildren() > 0)
                if ((ambigName = ambigName.jjtGetChild(0)) instanceof BSHAmbiguousName)
                    break;
            BSHAmbiguousName ambigNew =
                    new BSHAmbiguousName(ParserTreeConstants.JJTAMBIGUOUSNAME);
            ambigNew.jjtSetParent(tNode);
            ambigNew.text = ((BSHAmbiguousName) ambigName).text;
            tNode.jjtAddChild(ambigNew, 0);
            tNode.jjtSetParent(this);
            Node[] n = new Node[2];
            n[0] = tNode;
            n[1] = children[0];
            children = n;
        }
    }
1272667
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WMenu menu = (WMenu) component;
		XmlStringBuilder xml = renderContext.getWriter();
		int rows = menu.getRows();

		xml.appendTagOpen("ui:menu");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");

		switch (menu.getType()) {
			case BAR:
				xml.appendAttribute("type", "bar");
				break;

			case FLYOUT:
				xml.appendAttribute("type", "flyout");
				break;

			case TREE:
				xml.appendAttribute("type", "tree");
				break;

			case COLUMN:
				xml.appendAttribute("type", "column");
				break;

			default:
				throw new IllegalStateException("Invalid menu type: " + menu.getType());
		}

		xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true");
		xml.appendOptionalAttribute("hidden", menu.isHidden(), "true");
		xml.appendOptionalAttribute("rows", rows > 0, rows);

		switch (menu.getSelectionMode()) {
			case NONE:
				break;

			case SINGLE:
				xml.appendAttribute("selectMode", "single");
				break;

			case MULTIPLE:
				xml.appendAttribute("selectMode", "multiple");
				break;

			default:
				throw new IllegalStateException("Invalid select mode: " + menu.getSelectMode());
		}

		xml.appendClose();

		// Render margin
		MarginRendererUtil.renderMargin(menu, renderContext);

		paintChildren(menu, renderContext);

		xml.appendEndTag("ui:menu");
	}
19215
protected function renderFilterCellContent()
    {
        if (is_string($this->filter)) {
            echo $this->filter;
        } else {
            if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos(
                    $this->name,
                    '.'
                ) === false
            ) {
                if ($this->filterInputOptions) {
                    $filterInputOptions = $this->filterInputOptions;
                    if (empty($filterInputOptions['id'])) {
                        $filterInputOptions['id'] = false;
                    }
                } else {
                    $filterInputOptions = array();
                }
                if (is_array($this->filter)) {
                    $filterInputOptions['prompt'] = '';
                    echo TbHtml::activeDropDownList(
                        $this->grid->filter,
                        $this->name,
                        $this->filter,
                        $filterInputOptions
                    );
                } else {
                    if ($this->filter === null) {
                        echo TbHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions);
                    }
                }
            } else {
                parent::renderFilterCellContent();
            }
        }
    }
1245212
function renderComponent(req, res, hrStart) {
  var extension = getExtension(req), // Get the extension for the request
    renderer = findRenderer(extension), // Determine which renderer we are using
    _ref = req.uri,
    locals = res.locals,
    options = options || {};

  if (renderer instanceof Error) {
    log('error', renderer);
    return Promise.reject(renderer);
  }
  // Add request route params, request query params
  // and the request extension to the locals object
  locals.params = req.params;
  locals.query = req.query;
  locals.extension = extension;

  return components.get(_ref, locals)
    .then(cmptData => formDataForRenderer(cmptData, { _ref }, locals))
    .tap(logTime(hrStart, _ref))
    .then(({data, options}) => renderer.render(data, options, res))
    .catch(err => log('error', err));
}
604519
def grid_html(grid, options, rendering, reuse_last_column_for_filter_buttons) #:nodoc:
      table_html_attrs, header_tr_html = options[:html], options[:header_tr_html]

      Wice::WgHash.add_or_append_class_value!(table_html_attrs, 'wice-grid', true)

      if Array === Defaults::DEFAULT_TABLE_CLASSES
        Defaults::DEFAULT_TABLE_CLASSES.each do |default_class|
          Wice::WgHash.add_or_append_class_value!(table_html_attrs, default_class, true)
        end
      end

      if options[:class]
        Wice::WgHash.add_or_append_class_value!(table_html_attrs, options[:class])
        options.delete(:class)
      end

      cycle_class = nil
      sorting_dependant_row_cycling = options[:sorting_dependant_row_cycling]

      grid.output_buffer = GridOutputBuffer.new

      # Ruby 1.9.x
      grid.output_buffer.force_encoding('UTF-8') if grid.output_buffer.respond_to?(:force_encoding)

      grid.output_buffer << %(<div class="wice-grid-container table-responsive" data-grid-name="#{grid.name}" id="#{grid.name}"><div id="#{grid.name}_title">)
      grid.output_buffer << content_tag(:h3, grid.saved_query.name) if grid.saved_query
      grid.output_buffer << "</div><table #{public_tag_options(table_html_attrs, true)}>"
      grid.output_buffer << "<caption>#{rendering.kaption}</caption>" if rendering.kaption
      grid.output_buffer << '<thead>'

      no_filters_at_all = (options[:show_filters] == :no || rendering.no_filter_needed?)

      if no_filters_at_all
        no_rightmost_column = no_filter_row = no_filters_at_all
      else
        no_rightmost_column = no_filter_row = (options[:show_filters] == :no || rendering.no_filter_needed_in_main_table?) ? true : false
      end

      no_rightmost_column = true if reuse_last_column_for_filter_buttons

      number_of_columns = rendering.number_of_columns(:in_html)
      number_of_columns -= 1 if no_rightmost_column

      number_of_columns_for_extra_rows = number_of_columns + 1

      pagination_panel_content_html = nil
      if options[:upper_pagination_panel]
        grid.output_buffer << rendering.pagination_panel(number_of_columns, options[:hide_csv_button]) do
          pagination_panel_content_html =
            pagination_panel_content(grid, options[:extra_request_parameters], options[:allow_showing_all_records], options[:pagination_theme])
          pagination_panel_content_html
        end
      end

      title_row_attrs = header_tr_html.clone
      Wice::WgHash.add_or_append_class_value!(title_row_attrs, 'wice-grid-title-row', true)

      grid.output_buffer << %(<tr #{public_tag_options(title_row_attrs, true)}>)

      filter_row_id = grid.name + '_filter_row'

      # first row of column labels with sorting links

      filter_shown = if options[:show_filters] == :when_filtered
        grid.filtering_on?
      elsif options[:show_filters] == :always
        true
      end

      rendering.each_column_aware_of_one_last_one(:in_html) do |column, last|
        column_name = column.name

        opts = column.html

        opts = opts ? opts.clone : {}

        Wice::WgHash.add_or_append_class_value!(opts, column.css_class)

        if column.attribute && column.ordering

          column.add_css_class('active-filter') if grid.filtered_by?(column)

          direction = 'asc'
          link_style = nil
          arrow_class = nil

          if grid.ordered_by?(column)
            column.add_css_class('sorted')
            Wice::WgHash.add_or_append_class_value!(opts, 'sorted')
            link_style = grid.order_direction

            case grid.order_direction
            when 'asc'
              direction = 'desc'
              arrow_class = 'down'
            when 'desc'
              direction = 'asc'
              arrow_class = 'up'
            end
          end

          col_link = link_to(
            (column_name +
              if arrow_class
                ' ' + content_tag(:i, '', class: "fa fa-arrow-#{arrow_class}")
              else
                ''
              end).html_safe,

            rendering.column_link(
              column,
              direction,
              params,
              options[:extra_request_parameters]
            ),
            class: link_style)

          grid.output_buffer << content_tag(:th, col_link, opts)

        else
          if reuse_last_column_for_filter_buttons && last
            grid.output_buffer << content_tag(:th,
                                              hide_show_icon(filter_row_id, grid, filter_shown, no_filter_row, options[:show_filters], rendering), opts
            )
          else
            grid.output_buffer << content_tag(:th, column_name, opts)
          end
        end
      end

      grid.output_buffer << content_tag(:th,
                                        hide_show_icon(filter_row_id, grid, filter_shown, no_filter_row, options[:show_filters], rendering)
      ) unless no_rightmost_column

      grid.output_buffer << '</tr>'
      # rendering first row end

      unless no_filters_at_all # there are filters, we don't know where, in the table or detached
        if no_filter_row # they are all detached
          rendering.each_column(:in_html) do |column|
            if column.filter_shown?
              filter_html_code = column.render_filter.html_safe
              grid.output_buffer.add_filter(column.detach_with_id, filter_html_code)
            end
          end

        else # some filters are present in the table

          filter_row_attrs = header_tr_html.clone
          Wice::WgHash.add_or_append_class_value!(filter_row_attrs, 'wg-filter-row', true)
          filter_row_attrs['id'] = filter_row_id

          grid.output_buffer << %(<tr #{public_tag_options(filter_row_attrs, true)} )
          grid.output_buffer << 'style="display:none"' unless filter_shown
          grid.output_buffer << '>'

          rendering.each_column_aware_of_one_last_one(:in_html) do |column, last|
            opts = column.html ? column.html.clone : {}
            Wice::WgHash.add_or_append_class_value!(opts, column.css_class)

            if column.filter_shown?

              filter_html_code = column.render_filter.html_safe
              if column.detach_with_id
                grid.output_buffer << content_tag(:th, '', opts)
                grid.output_buffer.add_filter(column.detach_with_id, filter_html_code)
              else
                grid.output_buffer << content_tag(:th, filter_html_code, opts)
              end
            else
              if reuse_last_column_for_filter_buttons && last
                grid.output_buffer << content_tag(:th,
                                                  reset_submit_buttons(options, grid, rendering),
                                                  Wice::WgHash.add_or_append_class_value!(opts, 'filter_icons')
                )
              else
                grid.output_buffer << content_tag(:th, '', opts)
              end
            end
          end
          unless no_rightmost_column
            grid.output_buffer << content_tag(:th, reset_submit_buttons(options, grid, rendering), class: 'filter_icons')
          end
          grid.output_buffer << '</tr>'
        end
      end

      grid.output_buffer << '</thead><tfoot>'
      grid.output_buffer << rendering.pagination_panel(number_of_columns, options[:hide_csv_button]) do
        if pagination_panel_content_html
          pagination_panel_content_html
        else
          pagination_panel_content_html =
            pagination_panel_content(grid, options[:extra_request_parameters], options[:allow_showing_all_records], options[:pagination_theme])
          pagination_panel_content_html
        end
      end

      grid.output_buffer << '</tfoot><tbody>'

      # rendering  rows
      cell_value_of_the_ordered_column = nil
      previous_cell_value_of_the_ordered_column = nil

      grid.each do |ar| # rows
        before_row_output = if rendering.before_row_handler
          call_block(rendering.before_row_handler, ar, number_of_columns_for_extra_rows)
        end

        after_row_output = if rendering.after_row_handler
          call_block(rendering.after_row_handler, ar, number_of_columns_for_extra_rows)
        end

        replace_row_output = if rendering.replace_row_handler
          call_block(rendering.replace_row_handler, ar, number_of_columns_for_extra_rows)
        end

        row_content = if replace_row_output
          no_rightmost_column = true
          replace_row_output
        else
          row_content, tmp_cell_value_of_the_ordered_column = get_row_content(rendering, ar, sorting_dependant_row_cycling)
          cell_value_of_the_ordered_column = tmp_cell_value_of_the_ordered_column if tmp_cell_value_of_the_ordered_column
          row_content
        end

        row_attributes = rendering.get_row_attributes(ar)

        if sorting_dependant_row_cycling
          cycle_class = cycle('odd', 'even', name: grid.name) if cell_value_of_the_ordered_column != previous_cell_value_of_the_ordered_column
          previous_cell_value_of_the_ordered_column = cell_value_of_the_ordered_column
        else
          cycle_class = cycle('odd', 'even', name: grid.name)
        end

        Wice::WgHash.add_or_append_class_value!(row_attributes, cycle_class)

        grid.output_buffer << before_row_output if before_row_output
        grid.output_buffer << "<tr #{public_tag_options(row_attributes)}>#{row_content}"
        grid.output_buffer << content_tag(:td, '') unless no_rightmost_column
        grid.output_buffer << '</tr>'
        grid.output_buffer << after_row_output if after_row_output
      end

      last_row_output = if rendering.last_row_handler
        call_block(rendering.last_row_handler, number_of_columns_for_extra_rows)
      end

      grid.output_buffer << last_row_output if last_row_output

      grid.output_buffer << '</tbody></table>'

      base_link_for_filter, base_link_for_show_all_records = rendering.base_link_for_filter(controller, options[:extra_request_parameters])

      link_for_export = rendering.link_for_export(controller, 'csv', options[:extra_request_parameters])

      parameter_name_for_query_loading = { grid.name => { q: '' } }.to_query
      parameter_name_for_focus = { grid.name => { foc: '' } }.to_query

      processor_initializer_arguments = [
        base_link_for_filter,
        base_link_for_show_all_records,
        link_for_export,
        parameter_name_for_query_loading,
        parameter_name_for_focus,
        Rails.env
      ]

      filter_declarations = if no_filters_at_all
        []
      else
        rendering.select_for(:in_html) do |vc|
          vc.attribute && vc.filter
        end.collect(&:yield_declaration)
      end

      wg_data = {
        'data-processor-initializer-arguments' => processor_initializer_arguments.to_json,
        'data-filter-declarations'             => filter_declarations.to_json,
        :class                                 => 'wg-data'
      }

      wg_data['data-foc'] = grid.status['foc'] if grid.status['foc']

      grid.output_buffer << content_tag(:div, '', wg_data)

      grid.output_buffer << '</div>'

      if Rails.env.development?
        grid.output_buffer << javascript_tag(%/ document.ready = function(){ \n/ +
          %$ if (typeof(WiceGridProcessor) == "undefined"){\n$ +
          %$   alert("wice_grid.js not loaded, WiceGrid cannot proceed!\\n" +\n$ +
          %(     "Make sure that you have loaded wice_grid.js.\\n" + ) +
          %(     "Add line //= require wice_grid.js " + ) +
          %$     "to app/assets/javascripts/application.js")\n$ +
          %( } ) +
          %$ } $)
      end

      grid.output_buffer
    end
185669
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WDefinitionList list = (WDefinitionList) component;
		XmlStringBuilder xml = renderContext.getWriter();

		xml.appendTagOpen("ui:definitionlist");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");

		switch (list.getType()) {
			case FLAT:
				xml.appendAttribute("type", "flat");
				break;

			case COLUMN:
				xml.appendAttribute("type", "column");
				break;

			case STACKED:
				xml.appendAttribute("type", "stacked");
				break;

			case NORMAL:
				break;

			default:
				throw new SystemException("Unknown layout type: " + list.getType());
		}

		xml.appendClose();

		// Render margin
		MarginRendererUtil.renderMargin(list, renderContext);

		for (Duplet<String, ArrayList<WComponent>> term : list.getTerms()) {
			xml.appendTagOpen("ui:term");
			xml.appendAttribute("text", I18nUtilities.format(null, term.getFirst()));
			xml.appendClose();

			for (WComponent data : term.getSecond()) {
				xml.appendTag("ui:data");
				data.paint(renderContext);
				xml.appendEndTag("ui:data");
			}

			xml.appendEndTag("ui:term");
		}

		xml.appendEndTag("ui:definitionlist");
	}
794548
def render
      buffer = []
      _guess_col_widths
      rows = @list.size.to_s.length
      @rows = rows
      _prepare_format
      
      str = ""
      if @numbering
        str = " "*(rows+1)+@y
      end
      str <<  @fmstr % @columns
      buffer << str
      #puts "-" * str.length
      buffer << separator
      if @list
        if @numbering
          @fmstr = "%#{rows}d "+ @y + @fmstr
        end
        #@list.each { |e| puts e.join(@y) }
        count = 0
        @list.each_with_index { |r,i|  
          value = convert_value_to_text r, count
          buffer << value
          count += 1
        }
      end
      buffer
    end
417864
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		AbstractWFieldIndicator fieldIndicator = (AbstractWFieldIndicator) component;
		XmlStringBuilder xml = renderContext.getWriter();

		WComponent validationTarget = fieldIndicator.getTargetComponent();

		// no need to render an indicator for nothing.
		// Diagnosables takes care of thieir own  messaging.
		if (validationTarget == null || (validationTarget instanceof Diagnosable && !(validationTarget instanceof Input))) {
			return;
		}

		if (validationTarget instanceof Input && !((Input) validationTarget).isReadOnly()) {
			return;
		}

		List<Diagnostic> diags = fieldIndicator.getDiagnostics();

		if (diags != null && !diags.isEmpty()) {
			xml.appendTagOpen("ui:fieldindicator");
			xml.appendAttribute("id", component.getId());
			xml.appendOptionalAttribute("track", component.isTracking(), "true");

			switch (fieldIndicator.getFieldIndicatorType()) {
				case INFO:
					xml.appendAttribute("type", "info");
					break;

				case WARN:
					xml.appendAttribute("type", "warn");
					break;

				case ERROR:
					xml.appendAttribute("type", "error");
					break;

				default:
					throw new SystemException("Cannot paint field indicator due to an invalid field indicator type: "
							+ fieldIndicator.getFieldIndicatorType());
			}

			xml.appendAttribute("for", fieldIndicator.getRelatedFieldId());
			xml.appendClose();

			for (Diagnostic diag : diags) {
				xml.appendTag("ui:message");
				xml.appendEscaped(diag.getDescription());
				xml.appendEndTag("ui:message");
			}

			xml.appendEndTag("ui:fieldindicator");
		}
	}
977725
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WMessageBox messageBox = (WMessageBox) component;
		XmlStringBuilder xml = renderContext.getWriter();

		if (messageBox.hasMessages()) {
			xml.appendTagOpen("ui:messagebox");
			xml.appendAttribute("id", component.getId());
			xml.appendOptionalAttribute("class", component.getHtmlClass());
			xml.appendOptionalAttribute("track", component.isTracking(), "true");

			switch (messageBox.getType()) {
				case SUCCESS:
					xml.appendOptionalAttribute("type", "success");
					break;

				case INFO:
					xml.appendOptionalAttribute("type", "info");
					break;

				case WARN:
					xml.appendOptionalAttribute("type", "warn");
					break;

				case ERROR:
				default:
					xml.appendOptionalAttribute("type", "error");
					break;
			}

			xml.appendOptionalAttribute("title", messageBox.getTitleText());

			xml.appendClose();

			for (String message : messageBox.getMessages()) {
				xml.appendTag("ui:message");
				xml.print(message);
				xml.appendEndTag("ui:message");
			}

			xml.appendEndTag("ui:messagebox");
		}
	}