Author: amarkhel
Date: 2010-10-29 07:39:19 -0400 (Fri, 29 Oct 2010)
New Revision: 19759
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml
Log:
RF-9474 Tooltip component
small fixes
Modified: trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml 2010-10-29 11:37:52 UTC
(rev 19758)
+++ trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml 2010-10-29 11:39:19 UTC
(rev 19759)
@@ -46,11 +46,11 @@
<p>Page</p>
<h:form id="f" style="border:blue solid thin;">
- <div id="div" style="border: 2px solid red;
background-color: #adff2f; width:300px; height:300px">
- Hello
+ <div id="myRectangle" style="border: 2px solid red;
background-color: #adff2f; width:300px; height:300px">
+ Tooltip apeared under green rectangle.
- <pn:tooltip id="tooltip" target="div">
- ToolTip Yo!!!
+ <pn:tooltip id="tooltip" target="myRectangle"
mode="ajax">
+ New ToolTip Yo!!!
</pn:tooltip>
</div>
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-10-29
11:37:52 UTC (rev 19758)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-10-29
11:39:19 UTC (rev 19759)
@@ -25,6 +25,7 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.TooltipMode;
import org.richfaces.component.AbstractTooltip;
import org.richfaces.component.html.HtmlTooltip;
import org.richfaces.renderkit.HtmlConstants;
@@ -34,6 +35,7 @@
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.util.HashMap;
@@ -105,7 +107,10 @@
writer.writeAttribute("id", component.getClientId(context) +
":cntr", null);
writer.writeAttribute("class", "rf-tt-cntr", null);
- encodeLoading(writer, context, tooltip);
+ if (tooltip.getMode() == TooltipMode.ajax) {
+ encodeLoading(writer, context, tooltip);
+ }
+
encodeContentBegin(writer, context, tooltip);
}
@@ -197,13 +202,16 @@
public void encodeMetaComponent(FacesContext context, UIComponent component, String
metaComponentId) throws IOException {
if (AbstractTooltip.CONTENT_META_COMPONENT_ID.equals(metaComponentId)) {
AbstractTooltip tooltip = (AbstractTooltip) component;
- ResponseWriter writer = context.getResponseWriter();
-
+ PartialResponseWriter writer =
context.getPartialViewContext().getPartialResponseWriter();
+ writer.startUpdate(((AbstractTooltip)
component).getContentClientId(context));
+
encodeContentBegin(writer, context, tooltip);
for (UIComponent child : tooltip.getChildren()) {
child.encodeAll(context);
}
encodeContentEnd(writer, context, tooltip);
+
+ writer.endUpdate();
}
}
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-10-29
11:37:52 UTC (rev 19758)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-10-29
11:39:19 UTC (rev 19759)
@@ -120,7 +120,7 @@
this.options = $.extend({}, DEFAULT_OPTIONS, this.options || {}, options ||
{});
this.attachToDom.call(this, componentId);
- this.mode = TooltipMode.ajax;
+ this.mode = this.options.mode;
this.target = this.options.target;
this.__addUserEventHandler("hide");
@@ -140,19 +140,19 @@
tooltip.popup.show(event);
}
- $(this.options.target).bind(this.options.showEvent, function (event) {
+ $(document.getElementById(this.target)).bind(this.options.showEvent, function
(event) {
tooltip.show(event);
if (tooltip.options.followMouse) {
- $(tooltip.target).bind("mousemove", mouseMoveHandler);
+
$(document.getElementById(tooltip.target)).bind("mousemove", mouseMoveHandler);
}
});
- $(tooltip.target).bind(this.options.hideEvent, function (event) {
+ $(document.getElementById(tooltip.target)).bind(this.options.hideEvent,
function (event) {
tooltip.hide();
if (tooltip.options.followMouse) {
- $(tooltip.target).unbind("mousemove", mouseMoveHandler);
+
$(document.getElementById(tooltip.target)).unbind("mousemove",
mouseMoveHandler);
}
});
@@ -207,8 +207,8 @@
},
onCompleteHandler : function () {
+ this.__content().show();
this.__loading().hide();
- this.__content().show();
return this.__fireShow();
},
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss 2010-10-29
11:37:52 UTC (rev 19758)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss 2010-10-29
11:39:19 UTC (rev 19759)
@@ -25,7 +25,7 @@
}
.rf-tt-loading {
-
+ display:none;
}
.rf-tt-cnt {
Modified:
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml
===================================================================
---
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml 2010-10-29
11:37:52 UTC (rev 19758)
+++
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml 2010-10-29
11:39:19 UTC (rev 19759)
@@ -1,6 +1,5 @@
<span id="f:tooltip" class="rf-tt">
<span id="f:tooltip:cntr" class="rf-tt-cntr">
- <span id="f:tooltip:loading"
class="rf-tt-loading">Loading...</span>
<span id="f:tooltip@content"
class="rf-tt-cnt"></span>
</span>
<script type="text/javascript">