Package org.richfaces.renderkit

Examples of org.richfaces.renderkit.ScriptOptions


    if(component instanceof UIPanelBar){
      UIPanelBar panelBar = (UIPanelBar)component;
     
      List<?> items = getScriptPanelBarItems(context, panelBar);
       
      ScriptOptions options = new ScriptOptions(component);
     
      AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
   
      addHandlerOption(panelBar, options, "onitemchange");
      addHandlerOption(panelBar, options, "onitemchanged");
         
      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);
      options.addOption("ajax", ajaxContext.isAjaxRequest());
     
         
      StringBuffer script = new StringBuffer();
      JSFunction function = new JSFunction("new Richfaces.PanelBar");
      function.addParameter(panelBar.getClientId(context));
View Full Code Here


    super.encodeEnd(context, component);
    StringBuffer buffer = new StringBuffer();
    JSFunction function = new JSFunction("new DnD.SimpleDraggable");
    function.addParameter(component.getParent().getClientId(context));
    RendererContributor contributor = DraggableRendererContributor.getInstance();
    ScriptOptions dragOptions = contributor.buildOptions(context, component);
   
    DnDParametersEncoder parametersEncoder = DnDParametersEncoder.getInstance();
    dragOptions.addOption("dndParams", parametersEncoder.doEncodeAsString(context, component));
   
    function.addParameter(dragOptions);
    function.appendScript(buffer);

    String scriptContribution = contributor.getScriptContribution(context, component);
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

  }

  public ScriptOptions buildOptions(FacesContext context,
      UIComponent component) {
    UIScrollableDataTable table = (UIScrollableDataTable) component;
    ScriptOptions scriptOptions = new ScriptOptions(component);
    if (table.isSelectionEnabled()) {
      scriptOptions.addOption("selectionInput", getSelectionInputName(
          context, table));
      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);
      scriptOptions.addOption("selectionMode", table.getSelectionMode());
    }
    return scriptOptions;
  }
View Full Code Here

    RendererContributor contributor = DropzoneRendererContributor.getInstance();
    StringBuffer buffer = new StringBuffer();
    JSFunction function = new JSFunction("new DnD.SimpleDropZone");
    function.addParameter(component.getParent().getClientId(context));
    ScriptOptions dropOptions = contributor.buildOptions(context, component);

    DnDParametersEncoder parametersEncoder = DnDParametersEncoder.getInstance();
    dropOptions.addOption("dndParams", parametersEncoder.doEncodeAsString(context, component));

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

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

     * @return all options needed for drag JavaScript object to work
     */
    public ScriptOptions buildOptions(FacesContext context, UIComponent column,
            String dragSourceScriptId, String indicatorId) {

        ScriptOptions options = new ScriptOptions(column);
        options.addOption("dragType", "COLUMN_ORDER_"
                + column.getParent().getClientId(context));

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters
                .put(
                        DraggableRendererContributor.DRAG_SOURCE_ID,
                        dragSourceScriptId);
        parameters.put(dragSourceScriptId, dragSourceScriptId);
        options.addOption("parameters", parameters);

        if (indicatorId != null) {
            options.addOption("dragIndicator", indicatorId);
        }

        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);
        scriptOptions.addEventHandler("onselectionchange");
        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

    super.encodeEnd(context, component);
    StringBuffer buffer = new StringBuffer();
    JSFunction function = new JSFunction("new DnD.SimpleDraggable");
    function.addParameter(component.getParent().getClientId(context));
    RendererContributor contributor = DraggableRendererContributor.getInstance();
    ScriptOptions dragOptions = contributor.buildOptions(context, component);
   
    DnDParametersEncoder parametersEncoder = DnDParametersEncoder.getInstance();
    dragOptions.addOption("dndParams", parametersEncoder.doEncodeAsString(context, component));
   
    function.addParameter(dragOptions);
    function.appendScript(buffer);

    String scriptContribution = contributor.getScriptContribution(context, component);
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.