Author: pyaschenko
Date: 2010-12-15 04:58:08 -0500 (Wed, 15 Dec 2010)
New Revision: 20572
Modified:
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
Log:
https://issues.jboss.org/browse/RF-9766
client side code review
Modified:
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
===================================================================
---
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-14
23:59:44 UTC (rev 20571)
+++
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-15
09:58:08 UTC (rev 20572)
@@ -1,3 +1,11 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * No event's unbindings when component would be destroyed
+ * Hint: easy way to unbind - use namespaces when bind event handlers
+ *
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};
Modified:
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
===================================================================
---
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-12-14
23:59:44 UTC (rev 20571)
+++
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-12-15
09:58:08 UTC (rev 20572)
@@ -1,3 +1,11 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * No event's unbindings when component would be destroyed
+ * Hint: easy way to unbind - use namespaces when bind event handlers
+ *
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};
Modified:
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js
===================================================================
---
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js 2010-12-14
23:59:44 UTC (rev 20571)
+++
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-indicator.js 2010-12-15
09:58:08 UTC (rev 20572)
@@ -1,3 +1,13 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * 1. No need to save DOM element (this.indicator). We can use id to get dom element. It
helps to avoid memory leaks :)
+ *
+ * 2. Name refactoring: change names acceptClass, rejectClass, draggingClass
+ * to more readable names: getAcceptClass, getRejectClass, getDragClass
+ *
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};
Modified:
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
===================================================================
---
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2010-12-14
23:59:44 UTC (rev 20571)
+++
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2010-12-15
09:58:08 UTC (rev 20572)
@@ -1,3 +1,25 @@
+/*
+ * code review by Pavel Yaschenko
+ *
+ * records in draggables and droppables should be cleaned up when remove component from
DOM
+ *
+ * draft code: something like this
+ *
+ *
+ rf.ui.Draggable = function (id, options) {
+ var c = rf.$(id);
+ if (c) {
+ var baseDestroy = c.destroy;
+ c. destroy = f ()
+ {
+ rf.ui.DnDManager.removeDraggable(id)
+ baseDestroy.call(this);
+ }
+ }
+ // other code ...
+ }
+ */
+
(function ($, rf) {
rf.ui = rf.ui || {};