This methods generates the HTML code of the current b:message.

@param context
the FacesContext.
@param component
the current b:message.
@throws IOException
thrown if something goes wrong when writing the HTML code.
352206
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}

		Message message = (Message) component;
		String forValue = message.getFor();
		if (null == forValue || forValue.length() == 0)
			forValue = "@previous";
		try {
		forValue = ExpressionResolver.getComponentIDs(context, message, forValue);
		} catch (FacesException ex) {
			if (null == message.getFor() || message.getFor().length() == 0) {
				throw new FacesException("<b:message> couldn't find its predecessor automatically. Please add the 'for' attribute to indicate which JSF element the message belongs to. id of the <b:message>: " + message.getClientId());
			}
		}

		List<FacesMessage> messageList = context.getMessageList(forValue);

		ResponseWriter rw = context.getResponseWriter();
		int numberOfDivs = 0;
		boolean idHasBeenRendered = false;

		String responsiveStyleClass = Responsive.getResponsiveStyleClass(message, false).trim();
		String clientId = message.getClientId(context);
		numberOfDivs++;
		rw.startElement("div", component);
		if (!responsiveStyleClass.isEmpty()) {
			writeAttribute(rw, "class", responsiveStyleClass);
		}
		writeAttribute(rw, "id", clientId);
		idHasBeenRendered = true;

		if (!messageList.isEmpty()) {
			numberOfDivs++;
			rw.startElement("div", message);
			if (!idHasBeenRendered) {
				writeAttribute(rw, "id", clientId);
			}
			if (null != message.getDir()) {
				rw.writeAttribute("dir", message.getDir(), "dir");
			}

			String styleClass = message.getStyleClass();
			if (null != styleClass && styleClass.length() > 0)
				styleClass = styleClass + " ";
			else
				styleClass = "";

			String severityClass = findHighestSeverityClass(messageList, message);
			// alert-danger
			styleClass += "alert " + severityClass + " bf-message";

			writeAttribute(rw, "class", styleClass.trim());
			String style = message.getStyle();
			if (null == style)
				style = "";
			else if (!style.endsWith(";"))
				style += ";";
			String severityStyle = findHighestSeverityStyle(messageList, message);
			if (null == severityStyle)
				severityStyle = "";
			else if (!severityStyle.endsWith(";"))
				severityStyle += ";";

			writeAttribute(rw, "style", style + severityStyle);
			writeAttribute(rw, "role", "alert");

			boolean onlyMostSevere = message.isOnlyMostSevere();
			FacesMessage mostSevere = null;
			if (onlyMostSevere) {
				for (FacesMessage msg : messageList) {
					if (null == mostSevere || msg.getSeverity().getOrdinal() > mostSevere.getSeverity().getOrdinal()) {
						mostSevere = msg;
					}
				}
			}

			boolean firstMessage = true;

			for (FacesMessage msg : messageList) {
				if (onlyMostSevere && msg != mostSevere) {
					continue;
				}
				if (!firstMessage) {
					if (message.isLineBreak()) {
						rw.append(message.getLineBreakTag());
					}
				}
				firstMessage = false;

				if (message.isShowIcon()) {
					rw.startElement("span", component);
					writeAttribute(rw, "class", findHighestSeverityIcon(messageList, message) + " bf-message-icon");
					writeAttribute(rw, "aria-hidden", "true");
					rw.endElement("span");
				}

				if (message.isShowSummary() && msg.getSummary() != null && !msg.getSummary().equals(msg.getDetail())) {
					rw.startElement("span", component);
					writeAttribute(rw, "class", "bf-message-summary");
					if (message.isEscape()) {
						rw.writeText(msg.getSummary(), null);
					} else {
						warnOnFirstUse();
						rw.write(msg.getSummary());
					}
					rw.endElement("span");
				}

				if (message.isShowDetail() && msg.getDetail() != null) {
					rw.startElement("span", component);
					writeAttribute(rw, "class", "bf-message-detail");
					if (message.isEscape()) {
						rw.writeText(msg.getDetail(), null);
					} else {
						warnOnFirstUse();
						rw.write(msg.getDetail());
					}

					rw.endElement("span");
				}
				msg.rendered();
			}
		}
		for (int i = numberOfDivs; i > 0; i--) {
			rw.endElement("div");
		}
	}
