Author: rgardler
Date: Thu Aug  9 10:59:00 2012
New Revision: 1371160

URL: http://svn.apache.org/viewvc?rev=1371160&view=rev
Log:
move scanning widget test code into test widget and parameterise the scanning 
delay

Added:
    incubator/wookie/trunk/widgets/templates/scanning/default.widget.properties 
  (with props)
    
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/content_primary.html
   (with props)
    
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/
    
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/scanningBaseTest_controller.js
   (with props)
Removed:
    incubator/wookie/trunk/widgets/templates/scanning/content_primary.html
Modified:
    incubator/wookie/trunk/widgets/templates/scanning/readme.txt
    
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js

Added: 
incubator/wookie/trunk/widgets/templates/scanning/default.widget.properties
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/scanning/default.widget.properties?rev=1371160&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/scanning/default.widget.properties 
(added)
+++ incubator/wookie/trunk/widgets/templates/scanning/default.widget.properties 
Thu Aug  9 10:59:00 2012
@@ -0,0 +1 @@
+scanning.delay=1000

Propchange: 
incubator/wookie/trunk/widgets/templates/scanning/default.widget.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/wookie/trunk/widgets/templates/scanning/default.widget.properties
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wookie/trunk/widgets/templates/scanning/readme.txt
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/scanning/readme.txt?rev=1371160&r1=1371159&r2=1371160&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/templates/scanning/readme.txt (original)
+++ incubator/wookie/trunk/widgets/templates/scanning/readme.txt Thu Aug  9 
10:59:00 2012
@@ -2,4 +2,19 @@ The Scanning Template adds basic switch 
 widget. It extends the base template. By default it will scan through
 all elements that have a "scan" CSS class assigned to them.
 
+Using
+=====
+
+To use this template you must provide the elements over which we should scan 
by setting
+${widget.shortname}_scanning_controller.scanElements, e.g.
+
+${widget.shortname}_scanning_controller.scanElements = $('.scan');
+
+You can also change various aspects of the scanning functionality by
+setting the following variables in ${widget.shortname}_scanning_controller:
+
+    delay: 1000, // time in milliseconds between focus change
+
+These can also be set in the widget.properties file using:
+
 

Modified: 
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js?rev=1371160&r1=1371159&r2=1371160&view=diff
==============================================================================
--- 
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
 (original)
+++ 
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
 Thu Aug  9 10:59:00 2012
@@ -24,32 +24,12 @@
  */ 
 var ${widget.shortname}_scanning_controller = {
     scanning: true, // indicates if we are currently scanning
-    delay: 1000, // time in milliseconds between focus change
+    delay: ${scanning.delay}, // time in milliseconds between focus change
     interval: null, // The interval object controlling the scan
     scanElements: null, // The elements to scan over
     currentElementIdx: 0, // The index of the currently scanning element
 
     init:function() {
-       $('#button1').click(function() {
-           alert("Button 1 clicked");
-       });
-       $('#button2').click(function() {
-           alert("Button 2 clicked");
-       });
-       $('#button3').click(function() {
-           alert("Button 3 clicked");
-       });
-       $('#button4').click(function() {
-           alert("Button 4 clicked");
-       });
-       $('#button5').click(function() {
-           alert("Button 5 clicked");
-       });
-       $('#button6').click(function() {
-           alert("Button 6 clicked");
-       });
-
-       ${widget.shortname}_scanning_controller.scanElements = $('.scan');
        ${widget.shortname}_scanning_controller.startScanning();
     },
 

Added: 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/content_primary.html
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/content_primary.html?rev=1371160&view=auto
==============================================================================
--- 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/content_primary.html
 (added)
+++ 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/content_primary.html
 Thu Aug  9 10:59:00 2012
@@ -0,0 +1,39 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the 'License'); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an 'AS IS' BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<p>Primary content.</p>
+<div>
+  <div class="scan" id="button1" data-role="button">
+    Button 1
+  </div>
+  <div class="scan" id="button2" data-role="button">
+    Button 2
+  </div>
+  <div class="scan" id="button3" data-role="button">
+    Button 3
+  </div>
+</div>
+<div>
+  <div class="scan" id="button4" data-role="button">
+    Button 4
+  </div>
+  <div class="scan" id="button5" data-role="button">
+    Button 5
+  </div>
+  <div class="scan" id="button6" data-role="button">
+    Button 6
+  </div>
+</div>

Propchange: 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/content_primary.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/content_primary.html
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/scanningBaseTest_controller.js
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/scanningBaseTest_controller.js?rev=1371160&view=auto
==============================================================================
--- 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/scanningBaseTest_controller.js
 (added)
+++ 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/scanningBaseTest_controller.js
 Thu Aug  9 10:59:00 2012
@@ -0,0 +1,52 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%>
+
+/**
+ * The @widget.shortname@_scanning_controller object This is used to
+ * allow users using a switch device to interact efficiently with a
+ * widget.
+ */ 
+var ${widget.shortname}_scanningBaseTest_controller = {
+    init:function() {
+       $('#button1').click(function() {
+           alert("Button 1 clicked");
+       });
+       $('#button2').click(function() {
+           alert("Button 2 clicked");
+       });
+       $('#button3').click(function() {
+           alert("Button 3 clicked");
+       });
+       $('#button4').click(function() {
+           alert("Button 4 clicked");
+       });
+       $('#button5').click(function() {
+           alert("Button 5 clicked");
+       });
+       $('#button6').click(function() {
+           alert("Button 6 clicked");
+       });
+
+       ${widget.shortname}_scanning_controller.scanElements = $('.scan');
+    },
+};
+
+$('#home').live('pageshow',function(event) {
+    ${widget.shortname}_scanningBaseTest_controller.init(); 
+});

Propchange: 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/scanningBaseTest_controller.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/scripts/scanningBaseTest_controller.js
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to