Author: rgardler
Date: Thu Aug  9 09:27:35 2012
New Revision: 1371120

URL: http://svn.apache.org/viewvc?rev=1371120&view=rev
Log:
basic scanning template which allows widgets to be built for access using a 
switch device as is commonly used by people with limited movement

Added:
    incubator/wookie/trunk/widgets/templates/scanning/
    incubator/wookie/trunk/widgets/templates/scanning/config.xml   (with props)
    incubator/wookie/trunk/widgets/templates/scanning/content_primary.html   
(with props)
    incubator/wookie/trunk/widgets/templates/scanning/readme.txt   (with props)
    incubator/wookie/trunk/widgets/templates/scanning/scripts/
    
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
   (with props)
    incubator/wookie/trunk/widgets/templates/scanning/template_build.xml   
(with props)
    incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/
    
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/widget.properties
   (with props)

Added: incubator/wookie/trunk/widgets/templates/scanning/config.xml
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/scanning/config.xml?rev=1371120&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/scanning/config.xml (added)
+++ incubator/wookie/trunk/widgets/templates/scanning/config.xml Thu Aug  9 
09:27:35 2012
@@ -0,0 +1,49 @@
+<%
+  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.
+%>
+<widget xmlns="http://www.w3.org/ns/widgets";
+               id="http://wookie.apache.org/widgets/${widget.shortname}";
+               version="0.1"
+        width="320"
+        height="480"
+        >
+  <name>${widget.name}</name>
+  <description>${widget.description}</description>
+  <content src="index.html"/>
+  <icon src="images/icon.png"/>
+  <author>Apache Wookie (Incubating) Community</author>
+  <access origin="${widget.access.origin}"/>  
+  
+  <license>
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+  </license>
+
+</widget>
+
+
+

Propchange: incubator/wookie/trunk/widgets/templates/scanning/config.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/wookie/trunk/widgets/templates/scanning/config.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/wookie/trunk/widgets/templates/scanning/content_primary.html
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/scanning/content_primary.html?rev=1371120&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/scanning/content_primary.html 
(added)
+++ incubator/wookie/trunk/widgets/templates/scanning/content_primary.html Thu 
Aug  9 09:27:35 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/scanning/content_primary.html
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: incubator/wookie/trunk/widgets/templates/scanning/readme.txt
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/scanning/readme.txt?rev=1371120&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/scanning/readme.txt (added)
+++ incubator/wookie/trunk/widgets/templates/scanning/readme.txt Thu Aug  9 
09:27:35 2012
@@ -0,0 +1,5 @@
+The Scanning Template adds basic switch control functionality to a
+widget. It extends the base template. By default it will scan through
+all elements that have a "scan" CSS class assigned to them.
+
+

Propchange: incubator/wookie/trunk/widgets/templates/scanning/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/wookie/trunk/widgets/templates/scanning/readme.txt
------------------------------------------------------------------------------
    svn:executable = *

Added: 
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=1371120&view=auto
==============================================================================
--- 
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
 (added)
+++ 
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
 Thu Aug  9 09:27:35 2012
@@ -0,0 +1,107 @@
+<%
+/*
+ * 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}_scanning_controller = {
+    scanning: true, // indicates if we are currently scanning
+    delay: 1000, // 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();
+    },
+
+    /**
+     * Action to take when switch is released.
+     * The event contains details supplied by the switch.
+     */
+    switchUp:function(event) {
+       if (event.keyCode === 32) {
+           
${widget.shortname}_scanning_controller.scanElements[${widget.shortname}_scanning_controller.currentElementIdx].click();
+       }
+    },
+
+    nextElement:function() {
+       var idx = ${widget.shortname}_scanning_controller.currentElementIdx;
+       var elements = ${widget.shortname}_scanning_controller.scanElements;
+
+       var oldElement = $(elements[idx]);
+       oldElement.fadeIn('slow', function() {
+           // Animation complete.
+       });
+
+       idx += 1;
+       if (idx >= elements.length) {
+           idx = 0
+       };
+
+       var newElement = $(elements[idx]);
+       newElement.fadeOut('slow', function() {
+           // Animation complete.
+       });
+       newElement.fadeIn('slow', function() {
+           // Animation complete.
+       });
+       ${widget.shortname}_scanning_controller.currentElementIdx = idx;
+    },
+
+    startScanning:function() {
+       ${widget.shortname}_scanning_controller.scanning = true;
+       ${widget.shortname}_scanning_controller.interval = 
+           
window.setInterval(${widget.shortname}_scanning_controller.nextElement, 
+                              ${widget.shortname}_scanning_controller.delay);
+       $(document).keyup(${widget.shortname}_scanning_controller.switchUp);
+    },
+
+    stopScanning:function() {
+       ${widget.shortname}_scanning_controller.scanning = false;
+       window.clearInterval(${widget.shortname}_scanning_controller.interval);
+    }
+
+};
+
+$('#home').live('pageshow',function(event) {
+    ${widget.shortname}_scanning_controller.init(); 
+});