531065
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {
        if (!ComponentHandler.isNew(parent))
        {
            return;
        }
        if (parent instanceof EditableValueHolder)
        {
            applyAttachedObject(ctx.getFacesContext(), parent);
        }
        else if (UIComponent.isCompositeComponent(parent))
        {
            FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx);
            mctx.addAttachedObjectHandler(parent, this);
        }
        else
        {
            throw new TagException(this.tag,
                    "Parent not composite component or an instance of EditableValueHolder: " + parent);
        }
    }
734598
@Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        PuiButton button = (PuiButton) component;
        writer.startElement("pui-button", component);
        String actionListener = button.getActionListener();
        if ((null != actionListener) && (!actionListener.contains("("))) {
            actionListener += "()";
        }
        renderNonEmptyAttribute(writer, "actionListener", actionListener);
        renderNonEmptyAttribute(writer, "disabled", button.getDisabled());
        renderNonEmptyAttribute(writer, "icon", button.getIcon());
        renderNonEmptyAttribute(writer, "iconPos", button.getIconPos());
        renderNonEmptyAttribute(writer, "value", button.getValue());
        writer.endElement("pui-button");
    }
654640
private void encodeHTML(FacesContext fc) throws IOException {
		boolean idHasBeenRendered = false;
		Map<String, Object> attrs = getAttributes();
		String clientId = getClientId(fc);
		ResponseWriter rw = fc.getResponseWriter();
		int numberOfDivs = 0;
		String responsiveStyleClass = Responsive.getResponsiveStyleClass(this, false).trim();
		if (responsiveStyleClass.length() > 0 && (!CoreRenderer.isHorizontalForm(this))) {
			rw.startElement("div", this);
			rw.writeAttribute("class", responsiveStyleClass, "class");
			rw.writeAttribute("id", clientId, "id");
			Tooltip.generateTooltip(fc, this, rw);
			idHasBeenRendered = true;
			numberOfDivs++;
		}
		rw.startElement("div", this);
		numberOfDivs++;
		String errorSeverityClass = BsfUtils.isLegacyFeedbackClassesEnabled() ? ""
				: FacesMessages.getErrorSeverityClass(clientId);

		String formGroupClass = "";
		if (!(getParent() instanceof FormGroup)) {
			formGroupClass = "form-group";
		}
		rw.writeAttribute("class", formGroupClass + errorSeverityClass, "class");
		if (!idHasBeenRendered) {
			rw.writeAttribute("id", clientId, "id");
			Tooltip.generateTooltip(fc, this, rw);
			idHasBeenRendered = true;
		}
		addLabel(rw, clientId + "_input", clientId);

		if (responsiveStyleClass.length() > 0 && (CoreRenderer.isHorizontalForm(this))) {
			rw.startElement("div", this);
			numberOfDivs++;
			rw.writeAttribute("class", responsiveStyleClass, "class");
		}

		// stz = selectTimeZone(attrs.get(A.TZ));

		sloc = selectLocale(fc.getViewRoot().getLocale(), A.asString(attrs.get(JQ.LOCALE)));
		sdf = selectDateFormat(sloc, A.asString(attrs.get(JQ.DTFORMAT)));

		// Debugging Locale and dateformat
		// rw.write("<span>DEBUG sloc='"+sloc+"', sdf='"+sdf+"' </span>");

		String dpId;

		Object v = getSubmittedValue();
		if (v == null) {
			v = this.getValue();
		}

		/*
		 * 6 modes: 1) inline 2) popup (no icons) 3) popup-icon 4) icon-popup 5)
		 * toggle-icon (Default) 6) icon-toggle
		 */
		boolean isDisabled = A.toBool(attrs.get("disabled"));
		mode = A.asString(attrs.get("mode"), "toggle-icon");
		boolean inline = mode.equals("inline");

		if (inline) { // inline => div with ID
			dpId = clientId + "_" + "div";
			rw.startElement("div", this);
			rw.writeAttribute("id", dpId, null);
			if (getStyleClass() != null) {
				rw.writeAttribute("class", getStyleClass(), "styleClass");
			}
			if (getStyle() != null) {
				rw.writeAttribute("style", getStyle(), "style");
			}
			rw.endElement("div");
		} else { // popup
			dpId = clientId + "_input";

			if (!mode.equals("popup")) { // with icon => div with prepend/append
											// style
				rw.startElement("div", this);
				numberOfDivs++;
				String clazz = "input-group ";
				if (null != getStyleClass()) {
					clazz += getStyleClass() + " ";
				}
				rw.writeAttribute("class", clazz, "class");
				if (getStyle() != null) {
					rw.writeAttribute("style", getStyle(), "style");
				}

				if (mode.equals("icon-popup") || mode.equals("icon-toggle")) {
					rw.startElement("span", this);
					rw.writeAttribute("id", clientId + "_" + ADDON, "id");
					rw.writeAttribute("class", ADDON, "class");
					IconRenderer.encodeIcon(rw, this, "calendar", false, null, null, null, false, null, null,
							isDisabled, true, true, true, isIconBrand(), isIconInverse(), isIconLight(), isIconPulse(),
							isIconRegular(), isIconRegular());

					rw.endElement("span");
				}
			}
		}
		String type = inline ? "hidden" : "text";

		rw.startElement("input", null);
		rw.writeAttribute("id", clientId + "_input", null);
		if (getTabindex() != null) {
			rw.writeAttribute("tabindex", getTabindex(), null);
		}

		// if (getStyle() != null) {
		// rw.writeAttribute("style", getStyle(), "style");
		// }
		rw.writeAttribute("name", clientId, null);
		rw.writeAttribute("type", type, null);
		String styleClass = new CoreRenderer().getErrorAndRequiredClass(this, clientId);
		rw.writeAttribute("class", "form-control " + styleClass, "class");
		if (v != null) {
			rw.writeAttribute("value", getConvertedDateAsString(v, sdf, sloc), null);
		}

		String ph = A.asString(attrs.get("placeholder"));
		if (ph != null) {
			rw.writeAttribute("placeholder", ph, null);
		}

		if (isDisabled) {
			rw.writeAttribute("disabled", "disabled", null);
		}
		if (A.toBool(attrs.get("readonly"))) {
			rw.writeAttribute("readonly", "readonly", null);
		}
		rw.endElement("input");

		encodeJS(fc, rw, clientId + "_input", dpId);
		if (mode.equals("popup-icon") || mode.equals("toggle-icon")) {
			rw.startElement("span", this);
			rw.writeAttribute("id", clientId + "_" + ADDON, "id");
			rw.writeAttribute("class", ADDON, "class");

			IconRenderer.encodeIcon(rw, this, "calendar", false, null, null, null, false, null, null, isDisabled, true,
					true, true, isIconBrand(), isIconInverse(), isIconLight(), isIconPulse(), isIconRegular(),
					isIconRegular());

			rw.endElement("span");
		}

		if (!inline && !mode.equals("popup")) {
			rw.endElement("div");
			numberOfDivs--;
			JQ.datePickerToggler(rw, clientId + "_input", clientId + "_" + ADDON);

		} // Closes the popup prepend/append style div

		while (numberOfDivs > 0) {
			rw.endElement("div");
			numberOfDivs--;
		}
	}
