code: @Override
  	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
  	    if (!component.isRendered()) {
  	        return;
  	    }
  		Shake shake = (Shake) component;
  		ResponseWriter rw = context.getResponseWriter();
  		String clientId = shake.getClientId();
  		
  		rw.startElement("script", shake);
  		rw.writeAttribute("id", clientId, null);
  		rw.write("\nvar myShakeEvent = new Shake({\n");
  		rw.write("  threshold: " + shake.getThreshold() + ",\n");
  		rw.write("  timeout: " + shake.getInterval() + "\n");
  		rw.write("});\n");
  		
  		if (!shake.isDisabled()) {
  			// Start listening to device motion:
  			rw.write("myShakeEvent.start();\n");
  		}
  
  		// Register a shake event listener on window with your callback:
  		rw.write("window.addEventListener('shake', function(){\n");
  		String code = new AJAXRenderer().generateBootsFacesAJAXAndJavaScriptForAnMobileEvent(context, shake, rw, "shake");
  		rw.write(code + "\n");
  		rw.write("}, false);\n");
  		rw.endElement("script");
  	}
docs: This methods generates the HTML code of the current b:shake.
  @param context the FacesContext.
  @param component the current b:shake.
  @throws IOException thrown if something goes wrong when writing the HTML code.