Propchange: 
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/wookie/trunk/widgets/templates/scanning/scripts/scanning_controller.js
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/wookie/trunk/widgets/templates/scanning/template_build.xml
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/scanning/template_build.xml?rev=1371120&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/scanning/template_build.xml (added)
+++ incubator/wookie/trunk/widgets/templates/scanning/template_build.xml Thu 
Aug  9 09:27:35 2012
@@ -0,0 +1,141 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<project basedir="." name="scanning_template">
+
+  <target name="_init_template"
+          description="Define any template specifc properties">
+    <echo message="+------------------------------------------"/>
+    <echo message="|  Initialising template properties for ${template.name}"/>
+    <echo message="+------------------------------------------"/>
+
+    <loadfile property="content.scripts"
+             srcFile="content_scripts.html"
+             failonerror="false">
+      <filterchain>
+       <expandproperties/>
+      </filterchain>
+    </loadfile>
+       
+    <loadfile property="content.scripts"
+              srcFile="${template.dir}/${template.name}/content_scripts.html"
+              failonerror="false">
+      <filterchain>
+       <expandproperties/>
+      </filterchain>
+    </loadfile>
+
+
+    <!-- Load the content header -->
+    <loadfile property="content.header"
+              srcFile="content_header.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+
+    <loadfile property="content.header"
+             srcFile="../common/content_header.html"
+             failonerror="false">
+      <filterchain>
+       <expandproperties/>
+      </filterchain>
+    </loadfile>
+       
+    <loadfile property="content.header"
+              srcFile="${template.dir}/${template.name}/content_header.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+
+    <!-- load content from widget definition -->
+    <loadfile property="content.primary"
+              srcFile="content_primary.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+
+    <loadfile property="content.primary"
+              srcFile="../common/content_primary.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+
+    <!-- load content from template definition -->
+    <loadfile property="content.primary"
+              srcFile="${template.dir}/${template.name}/content_primary.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+
+    <loadfile property="content.footer"
+              srcFile="content_footer.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+
+    <loadfile property="content.footer"
+              srcFile="../common/content_footer.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+       
+    <loadfile property="content.footer"
+              srcFile="${template.dir}/${template.name}/content_footer.html"
+              failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+    </loadfile>
+
+    <!-- load properties we've set in other templates -->
+    <property file="${widget.build.dir}/${widget.shortname}.properties"/>
+       
+    <echoproperties 
destfile="${widget.build.dir}/${widget.shortname}.properties" prefix=""/>
+  </target>
+
+  <target name="_prepare_template_files"
+          description="move all template files into the build director">
+    
+  </target>
+
+  <target name="_generate_from_parent_templates">
+    <echo message="+------------------------------------------"/>
+    <echo message="|  There are no parent templates for ${template.name}"/>
+    <!-- <echo message="|  Generating from parent templates for 
${template.name}"/>  -->
+    <echo message="+------------------------------------------"/>
+
+    <ant antfile="${wookie.template.dir}/build.xml"
+        target="_generate_widget">
+      <property name="template.name" value="base"/>
+      <property name="copyWidgetFiles" value="false"/>
+    </ant>
+  </target>
+</project>
\ No newline at end of file

Propchange: incubator/wookie/trunk/widgets/templates/scanning/template_build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/wookie/trunk/widgets/templates/scanning/template_build.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/wookie/trunk/widgets/templates/scanning/template_build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/widget.properties
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/widget.properties?rev=1371120&view=auto
==============================================================================
--- 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/widget.properties
 (added)
+++ 
incubator/wookie/trunk/widgets/templates/testWidgets/scanningBaseTestWidget/widget.properties
 Thu Aug  9 09:27:35 2012
@@ -0,0 +1,5 @@
+template.name=scanning
+widget.shortname=ScanningBaseTestWidget
+widget.name=Test Widget from Scanning Template
+widget.description=This is a very simple test widget from the scanning 
template.
+widget.help=<p>This is a test for the scanning widget template. This template 
provides features to allow scanning of controls in the widget for use with 
switch devices and other such HIDs. This makes widgets using this template 
accessible to those with limited motor functions.</p>
\ No newline at end of file

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

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


Reply via email to