1310837
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPanel panel = (WPanel) component;
		XmlStringBuilder xml = renderContext.getWriter();
		FlowLayout layout = (FlowLayout) panel.getLayout();
		Size gap = layout.getSpace();
		String gapString = gap != null ? gap.toString() : null;
		FlowLayout.Alignment align = layout.getAlignment();

		xml.appendTagOpen("ui:flowlayout");

		switch (align) {
			case RIGHT: {
				xml.appendAttribute("align", "right");
				break;
			}
			case CENTER: {
				xml.appendAttribute("align", "center");
				break;
			}
			case LEFT: {
				xml.appendAttribute("align", "left");
				break;
			}

			case VERTICAL:
				xml.appendAttribute("align", "vertical");
				break;

			default:
				throw new IllegalStateException("Unknown layout type: " + layout.getAlignment());
		}

		if (layout.getContentAlignment() != null) {
			switch (layout.getContentAlignment()) {
				case TOP: {
					xml.appendAttribute("valign", "top");
					break;
				}
				case MIDDLE: {
					xml.appendAttribute("valign", "middle");
					break;
				}
				case BASELINE: {
					xml.appendAttribute("valign", "baseline");
					break;
				}

				case BOTTOM:
					xml.appendAttribute("valign", "bottom");
					break;

				default:
					throw new IllegalStateException("Unknown content alignment type: " + layout.
							getContentAlignment());
			}
		}
		xml.appendOptionalAttribute("gap", gapString);

		xml.appendClose();

		int size = panel.getChildCount();

		for (int i = 0; i < size; i++) {
			xml.appendTag("ui:cell");
			WComponent child = panel.getChildAt(i);
			child.paint(renderContext);
			xml.appendEndTag("ui:cell");
		}

		xml.appendEndTag("ui:flowlayout");
	}
