Package org.richfaces.renderkit

Examples of org.richfaces.renderkit.ScriptOptions


         String evt = (String) component.getAttributes().get("event");
        if(evt == null || evt.trim().length() == 0){
          evt = "onmouseover";
        }
        function.addParameter(evt);
        ScriptOptions subMenuOptions = new ScriptOptions(component);
        subMenuOptions.addEventHandler("onopen");
        subMenuOptions.addEventHandler("onclose");
        subMenuOptions.addOption("direction");
        subMenuOptions.addOption("dummy", "dummy");
        function.addParameter(subMenuOptions);
        function.appendScript(buffer);

    } else {
        buffer.append(".");
        function = new JSFunction("asContextMenu");
/*        function.addParameter(component.getParent().getClientId(context));
          String evt = (String) component.getAttributes().get("event");
        if(evt == null || evt.trim().length() == 0){
          evt = "oncontextmenu";
        }
        function.addParameter(evt);
        function.addParameter("onmouseout");
*/        ScriptOptions menuOptions = new ScriptOptions(component);

        menuOptions.addOption("direction");
        menuOptions.addOption("jointPoint");
        menuOptions.addOption("verticalOffset");


        menuOptions.addOption("horizontalOffset");
        menuOptions.addEventHandler("oncollapse");
        menuOptions.addEventHandler("onexpand");
        menuOptions.addEventHandler("onitemselect");
        menuOptions.addEventHandler("ongroupactivate");
       
        menuOptions.addOption("dummy", "dummy");
        function.addParameter(menuOptions);
        function.appendScript(buffer);

    }
   
View Full Code Here


    return null;
  }

  public ScriptOptions buildOptions(FacesContext context,
      UIComponent component) {
    ScriptOptions scriptOptions = new ScriptOptions(component);
    scriptOptions.addOption("selectionInput", getSelectionInputName(
        context, (UIScrollableDataTable) component));
    Map<String, Object> attributes = component.getAttributes();
    Object attribut = attributes.get("selectedClass");
    if (attribut == null) {
      attribut = "";
    }
    scriptOptions.addOption("selectedClass", attribut);
    attribut = attributes.get("activeClass");
    if (attribut == null) {
      attribut = "";
    }scriptOptions.addOption("activeClass", attribut);
    return scriptOptions;
  }
View Full Code Here

   * @param context faces context
   * @param column table column
   * @return all options needed for drop JavaScript object to work
   */
  public ScriptOptions buildOptions(FacesContext context, UIComponent column) {
    ScriptOptions options = new ScriptOptions(column);
    options.addOption("acceptedTypes", "COLUMN_ORDER_"+column.getParent().getClientId(context));
    return options;
  }
View Full Code Here

        return null;
    }

    public ScriptOptions buildOptions(FacesContext context,
            UIComponent component) {
        ScriptOptions scriptOptions = new ScriptOptions(component);
        scriptOptions.addOption("selectionInput", getSelectionInputName(
                context, (UIExtendedDataTable) component));
        scriptOptions.addOption("gridId", getGridId(context,
                (UIExtendedDataTable) component));
        Map<String, Object> attributes = component.getAttributes();
        Object attribut = attributes.get("selectedClass");
        if (attribut == null) {
            attribut = "";
        }
        scriptOptions.addOption("selectedClass", attribut);
        attribut = attributes.get("activeClass");
        if (attribut == null) {
            attribut = "";
        }
        scriptOptions.addOption("activeClass", attribut);

        attribut = attributes.get("selectionMode");
        if (attribut == null) {
            attribut = "";
        }
        scriptOptions.addOption("selectionMode", attribut);

        attribut = attributes.get("onselectionchange");
        if (attribut == null) {
            attribut = "";
        }
        JSFunctionDefinition function = new JSFunctionDefinition();
        function.addToBody(attribut);
        scriptOptions.addEventHandler("onselectionchange", function);
        return scriptOptions;
    }
