Examples of UIToolTip


Examples of org.richfaces.component.UIToolTip

      return component.getParent().getClientId(context);
    }
  }

  public String constructJSVariable(FacesContext context, UIComponent component) {
    UIToolTip toolTip = (UIToolTip)component;
    String targetClientId = getTargetId(context, component);
    StringBuffer ret = new StringBuffer();
    String comma = ",";
    String quot = "\"";
    String eventShow = (toolTip.isAttached()) ? toolTip.getShowEvent() : "";
    String eventHide = (toolTip.isAttached()) ? toolTip.getHideEvent() : "";
    if(eventShow.startsWith("on")){
      eventShow = eventShow.substring(2);
    }
    if(eventHide.startsWith("on")){
      eventHide = eventHide.substring(2);
    }
   
    Map<JSReference, Object> eventsMap = new HashMap<JSReference, Object>();
    eventsMap.put(new JSReference("showEvent"), eventShow);
    eventsMap.put(new JSReference("hideEvent"), eventHide);
    eventsMap.put(new JSReference("delay"), new Integer(toolTip.getShowDelay()));
    eventsMap.put(new JSReference("hideDelay"), new Integer(toolTip.getHideDelay()));
   
    JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
    JSReference ref = new JSReference("ajaxOptions");
    function.addParameter(ref);
    String ajaxFunc = function.toScript();
       
    Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip, targetClientId);
    ajaxOptions.putAll(getParamsMap(context, toolTip));
    JSFunctionDefinition completeFunc = getUtils().getAsEventHandler(context, component, "oncomplete", "; return true;");
    JSFunctionDefinition hideFunc = getUtils().getAsEventHandler(context, component,"onhide", "; return true;");
    JSFunctionDefinition showFunc = getUtils().getAsEventHandler(context, component,"onshow", "; return true;");
   
    Map<JSReference, Object> funcMap = new HashMap<JSReference, Object>();
    funcMap.put(new JSReference("oncomplete"), completeFunc);
    funcMap.put(new JSReference("onhide"), hideFunc);
    funcMap.put(new JSReference("onshow"), showFunc);
   
   
    ret.append("new ToolTip(" + ScriptUtils.toScript(eventsMap)).append(comma).append(ScriptUtils.toScript(funcMap))
    .append(comma).append(quot).append( toolTip.getClientId(context)).append(quot).append(comma).
    append(quot).append(targetClientId).append(quot).append(comma).
    append(quot).append(toolTip.getMode()).append(quot).append(comma).
    append(toolTip.isDisabled()).append(comma).
    append(quot).append(toolTip.getDirection()).append(quot).append(comma).
    append(toolTip.isFollowMouse()).append(comma).
    append(toolTip.getHorizontalOffset()).append(comma).
    append(toolTip.getVerticalOffset()).append(comma).
    append("\"").append(ajaxFunc).append("\"").append(comma).append(ScriptUtils.toScript(ajaxOptions)).append(");");
   
    return ret.toString();
  }
View Full Code Here