1026696
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WTextField textField = (WTextField) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = textField.isReadOnly();

		xml.appendTagOpen("ui:textfield");
		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");
		} else {
			int cols = textField.getColumns();
			int minLength = textField.getMinLength();
			int maxLength = textField.getMaxLength();
			String pattern = textField.getPattern();

			WSuggestions suggestions = textField.getSuggestions();
			String suggestionsId = suggestions == null ? null : suggestions.getId();

			WComponent submitControl = textField.getDefaultSubmitButton();
			String submitControlId = submitControl == null ? null : submitControl.getId();

			xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true");
			xml.appendOptionalAttribute("required", textField.isMandatory(), "true");
			xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
			xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
			xml.appendOptionalAttribute("toolTip", textField.getToolTip());
			xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText());
			xml.appendOptionalAttribute("size", cols > 0, cols);
			xml.appendOptionalAttribute("buttonId", submitControlId);
			xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern);
			xml.appendOptionalAttribute("list", suggestionsId);
			String placeholder = textField.getPlaceholder();
			xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
			String autocomplete = textField.getAutocomplete();
			xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
		}

		xml.appendClose();

		xml.appendEscaped(textField.getText());
		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(textField, renderContext);
		}
		xml.appendEndTag("ui:textfield");
	}
147112
protected void startTable(FacesContext facesContext, UIComponent uiComponent) throws IOException
    {
        ResponseWriter writer = facesContext.getResponseWriter();
        writer.startElement(HTML.TABLE_ELEM, uiComponent);
        
        Map<String, List<ClientBehavior>> behaviors = null;
        if (uiComponent instanceof ClientBehaviorHolder)
        {
            behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
            if (!behaviors.isEmpty())
            {
                HtmlRendererUtils.writeIdAndName(writer, uiComponent, facesContext);
            }
            else
            {
                HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent, facesContext);
            }
            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderEventProperties(writer, 
                        CommonPropertyUtils.getCommonPropertiesMarked(uiComponent), uiComponent);
            }
            else
            {
                if (isCommonEventsOptimizationEnabled(facesContext))
                {
                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer, 
                           CommonPropertyUtils.getCommonPropertiesMarked(uiComponent),
                           CommonEventUtils.getCommonEventsMarked(uiComponent), uiComponent, behaviors);
                }
                else
                {
                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
                }
            }
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.TABLE_ATTRIBUTES);
                CommonPropertyUtils.renderCommonPassthroughPropertiesWithoutEvents(writer, 
                        CommonPropertyUtils.getCommonPropertiesMarked(uiComponent), uiComponent);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                        HTML.TABLE_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS);
            }
        }
        else
        {
            HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent, facesContext);
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.TABLE_ATTRIBUTES);
                CommonPropertyUtils.renderCommonPassthroughProperties(writer, 
                        CommonPropertyUtils.getCommonPropertiesMarked(uiComponent), uiComponent);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                        HTML.TABLE_PASSTHROUGH_ATTRIBUTES);
            }
        }
    }
301224
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		SelectOneMenu menu = (SelectOneMenu) component;

		if (!menu.isRendered()) {
			return;
		}
		ResponseWriter rw = context.getResponseWriter();
		String outerClientId = menu.getClientId(context);
		boolean clientIdHasBeenRendered = false;
		String clientId = outerClientId + "Inner";
		String span = null;
		if (!isHorizontalForm(component)) {
			span = startColSpanDiv(rw, menu, outerClientId);
			if (null != span) {
				Tooltip.generateTooltip(context, menu, rw);
				clientIdHasBeenRendered = true;
			}
		}
		rw.startElement("div", menu);

		rw.writeAttribute("class", getWithFeedback(getInputMode(menu.isInline()), component), "class");
		if (!clientIdHasBeenRendered) {
			rw.writeAttribute("id", outerClientId, "id");
			Tooltip.generateTooltip(context, menu, rw);
		}
		writeAttribute(rw, "dir", menu.getDir(), "dir");

		addLabel(rw, clientId, menu, outerClientId);
		if (isHorizontalForm(component)) {
			span = startColSpanDiv(rw, menu, null);
		}

		UIComponent prependingAddOnFacet = menu.getFacet("prepend");
		UIComponent appendingAddOnFacet = menu.getFacet("append");
		final boolean hasAddon = startInputGroupForAddOn(rw, (prependingAddOnFacet != null),
				(appendingAddOnFacet != null), menu);

		addPrependingAddOnToInputGroup(context, rw, prependingAddOnFacet, (prependingAddOnFacet != null), menu);
		renderSelectTag(context, rw, clientId, menu, outerClientId);
		addAppendingAddOnToInputGroup(context, rw, appendingAddOnFacet, (appendingAddOnFacet != null), menu);

		closeInputGroupForAddOn(rw, hasAddon);
		rw.endElement("div"); // form-group
		closeColSpanDiv(rw, span);
		Tooltip.activateTooltips(context, menu);
	}
