Author: vbaranov
Date: 2008-03-11 05:26:02 -0400 (Tue, 11 Mar 2008)
New Revision: 6674
Modified:
trunk/ui/tooltip/src/main/config/component/toolTip.xml
trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-2051
Modified: trunk/ui/tooltip/src/main/config/component/toolTip.xml
===================================================================
--- trunk/ui/tooltip/src/main/config/component/toolTip.xml 2008-03-11 08:51:07 UTC (rev
6673)
+++ trunk/ui/tooltip/src/main/config/component/toolTip.xml 2008-03-11 09:26:02 UTC (rev
6674)
@@ -190,7 +190,16 @@
<classname>java.lang.String</classname>
<description>Event that triggers the tooltip
disappearance</description>
<defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
+ </property>
+ <property>
+ <name>attached</name>
+ <classname>boolean</classname>
+ <description>
+ If the value of the "attached" attribute is true,
component is attached to parent component;
+ if false - component does not listen to activating browser events, but
should be activated externally
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
</component>
<renderer generate="true">
<template>org/richfaces/htmltooltipblock.jspx</template>
Modified: trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
===================================================================
--- trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2008-03-11
08:51:07 UTC (rev 6673)
+++ trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2008-03-11
09:26:02 UTC (rev 6674)
@@ -117,7 +117,10 @@
public abstract void setHideEvent(String hideEvent);
-
+ public abstract boolean isAttached();
+
+ public abstract void setAttached(boolean attached);
+
public String getUsedElementType(){
return getLayout().equals("block") ? "div" : "span";
}
Modified:
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
---
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2008-03-11
08:51:07 UTC (rev 6673)
+++
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2008-03-11
09:26:02 UTC (rev 6674)
@@ -136,8 +136,8 @@
}
- public Map buildEventOptions(FacesContext context, UIComponent component, String
targetId){
- Map eventOptions = AjaxRendererUtils.buildEventOptions(context, component);
+ public Map<String, Object> buildEventOptions(FacesContext context, UIComponent
component, String targetId){
+ Map<String, Object> eventOptions =
AjaxRendererUtils.buildEventOptions(context, component);
String jsVarName = "_toolTip";
//after element is subsituted in DOM tree, we have to re-create
@@ -232,18 +232,18 @@
StringBuffer ret = new StringBuffer();
String comma = ",";
String quot = "\"";
- String eventS = toolTip.getShowEvent();
- String eventH = toolTip.getHideEvent();
- if(eventS.startsWith("on")){
- eventS = eventS.substring(2);
+ String eventShow = (toolTip.isAttached()) ? toolTip.getShowEvent() : "";
+ String eventHide = (toolTip.isAttached()) ? toolTip.getHideEvent() : "";
+ if(eventShow.startsWith("on")){
+ eventShow = eventShow.substring(2);
}
- if(eventH.startsWith("on")){
- eventH = eventH.substring(2);
+ if(eventHide.startsWith("on")){
+ eventHide = eventHide.substring(2);
}
- Map eventsMap = new HashMap();
- eventsMap.put(new JSReference("showEvent"), eventS);
- eventsMap.put(new JSReference("hideEvent"), eventH);
+ 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()));
@@ -252,12 +252,12 @@
function.addParameter(ref);
String ajaxFunc = function.toScript();
- Map ajaxOptions = buildEventOptions(context, toolTip, targetClientId);
- JSFunctionDefinition completeFunc = getUtils().getAsEventHandler(context, component,
"oncoplete", "; return true;");
+ Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip,
targetClientId);
+ 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 funcMap = new HashMap();
+ 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);