/*
处理renderType
begin为起始行，length为行数（增加行数时使用）
325393
function renderTypeFun(obj) {
    if (!this.isGridShow()) return;
    if (typeof obj == 'undefined') {
        var begin = null,
            length = null,
            field = '';
    } else {
        var begin = typeof obj.begin == 'undefined' ? null : obj.begin,
            length = typeof obj.length == 'undefined' ? null : obj.length,
            field = typeof obj.field == 'undefined' ? '' : obj.field;
    }
    var oThis = this,
        begin = parseInt(begin),
        length = parseInt(length),
        end = begin;
    if (length > 0) {
        end = parseInt(begin + length - 1);
    }
    if (field == '') {
        if (this.gridCompColumnFixedArr) $.each(this.gridCompColumnFixedArr, function (i) {
            oThis.renderTypeByColumn(this, i, begin, length, true);
        });
        $.each(this.gridCompColumnArr, function (i) {
            oThis.renderTypeByColumn(this, i, begin, length, false);
        });
    } else {
        var rendered = false;
        if (this.gridCompColumnFixedArr) $.each(this.gridCompColumnFixedArr, function (i) {
            if (this.options.field == field) {
                oThis.renderTypeByColumn(this, i, begin, length, true);
                rendered = true;
                return;
            }
        });
        if (!rendered) $.each(this.gridCompColumnArr, function (i) {
            if (this.options.field == field) {
                oThis.renderTypeByColumn(this, i, begin, length, false);
                return;
            }
        });
    }
}
1073024
@Override
	protected void renderContent(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		log.trace("renderContent");

		Map<String, String> pageProps = new HashMap<String, String>();
		pageProps.put("message", "");
		pageProps.put("searchAllChecked", "");
		pageProps.put("resourceType", "");

		ComponentBindingsProviderFactoryImpl factoryImpl = (ComponentBindingsProviderFactoryImpl) factory;

		if ("true".equals(req.getParameter("reloadCache"))) {
			factoryImpl.reloadCache();
			pageProps.put("message", "Cache Reloaded");
		}
		List<ServiceReference> bindingProviders = new ArrayList<ServiceReference>();
		String resourceType = req.getParameter("resourceType");
		if (!StringUtils.isEmpty(resourceType)) {
			log.debug("Searching for resource type: {}", resourceType);
			pageProps.put("resourceType", resourceType);
			bindingProviders = factoryImpl.getReferences(req
					.getParameter("resourceType"));
		} else if ("true".equals(req.getParameter("searchAll"))) {
			pageProps.put("searchAllChecked", "checked");
			log.debug("Searching for all binding providers");
			for (String rt : factoryImpl.getLoadedResourceTypes()) {
				log.debug("Searching for resource type: {}", rt);
				for (ServiceReference reference : factoryImpl.getReferences(rt)) {
					if (!bindingProviders.contains(reference)) {
						bindingProviders.add(reference);
					}
				}
			}
		}

		renderBlock(res, "header.html", pageProps);
		renderBlock(res, "search.html", pageProps);

		for (int i = 0; i < bindingProviders.size(); i++) {
			Map<String, String> properties = loadProperties(bindingProviders
					.get(i));
			properties.put("state", (i + 1) % 2 == 0 ? "even" : "odd");
			renderBlock(res, "result.html", properties);
		}
		res.getWriter().write("</tbody></table>");

		res.getWriter()
				.write("<table><tr><th class=\"content ui-state-default\">Recent Exceptions</th></tr>");

		for (final Object obj : componentBindingsValuesProvider
				.getRecentExceptions()) {
			renderBlock(res, "exception.html", new HashMap<String, String>() {
				private static final long serialVersionUID = 1L;
				{
					put("ex", obj.toString());
				}
			});
		}
		res.getWriter().write("</table>");
	}
1039659
function (startIndex, endIndex) {
                if (_.isUndefined(startIndex)) {
                    startIndex = Number.MAX_VALUE;
                }
                if (_.isUndefined(endIndex)) {
                    endIndex = -1;
                }
                var renderer;
                // release unused renderer
                for (var index in this.$activeRenderer) {
                    if (this.$activeRenderer.hasOwnProperty(index) && (index < startIndex || index > endIndex)) {
                        // render not in use
                        renderer = this.$activeRenderer[index];
                        if (renderer) {
                            renderer.set({
                                $index: null,
                                $dataItem: null
                            });

                            renderer.remove();

                            this.$availableRenderer.push(renderer);
                        }

                        delete this.$activeRenderer[index];
                    }
                }
            }
1251232
@Override
	public void paint(final RenderContext renderContext) {

		if (!doTransform) {
			super.paint(renderContext);
			return;
		}

		if (!(renderContext instanceof WebXmlRenderContext)) {
			LOG.warn("Unable to transform a " + renderContext);
			super.paint(renderContext);
			return;
		}
		LOG.debug("Transform XML Interceptor: Start");

		UIContext uic = UIContextHolder.getCurrent();

		// Set up a render context to buffer the XML payload.
		StringWriter xmlBuffer = new StringWriter();
		PrintWriter xmlWriter = new PrintWriter(xmlBuffer);

		WebXmlRenderContext xmlContext = new WebXmlRenderContext(xmlWriter, uic.getLocale());

		super.paint(xmlContext);  // write the XML to the buffer

		// Get a handle to the true PrintWriter.
		WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
		PrintWriter writer = webRenderContext.getWriter();

		/*
		 * Switch the response content-type to HTML.
		 * In theory the transformation could be to ANYTHING (not just HTML) so perhaps it would make more sense to
		 *    write a new interceptor "ContentTypeInterceptor" which attempts to sniff payloads and choose the correct
		 *    content-type. This is exactly the kind of thing IE6 loved to do, so perhaps it's a bad idea.
		 */
		Response response = getResponse();
		response.setContentType(WebUtilities.CONTENT_TYPE_HTML);

		String xml = xmlBuffer.toString();
		if (isAllowCorruptCharacters() && !Util.empty(xml)) {
			// Remove illegal HTML characters from the content before transforming it.
			xml = removeCorruptCharacters(xml);
		}
		// Double encode template tokens in the XML
		xml = WebUtilities.doubleEncodeBrackets(xml);
		// Setup temp writer
		StringWriter tempBuffer = new StringWriter();
		PrintWriter tempWriter = new PrintWriter(tempBuffer);
		// Perform the transformation and write the result.
		transform(xml, uic, tempWriter);
		// Decode Double Encoded Brackets
		String tempResp = tempBuffer.toString();
		tempResp = WebUtilities.doubleDecodeBrackets(tempResp);
		// Write response
		writer.write(tempResp);

		LOG.debug("Transform XML Interceptor: Finished");
	}
