Author: pyaschenko
Date: 2011-02-09 10:01:21 -0500 (Wed, 09 Feb 2011)
New Revision: 21567
Modified:
trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js
Log:
https://jira.jboss.org/browse/RF-10395 + tooltip bindings refactoring
Modified: trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2011-02-09
14:39:21 UTC (rev 21566)
+++ trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2011-02-09
15:01:21 UTC (rev 21567)
@@ -4,7 +4,8 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:in="http://richfaces.org/input"
-
xmlns:misc="http://richfaces.org/misc">
+
xmlns:misc="http://richfaces.org/misc"
+
xmlns:a4j="http://richfaces.org/a4j">
<f:view contentType="text/html" />
<h:head>
@@ -14,7 +15,7 @@
<h:body>
<h:form id="form">
- <div id="scroll" style="width: 500px; height:400px;
overflow:auto;" >
+ <div id="scroll" style="width: 500px; height:260px;
overflow:auto;" >
<fieldset>
<legend>InplaceSelect Test App</legend>
Fresh off his victory in the Florida primary, Sen. John McCain is poised to take
another big prize. Former
@@ -47,6 +48,12 @@
<h:panelGroup id="out">
<h:outputText value="Entered Value: #{inputBean.value}"/>
</h:panelGroup>
+
+ <!--a4j:poll render="is" interval="2000" />
+ <in:inplaceSelect id='is' defaultLabel="Edit Text"
value="#{inputBean.value}" openOnEdit="true"
saveOnSelect="false">
+ <f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
+ <f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
+ </in:inplaceSelect-->
</h:form>
</h:body>
</html>
Modified: trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml 2011-02-09 14:39:21
UTC (rev 21566)
+++ trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml 2011-02-09 15:01:21
UTC (rev 21567)
@@ -145,6 +145,14 @@
</h:panelGrid>
<a4j:outputPanel
ajaxRendered="true"><h:messages></h:messages></a4j:outputPanel>
</h:form>
+ <!-- h:form>
+ <a4j:poll render="tt" interval="10000" />
+ <rich:panel id="myId1" styleClass="tooltip-text"
bodyClass="rich-laguna-panel-no-header">
+ <pn:tooltip id="tt" styleClass="tooltip">
+ <span style="white-space: nowrap">Test tooltip with
a4j:pool</span>
+ </pn:tooltip>
+ </rich:panel>
+ </h:form-->
</ui:define>
</ui:composition>
</body>
Modified: trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
===================================================================
---
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2011-02-09
14:39:21 UTC (rev 21566)
+++
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2011-02-09
15:01:21 UTC (rev 21567)
@@ -78,6 +78,13 @@
getId: function() {
return this.id;
+ },
+
+ destroy: function() {
+ if (this.attachToBody && this.parentElement) {
+ this.parentElement.appendChild(this.popup.get(0));
+ this.parentElement = null;
+ }
}
});
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2011-02-09
14:39:21 UTC (rev 21566)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2011-02-09
15:01:21 UTC (rev 21567)
@@ -256,6 +256,11 @@
break;
}
}
+ },
+ destroy: function() {
+ this.popupList.destroy();
+ this.popupList = null;
+ $super.destroy.call(this);
}
};
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2011-02-09
14:39:21 UTC (rev 21566)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2011-02-09
15:01:21 UTC (rev 21567)
@@ -371,7 +371,13 @@
getLabel: function() {
return this.__getValue();
- }
+ },
+
+ destroy: function() {
+ this.popupList.destroy();
+ this.popupList = null;
+ $super.destroy.call(this);
+ }
}
})());
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js 2011-02-09
14:39:21 UTC (rev 21566)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js 2011-02-09
15:01:21 UTC (rev 21567)
@@ -226,6 +226,9 @@
this.detach(this.id);
rf.Event.unbind(this.popupElement, "keydown" + this.namespace);
+
+ this.popup.destroy();
+ this.popup = null;
// call parent's destroy method
$super.destroy.call(this);
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 2011-02-09
14:39:21 UTC (rev 21566)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js 2011-02-09
15:01:21 UTC (rev 21567)
@@ -105,6 +105,7 @@
* */
init : function (componentId, options) {
$super.constructor.call(this, componentId);
+ this.namespace = "."+rf.Event.createNamespace(this.name, this.id);
this.options = $.extend(this.options, DEFAULT_OPTIONS, options || {});
this.attachToDom();
@@ -116,7 +117,7 @@
this.__addUserEventHandler("beforehide");
this.__addUserEventHandler("beforeshow");
- this.popup = new RichFaces.ui.Popup(this.id, {
+ this.popup = new rf.ui.Popup(this.id, {
attachTo: this.target,
attachToBody: true,
positionType: "TOOLTIP",
@@ -125,14 +126,14 @@
direction: this.options.direction
});
- var targetElt = $(document.getElementById(this.target));
+ var handlers = {};
+ handlers[this.options.showEvent + this.namespace] = this.__showHandler;
+ handlers[this.options.hideEvent + this.namespace] = this.__hideHandler;
- targetElt.bind(this.options.showEvent, $.proxy(this.__showHandler, this));
+ rf.Event.bindById(this.target, handlers, this);
- var hideFunction = $.proxy(this.__hideHandler, this);
- targetElt.bind(this.options.hideEvent, hideFunction);
if (this.options.hideEvent == 'mouseleave') {
- $(document.getElementById(this.id)).bind(this.options.hideEvent,
hideFunction);
+ rf.Event.bindById(this.id, this.options.hideEvent + this.namespace,
this.__hideHandler, this);
}
},
@@ -164,7 +165,7 @@
this.hide();
if (this.options.followMouse) {
- $(document.getElementById(this.target)).unbind("mousemove",
this.__mouseMoveHandler);
+ rf.Event.unbindById(this.target, "mousemove" + this.namespace);
}
},
@@ -187,7 +188,7 @@
this.show(event);
if (this.options.followMouse) {
- $(document.getElementById(this.target)).bind("mousemove",
$.proxy(this.__mouseMoveHandler, this));
+ rf.Event.bindById(this.target, "mousemove"+ this.namespace,
this.__mouseMoveHandler, this);
}
},
@@ -283,7 +284,7 @@
__addUserEventHandler : function (name) {
var handler = this.options["on" + name];
if (handler) {
- rf.Event.bindById(this.id, name, handler);
+ rf.Event.bindById(this.id, name + this.namespace, handler);
}
},
@@ -304,6 +305,10 @@
},
destroy: function () {
+ rf.Event.unbindById(this.id, this.namespace);
+ rf.Event.unbindById(this.target, this.namespace);
+ this.popup.destroy();
+ this.popup = null;
$super.destroy.call(this);
}
});