1201474
public void encodeHTML(FacesContext context, Button button)
	throws IOException {
		boolean idHasBeenRendered=false;
		if (button.getHref()!=null&&button.getOutcome()!=null) 
			throw new FacesException("Please define the href attribute or the outcome attribute, but not both");
		ResponseWriter rw = context.getResponseWriter();
		String clientId = button.getClientId();
		
		// add responsive style
		String clazz = Responsive.getResponsiveStyleClass(button, false).trim();
		boolean isResponsive = clazz.length() > 0;
		if (isResponsive) {
			rw.startElement("div", button);
			rw.writeAttribute("class", clazz, null);
			rw.writeAttribute("id", clientId, "id");
			idHasBeenRendered = true;
		}


		Object value = (button.getValue() != null ? button.getValue() : "");
		String style = button.getStyle();

		String tag = "button";
		if ((button.getHref() != null) || (button.getTarget() != null)) {
			tag="a";
		}
		rw.startElement(tag, button);
		if (!idHasBeenRendered) {
			rw.writeAttribute("id", clientId, "id");
		}
		rw.writeAttribute("name", clientId, "name");
		if ("button".equals(tag)) {
			rw.writeAttribute("type", "button", null);
		}
		if(BsfUtils.isStringValued(button.getDir())) {
			rw.writeAttribute("dir", button.getDir(), "dir");
		}
		if (style != null) {
			rw.writeAttribute("style", style, "style");
		}
		if (button.getHref() != null)
			rw.writeAttribute("href", button.getHref(), "href");
		if (button.getTarget() != null)
			rw.writeAttribute("target", button.getTarget(), "target");
		rw.writeAttribute("class", getStyleClasses(button, isResponsive), "class");

		Tooltip.generateTooltip(context, button, rw);

		final String clickHandler = encodeClick(context, button);
		if (null != clickHandler && clickHandler.length() > 0) {
			rw.writeAttribute("onclick", clickHandler, null);
		}
		if (BsfUtils.isStringValued(button.getDismiss())) {
			rw.writeAttribute("data-dismiss", button.getDismiss(), null);
		}
		if (button.isDisabled()) {
			rw.writeAttribute("disabled", "disabled", null);
		}

		// Encode attributes (HTML 4 pass-through + DHTML)
		renderPassThruAttributes(context, button, new String[] { "accesskey", "dir", "lang", "style", "tabindex", "title" });
		
		writeAttribute(rw, "onblur", button.getOnblur());
		writeAttribute(rw, "onchange", button.getOnchange());
		writeAttribute(rw, "onclick", button.getOnclick());
		writeAttribute(rw, "ondblclick", button.getOndblclick());
		writeAttribute(rw, "onfocus", button.getOnfocus());
		writeAttribute(rw, "onkeydown", button.getOnkeydown());
		writeAttribute(rw, "onkeypress", button.getOnkeypress());
		writeAttribute(rw, "onkeyup", button.getOnkeyup());
		writeAttribute(rw, "onmousedown", button.getOnmousedown());
		writeAttribute(rw, "onmousemove", button.getOnmousemove());
		writeAttribute(rw, "onmouseout", button.getOnmouseout());
		writeAttribute(rw, "onmouseover", button.getOnmouseover());
		writeAttribute(rw, "onmouseup", button.getOnmouseup());
		
		renderPassThruAttributes(context, button, button.getEventNames().toArray(new String[0]));


		String icon = button.getIcon();
		String faicon = button.getIconAwesome();
		boolean fa = false; // flag to indicate whether the selected icon set is
							// Font Awesome or not.
		if (faicon != null) {
			icon = faicon;
			fa = true;
		}
		if (icon != null) {
			Object ialign = button.getIconAlign(); // Default Left
			if (ialign != null && ialign.equals("right")) {
				rw.writeText(value + " ", null);
				IconRenderer.encodeIcon(rw, button, icon, fa, button.getIconSize(), button.getIconRotate(), button.getIconFlip(), button.isIconSpin(), null, null, false, false, false, false,
						button.isIconBrand(), button.isIconInverse(), button.isIconLight(), button.isIconPulse(), button.isIconRegular(), button.isIconRegular());
			} else {
				IconRenderer.encodeIcon(rw, button, icon, fa, button.getIconSize(), button.getIconRotate(), button.getIconFlip(), button.isIconSpin(), null, null, false, false, false, false,
						button.isIconBrand(), button.isIconInverse(), button.isIconLight(), button.isIconPulse(), button.isIconRegular(), button.isIconRegular());
				rw.writeText(" " + value, null);
			}

		} else {
			rw.writeText(value, null);
		}

		Tooltip.activateTooltips(context, button);
		rw.endElement(tag);
		if (isResponsive) {
			rw.endElement("div");
		}
	}