716609
function (outputName, renderer) {
        var outputInfo = this.outputs[outputName];
        var parameters = outputInfo.parameters;
        var parametersCopy = outputInfo._parametersCopy;
        if (!parametersCopy) {
            parametersCopy = outputInfo._parametersCopy = {};
        }
        if (parameters) {
            for (var key in parameters) {
                if (key !== 'width' && key !== 'height') {
                    parametersCopy[key] = parameters[key];
                }
            }
        }
        var width, height;
        if (typeof parameters.width === 'function') {
            width = parameters.width.call(this, renderer);
        }
        else {
            width = parameters.width;
        }
        if (typeof parameters.height === 'function') {
            height = parameters.height.call(this, renderer);
        }
        else {
            height = parameters.height;
        }
        width = Math.ceil(width);
        height = Math.ceil(height);
        if (
            parametersCopy.width !== width
            || parametersCopy.height !== height
        ) {
            if (this._outputTextures[outputName]) {
                this._outputTextures[outputName].dispose(renderer);
            }
        }
        parametersCopy.width = width;
        parametersCopy.height = height;

        return parametersCopy;
    }
1250570
public RequestContext renderTrueResult() {
        if (renderer instanceof JsonRenderer) {
            final JsonRenderer r = (JsonRenderer) renderer;

            final JSONObject ret = r.getJSONObject();
            ret.put(Keys.STATUS_CODE, true);
        }

        return this;
    }
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));
}
1337504
function createRendererType2(values) {
    return {
        id: UNDEFINED_RENDERER_TYPE_ID,
        styles: values.styles,
        encapsulation: values.encapsulation,
        data: values.data
    };
}
116736
function render() {
  return function(...args) {
    return (
      <PseudoContext.Consumer>
        {value => {
          if (!value) {
            return defaultTextRender.apply(this, args);
          }
          return renderText(args, this);
        }}
      </PseudoContext.Consumer>
    );
  };
}
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");
		}
	}
34813
@Override
	public void render() {
		uri = ActionContext.getContextPath() + uri;
		try {
			Response.getServletResponse().sendRedirect(uri);
		} catch (IOException e) {
			throw new RenderException("Redirect to [" + uri + "] error!", e);
		}
	}
1167929
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WColumn col = (WColumn) component;
		XmlStringBuilder xml = renderContext.getWriter();

		xml.appendTagOpen("ui:column");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		int width = col.getWidth();
		xml.appendOptionalAttribute("width", width > 0, width);

		switch (col.getAlignment()) {
			case LEFT:
				// left is assumed if omitted
				break;

			case RIGHT:
				xml.appendAttribute("align", "right");
				break;

			case CENTER:
				xml.appendAttribute("align", "center");
				break;

			default:
				throw new IllegalArgumentException("Invalid alignment: " + col.getAlignment());
		}

		xml.appendClose();

		// Paint column contents
		paintChildren(col, renderContext);

		xml.appendEndTag("ui:column");
	}
