This methods generates the HTML code of the current b:gyroscope.
@param context the FacesContext.
@param component the current b:gyroscope.
@throws IOException thrown if something goes wrong when writing the HTML code.
195293
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}
		Gyroscope gyroscope = (Gyroscope) component;
		ResponseWriter rw = context.getResponseWriter();
		String clientId = gyroscope.getClientId();

		rw.startElement("input", component);
		rw.writeAttribute("id", clientId + ".alpha", null);
		rw.writeAttribute("name", clientId + ".alpha", null);
		rw.writeAttribute("type", "hidden", null);
		rw.endElement("input");
		rw.startElement("input", component);
		rw.writeAttribute("id", clientId + ".beta", null);
		rw.writeAttribute("name", clientId + ".beta", null);
		rw.writeAttribute("type", "hidden", null);
		rw.endElement("input");
		rw.startElement("input", component);
		rw.writeAttribute("id", clientId + ".gamma", null);
		rw.writeAttribute("name", clientId + ".gamma", null);
		rw.writeAttribute("type", "hidden", null);
		rw.endElement("input");
		rw.startElement("input", component);
		rw.writeAttribute("id", clientId + ".timer", null);
		rw.writeAttribute("name", clientId + ".timer", null);
		rw.writeAttribute("value", "0", null);
		rw.writeAttribute("type", "hidden", null);
		rw.endElement("input");
		rw.startElement("script", component);
		rw.writeAttribute("id", clientId, null);
		StringBuilder jsCode = new StringBuilder();
		// Render Ajax Capabilities
		AJAXRenderer.generateAJAXCallForASingleEvent(
				FacesContext.getCurrentInstance(), gyroscope, rw, null,
				null, null, false, "rotation", jsCode, null);
		String js = jsCode.toString().replace("callAjax(this,", "callAjax(document.getElementById('" + clientId + ".alpha'),");
		rw.write("window.addEventListener('deviceorientation', function(event) {\n");
		rw.write("  var oldAlpha = document.getElementById('" + clientId + ".alpha').value;");
		rw.write("  var alpha = Math.round(event.alpha);");
		rw.write("  var oldBeta = document.getElementById('" + clientId + ".beta').value;");
		rw.write("  var beta = Math.round(event.beta);");
		rw.write("  var oldGamma = document.getElementById('" + clientId + ".gamma').value;");
		rw.write("  var gamma = Math.round(event.gamma);");
		rw.write("  if (alpha==oldAlpha && beta == oldBeta && gamma == oldGamma) return;");
		rw.write("   if (new Date().getTime() < document.getElementById('" + clientId + ".timer').value) return;");

		rw.write("  document.getElementById('" + clientId + ".alpha').value = alpha;");
		rw.write("  document.getElementById('" + clientId + ".beta').value = beta;");
		rw.write("  document.getElementById('" + clientId + ".gamma').value = gamma;");
		rw.write("  document.getElementById('" + clientId + ".timer').value = new Date().getTime()+100;");
		rw.write(js);
		rw.write("}, true);\n");
//		rw.write("window.addEventListener('compassneedscalibration', function(event) {\n");
//		rw.write("  alert('Your compass needs calibrating! Wave your device in a figure-eight motion');");
//		rw.write("  event.preventDefault();");
//		rw.write("}, true);\n");
		rw.endElement("script");
	}
9221
function Component(parent, context, id, scope) {
    this.parent = parent;
    this.context = context;
    this.id = id;
    this._scope = scope;
  }
625413
public static void createBufferStrategy(java.awt.Canvas component, GraphicsConfiguration conf)
    {
        try
        {
            component.createBufferStrategy(2, conf.getBufferCapabilities());
        }
        catch (final AWTException exception)
        {
            Verbose.exception(exception);
            component.createBufferStrategy(1);
        }
    }
1352341
@Override
    public void encodeEnd(final FacesContext context, final UIComponent component) throws IOException {
        final ResponseWriter responseWriter = context.getResponseWriter();
        final Sheet sheet = (Sheet) component;

        // update column mappings on render
        sheet.updateColumnMappings();

        // sort data
        sheet.sortAndFilter();

        // encode markup
        encodeMarkup(context, sheet, responseWriter);

        // encode javascript
        encodeScript(context, sheet, responseWriter);
    }
