Author: dbiatenia
Date: 2007-07-27 10:15:05 -0400 (Fri, 27 Jul 2007)
New Revision: 1893
Modified:
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltipblock.jspx
Log:
optimization tooltip content displaying
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 2007-07-27
13:37:10 UTC (rev 1892)
+++
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-07-27
14:15:05 UTC (rev 1893)
@@ -17,6 +17,7 @@
import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
import org.ajax4jsf.framework.util.javascript.JSReference;
*/
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
@@ -269,8 +270,18 @@
ResponseWriter responseWriter = context.getResponseWriter();
responseWriter.startElement(component.getUsedElementType(), component);
responseWriter.writeAttribute("id", component.getClientId(context) +
"content", null);
- responseWriter.write(component.getValue() != null ? component.getValue() :
"");
- super.renderChildren(context, component);
+ if("ajax".equals(component.getMode())){
+ // we want to avoid rendering toolTip content during initialy page displaying
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
+ if(ajaxContext != null &&
ajaxContext.getAjaxAreasToRender().contains(component.getClientId(context) +
"content")){
+ responseWriter.write(component.getValue() != null ? component.getValue() :
"");
+ super.renderChildren(context, component);
+ }
+ } else {
+ // client mode
+ responseWriter.write(component.getValue() != null ? component.getValue() :
"");
+ super.renderChildren(context, component);
+ }
responseWriter.endElement(component.getUsedElementType());
}
Modified: trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
===================================================================
--- trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2007-07-27 13:37:10
UTC (rev 1892)
+++ trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2007-07-27 14:15:05
UTC (rev 1893)
@@ -24,9 +24,16 @@
<f:clientid var="clientId"/>
<span id="#{clientId}" style="position: absolute; display :
none;z-index:#{component.attributes['zorder']};
#{component.attributes['style']}" class="dr-rich-tool-tip rich-tool-tip
#{component.attributes['styleClass']}">
<f:call name="utils.encodePassThru" />
- <span id="#{clientId}defaultContent"
style="display:none">
- <u:insertFacet name="defaultContent" />
- </span>
+ <jsp:scriptlet>
+ <![CDATA[if("ajax".equals(component.getMode()) &&
component.getFacet("defaultContent")!=null) {]]>
+ </jsp:scriptlet>
+ <span id="#{clientId}defaultContent"
style="display:none">
+ <u:insertFacet name="defaultContent" />
+ </span>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
+
<vcp:body>
<f:call name="encodeTooltipText"/>
</vcp:body>
Modified: trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltipblock.jspx
===================================================================
--- trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltipblock.jspx 2007-07-27
13:37:10 UTC (rev 1892)
+++ trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltipblock.jspx 2007-07-27
14:15:05 UTC (rev 1893)
@@ -24,9 +24,16 @@
<f:clientid var="clientId"/>
<div id="#{clientId}" style="position: absolute; display :
none;z-index:#{component.attributes['zorder']};
#{component.attributes['style']}" class="dr-rich-tool-tip rich-tool-tip
#{component.attributes['styleClass']}">
<f:call name="utils.encodePassThru" />
- <div id="#{clientId}defaultContent"
style="display:none">
- <u:insertFacet name="defaultContent" />
- </div>
+ <jsp:scriptlet>
+ <![CDATA[if("ajax".equals(component.getMode()) &&
component.getFacet("defaultContent")!=null) {]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}defaultContent"
style="display:none">
+ <u:insertFacet name="defaultContent" />
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
+
<vcp:body>
<f:call name="encodeTooltipText"/>
</vcp:body>