return new JSObject("RichFaces.ui.Tooltip", component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
AbstractTooltip tooltip = (AbstractTooltip) component;
Map<String, Object> options = new HashMap<String, Object>();
RenderKitUtils.addToScriptHash(options, "ajax", getAjaxOptions(context, tooltip), TooltipMode.DEFAULT);
Positioning jointPoint = tooltip.getJointPoint();
if (jointPoint == null) {
jointPoint = org.richfaces.component.Positioning.DEFAULT;
}
Positioning direction = tooltip.getDirection();
if (direction == null) {
direction = org.richfaces.component.Positioning.DEFAULT;
}
RenderKitUtils.addToScriptHash(options, "jointPoint", jointPoint.getValue(), Positioning.DEFAULT.getValue());
RenderKitUtils.addToScriptHash(options, "direction", direction.getValue(), Positioning.DEFAULT.getValue());
RenderKitUtils.addToScriptHash(options, "attached", tooltip.isAttached(), true);
RenderKitUtils.addToScriptHash(options, "offset", getOffset(tooltip));
RenderKitUtils.addToScriptHash(options, "mode", tooltip.getMode(), TooltipMode.DEFAULT);
RenderKitUtils.addToScriptHash(options, "hideDelay", tooltip.getHideDelay(), 0);
RenderKitUtils.addToScriptHash(options, "hideEvent", tooltip.getHideEvent(), "mouseleave");
RenderKitUtils.addToScriptHash(options, "showDelay", tooltip.getShowDelay(), 0);
RenderKitUtils.addToScriptHash(options, "showEvent", tooltip.getShowEvent(), "mouseenter");
RenderKitUtils.addToScriptHash(options, "followMouse", tooltip.isFollowMouse(), true);
String target = tooltip.getTarget();
UIComponent targetComponent = RENDERER_UTILS.findComponentFor(component, target);
if (targetComponent != null) {
target = targetComponent.getClientId();
}
RenderKitUtils.addToScriptHash(options, "target", target);