1104804
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}
		SocialShare socialShare = (SocialShare) component;
		ResponseWriter rw = context.getResponseWriter();
		String clientId = socialShare.getClientId();

		if (!BsfUtils.isStringValued(socialShare.getShares())) {
			return;
		}

		beginResponsiveWrapper(component, rw);

		rw.startElement("div", socialShare);
		rw.writeAttribute("id", clientId + "_wrapper", "id");

		// Create the div container
		rw.startElement("div", socialShare);
		rw.writeAttribute("id", clientId, "id");
		if (BsfUtils.isStringValued(socialShare.getStyle()))
			rw.writeAttribute("style", socialShare.getStyle(), "style");
		rw.writeAttribute("class", socialShare.getStyleClass(), "class");
		rw.endElement("div");

		rw.endElement("div");

		// decode shares
		String shares = "";
		String[] _share = socialShare.getShares().split(",");
		for (int i = 0; i < _share.length; i++) {
			_share[i] = "'" + _share[i] + "'";
			shares += _share[i];
			if (i < _share.length - 1)
				shares += ",";
		}

		String showCount = socialShare.getShowCount();
		if (!"false".equalsIgnoreCase(showCount) && !"true".equalsIgnoreCase(showCount)
				&& BsfUtils.isStringValued(showCount))
			showCount = "'" + showCount + "'";

		String scriptId = "#" + BsfUtils.escapeJQuerySpecialCharsInSelector(clientId);
		rw.startElement("script", socialShare);
		rw.writeText("$(function () { " +
		// social share section
				"$('" + scriptId + "').jsSocials({  "
				+ (BsfUtils.isStringValued(socialShare.getUrl()) ? "url: '" + socialShare.getUrl() + "', " : "")
				+ (BsfUtils.isStringValued(socialShare.getText()) ? "text: '" + socialShare.getText() + "', " : "")
				+ (BsfUtils.isStringValued(socialShare.getShareIn()) ? "shareIn: '" + socialShare.getShareIn() + "', "	: "")
				+ (BsfUtils.isStringValued(showCount) ? "showCount: " + showCount + ", " : "")
				+ (socialShare.isShowLabel() ? "showLabel: true, " : "showLabel: false,") + "shares: [" + shares + "] "
				+ "});" 
				+ (socialShare.isDisableBlock() ?
				// no block
						"" :
						// overlay
						"$('" + scriptId + "_wrapper').block({" 
						      + "	message: '" + socialShare.getBlockMessage() 
						      + "',"
						      + "	css: { " + "		border: 'none', " 
						      + "     padding: '8px', "
						      + "		backgroundColor: '#000', " 
						      + "		'-webkit-border-radius': '10px', "
						      + "		'-moz-border-radius': '10px', " 
						      + " 	'border-radius': '10px', "
						      + "		opacity: 1, " 
						      + "		color: '#fff', " + "		fontSize: '12px', "
						      + "		cursor: 'default', " 
						      + "		top: '40%', " 
						      + "		left: '35%' " 
						      + "	}, "
						      + " overlayCSS: { "
						      + "     backgroundColor: '#000', " 
						      + "     opacity: 0.6, "
						      + "     cursor: 'default' " 
						      + " } " 
						      + "}); " 
						      + "$('" + scriptId
						      + "_wrapper').click(function() { $('" + scriptId + "_wrapper').unblock(); }); ")
				              + "});", null);

		rw.endElement("script");
	}
1195339
public static void initPartialValidationAndModelUpdate(
            UIComponent component, FacesContext facesContext)
    {
        String actionFor = (String) component.getAttributes().get("actionFor");

        if (actionFor != null)
        {
            List li = convertIdsToClientIds(actionFor, facesContext, component);

            facesContext.getExternalContext().getRequestMap()
                    .put(ACTION_FOR_LIST, li);

            String actionForPhase = (String) component.getAttributes().get(
                    "actionForPhase");

            if (actionForPhase != null)
            {
                List phaseList = convertPhasesToPhasesIds(actionForPhase);

                facesContext.getExternalContext().getRequestMap()
                        .put(ACTION_FOR_PHASE_LIST, phaseList);
            }
        }
    }