Examples of org.richfaces.component.UIToolTip

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

    UIToolTip toolTip = (UIToolTip)component;
    Class rendererClass = null;
    try{
      if("block".equals(toolTip.getLayout())){
        rendererClass = Class.forName("org.richfaces.renderkit.html.HtmlToolTipRendererBlock");
      } else if("inline".equals(toolTip.getLayout())){
        rendererClass = Class.forName("org.richfaces.renderkit.html.HtmlToolTipRenderer");
      } else {
        throw new FacesException("Only \"block\" or \"inline\" values can be established to attribute \"layout\".");
      }
      ToolTipRenderer renderer = (ToolTipRenderer)rendererClass.newInstance();
View Full Code Here

Examples of org.richfaces.component.UIToolTip

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

    UIToolTip toolTip = (UIToolTip)component;
    Class rendererClass = null;
    try{
      if("block".equals(toolTip.getLayout())){
        rendererClass = Class.forName("org.richfaces.renderkit.html.HtmlToolTipRendererBlock");
      } else {
        rendererClass = Class.forName("org.richfaces.renderkit.html.HtmlToolTipRenderer");
      }
     
View Full Code Here

Examples of org.richfaces.component.UIToolTip

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

    UIToolTip toolTip = (UIToolTip)component;
    Class rendererClass = null;
    try{
      if("block".equals(toolTip.getLayout())){
        rendererClass = Class.forName("org.richfaces.renderkit.html.HtmlToolTipRendererBlock");
      } else {
        rendererClass = Class.forName("org.richfaces.renderkit.html.HtmlToolTipRenderer");
      }
      ToolTipRenderer renderer = (ToolTipRenderer)rendererClass.newInstance();
View Full Code Here

Examples of org.richfaces.component.UIToolTip

        return eventOptions;
  }
 
  public void insertScript(FacesContext context, UIComponent component) throws IOException{
   
    UIToolTip toolTip = (UIToolTip)component;

    StringBuffer ret = new StringBuffer();
    ret.append("<script ");
    ret.append("type=\"text/javascript\" ");
    ret.append("id =\"script" + component.getClientId(context)+"\">\n");
View Full Code Here

Examples of org.richfaces.component.UIToolTip

    writer.write(ret.toString());
   
  }

  public String constructJSVariable(FacesContext context, UIComponent component) {
    UIToolTip toolTip = (UIToolTip)component;
    String parentClientId = toolTip.getParent().getClientId(context);
    StringBuffer ret = new StringBuffer();
    String comma = ",";
    String quot = "\"";
    String event = toolTip.getEvent();
    if(event.startsWith("on")){
      event = event.substring(2);
    }
   
    Map eventsMap = new HashMap();
    eventsMap.put(new JSReference("event"), event);
    eventsMap.put(new JSReference("onshow"), toolTip.getOnshow());
    eventsMap.put(new JSReference("oncomplete"), toolTip.getOncomplete());
    eventsMap.put(new JSReference("onhide"), toolTip.getOnhide());
    eventsMap.put(new JSReference("delay"), new Integer(toolTip.getDelay()));
   
    JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
    JSReference ref = new JSReference("ajaxOptions");
    function.addParameter(ref);
    String ajaxFunc = function.toScript();
   
    Map ajaxOptions = buildEventOptions(context, toolTip);
   
    ret.append("new ToolTip(" + ScriptUtils.toScript(eventsMap)).append(comma).append(quot).append( toolTip.getClientId(context)).append(quot).append(comma).
    append(quot).append(parentClientId).append(quot).append(comma).
    append(quot).append(toolTip.getMode()).append(quot).append(comma).
    append(toolTip.isDisabled()).append(comma).
    append(quot).append(toolTip.getDirection()).append(quot).append(comma).
    append(toolTip.isFollowMouse()).append(comma).
    append(toolTip.getHorizontalOffset()).append(comma).
    append(toolTip.getVerticalOffset()).append(comma).
    append("\"").append(ajaxFunc).append("\"").append(comma).append(ScriptUtils.toScript(ajaxOptions)).append(");");

    return ret.toString();
  }
View Full Code Here

Examples of org.richfaces.component.UIToolTip

    return "Richfaces.tooltips[\'" + component.getParent().getClientId(context) + "\']";
  }
 
  protected void doDecode(FacesContext context, UIComponent component) {

    UIToolTip tooltip = (UIToolTip)component;
   
    String clientId = tooltip.getClientId(context);
   
    if(context.getExternalContext().getRequestParameterMap().containsKey(clientId)){
      if("ajax".equals(tooltip.getMode())){
        new AjaxEvent(component).queue();
      }
    }
  }
View Full Code Here

Examples of org.richfaces.component.UIToolTip

        }
        return paramsMap;
    }
   
    private String getTargetId(FacesContext context, UIComponent component) {
        UIToolTip toolTip = (UIToolTip) component;
        String forValue = toolTip.getFor();
       
        if (forValue != null && forValue.length() != 0) {
            UIComponent targetComponent = getUtils().findComponentFor(component, forValue);
            if (targetComponent != null) {
                return targetComponent.getClientId(context);
View Full Code Here

Examples of org.richfaces.component.UIToolTip

    private final static String COMMA = ",";
    private final static String QUOT = "\"";
    private final static String QUOT_COMMA = "\"" + ","
   
    public String constructJSVariable(FacesContext context, UIComponent component) {
        UIToolTip toolTip = (UIToolTip) component;
        String targetClientId = getTargetId(context, component);
       
        Map<String, Object> options = new HashMap<String, Object>();
       
        String eventShow = (toolTip.isAttached()) ? toolTip.getShowEvent() : "";
        if (eventShow.startsWith("on")) {
            eventShow = eventShow.substring(2);
        }
        RendererUtils utils = getUtils();
    utils.addToScriptHash(options, "showEvent", eventShow);
        String eventHide = (toolTip.isAttached()) ? toolTip.getHideEvent() : "";
        if (eventHide.startsWith("on")) {
            eventHide = eventHide.substring(2);
        }
        utils.addToScriptHash(options, "hideEvent", eventHide);

        utils.addToScriptHash(options, "delay", toolTip.getShowDelay(), "0");
        utils.addToScriptHash(options, "hideDelay", toolTip.getHideDelay(), "0");
       
        if (AJAX_MODE.equalsIgnoreCase(toolTip.getMode())) {
          JSFunctionDefinition ajaxFunc = new JSFunctionDefinition("event");
            JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
            Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip);
            ajaxOptions.putAll(getParamsMap(context, toolTip));
            function.addParameter(ajaxOptions);
            ajaxFunc.addToBody(function);
            utils.addToScriptHash(options, "ajaxFunction", ajaxFunc);
       }
       
        JSFunctionDefinition hideFunc = utils.getAsEventHandler(
                context, component, "onhide", "; return true;");
        utils.addToScriptHash(options, "onhide", hideFunc);

        JSFunctionDefinition showFunc = utils.getAsEventHandler(
                context, component, "onshow", "; return true;");
        utils.addToScriptHash(options, "onshow", showFunc);
       
        utils.addToScriptHash(options, "disabled", toolTip.isDisabled(), "false");
        String direction = toolTip.getDirection();
        if (DIRECTION_AUTO.equalsIgnoreCase(direction)) {
            direction = DIRECTION_BOTTOM_RIGHT;
        }
        utils.addToScriptHash(options, "direction", direction, DIRECTION_BOTTOM_RIGHT);
        utils.addToScriptHash(options, "followMouse", toolTip.isFollowMouse(), "false");
        utils.addToScriptHash(options, "horizontalOffset", toolTip.getHorizontalOffset(), "10");
        utils.addToScriptHash(options, "verticalOffset", toolTip.getVerticalOffset(), "10");

        StringBuffer ret = new StringBuffer();
        ret.append("new ToolTip(").append(QUOT).append(toolTip.getClientId(context)).append(QUOT_COMMA)
           .append(QUOT).append(targetClientId).append(QUOT);
        if (!options.isEmpty()) {
          ret.append(COMMA).append(ScriptUtils.toScript(options));
    }
        ret.append(");");
View Full Code Here

Examples of org.richfaces.component.UIToolTip

        return ret.toString();
    }
   
    protected void doDecode(FacesContext context, UIComponent component) {
       
        UIToolTip tooltip = (UIToolTip) component;
       
        String clientId = tooltip.getClientId(context);
       
        if (context.getExternalContext().getRequestParameterMap().containsKey(clientId)) {
            if (AJAX_MODE.equals(tooltip.getMode())) {
                new AjaxEvent(component).queue();
                new ActionEvent(component).queue();
            }
        }
    }
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.