Author: jmorliaguet
Date: Wed Dec 28 15:15:04 2005
New Revision: 2092

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
Log:

- moved Identifiable.getData to Canvas.getNodeData



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Wed Dec 28 
15:15:04 2005
@@ -61,7 +61,6 @@
 
 // Identifiable DOM elements.
 if (!window.Identifiable) var Identifiable = new Object();
-
 Object.extend(Identifiable, {
 
   isIdentifiable: function(element) {
@@ -130,7 +129,13 @@
     return true;
   },
 
-  getData: function(element) {
+});
+
+
+if (!window.Canvas) { var Canvas = new Object(); }
+Object.extend(Canvas, {
+
+  getNodeData: function(element) {
     var node = $(element);
     while(true) {
       node = node.previousSibling;
@@ -149,9 +154,9 @@
 
 });
 
+
 // Renderer (converts XML controls to XHTML)
 if (!window.Renderer) { var Renderer = new Object(); }
-
 Object.extend(Renderer, {
 
   contextmenu: function(node) {
@@ -184,15 +189,13 @@
 
   tooltip: function(node) {
     var tooltip = document.createElement('div');
-    tooltip.style.position = 'absolute';
-    Element.hide(tooltip);
     Element.addClassName(tooltip, node.getAttribute('class'))
+    tooltip.style.position = 'absolute';
     tooltip.style.display = 'none';
     node.parentNode.replaceChild(tooltip, node)
     var area = node.getAttribute('area');
     var options = {
       delay: node.getAttribute('delay') || 1000,
-      text: node.getAttribute('text') || 'hint'
     }
     new CPSSkins.Tooltip(tooltip, area, options);
   }
@@ -368,10 +371,11 @@
   },
 
   setup: function(e) {
-    var text = Event.element(e).getAttribute(this.options.text);
-    if (!text) return;
+    var selected = Event.element(e);
+    var data = Canvas.getNodeData(selected);
+    if (!data) return;
     this.hint = {
-      text: text,
+      text: data['hint'],
       x: Event.pointerX(e),
       y: Event.pointerY(e)
     }

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    Wed Dec 28 15:15:04 2005
@@ -1,6 +1,9 @@
+<?xml version="1.0" ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xml:lang="en" lang="en"
+      xmlns="http://www.w3.org/1999/xhtml";
+      xmlns:cpsskins=http://namespaces.zope.org/cpsskins";>
 <head>
   <title>CPSSkins Unit test file</title>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
@@ -11,7 +14,9 @@
   <link rel="stylesheet" href="../test.css" type="text/css" />
 </head>
 <body>
+
 <h1>CPSSkins Unit test file</h1>
+
 <p>
   Tests for CPSSkins javascript library.
 </p>
@@ -116,11 +121,11 @@
     }},
 
     testGetData: function() { with(this) {
-      assertEqual(Identifiable.getData(e1), null);
-      assertEqual($H(Identifiable.getData(e2)).inspect(),
+      assertEqual(Canvas.getNodeData(e1), null);
+      assertEqual($H(Canvas.getNodeData(e2)).inspect(),
                   $H({a:"1", b:"2"}).inspect());
-      assertEqual(Identifiable.getData(e5), null);
-      assertEqual($H(Identifiable.getData(e6)).inspect(),
+      assertEqual(Canvas.getNodeData(e5), null);
+      assertEqual($H(Canvas.getNodeData(e6)).inspect(),
                   $H({"a":"1","b":{"c":1,"d":2}}).inspect());
     }}
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to