Examples of RendererUtils


Examples of org.ajax4jsf.renderkit.RendererUtils

   * @param table
   * @throws IOException
   */
  protected void encodeRowEvents(FacesContext context, UIDataAdaptor table)
      throws IOException {
    RendererUtils utils2 = getUtils();
    for (int i = 0; i < TABLE_EVENT_ATTRS.length; i++) {
        String[] attrs = TABLE_EVENT_ATTRS[i];
      utils2.encodeAttribute(context, table, attrs[1], attrs[0]);       
    }
  }
View Full Code Here

Examples of org.ajax4jsf.renderkit.RendererUtils

   * @param table
   * @throws IOException
   */
  protected void encodeRowEvents(FacesContext context, UIDataAdaptor table)
      throws IOException {
    RendererUtils utils2 = getUtils();
    for (int i = 0; i < TABLE_EVENT_ATTRS.length; i++) {
        String[] attrs = TABLE_EVENT_ATTRS[i];
      utils2.encodeAttribute(context, table, attrs[1], attrs[0]);       
    }
  }
View Full Code Here

Examples of org.ajax4jsf.renderkit.RendererUtils

 
  @Override
  protected void encodeRowEvents(FacesContext context, UIDataAdaptor table)
      throws IOException {
    super.encodeRowEvents(context, table);
    RendererUtils utils2 = getUtils();
    utils2.encodeAttribute(context, table, "onRowContextMenu", "oncontextmenu" );
   
  }
View Full Code Here