1342011
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		ResponseWriter writer = context.getResponseWriter();
		writer.startElement("span", component);
		String keys = (String) component.getAttributes().get("attributeNames");
		if (null != keys) {
			String[] keyArray = keys.split(",");
			for (String key:keyArray) {
				writer.writeAttribute(key, AttributeUtilities.getAttributeAsString(component, key), key);				
			}
		}
	}
150721
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WFieldSet fieldSet = (WFieldSet) component;
		XmlStringBuilder xml = renderContext.getWriter();

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

		switch (fieldSet.getFrameType()) {
			case NO_BORDER:
				xml.appendOptionalAttribute("frame", "noborder");
				break;

			case NO_TEXT:
				xml.appendOptionalAttribute("frame", "notext");
				break;

			case NONE:
				xml.appendOptionalAttribute("frame", "none");
				break;

			case NORMAL:
			default:
				break;
		}

		xml.appendOptionalAttribute("required", fieldSet.isMandatory(), "true");
		xml.appendClose();

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

		// Label
		WDecoratedLabel label = fieldSet.getTitle();
		label.paint(renderContext);

		// Children
		xml.appendTag("ui:content");
		int size = fieldSet.getChildCount();

		for (int i = 0; i < size; i++) {
			WComponent child = fieldSet.getChildAt(i);

			// Skip label, as it has already been painted
			if (child != label) {
				child.paint(renderContext);
			}
		}

		xml.appendEndTag("ui:content");
		DiagnosticRenderUtil.renderDiagnostics(fieldSet, renderContext);
		xml.appendEndTag("ui:fieldset");
	}
636398
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
	    if (!component.isRendered()) {
	        return;
	    }
		Canvas canvas = (Canvas) component;
		ResponseWriter rw = context.getResponseWriter();
		String clientId = canvas.getClientId();

		rw.startElement("canvas", canvas);
		Tooltip.generateTooltip(context, canvas, rw);

//	    rw.writeAttribute("initial-drawing", canvas.getInitial-drawing(), "initial-drawing");
	    rw.writeAttribute("id", clientId, "id");
	    writeAttribute(rw, "style", canvas.getStyle(), "style");
	    String styleClass = canvas.getStyleClass();
	    if (null != styleClass)
	    	styleClass += Responsive.getResponsiveStyleClass(canvas, false);
	    else
	    	styleClass = Responsive.getResponsiveStyleClass(canvas, false);
		writeAttribute(rw, "class", styleClass, "class");
	    writeAttribute(rw, "width", canvas.getWidth(), "width");
	    writeAttribute(rw, "height", canvas.getHeight(), "height");
		rw.endElement("canvas");
		Tooltip.activateTooltips(context, canvas);
		Drawing drawing = canvas.getDrawing();
		if (null != drawing) {
			String script = ((Drawing) drawing).getJavaScript();
			rw.startElement("script", component);
			rw.write("\nnew function(){\n");
			rw.write("    var canvas=document.getElementById('" + clientId + "');\n");
			rw.write("    var ctx = canvas.getContext('2d');\n");

			rw.write(script);
			rw.write("\n}();\n");
			rw.endElement("script");
		}
	}
