Examples of UIPush


Examples of org.ajax4jsf.component.UIPush

  /* (non-Javadoc)
   * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
   */
  protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
    UIPush push = (UIPush) component;
    writer.startElement(HTML.SPAN_ELEM, component);
    writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
    getUtils().encodeId(context, component);
    getUtils().encodeBeginFormIfNessesary(context, component);
      // pushing script.
        writer.startElement(HTML.SCRIPT_ELEM, component);
        writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
        StringBuffer script = new StringBuffer("\n");
        if(push.isEnabled()){
        JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_PUSH_FUNCTION);
        // Set dummy form id, if nessesary.
        Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component);
        options.put("dummyForm", component.getClientId(context)+RendererUtils.DUMMY_FORM_ID);
        int interval = push.getInterval();
        if(interval == Integer.MIN_VALUE){
            String intervalInitParameter = context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
            if(null != intervalInitParameter){
          interval = Integer.parseInt(intervalInitParameter);
            } else {
          interval = DEFAULT_PUSH_INTERVAL;
            }
        }
        options.put("pushinterval", new Integer(interval));
        options.put("pushId", push.getListenerId(context));
        String pushUrl = context.getExternalContext().getInitParameter(PUSH_URL_PARAMETER);
        if(null != pushUrl){
            options.put("pushUrl", pushUrl);
        }
        //        options.put("timeout", interval);
        function.addParameter(options);
        function.appendScript(script);
        } else {
          script.append("A4J.AJAX.StopPush('").append(push.getListenerId(context)).append("')");
        }
        script.append(";\n");
        writer.writeText(script.toString(),null);
        writer.endElement(HTML.SCRIPT_ELEM);
    getUtils().encodeEndFormIfNessesary(context, component);
View Full Code Here

Examples of org.ajax4jsf.component.UIPush

    return UIPush.class;
  }
 
  protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
    boolean submitted = super.isSubmitted(facesContext, uiComponent);
    UIPush push = (UIPush) uiComponent;
    push.setSubmitted(submitted);
    return submitted;
  }
View Full Code Here

Examples of org.ajax4jsf.component.UIPush

  /* (non-Javadoc)
   * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
   */
  protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
    UIPush push = (UIPush) component;
    writer.startElement(HTML.SPAN_ELEM, component);
    writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
    getUtils().encodeId(context, component);
    getUtils().encodeBeginFormIfNessesary(context, component);
      // pushing script.
        writer.startElement(HTML.SCRIPT_ELEM, component);
        writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
        StringBuffer script = new StringBuffer("\n");
        if(push.isEnabled()){
        JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_PUSH_FUNCTION);
        // Set dummy form id, if nessesary.
        Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component, false);
        options.put("dummyForm", component.getClientId(context)+RendererUtils.DUMMY_FORM_ID);
        int interval = push.getInterval();
        if(interval == Integer.MIN_VALUE){
            String intervalInitParameter = context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
            if(null != intervalInitParameter){
          interval = Integer.parseInt(intervalInitParameter);
            } else {
          interval = DEFAULT_PUSH_INTERVAL;
            }
        }
        options.put("pushinterval", new Integer(interval));
        options.put("pushId", push.getListenerId(context));
        String pushUrl = context.getExternalContext().getInitParameter(PUSH_URL_PARAMETER);
        if(null != pushUrl){
            options.put("pushUrl", pushUrl);
        }
        //        options.put("timeout", interval);
        function.addParameter(options);
        function.appendScript(script);
        } else {
          script.append("A4J.AJAX.StopPush('").append(push.getListenerId(context)).append("')");
        }
        script.append(";\n");
        writer.writeText(script.toString(),null);
        writer.endElement(HTML.SCRIPT_ELEM);
    getUtils().encodeEndFormIfNessesary(context, component);
View Full Code Here

Examples of org.ajax4jsf.component.UIPush

    return UIPush.class;
  }
 
  protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
    boolean submitted = super.isSubmitted(facesContext, uiComponent);
    UIPush push = (UIPush) uiComponent;
    push.setSubmitted(submitted);
    return submitted;
  }
View Full Code Here

Examples of org.ajax4jsf.component.UIPush

  /* (non-Javadoc)
   * @see org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
   */
  protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
    UIPush push = (UIPush) component;
    writer.startElement(HTML.SPAN_ELEM, component);
    writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
    getUtils().encodeId(context, component);
    getUtils().encodeBeginFormIfNessesary(context, component);
      // pushing script.
        writer.startElement(HTML.SCRIPT_ELEM, component);
        writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
        StringBuffer script = new StringBuffer("\n");
        if(push.isEnabled()){
        JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_PUSH_FUNCTION);
        // Set dummy form id, if nessesary.
        Map options = AjaxRendererUtils.buildEventOptions(context, component);
        options.put("dummyForm", component.getClientId(context)+RendererUtils.DUMMY_FORM_ID);
        int interval = push.getInterval();
        if(interval == Integer.MIN_VALUE){
            String intervalInitParameter = context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
            if(null != intervalInitParameter){
          interval = Integer.parseInt(intervalInitParameter);
            } else {
          interval = DEFAULT_PUSH_INTERVAL;
            }
        }
        options.put("pushinterval", new Integer(interval));
        options.put("pushId", push.getListenerId(context));
        String pushUrl = context.getExternalContext().getInitParameter(PUSH_URL_PARAMETER);
        if(null != pushUrl){
            options.put("pushUrl", pushUrl);
        }
        //        options.put("timeout", interval);
        function.addParameter(options);
        function.appendScript(script);
        } else {
          script.append("A4J.AJAX.StopPush('").append(push.getListenerId(context)).append("')");
        }
        script.append(";\n");
        writer.writeText(script.toString(),null);
        writer.endElement(HTML.SCRIPT_ELEM);
    getUtils().encodeEndFormIfNessesary(context, component);
View Full Code Here

Examples of org.ajax4jsf.component.UIPush

    return UIPush.class;
  }
 
  protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
    boolean submitted = super.isSubmitted(facesContext, uiComponent);
    UIPush push = (UIPush) uiComponent;
    push.setSubmitted(submitted);
    return submitted;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.