Examples of org.ajax4jsf.renderkit.RendererUtils

  private static final String[] OPTIONS_ATTRIBUTES_LIST = { "showConnectingLines", "toggleOnClick",
    "disableKeyboardNavigation"};
 
  public String getOptions(FacesContext context, UITree tree) {
    Map<String, Object> attributes = tree.getAttributes();
    RendererUtils utils = getUtils();
   
    Map<String, Object> options = new HashMap<String, Object>();
    for (String optionAttributeName : OPTIONS_ATTRIBUTES_LIST) {
      Object value = attributes.get(optionAttributeName);
     
      if (utils.shouldRenderAttribute(value)) {
        options.put(optionAttributeName, value);
      }
    }
   
    return ScriptUtils.toScript(options);
View Full Code Here

Examples of org.ajax4jsf.renderkit.RendererUtils

        if (event instanceof DataFilterSliderEvent){
         
          FacesContext context = FacesContext.getCurrentInstance();
            AjaxRendererUtils.addRegionByName(context, this, this.getId());
            String forAttr = this.getFor();
            RendererUtils rendUtil = RendererUtils.getInstance();
           
            if(forAttr != null) {
              AjaxRendererUtils.addRegionByName(context, this, rendUtil.correctForIdReference(forAttr, this));
           
           
           if(getSliderListeners().length < 1){
               addSliderListener(new DataFilterSliderAdapter(getSliderListener()));
           }
View Full Code Here

Examples of org.ajax4jsf.renderkit.RendererUtils

            resource = getResource("images/spacer.gif").getUri(
                    context, menuItem);
        }
        variables.setVariable("icon", resource);
       
      RendererUtils rendererUtils = getUtils();

        if (menuItem.isDisabled()) {
            variables.setVariable("iconDisabledClasses",
                    "rich-menu-item-icon-disabled");
        } else {
            Map<String, Object> menuItemAttributes = menuItem.getAttributes();

            // create attributes string for item without parent
            Map<String, Object> attrMap = new HashMap<String, Object>(3);
      if (!isNestedInMenu(menuItem)) {
                rendererUtils.addToScriptHash(attrMap, "styleClass", menuItemAttributes.get(HTML.STYLE_CLASS_ATTR),
                  null, ScriptHashVariableWrapper.DEFAULT);

                rendererUtils.addToScriptHash(attrMap, "onselect", menuItemAttributes.get(HTML.onselect_ATTRIBUTE),
                      null, ScriptHashVariableWrapper.EVENT_HANDLER);
            }

            //-----------------------------------
            StringBuilder scriptValue = new StringBuilder();
            String mode = resolveSubmitMode(menuItem);
           
            if (MenuComponent.MODE_AJAX.equalsIgnoreCase(mode)) {
              scriptValue.append("RichFaces.Menu.updateItem(event,this");
             
              if (!attrMap.isEmpty()) {
                scriptValue.append(',');
                  scriptValue.append(ScriptUtils.toScript(attrMap));
              }

              scriptValue.append(");");
              String event = null;
              Object onclick = menuItemAttributes.get(HTML.onclick_ATTRIBUTE);
              if(onclick != null && onclick.toString().length()>0){
                event = HTML.onclick_ATTRIBUTE;
              }else{
                Object onselect = menuItemAttributes.get(HTML.onselect_ATTRIBUTE);
                if(onselect != null && onselect.toString().length()>0){
                  event = HTML.onselect_ATTRIBUTE;
                }
              }
              scriptValue.append(AjaxRendererUtils.buildOnEvent(
                        menuItem, context, event, true).toString());
              menuItemAttributes.put(HTML.onselect_ATTRIBUTE, null);
            } else if (MenuComponent.MODE_SERVER.equalsIgnoreCase(mode)) {
             
            /*
             String id = menuItem.getClientId(context);
      scriptValue.append("var form=A4J.findForm(this);");
      scriptValue.append("var params={");
      scriptValue.append(ScriptUtils.toScript(id + ":hidden"));
      scriptValue.append(":");
      scriptValue.append(ScriptUtils.toScript(id));
      scriptValue.append("};");
     
      List params = encodeParams(context, menuItem);
      if(!params.isEmpty()){
        for (Iterator iterator = params.iterator(); iterator.hasNext();) {
          scriptValue.append(iterator.next());
        }
      }
     
      scriptValue.append("Richfaces.jsFormSubmit(");
      scriptValue.append(ScriptUtils.toScript(id)).append(",");
     
      scriptValue.append("form.id").append(",");
          Object target = menuItem.getAttributes().get("target");
                
          if (null != target) {
         scriptValue.append(ScriptUtils.toScript(target));
       } else {
        scriptValue.append("''");
      }
         
          scriptValue.append(",");
          scriptValue.append("params);return false;");
          */
              Object onclick = menuItemAttributes.get(HTML.onclick_ATTRIBUTE);
              if(onclick != null && onclick.toString().length()>0){
                scriptValue.append(onclick.toString());
                scriptValue.append(";");
              }
              scriptValue.append("RichFaces.Menu.submitForm(event,this");
             
              Map<String, Object> scriptOptionsMap = new HashMap<String, Object>(5);
              rendererUtils.addToScriptHash(scriptOptionsMap, "a", attrMap, null, ScriptHashVariableWrapper.DEFAULT);
             
              Map<String, Object> paramsMap = getParamsAsMap(context, menuItem);
              rendererUtils.addToScriptHash(scriptOptionsMap, "p", paramsMap, null, ScriptHashVariableWrapper.DEFAULT);

              String target = (String) menuItemAttributes.get("target");
              rendererUtils.addToScriptHash(scriptOptionsMap, "t", target, null, ScriptHashVariableWrapper.DEFAULT);

              if (!scriptOptionsMap.isEmpty()) {
                scriptValue.append(',');
                scriptValue.append(ScriptUtils.toScript(scriptOptionsMap));
              }
View Full Code Here

Examples of org.richfaces.renderkit.util.RendererUtils

        JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
        JSFunction messageObject = new JSObject(getJSClassName(), component.getClientId(facesContext));
        Map<String, Object> attributes = component.getAttributes();
        Builder<String, Object> parametersBuilder = ImmutableMap.builder();
        String forId = (String) attributes.get("for");
        RendererUtils rendererUtils = RendererUtils.getInstance();
        if (!Strings.isNullOrEmpty(forId)) {
            UIComponent target = rendererUtils.findComponentFor(component, forId);
            if (null != target) {
                parametersBuilder.put("forComponentId", target.getClientId(facesContext));
            }
        }
        Severity level = getLevel(component);
        if (FacesMessage.SEVERITY_INFO != level) {
            parametersBuilder.put("level", level.getOrdinal());
        }
        if (!rendererUtils.isBooleanAttribute(component, "showSummary")) {
            parametersBuilder.put("showSummary", false);
        }
        if (rendererUtils.isBooleanAttribute(component, "showDetail")) {
            parametersBuilder.put("showDetail", true);
        }
        if (rendererUtils.isBooleanAttribute(component, "tooltip")) {
            parametersBuilder.put("tooltip", true);
        }
        if (isComponentMessages(component) && rendererUtils.isBooleanAttribute(component, "globalOnly")) {
            parametersBuilder.put("globalOnly", true);
        }
        if (isComponentMessages(component)) {
            parametersBuilder.put("isMessages", true);
        }
View Full Code Here

Examples of org.richfaces.renderkit.util.RendererUtils

        JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
        JSFunction messageObject = new JSObject(getJSClassName(), component.getClientId(facesContext));
        Map<String, Object> attributes = component.getAttributes();
        Builder<String, Object> parametersBuilder = ImmutableMap.builder();
        String forId = (String) attributes.get("for");
        RendererUtils rendererUtils = RendererUtils.getInstance();
        if (!Strings.isNullOrEmpty(forId)) {
            UIComponent target = rendererUtils.findComponentFor(component, forId);
            if (null != target) {
                parametersBuilder.put("forComponentId", target.getClientId(facesContext));
            }
        }
        Severity level = getLevel(component);
        if (FacesMessage.SEVERITY_INFO != level) {
            parametersBuilder.put("level", level.getOrdinal());
        }
        if (!rendererUtils.isBooleanAttribute(component, "showSummary")) {
            parametersBuilder.put("showSummary", false);
        }
        if (rendererUtils.isBooleanAttribute(component, "showDetail")) {
            parametersBuilder.put("showDetail", true);
        }
        if (rendererUtils.isBooleanAttribute(component, "tooltip")) {
            parametersBuilder.put("tooltip", true);
        }
        if (isComponentMessages(component) && rendererUtils.isBooleanAttribute(component, "globalOnly")) {
            parametersBuilder.put("globalOnly", true);
        }
        if (isComponentMessages(component)) {
            parametersBuilder.put("isMessages", true);
        }
View Full Code Here

Examples of org.richfaces.renderkit.util.RendererUtils

     * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
     */

    protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {

        RendererUtils utils = getUtils();
        boolean shouldRenderForm = utils.getNestingForm(component) == null;
        String rootElementName = shouldRenderForm ? HtmlConstants.DIV_ELEM : HtmlConstants.SPAN_ELEM;

        AbstractPoll poll = (AbstractPoll) component;
        writer.startElement(rootElementName, component);
        writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "display:none;", null);
        utils.encodeId(context, component);

        if (shouldRenderForm) {
            String clientId = component.getClientId(context) + RendererUtils.DUMMY_FORM_ID;
            utils.encodeBeginForm(context, component, writer, clientId);
            utils.encodeEndForm(context, writer);
        }

        // polling script.
        writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
        writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript", null);
View Full Code Here

Examples of org.richfaces.renderkit.util.RendererUtils

     * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
     */

    protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {

        RendererUtils utils = getUtils();
        boolean shouldRenderForm = utils.getNestingForm(context, component) == null;
        String rootElementName = shouldRenderForm ? HtmlConstants.DIV_ELEM : HtmlConstants.SPAN_ELEM;

        AbstractPoll poll = (AbstractPoll) component;
        writer.startElement(rootElementName, component);
        writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "display:none;", null);
        utils.encodeId(context, component);

        if (shouldRenderForm) {
            String clientId = component.getClientId(context) + RendererUtils.DUMMY_FORM_ID;
            utils.encodeBeginForm(context, component, writer, clientId);
            utils.encodeEndForm(context, writer);
        }

        // polling script.
        writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
        writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript", null);
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.