1342528
protected void renderInputBegin(FacesContext facesContext,
            UIComponent uiComponent) throws IOException
    {
        ResponseWriter writer = facesContext.getResponseWriter();
        
        writer.startElement(HTML.INPUT_ELEM, uiComponent);
        writer.writeAttribute(HTML.TYPE_ATTR, org.apache.myfaces.shared.renderkit.html.HTML.INPUT_TYPE_PASSWORD, null);

        if (uiComponent instanceof ClientBehaviorHolder
                && !((ClientBehaviorHolder) uiComponent).getClientBehaviors().isEmpty())
        {
            writer.writeAttribute(HTML.ID_ATTR, 
                                  uiComponent.getClientId(facesContext), null);
        }
        else
        {
            HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent, facesContext);
        }
        writer.writeAttribute(HTML.NAME_ATTR,
                              uiComponent.getClientId(facesContext), null);

        boolean isRedisplay;
        if (uiComponent instanceof HtmlInputSecret)
        {
            isRedisplay = ((HtmlInputSecret)uiComponent).isRedisplay();
        }
        else
        {
            isRedisplay = org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute(uiComponent, 
                    JSFAttr.REDISPLAY_ATTR, false);
        }
        if (isRedisplay)
        {
            String strValue = RendererUtils.getStringValue(facesContext, uiComponent);
            writer.writeAttribute(HTML.VALUE_ATTR, strValue, JSFAttr.VALUE_ATTR);
        }

        Map<String, List<ClientBehavior>> behaviors = null;
        if (uiComponent instanceof ClientBehaviorHolder)
        {
            behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
            
            long commonPropertiesMarked = 0L;
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(uiComponent);
            }
            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderChangeEventProperty(writer, 
                        commonPropertiesMarked, uiComponent);
                CommonPropertyUtils.renderEventProperties(writer, 
                        commonPropertiesMarked, uiComponent);
                CommonPropertyUtils.renderFieldEventPropertiesWithoutOnchange(writer, 
                        commonPropertiesMarked, uiComponent);
            }
            else
            {
                HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer, uiComponent, behaviors);
                if (isCommonEventsOptimizationEnabled(facesContext))
                {
                    Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(uiComponent);
                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer, 
                            commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
                    CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                        facesContext, writer, commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
                }
                else
                {
                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
                    HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                            facesContext, writer, uiComponent, behaviors);
                }
            }
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderInputPassthroughPropertiesWithoutDisabledAndEvents(writer, 
                        commonPropertiesMarked, uiComponent);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                        HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
            }
        }
        else
        {
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderInputPassthroughPropertiesWithoutDisabled(writer, 
                        CommonPropertyUtils.getCommonPropertiesMarked(uiComponent), uiComponent);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                        HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
            }
        }

        if (isDisabled(facesContext, uiComponent))
        {
            writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
        }

        if (isAutocompleteOff(facesContext, uiComponent))
        {
            writer.writeAttribute(HTML.AUTOCOMPLETE_ATTR, AUTOCOMPLETE_VALUE_OFF, HTML.AUTOCOMPLETE_ATTR);
        }
    }
80391
@Override
	public void doTag() throws JspException, IOException
	{
		JspContext context = getJspContext();
		Object component = getComponent(context);
		Reflector<?> reflector = getReflector(context);
		
		try
		{
			reflect(reflector, component, context.getOut());
		}
		catch (ReflectorException exception)
		{
			throw new JspTagException("Error writing component", exception);
		}
	}
1155595
@Override
    protected void afterFormElementsEnd(FacesContext facesContext, UIComponent component) throws IOException
    {
        super.afterFormElementsEnd(facesContext, component);
    }
1020474
private static void decorateComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
			throws IOException {
		if (comp instanceof Icon)
			((Icon) comp).setAddon(true); // modifies the id of the icon

		String classToApply = "input-group-addon";
		if (comp.getClass().getName().endsWith("Button") || comp.getChildCount() > 0)
			classToApply = "input-group-btn";

		if (comp instanceof HtmlOutputText) {
			HtmlOutputText out = (HtmlOutputText)comp;
			
			String sc = out.getStyleClass();
			if (sc == null)
				sc = classToApply;
			else
				sc = sc + " " + classToApply;
			out.setStyleClass(sc);
			comp.encodeAll(ctx);
		}
		else {
			rw.startElement("span", parent);
			rw.writeAttribute("class", classToApply, "class");
			comp.encodeAll(ctx);
		 rw.endElement("span");
		}
	}
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");
		}
	}