1342430
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WFieldLayout fieldLayout = (WFieldLayout) component;
		XmlStringBuilder xml = renderContext.getWriter();
		int labelWidth = fieldLayout.getLabelWidth();
		String title = fieldLayout.getTitle();

		xml.appendTagOpen("ui:fieldlayout");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", fieldLayout.isHidden(), "true");
		xml.appendOptionalAttribute("labelWidth", labelWidth > 0, labelWidth);
		xml.appendAttribute("layout", fieldLayout.getLayoutType());
		xml.appendOptionalAttribute("title", title);
		// Ordered layout
		if (fieldLayout.isOrdered()) {
			xml.appendAttribute("ordered", fieldLayout.getOrderedOffset());
		}
		xml.appendClose();

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

		// Paint Fields
		paintChildren(fieldLayout, renderContext);

		xml.appendEndTag("ui:fieldlayout");
	}
78069
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}
		Badge badge = (Badge) component;
		ResponseWriter rw = context.getResponseWriter();
		String clientId = badge.getClientId();

		if (!component.isRendered()) {
			return;
		}
		String styleClass = badge.getStyleClass();
		String style=badge.getStyle();
		String val = getValue2Render(context, badge);

		generateBadge(context, badge, rw, clientId, styleClass, style, val, null);
	}
794522
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}
		InternalJavaScriptResource internalJavaScriptResource = (InternalJavaScriptResource) component;
		ResponseWriter rw = context.getResponseWriter();

		rw.startElement("script", internalJavaScriptResource);
		rw.writeAttribute("src", internalJavaScriptResource.getUrl(), null);

		rw.endElement("script");

	}
605359
function (components) {
        OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
        this.components = [];
        if (components != null) {
            this.addComponents(components);
        }
    }
156690
public void applyAttachedObject(FacesContext context, UIComponent parent)
    {
        // Retrieve the current FaceletContext from FacesContext object
        FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(
                FaceletContext.FACELET_CONTEXT_KEY);
        
        ValueExpression ve = null;
        Behavior behavior = null;
        if (_delegate.getBinding() != null)
        {
            ve = _delegate.getBinding().getValueExpression(faceletContext, Behavior.class);
            behavior = (Behavior) ve.getValue(faceletContext);
        }
        if (behavior == null)
        {
            behavior = this.createBehavior(faceletContext);
            if (ve != null)
            {
                ve.setValue(faceletContext, behavior);
            }
        }
        if (behavior == null)
        {
            throw new TagException(_delegate.getTag(), "No Validator was created");
        }
        _delegate.setAttributes(faceletContext, behavior);
        
        if (behavior instanceof ClientBehavior)
        {
            // cast to a ClientBehaviorHolder
            ClientBehaviorHolder cvh = (ClientBehaviorHolder) parent;
            
            // TODO: check if the behavior could be applied to the current parent
            // For run tests it is not necessary, so we let this one pending.

            // It is necessary to obtain a event name for add it, so we have to
            // look first to the defined event name, otherwise take the default from
            // the holder
            String eventName = getEventName();
            if (eventName == null)
            {
                eventName = cvh.getDefaultEventName();
            }
            if (eventName == null)
            {
                throw new TagAttributeException(_delegate.getEvent(),
                        "eventName could not be defined for client behavior "+ behavior.toString());
            }
            else if (!cvh.getEventNames().contains(eventName))
            {
                throw new TagAttributeException(_delegate.getEvent(),
                        "eventName "+eventName+" not found on component instance");
            }
            else
            {
                cvh.addClientBehavior(eventName, (ClientBehavior) behavior);
            }
            
            AjaxHandler.registerJsfAjaxDefaultResource(faceletContext, parent);
        }
    }
419542
@Override
    public UIComponent createComponent(ValueExpression componentExpression,
                                       FacesContext context,
                                       String componentType)
          throws FacesException {
        return getWrapped().createComponent(componentExpression, context, componentType);
    }
878565
private Object getComponent(JspContext context) throws JspTagException
	{
		int scope = context.getAttributesScope(name);

		if (scope == 0)
		{
			throw new JspTagException("Cannot find component: " + name);
		}
		
		return context.getAttribute(name, scope);
	}
7158
public void encodeEnd(FacesContext facesContext, UIComponent component)
            throws IOException
    {
        RendererUtils.checkParamValidity(facesContext, component, null);
        
        Map<String, List<ClientBehavior>> behaviors = null;
        if (component instanceof ClientBehaviorHolder)
        {
            behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
            if (!behaviors.isEmpty())
            {
                ResourceUtils.renderDefaultJsfJsInlineIfNecessary(
                        facesContext, facesContext.getResponseWriter());
            }
        }

        if (component instanceof UISelectMany)
        {
            renderMenu(facesContext,
                                         (UISelectMany)component,
                                         isDisabled(facesContext, component),
                                         getConverter(facesContext, component));
        }
        else if (component instanceof UISelectOne)
        {
            renderMenu(facesContext,
                                         (UISelectOne)component,
                                         isDisabled(facesContext, component),
                                         getConverter(facesContext, component));
        }
        else
        {
            throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
        }
    }
