Package org.ajax4jsf.component

Examples of org.ajax4jsf.component.UIPoll


  /* (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 {
    UIPoll poll = (UIPoll) component;
    writer.startElement(HTML.SPAN_ELEM, component);
    writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
    getUtils().encodeId(context, component);
      // polling script.
        writer.startElement(HTML.SCRIPT_ELEM, component);
        writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
        StringBuffer script = new StringBuffer("\n");
        if(poll.isEnabled()){
        JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_POLL_FUNCTION);
        Map options = AjaxRendererUtils.buildEventOptions(context, component);
        Integer interval = new Integer(poll.getInterval());
        options.put("pollinterval", interval);
        options.put("pollId", component.getClientId(context));
        Object onsubmit = component.getAttributes().get("onsubmit");
        if (null != onsubmit) {
          JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition();
View Full Code Here


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

    assertNotNull("Can't find PollBean",pb);
    // Make sure polling is enabled
    assertTrue("Polling is not enabled in the PollBean",pb.getPollEnabled());
   
    // Get poll control to check status
    UIPoll poll = (UIPoll)server.findComponent(_POLL_ID);
    assertNotNull("Can't find server side poll component",poll);
    int interval = poll.getInterval();
    // Make sure polling is enabled
    assertTrue("Polling is not enabled in the component",poll.isEnabled());
   
    // Make sure the date is updating
    Date startDate = pb.getLasttime();
    Thread.sleep(interval*4);
    Date endDate = pb.getLasttime();
View Full Code Here

  /* (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 {
    UIPoll poll = (UIPoll) component;
    writer.startElement(HTML.SPAN_ELEM, component);
    writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
    getUtils().encodeId(context, component);
      // polling script.
        writer.startElement(HTML.SCRIPT_ELEM, component);
        writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
        StringBuffer script = new StringBuffer("\n");
        if(poll.isEnabled()){
        JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_POLL_FUNCTION);
        Map options = AjaxRendererUtils.buildEventOptions(context, component, true);
        Integer interval = new Integer(poll.getInterval());
        options.put("pollinterval", interval);
        options.put("pollId", component.getClientId(context));
        Object onsubmit = component.getAttributes().get("onsubmit");
        if (null != onsubmit) {
          JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition();
View Full Code Here

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

TOP

Related Classes of org.ajax4jsf.component.UIPoll

Copyright © 2018 www.massapicom. 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.