1216207
@Override
	public void render() {
		if(null == this.file){
			throw new RenderException("File param is null !");
		}
		if(false == file.exists()){
			throw new RenderException(StrUtil.format("File [{}] not exist !", file));
		}
		if(false == file.isFile()){
			throw new RenderException(StrUtil.format("File [{}] not a file !", file));
		}
		long fileLength = file.length();
		if(fileLength > Integer.MAX_VALUE) {
			throw new RenderException("File [" + file.getName() + "] is too large, file size: [" + fileLength + "]");
		}
		
		if (StrUtil.isBlank(responseFileName)) {
			// 如果未指定文件名，使用原文件名
			responseFileName = file.getName();
		}
		responseFileName = HttpUtil.encode(responseFileName, HuluSetting.charset);
		
		final HttpServletResponse response = Response.getServletResponse();
		response.addHeader("Content-disposition", "attachment; filename=" + responseFileName);
		response.setContentType("application/octet-stream");
		response.setContentLength((int)fileLength);
		
		try {
			Response.write(new FileInputStream(file));
		} catch (FileNotFoundException e) {
			throw new RenderException(StrUtil.format("File [{}] not exist !", file), e);
		}
	}
672104
function render (currentTime) {
      // Store time scroll started, if not started already:
      if (!startTime) {
        startTime = currentTime;
      }

      // Determine time spent scrolling so far:
      elapsedTime = currentTime - startTime;

      // Calculate next scroll position:
      next = easing(elapsedTime, start, distance, duration, settings);

      // Scroll to it:
      window.scrollTo(0, next);

      // Check progress:
      elapsedTime < duration
        ? window.requestAnimationFrame(render)
        : done(start, startTime, distance, settings);
    }
1349449
def render(self, type, rerender=False):
        """"""
        for child in self.children:
            child.render(type, rerender)
559815
private int renderStructured() {
        if(LOGGER.isDebugEnabled() && _padContext != null)
            LOGGER.debug("\ncurrentIndex: " + _currentIndex + "\n" +
                    "checkMaxRepeat: " + _padContext.checkMaxRepeat(_currentIndex) + "\n" +
                    "checkMinRepeat: " + _padContext.checkMinRepeat(_currentIndex) + "\n");

        if(_renderState == INIT) {
            _renderState = HEADER;
            return EVAL_BODY_AGAIN;
        }

        if(_renderState == HEADER) {
            assert _renderedItems == 0;

            /* this would only happen if Pad.maxRepeat == 0 */
            if(_padContext != null && _padContext.checkMaxRepeat(_renderedItems)) {
                _renderState = FOOTER;
                return EVAL_BODY_AGAIN;
            }

            if(_currentItem == null && _ignoreNulls) {
                advanceToNonNullItem();

                /* no non-null item was found; render the footer */
                if(_currentItem == null) {
                    doPadding();
                    // render the header
                    _renderState = FOOTER;
                }
                /* non-null item found; it's not the 0th item; render it */
                else _renderState = ITEM;
            }
            /* 0th item is non-null; render it */
            else _renderState = ITEM;

            return EVAL_BODY_AGAIN;
        }

        if(_renderState == ITEM) {
            _renderedItems++;

            /* check that the maximum number of items to render has *not* been reached */
                if(_iterator.hasNext() && (_padContext == null || (_padContext != null && !_padContext.checkMaxRepeat(_renderedItems)))) {
                _currentIndex++;
                _currentItem = _iterator.next();

                if(_ignoreNulls && _currentItem == null) {
                    advanceToNonNullItem();

                    /* last item */
                    if(_currentItem == null) {
                        doPadding();

                        /* render the header */
                        _renderState = FOOTER;
                        return EVAL_BODY_AGAIN;
                    }
                }

                /* if _ignoreNulls is false, the _currentItem may be null here */
                return EVAL_BODY_AGAIN;
            }
            /*
             have finished rendering items for some reason:
              1) there isn't a next item
              2) reached the maximum number of items to render
              So:
              1) pad if necessary
              2) render the footer
             */
            else {
                doPadding();

                _renderState = FOOTER;
                return EVAL_BODY_AGAIN;
            }
        }

        if(_renderState == FOOTER) {
            _renderState = END;
            return SKIP_BODY;
        }

        return SKIP_BODY;
    }
700989
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WFileWidget fileWidget = (WFileWidget) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = fileWidget.isReadOnly();

		xml.appendTagOpen(TAG_NAME);
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
			xml.appendEnd();
			return;
		}
		xml.appendOptionalAttribute("disabled", fileWidget.isDisabled(), "true");
		xml.appendOptionalAttribute("required", fileWidget.isMandatory(), "true");
		xml.appendOptionalAttribute("toolTip", fileWidget.getToolTip());
		xml.appendOptionalAttribute("accessibleText", fileWidget.getAccessibleText());
		xml.appendOptionalAttribute("acceptedMimeTypes", typesToString(fileWidget.getFileTypes()));
		long maxFileSize = fileWidget.getMaxFileSize();
		xml.appendOptionalAttribute("maxFileSize", maxFileSize > 0, maxFileSize);

		List<Diagnostic> diags = fileWidget.getDiagnostics(Diagnostic.ERROR);
		if (diags == null || diags.isEmpty()) {
			xml.appendEnd();
			return;
		}
		xml.appendClose();
		DiagnosticRenderUtil.renderDiagnostics(fileWidget, renderContext);
		xml.appendEndTag(TAG_NAME);
	}