View Full Code Here

        function.addParameter(dragSourceId);
        String dragSourceScriptId = column.getClientId(context) + ":"
                + DRAG_SOURCE_SCRIPT_ID;
        ExtDraggableRendererContributor contributor = ExtDraggableRendererContributor
                .getInstance();
        ScriptOptions dragOptions = contributor.buildOptions(context, column,
                dragSourceScriptId, indicatorId);

        JSONObject dndParams = new JSONObject();
        try {
            dndParams.put("label", dragLabel == null ? "" : dragLabel);
        } catch (JSONException e) {
        }
        dragOptions.addOption("dndParams", dndParams.toString());

        function.addParameter(dragOptions);
        function.appendScript(buffer);

        String scriptContribution = contributor.getScriptContribution(context,
View Full Code Here

                .getInstance();
        String varName = "DnD_ExtSimpleDropZone_"+column.getId().replaceAll("[^A-Za-z0-9_]", "_") + (before?"L":"R");
        StringBuffer buffer = new StringBuffer("delete " + varName + ";\nvar " + varName + " = ");
        JSFunction function = new JSFunction("new DnD.ExtSimpleDropZone");
        function.addParameter(dropTargetId);
        ScriptOptions dropOptions = contributor.buildOptions(context, column);
        JSONObject dndParams = new JSONObject();
        dropOptions.addOption("dndParams", dndParams.toString());

        function.addParameter(dropOptions);
        function.appendScript(buffer);

        String dropTargetScriptId = column.getClientId(context) + ":"
View Full Code Here

    return null;
  }

  public ScriptOptions buildOptions(FacesContext context,
      UIComponent component) {
    ScriptOptions scriptOptions = new ScriptOptions(component);
    scriptOptions.addOption("selectionInput", getSelectionInputName(
        context, (UIScrollableDataTable) component));
    Map<String, Object> attributes = component.getAttributes();
    Object attribut = attributes.get("selectedClass");
    if (attribut == null) {
      attribut = "";
    }
    scriptOptions.addOption("selectedClass", attribut);
    attribut = attributes.get("activeClass");
    if (attribut == null) {
      attribut = "";
    }scriptOptions.addOption("activeClass", attribut);
    return scriptOptions;
  }
View Full Code Here

         String evt = (String) component.getAttributes().get("event");
        if(evt == null || evt.trim().length() == 0){
             evt = "onmouseover";
        }
        function.addParameter(evt);
        ScriptOptions Optionssub = new ScriptOptions(component);
        Optionssub.addOption("onopen", component.getAttributes().get("onopen"));
        Optionssub.addOption("onclose", component.getAttributes().get("onclose"));
        Optionssub.addOption("direction", component.getAttributes().get("direction"));
        function.addParameter(Optionssub);
        function.appendScript(buffer);

    } else {
        buffer.append(".");
        function = new JSFunction("asDropDown");
        function.addParameter(component.getClientId(context));
          String evt = (String) component.getAttributes().get("event");
        if(evt == null || evt.trim().length() == 0){
          evt = "onmouseover";
        }
        function.addParameter(evt);
        function.addParameter("onmouseout");
        ScriptOptions Options = new ScriptOptions(component);

        Options.addOption("direction", component.getAttributes().get("direction"));
        Options.addOption("jointPoint", component.getAttributes().get("jointPoint"));
        Options.addOption("verticalOffset", component.getAttributes().get("verticalOffset"));


        Options.addOption("horizontalOffset", component.getAttributes().get("horizontalOffset"));
        Options.addOption("oncollapse", component.getAttributes().get("oncollapse"));
        Options.addOption("onexpand", component.getAttributes().get("onexpand"));
        Options.addOption("onitemselect", component.getAttributes().get("onitemselect"));
        Options.addOption("ongroupactivate", component.getAttributes().get("ongroupactivate"));
        function.addParameter(Options);
        function.appendScript(buffer);

    }

    List children = component.getChildren();
    for(Iterator it = children.iterator();it.hasNext();) {
      UIComponent kid = (UIComponent)it.next();
      String itemId = null;
      int flcloseonclick=1;
            int flagGroup = 0;
      if (kid instanceof UIMenuItem) {
        UIMenuItem MenuItem=(UIMenuItem)kid;
        itemId = kid.getClientId(context);
        if (MenuItem.isDisabled()){
          flcloseonclick=0;
        }
      } else if (kid instanceof UIMenuGroup) {
                UIMenuGroup menuGroup=(UIMenuGroup)kid;
        itemId = "ref" + kid.getClientId(context);
        flcloseonclick=0;
                if (menuGroup.isDisabled()) flagGroup = 2; else flagGroup = 1;
      }
      if(itemId != null){
          function = new JSFunction("addItem");
          function.addParameter(itemId);
          function.addParameter(new Integer(flcloseonclick));

          ScriptOptions options = new ScriptOptions(kid);
          options.addOption("onmouseout", kid.getAttributes().get("onmouseout"));
          options.addOption("onmouseover", kid.getAttributes().get("onmouseover"));
                  options.addOption("flagGroup", new Integer(flagGroup));
                  String tmp = (String)kid.getAttributes().get("selectClass");
                  if (tmp != null && tmp.length() > 0) options.addOption("selectClass", tmp);
          function.addParameter(options);
          buffer.append('.');
          function.appendScript(buffer);
      }
    }
