Author: Alex.Kolonitsky
Date: 2010-12-13 07:58:08 -0500 (Mon, 13 Dec 2010)
New Revision: 20526
Modified:
trunk/examples/output-demo/src/main/webapp/examples/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
Log:
fix tooltip offsets
Modified: trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml 2010-12-13 12:41:53
UTC (rev 20525)
+++ trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml 2010-12-13 12:58:08
UTC (rev 20526)
@@ -21,7 +21,8 @@
-->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
@@ -33,7 +34,7 @@
<ui:composition template="/templates/template.xhtml">
<ui:define name="scripts">
- <h:outputScript name="Tooltip.js" />
+ <h:outputScript name="Tooltip.js"/>
</ui:define>
<ui:define name="title">TOOLTIP JS Development</ui:define>
@@ -41,66 +42,66 @@
<ui:define name="body">
<h:panelGrid columns="2">
- <rich:panel id="sample1" styleClass="tooltip-text"
- bodyClass="rich-laguna-panel-no-header">
- <p>Here you can see <b>default client-side</b>
tool-tip</p>
- <pn:tooltip id="tt1" styleClass="tooltip">
- <span style="white-space: nowrap"> This tool-tip content
was
- <strong>pre-rendered</strong> to the page.<br />
- Also the tooltip following mouse by default </span>
- </pn:tooltip>
- </rich:panel>
- <rich:panel id="sample2" styleClass="tooltip"
- bodyClass="rich-laguna-panel-no-header">
- <p>This tool-tip will not <b>follow mouse</b>. Also this
tool-tip
- has a <b>delay 1.5 sec</b>, so be patient!</p>
- <pn:tooltip followMouse="false" showDelay="1500"
- styleClass="tooltip-custom-body">
+ <rich:panel id="sample1" styleClass="tooltip-text"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>Here you can see <b>default client-side</b>
tool-tip</p>
+ <pn:tooltip id="tt1" styleClass="tooltip">
+ <span style="white-space: nowrap"> This tool-tip
content was
+ <strong>pre-rendered</strong> to the page.<br/>
+ Also the tooltip following mouse by default </span>
+ </pn:tooltip>
+ </rich:panel>
+ <rich:panel id="sample2" styleClass="tooltip"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>This tool-tip will not <b>follow mouse</b>. Also
this tool-tip
+ has a <b>delay 1.5 sec</b>, so be patient!</p>
+ <pn:tooltip followMouse="false" showDelay="1500"
+ styleClass="tooltip-custom-body">
<span style="white-space: nowrap"> This tool-tip content
also
- <strong>pre-rendered</strong> to the page.<br />
+ <strong>pre-rendered</strong> to the page.<br/>
</span>
- </pn:tooltip>
- </rich:panel>
- <h:form>
- <rich:panel id="sample3" styleClass="tooltip-text"
- bodyClass="rich-laguna-panel-no-header">
- <p>This tool-tip rendered on server <b>in separate
request</b>.
- </p>
- <pn:tooltip mode="ajax" styleClass="tooltip"
layout="block">
- <f:facet name="defaultContent">
- <strong>Wait...</strong>
- </f:facet>
+ </pn:tooltip>
+ </rich:panel>
+ <h:form>
+ <rich:panel id="sample3"
styleClass="tooltip-text"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>This tool-tip rendered on server <b>in separate
request</b>.
+ </p>
+ <pn:tooltip mode="ajax" styleClass="tooltip"
layout="block">
+ <f:facet name="defaultContent">
+ <strong>Wait...</strong>
+ </f:facet>
<span style="white-space: nowrap">This tool-tip
content was
<strong>rendered on server</strong> </span>
- <h:panelGrid columns="2">
- <h:outputText style="white-space:nowrap"
- value="tooltips requested" />
- </h:panelGrid>
- </pn:tooltip>
- </rich:panel>
- </h:form>
- <h:form>
- <rich:panel id="sample4" styleClass="tooltip-text"
- bodyClass="rich-laguna-panel-no-header">
- <p>This tool-tip will be <b>activated on mouse
click</b>.</p>
- <pn:tooltip showEvent="click" mode="ajax"
styleClass="tooltip"
- layout="block">
- <f:facet name="defaultContent">
- <strong>Wait...</strong>
- </f:facet>
- <span style="white-space: nowrap">This tool-tip
content was
- <strong>rendered on server</strong><br />
- </span>
- <h:panelGrid columns="2">
- <h:outputText style="white-space:nowrap"
- value="tooltips requested:" />
- <h:outputText
value="#{tooltipData.tooltipCounter}"
- styleClass="tooltipData" />
- </h:panelGrid>
- </pn:tooltip>
- </rich:panel>
- </h:form>
- </h:panelGrid>
+ <h:panelGrid columns="2">
+ <h:outputText style="white-space:nowrap"
+ value="tooltips requested"/>
+ </h:panelGrid>
+ </pn:tooltip>
+ </rich:panel>
+ </h:form>
+ <h:form>
+ <rich:panel id="sample4"
styleClass="tooltip-text"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>This tool-tip will be <b>activated on mouse
click</b>.</p>
+ <pn:tooltip showEvent="click" mode="ajax"
styleClass="tooltip"
+ layout="block" horizontalOffset="50"
verticalOffset="50">
+ <f:facet name="defaultContent">
+ <strong>Wait...</strong>
+ </f:facet>
+ <span style="white-space: nowrap">This tool-tip
content was
+ <strong>rendered on server</strong><br/>
+ </span>
+ <h:panelGrid columns="2">
+ <h:outputText style="white-space:nowrap"
+ value="tooltips requested:"/>
+ <h:outputText
value="#{tooltipData.tooltipCounter}"
+ styleClass="tooltipData"/>
+ </h:panelGrid>
+ </pn:tooltip>
+ </rich:panel>
+ </h:form>
+ </h:panelGrid>
</ui:define>
</ui:composition>
</body>
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-12-13
12:41:53 UTC (rev 20525)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-13
12:58:08 UTC (rev 20526)
@@ -178,10 +178,8 @@
return options;
}
- public Map<String, Object> getOffset(HtmlTooltip tooltip) {
- Map<String, Object> options = new HashMap<String, Object>();
- // TODO
- return options;
+ public Integer[] getOffset(HtmlTooltip tooltip) {
+ return new Integer[] {tooltip.getHorizontalOffset(),
tooltip.getHorizontalOffset()};
}
private void encodeContentEnd(ResponseWriter writer, FacesContext context,
AbstractTooltip tooltip) throws IOException {
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-12-13
12:41:53 UTC (rev 20525)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js 2010-12-13
12:58:08 UTC (rev 20526)
@@ -47,7 +47,7 @@
var DEFAULT_OPTIONS = {
direction : TooltipDirection.DEFAULT,
attached : true,
- offset : [],
+ offset : [10, 10],
mode : TooltipMode.DEFAULT,
disabled : false,
hideDelay : 0,
@@ -132,7 +132,7 @@
attachTo: this.target,
attachToBody: false,
positionType: "TOOLTIP",
- positionOffset: [200,200]
+ positionOffset: this.options.offset
});
var tooltip = this;