[claw-cvs] r126 - trunk/main/claw-html.dojo/src/js/dnd

Andrea Chiumenti achiumenti at common-lisp.net
Tue Oct 21 13:06:42 UTC 2008


Author: achiumenti
Date: Tue Oct 21 13:06:41 2008
New Revision: 126

Log:
several bugfixes and enhancements

Added:
   trunk/main/claw-html.dojo/src/js/dnd/
   trunk/main/claw-html.dojo/src/js/dnd/Avatar.js
   trunk/main/claw-html.dojo/src/js/dnd/Container.js
   trunk/main/claw-html.dojo/src/js/dnd/Moveable.js
   trunk/main/claw-html.dojo/src/js/dnd/Mover.js
   trunk/main/claw-html.dojo/src/js/dnd/Source.js
   trunk/main/claw-html.dojo/src/js/dnd/TimedMoveable.js
   trunk/main/claw-html.dojo/src/js/dnd/common.js

Added: trunk/main/claw-html.dojo/src/js/dnd/Avatar.js
==============================================================================
--- (empty file)
+++ trunk/main/claw-html.dojo/src/js/dnd/Avatar.js	Tue Oct 21 13:06:41 2008
@@ -0,0 +1,37 @@
+/**
+;;; $Header: dojo/src/js/dnd/Avatar.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+dojo.provide("claw.dnd.Avatar");
+
+dojo.require("claw.dnd.common");
+dojo.require("dojo.dnd.Avatar");
+
+dojo.declare("claw.dnd.Avatar",[dojo.dnd.Avatar,claw.dnd._DndMixin], {
+    
+});
\ No newline at end of file

Added: trunk/main/claw-html.dojo/src/js/dnd/Container.js
==============================================================================
--- (empty file)
+++ trunk/main/claw-html.dojo/src/js/dnd/Container.js	Tue Oct 21 13:06:41 2008
@@ -0,0 +1,37 @@
+/**
+;;; $Header: dojo/src/js/dnd/Container.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+dojo.provide("claw.dnd.Container");
+
+dojo.require("claw.dnd.common");
+dojo.require("dojo.dnd.Container");
+
+dojo.declare("claw.dnd.Container",[dojo.dnd.Container,claw.dnd._DndMixin], {
+    
+});
\ No newline at end of file

Added: trunk/main/claw-html.dojo/src/js/dnd/Moveable.js
==============================================================================
--- (empty file)
+++ trunk/main/claw-html.dojo/src/js/dnd/Moveable.js	Tue Oct 21 13:06:41 2008
@@ -0,0 +1,37 @@
+/**
+;;; $Header: dojo/src/js/dnd/Moveable.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+dojo.provide("claw.dnd.Selector");
+
+dojo.require("claw.dnd.common");
+dojo.require("dojo.dnd.Selector");
+
+dojo.declare("claw.dnd.Selector",[dojo.dnd.Selector,claw.dnd._DndMixin], {
+    
+});
\ No newline at end of file

Added: trunk/main/claw-html.dojo/src/js/dnd/Mover.js
==============================================================================
--- (empty file)
+++ trunk/main/claw-html.dojo/src/js/dnd/Mover.js	Tue Oct 21 13:06:41 2008
@@ -0,0 +1,37 @@
+/**
+;;; $Header: dojo/src/js/dnd/Mover.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+dojo.provide("claw.dnd.Mover");
+
+dojo.require("claw.dnd.common");
+dojo.require("dojo.dnd.Mover");
+
+dojo.declare("claw.dnd.Mover",[dojo.dnd.Mover,claw.dnd._DndMixin], {
+    
+});
\ No newline at end of file

Added: trunk/main/claw-html.dojo/src/js/dnd/Source.js
==============================================================================
--- (empty file)
+++ trunk/main/claw-html.dojo/src/js/dnd/Source.js	Tue Oct 21 13:06:41 2008
@@ -0,0 +1,40 @@
+/**
+;;; $Header: dojo/src/js/dnd/Source.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+dojo.provide("claw.dnd.Source");
+
+dojo.require("claw.dnd.common");
+dojo.require("dojo.dnd.Source");
+
+dojo.declare("claw.dnd.Source",[dojo.dnd.Source,claw.dnd._DndMixin], {
+    markupFactory: function(params, node){
+	params._skipStartup = true;
+	return new claw.dnd.Source(node, params);
+    }
+});
\ No newline at end of file

Added: trunk/main/claw-html.dojo/src/js/dnd/TimedMoveable.js
==============================================================================
--- (empty file)
+++ trunk/main/claw-html.dojo/src/js/dnd/TimedMoveable.js	Tue Oct 21 13:06:41 2008
@@ -0,0 +1,37 @@
+/**
+;;; $Header: dojo/src/js/dnd/TimedMoveable.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+dojo.provide("claw.dnd.TimedMoveable");
+
+dojo.require("claw.dnd.common");
+dojo.require("dojo.dnd.TimedMoveable");
+
+dojo.declare("claw.dnd.TimedMoveable",[dojo.dnd.TimedMoveable,claw.dnd._DndMixin], {
+    
+});
\ No newline at end of file

Added: trunk/main/claw-html.dojo/src/js/dnd/common.js
==============================================================================
--- (empty file)
+++ trunk/main/claw-html.dojo/src/js/dnd/common.js	Tue Oct 21 13:06:41 2008
@@ -0,0 +1,69 @@
+/**
+;;; $Header: dojo/src/js/dnd/common.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+dojo.provide("claw.dnd.common");
+
+
+claw.dnd = {};
+
+claw.dnd._map = {};
+
+
+claw.dnd._cache = {'clawDnd': 0};
+
+claw.dnd.byId = function(id){
+    // summary: returns the dojo.dnd instance bound to a HTML object element
+    return claw.dnd._map[id]; // assume it's a node
+};
+
+
+dojo.declare("claw.dnd._DndMixin", null, {
+    id: "",
+    _putInCache: function (node) {
+        this.id = dojo.attr(node, "dndId");
+        if(!this.id) {
+            this.id = dojo.attr(node, "id");
+            if (!this.id) {
+                var index = claw.dnd._cache._clawDnd;
+                claw.dnd._cache._clawDnd = index++;
+                this.id = "clawDnd" + index;
+            }
+            dojo.attr(node, "dndId", this.id);
+        }
+        claw.dnd._map[this.id] = this;
+    },
+    constructor: function (node, params) {
+        this._putInCache(this.node);
+    },
+    destroy: function() {
+        // summary: warning. Like dojo.dnd.Container destroy method, but cleans up claw.dnd._map. Remember to eventually remove its node.
+        delete claw.dnd._map[this.id];
+        dojo.dnd.Source.prototype.destroy.call(this);
+    }
+});




More information about the Claw-cvs mailing list