View Full Code Here

         String evt = (String) component.getAttributes().get("event");
        if(evt == null || evt.trim().length() == 0){
          evt = "onmouseover";
        }
        function.addParameter(evt);
        ScriptOptions subMenuOptions = new ScriptOptions(component);
        subMenuOptions.addEventHandler("onopen");
        subMenuOptions.addEventHandler("onclose");
        subMenuOptions.addOption("direction");
        subMenuOptions.addOption("highlightParent", Boolean.TRUE);
        function.addParameter(subMenuOptions);
        function.appendScript(buffer);

    } else {
        buffer.append(".");
        function = new JSFunction("asDropDown");
        function.addParameter(component.getClientId(context));
        function.addParameter(component.getClientId(context) + "_span");
          String evt = (String) component.getAttributes().get("event");
        if(evt == null || evt.trim().length() == 0){
          evt = "onmouseover";
        }
        function.addParameter(evt);
        function.addParameter("onmouseout");
        ScriptOptions menuOptions = new ScriptOptions(component);

        menuOptions.addOption("direction");
        menuOptions.addOption("jointPoint");
        menuOptions.addOption("verticalOffset");


        menuOptions.addOption("horizontalOffset");
        menuOptions.addEventHandler("oncollapse");
        menuOptions.addEventHandler("onexpand");
        menuOptions.addEventHandler("onitemselect");
        menuOptions.addEventHandler("ongroupactivate");
        menuOptions.addOption("disabled");
        function.addParameter(menuOptions);
        function.appendScript(buffer);

    }
   
View Full Code Here

    if(component instanceof UIPanelBar){
      UIPanelBar panelBar = (UIPanelBar)component;
     
      List items = getScriptPanelBarItems(context, panelBar);
       
      ScriptOptions options = new ScriptOptions(component);
     
     
      Object changeScript = panelBar.getAttributes().get("onitemchange");
     
      if (changeScript != null && !changeScript.equals("")) {
        JSFunctionDefinition function =  new JSFunctionDefinition();
        function.addParameter("event");
        function.addToBody(changeScript);
        options.addOption("onitemchange",function);
      } else {
        options.addOption("onitemchange","");
      }
         
      options.addOption("onclick", panelBar.getAttributes().get("onclick"));
      options.addOption("mouseover", panelBar.getAttributes().get("onmouseover"));
      options.addOption("mouseout", panelBar.getAttributes().get("onmouseout"));
      options.addOption("mousemove", panelBar.getAttributes().get("onmousemove"));
      options.addOption("items", items);
     
         
      StringBuffer script = new StringBuffer();
      JSFunction function = new JSFunction("new Richfaces.PanelBar");
      function.addParameter(panelBar.getClientId(context));
View Full Code Here

TOP

Related Classes of org.richfaces.renderkit.ScriptOptions

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.