Author: Christian Lopes
Date: 2010-09-07 13:41:01 -0700 (Tue, 07 Sep 2010)
New Revision: 21728

Modified:
   cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.js
   cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/ConfigProxy.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/ConfigVO.as
   
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ApplicationMediator.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as
Log:
Added customCursorsEnabled() function to the API.

Modified: cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.js
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.js    
2010-09-07 20:32:41 UTC (rev 21727)
+++ cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.js    
2010-09-07 20:41:01 UTC (rev 21728)
@@ -463,9 +463,17 @@
             else { return swf.isEdgeTooltipsEnabled(); }
         },
         
-        customCursorsEnabled: function (visible) {
-            this.swf().enableCustomCursor(visible);
-            return this;
+        /**
+         * <p>If the boolean argument is passed, it enables or disables custom 
mouse cursors, such as the hand icon used when panning the network.</p>
+         * <p>If no argument is passed, it returns a boolean value indicating 
whether or not custom cursors are enabled.</p>
+         * @param {Boolean} [enabled] If <code>true</code>, custom (Flash) 
cursors can be used in some actions.
+         *                            If <code>false</code>, Cytoscape Web 
will never replace the operating system's cursors.
+         * @return <ul><li>A boolean value for 
<code>customCursorsEnabled()</code>.</li>
+         *             <li>The {...@link org.cytoscapeweb.Visualization} 
object for <code>panEnabled({Boolean})</code>.</li></ul>
+         */
+        customCursorsEnabled: function (/*enabled*/) {
+               if (arguments.length > 0) { 
this.swf().enableCustomCursors(arguments[0]); return this; }
+               else { return this.swf().isCustomCursorsEnabled(); }
         },
 
         /**

Modified: cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js   2010-09-07 
20:32:41 UTC (rev 21727)
+++ cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js   2010-09-07 
20:41:01 UTC (rev 21728)
@@ -158,6 +158,14 @@
         same(vis.nodeTooltipsEnabled(),   options.nodeTooltipsEnabled,   "Node 
tooltips enabled?");
         same(vis.edgeTooltipsEnabled(),   options.edgeTooltipsEnabled,   "Edge 
tooltips enabled?");
     });
+       
+       test("Custom Cursors", function() {
+               ok(vis.customCursorsEnabled() === true, "Custom cursors enabled 
by default");
+               vis.customCursorsEnabled(false);
+               ok(vis.customCursorsEnabled() === false, "Custom cursors 
disabled");
+               vis.customCursorsEnabled(true);
+               ok(vis.customCursorsEnabled() === true, "Custom cursors enabled 
again");
+       });
 
     test("Pan-Zoom Control", function() {
         vis.panZoomControlVisible(false);

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/ConfigProxy.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/ConfigProxy.as   
2010-09-07 20:32:41 UTC (rev 21727)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/ConfigProxy.as   
2010-09-07 20:41:01 UTC (rev 21728)
@@ -120,6 +120,14 @@
             return config.edgeTooltipsEnabled;
         }
         
+        public function set customCursorsEnabled(enable:Boolean):void {
+            config.customCursorsEnabled = enable;
+        }
+        
+        public function get customCursorsEnabled():Boolean {
+            return config.customCursorsEnabled;
+        }
+        
         public function set edgesMerged(merged:Boolean):void {
             config.edgesMerged = merged;
         }

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/ConfigVO.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/ConfigVO.as 
2010-09-07 20:32:41 UTC (rev 21727)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/ConfigVO.as 
2010-09-07 20:41:01 UTC (rev 21728)
@@ -49,6 +49,7 @@
         public var edgeLabelsVisible:Boolean;
         public var nodeTooltipsEnabled:Boolean;
         public var edgeTooltipsEnabled:Boolean;
+        public var customCursorsEnabled:Boolean = true;
         public var visualStyle:VisualStyleVO;
         public var currentLayout:Object;
         public var minZoom:Number = 0.002;

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ApplicationMediator.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ApplicationMediator.as
    2010-09-07 20:32:41 UTC (rev 21727)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ApplicationMediator.as
    2010-09-07 20:41:01 UTC (rev 21728)
@@ -187,6 +187,7 @@
                     break;
                 case ApplicationFacade.ENABLE_CUSTOM_CURSORS:
                     _customCursorsEnabled = n.getBody();
+                    configProxy.customCursorsEnabled = _customCursorsEnabled;
                     if (_customCursorsEnabled === true) 
updateCursor(_cursorOptions);
                     else hideAllCustomCursors();
                     break;

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as   
    2010-09-07 20:32:41 UTC (rev 21727)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as   
    2010-09-07 20:41:01 UTC (rev 21728)
@@ -223,9 +223,13 @@
             return configProxy.panZoomControlVisible;
         }
 
-        private function enableCustomCursor(value:Boolean):void {
+        private function enableCustomCursors(value:Boolean):void {
             sendNotification(ApplicationFacade.ENABLE_CUSTOM_CURSORS, value);
         }
+        
+        private function isCustomCursorsEnabled():Boolean {
+            return configProxy.customCursorsEnabled;
+        }
 
         private function enableGrabToPan(value:Boolean):void {
             sendNotification(ApplicationFacade.ENABLE_GRAB_TO_PAN, value);
@@ -471,7 +475,7 @@
                                         "enableNodeTooltips", 
"isNodeTooltipsEnabled", 
                                         "enableEdgeTooltips", 
"isEdgeTooltipsEnabled", 
                                         "showPanZoomControl", 
"isPanZoomControlVisible",
-                                        "enableCustomCursor", 
+                                        "enableCustomCursors", 
"isCustomCursorsEnabled",
                                         "enableGrabToPan", 
"isGrabToPanEnabled", "panBy", "panToCenter", 
                                         "zoomTo", "zoomToFit", "getZoom", 
                                         "filter", "removeFilter", 

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to