@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
	    if (!component.isRendered()) {
	        return;
	    }
		Label label = (Label) component;
		ResponseWriter rw = context.getResponseWriter();
		String clientId = label.getClientId();
	
		boolean idHasBeenRendered = false;

		String sev = label.getSeverity();
		String txt = label.getValue();
		if (txt == null) {
			txt = label.getText();
		}

		// add responsive style
		String clazz = Responsive.getResponsiveStyleClass(label, false).trim();
		boolean isResponsive = clazz.length() > 0;
		if (isResponsive) {
			rw.startElement("div", label);
			rw.writeAttribute("class", clazz, null);
			rw.writeAttribute("id", clientId, "id");
			idHasBeenRendered = true;
		}

		rw.startElement("span", label);
		if (!idHasBeenRendered) {
			rw.writeAttribute("id", clientId, "id");
		}
		Tooltip.generateTooltip(context, label, rw);
		String sclass = "label" + " " + "label";
		if (sev != null) {
			sclass += "-" + sev;
		} else {
			sclass += "-default";
		}
		String styleClass = label.getStyleClass();
		sclass += styleClass != null ? " " + styleClass : "";
		rw.writeAttribute("class", sclass, "class");
		String style = label.getStyle();
		if (isResponsive) {
			if (null == style) {
				style = "display:block";
			} else {
				style += ";display:block";
			}
		}

		if (style != null)
			rw.writeAttribute("style", style, "style");

		rw.writeText(txt, null);
		rw.endElement("span");
		if (isResponsive) {
			rw.endElement("div");
		}

		Tooltip.activateTooltips(context, label);
	}
@ Override public void encodeBegin ( FacesContext context , UIComponent component ) throws IOException { if ( ! component . isRendered ( ) ) { return ; } Label label = ( Label ) component ; ResponseWriter rw = context . getResponseWriter ( ) ; String clientId = label . getClientId ( ) ; boolean idHasBeenRendered = false ; String sev = label . getSeverity ( ) ; String txt = label . getValue ( ) ; if ( txt == null ) { txt = label . getText ( ) ; } String clazz = Responsive . getResponsiveStyleClass ( label , false ) . trim ( ) ; boolean isResponsive = clazz . length ( ) > 0 ; if ( isResponsive ) { rw . startElement ( "div" , label ) ; rw . writeAttribute ( "class" , clazz , null ) ; rw . writeAttribute ( "id" , clientId , "id" ) ; idHasBeenRendered = true ; } rw . startElement ( "span" , label ) ; if ( ! idHasBeenRendered ) { rw . writeAttribute ( "id" , clientId , "id" ) ; } Tooltip . generateTooltip ( context , label , rw ) ; String sclass = "label" + " " + "label" ; if ( sev != null ) { sclass += "-" + sev ; } else { sclass += "-default" ; } String styleClass = label . getStyleClass ( ) ; sclass += styleClass != null ? " " + styleClass : "" ; rw . writeAttribute ( "class" , sclass , "class" ) ; String style = label . getStyle ( ) ; if ( isResponsive ) { if ( null == style ) { style = "display:block" ; } else { style += ";display:block" ; } } if ( style != null ) rw . writeAttribute ( "style" , style , "style" ) ; rw . writeText ( txt , null ) ; rw . endElement ( "span" ) ; if ( isResponsive ) { rw . endElement ( "div" ) ; } Tooltip . activateTooltips ( context , label ) ; }
label methods generates the HTML code of the current b:label.
@param context the FacesContext.
@param component the current b:label.
@throws IOException thrown if something goes wrong when writing the HTML code.