861924
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}
		Image image = (Image) component;
		ResponseWriter rw = context.getResponseWriter();
		String clientId = image.getClientId();
		
		boolean useXHRLoader = false;
		if (image.getOnloadend()!= null || image.getOnloadstart() != null || image.getOnprogress() != null) {
			useXHRLoader = true;
		}

		rw.startElement("img", image);
		Tooltip.generateTooltip(context, image, rw);
		rw.writeAttribute("id", clientId, "id");
		if (!useXHRLoader) {
			rw.writeURIAttribute("src", getImageSource(context, component), "value");
		}

		renderPassThruAttributes(context, image, new String[] { "alt", "height", "lang", "style", "title", "width" });

		String styleClass = image.getStyleClass();
		if (null == styleClass)
			styleClass = Responsive.getResponsiveStyleClass(image, false);
		else
			styleClass += Responsive.getResponsiveStyleClass(image, false);
		if (styleClass != null && styleClass.trim().length() > 0) {
			writeAttribute(rw, "class", styleClass, "styleClass");
		}

		AJAXRenderer.generateBootsFacesAJAXAndJavaScript(FacesContext.getCurrentInstance(), image, rw, false);

		rw.endElement("img");
		if (useXHRLoader) {
			rw.startElement("script", image);
			rw.writeText("document.getElementById('" + clientId + "').load('" + getImageSource(context, component) + "', " 
			+ getJSFunction(image.getOnloadstart()) + "," + getJSFunction(image.getOnprogress())
			+ ", " + getJSFunction(image.getOnloadend()) + ");", null);
			rw.endElement("script");
		}
		Tooltip.activateTooltips(context, image);
	}
1102938
protected void renderTextAreaBegin(FacesContext facesContext,
            UIComponent uiComponent) throws IOException
    {
        ResponseWriter writer = facesContext.getResponseWriter();
        writer.startElement(HTML.TEXTAREA_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);
                writer.writeAttribute(HTML.NAME_ATTR, uiComponent.getClientId(facesContext), null);
            }
            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.renderCommonFieldPassthroughPropertiesWithoutDisabledAndEvents(writer, 
                        CommonPropertyUtils.getCommonPropertiesMarked(uiComponent), uiComponent);
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.TEXTAREA_ATTRIBUTES);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                        HTML.TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
            }
        }
        else
        {
            HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent, facesContext);
            writer.writeAttribute(HTML.NAME_ATTR, uiComponent.getClientId(facesContext), null);
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderCommonFieldPassthroughPropertiesWithoutDisabled(writer, 
                        CommonPropertyUtils.getCommonPropertiesMarked(uiComponent), uiComponent);
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.TEXTAREA_ATTRIBUTES);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                        HTML.TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
            }
        }

        if (isDisabled(facesContext, uiComponent))
        {
            writer.writeAttribute(org.apache.myfaces.shared.renderkit.html.HTML.DISABLED_ATTR, Boolean.TRUE, null);
        }
    }
396959
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {
        if (_template != null)
        {
            //VariableMapper orig = ctx.getVariableMapper();
            //if (_params != null)
            //{
            //    VariableMapper vm = new VariableMapperWrapper(orig);
            //    ctx.setVariableMapper(vm);
            //    for (int i = 0; i < _params.length; i++)
            //    {
            //        _params[i].apply(ctx, parent);
            //    }
            //}
            AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
            FaceletCompositionContext fcc = FaceletCompositionContext.getCurrentInstance(ctx);
            actx.extendClient(this);
            if (_params != null)
            {
                String uniqueId = fcc.generateUniqueComponentId();
                //VariableMapper vm = new VariableMapperWrapper(orig);
                //ctx.setVariableMapper(vm);
                for (int i = 0; i < _params.length; i++)
                {
                    _params[i].apply(ctx, parent, _params[i].getName(ctx), _params[i].getValue(ctx), uniqueId);
                }
            }

            try
            {
                ctx.includeFacelet(parent, _template.getValue(ctx));
            }
            finally
            {
                actx.popExtendedClient(this);
                //ctx.setVariableMapper(orig);
            }
        }
        else
        {
            this.nextHandler.apply(ctx, parent);
        }
    }