Author: rgardler
Date: Thu Mar  3 00:09:58 2011
New Revision: 1076465

URL: http://svn.apache.org/viewvc?rev=1076465&view=rev
Log:
Add a template for jqueryMobile widgets

Added:
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/build.xml   
(with props)
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/config.xml
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon.png 
  (with props)
    
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_16x16.png
   (with props)
    
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_32x32.png
   (with props)
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/index.html
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/legal/
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/lib/
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/
    
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/controller.js
    
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/properties.js
    incubator/wookie/trunk/widgets/widget-template/jqueryMobile/style/
Modified:
    incubator/wookie/trunk/widgets/build.xml

Modified: incubator/wookie/trunk/widgets/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/build.xml?rev=1076465&r1=1076464&r2=1076465&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/build.xml (original)
+++ incubator/wookie/trunk/widgets/build.xml Thu Mar  3 00:09:58 2011
@@ -41,7 +41,7 @@
        
 
     <target name="seed-widget" description="Seed a new widget">
-       <input message="What type of widget template do you want to use?" 
validargs="basic,wave" defaultvalue="basic" addproperty="widget.type"/>
+       <input message="What type of widget template do you want to use?" 
validargs="basic,wave,jqueryMobile" defaultvalue="basic" 
addproperty="widget.type"/>
        <input message="What is the short name of the widget you wish to 
create?" addproperty="widget.shortname"/>
        <input message="Provide a brief description of the purpose of the 
${widget.shortname} widget" addproperty="widget.description"/>
        <input message="What is the default height of the ${widget.shortname} 
widget?" addproperty="widget.height" defaultvalue="320"/>

Added: incubator/wookie/trunk/widgets/widget-template/jqueryMobile/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/build.xml?rev=1076465&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/widget-template/jqueryMobile/build.xml 
(added)
+++ incubator/wookie/trunk/widgets/widget-template/jqueryMobile/build.xml Thu 
Mar  3 00:09:58 2011
@@ -0,0 +1,23 @@
+<?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 default="build-widget" basedir="." name="widget build file">
+       <property name="wookie.widgets.dir" location="../"/>
+       <property name="widget.shortname" value="@widget.shortname@"/>
+       
+       <import file="../build.xml"/>
+</project>
\ No newline at end of file

Propchange: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/wookie/trunk/widgets/widget-template/jqueryMobile/config.xml
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/config.xml?rev=1076465&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/widget-template/jqueryMobile/config.xml 
(added)
+++ incubator/wookie/trunk/widgets/widget-template/jqueryMobile/config.xml Thu 
Mar  3 00:09:58 2011
@@ -0,0 +1,46 @@
+<!--
+  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="@widget.width@"
+        height="@widget.height@"
+        >
+  <name>@widget.shortname@</name>
+  <description>@widget.description@</description>
+  <content src="index.html"/>
+  <icon src="images/icon.png"/>
+  <author>Apache Wookie (Incubating) Team</author>
+  <licence>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.</licence>
+
+</widget>
+
+
+

Added: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon.png
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon.png?rev=1076465&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_16x16.png
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_16x16.png?rev=1076465&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_16x16.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_32x32.png
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_32x32.png?rev=1076465&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/images/icon_32x32.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wookie/trunk/widgets/widget-template/jqueryMobile/index.html
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/index.html?rev=1076465&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/widget-template/jqueryMobile/index.html 
(added)
+++ incubator/wookie/trunk/widgets/widget-template/jqueryMobile/index.html Thu 
Mar  3 00:09:58 2011
@@ -0,0 +1,104 @@
+<!--
+  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.
+-->
+<!DOCTYPE html> 
+<html>
+       <head>
+        <meta http-equiv="pragma" content="no-cache"/>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+        <link rel="stylesheet" 
href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css"; />
+               <script type="text/javascript" 
src="http://code.jquery.com/jquery-1.5.min.js";></script>
+               <script type="text/javascript" 
src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js";></script>
+               <script type="text/javascript" src="scripts/properties.js" 
charset="utf-8"></script>  
+        <script type="text/javascript" src="scripts/controller.js" 
charset="utf-8"></script> 
+               <title>@widget.shortname@</title>
+       </head>
+       <body onLoad="Controller.init()">
+               <div data-role="page" data-theme="b" id="jqm-home">
+               
+                   <div data-role="header" data-position="fixed">
+                               <h4>Hello World</h4>
+                               <a onClick="Controller.update()" 
data-role="button" data-icon="refresh" data-iconpos="notext">Refresh</a>
+                               <a href="#settings" data-role="button" 
data-icon="gear" data-iconpos="notext">Settings</a>
+                       </div> <!-- /header -->
+               
+                       <div data-role="content" class="ui-content">    
+                               <div data-role="collapsible">
+                                 <h3>I'm a header (click me)</h3>
+                                 <p>I'm the collapsible content. By default 
I'm open and displayed on the page, but you can click the header to hide me.</p>
+                               </div>
+                               
+                               <div data-role="collapsible" 
data-collapsed="true">
+                                 <h3>I'm another header (click me)</h3>
+                                 <p>I'm not open by default, so you must have 
clicked on me to see this.</p>
+                               </div>
+                               
+                               <p><a href="#helloWorld">Say Hello</a></p>
+                       </div><!-- /content -->
+               
+                       <!--
+                       <div data-role="footer" data-position="fixed">
+                               <h4>Footer</h4>
+                       </div> /footer -->
+               </div><!-- /page -->
+               
+               <div data-role="page" data-theme="b" id="helloWorld">
+               
+                   <div data-role="header" data-position="fixed">
+                               <h4>Hello World</h4>
+                               <a onClick="Controller.update()" 
data-role="button" data-icon="refresh" data-iconpos="notext">Refresh</a>
+                               <a href="#settings" data-role="button" 
data-icon="gear" data-iconpos="notext">Settings</a>
+                       </div> <!-- /header -->
+               
+                       <div data-role="content" class="ui-content">    
+                               <p id="helloMessage">
+                                 Hello. (this message will be replaced 
dynamically by the code).
+                               </p>
+                               
+                               <p>Last Updated: <span 
id="lastUpdatedTime">00:00:00</span></p>
+                       </div><!-- /content -->
+               
+                       <!--
+                       <div data-role="footer" data-position="fixed">
+                               <h4>Footer</h4>
+                       </div> /footer -->
+               </div><!-- /page -->
+               
+               <div data-role="page" id="settings">
+               
+                       <div data-role="header" data-position="fixed">
+                               <h4>Settings</h4>
+                       </div> <!-- /header -->
+               
+                       <div data-role="content" class="ui-content" 
id="settings-content">      
+                       <form action="" method="post">
+                               <div data-role="fieldcontain">
+                                               <label for="name">Name:</label>
+                                       <input type="url" name="name" id="name" 
 />
+                                       </div>
+                                       <div data-role="fieldcontain">
+                                               <button type="submit" 
onClick="Properties.submitForm(this.form)" value="save-settings" 
name="save-settings">Save</button>
+                                       </div>
+                       </form>
+                       </div><!-- /content -->
+               
+                       <!--
+                       <div data-role="footer" data-position="fixed">
+                               <h4>Footer</h4>
+                       </div> /footer -->
+               </div><!-- /page -->
+       </body>
+</html>
\ No newline at end of file

Added: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/controller.js
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/controller.js?rev=1076465&view=auto
==============================================================================
--- 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/controller.js
 (added)
+++ 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/controller.js
 Thu Mar  3 00:09:58 2011
@@ -0,0 +1,37 @@
+/*
+ * 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 Controller object
+ * This is used to wire up the view and model with actions
+ */ 
+var Controller = {
+       init:function() {
+               Controller.update();
+       },
+
+       /**
+        * Update the hello world message, and the updated time
+        */
+       update:function() {
+               $('#helloMessage').html("<p>" + Properties.getMessage() + 
"</p>");
+               var d = new Date();
+               $('#lastUpdatedTime').text(d.getHours() + ":" + d.getMinutes() 
+ ":" + d.getSeconds());
+               // rebuild the page to register the changes
+               $('#helloWorld').page();
+       }
+}
\ No newline at end of file

Added: 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/properties.js
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/properties.js?rev=1076465&view=auto
==============================================================================
--- 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/properties.js
 (added)
+++ 
incubator/wookie/trunk/widgets/widget-template/jqueryMobile/scripts/properties.js
 Thu Mar  3 00:09:58 2011
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+/**
+ * Utility methods for working with widget properties.
+ */ 
+var Properties = {
+       
+       submitForm: function() {
+               var msg = "Hello " + dwr.util.getValue("name");
+               Widget.preferences.setItem("message", msg);
+               Controller.update();
+               $.mobile.changePage("#helloWorld");
+       },
+
+       /**
+        * Get the base URL for the Simal REST interface.
+        */
+       getMessage: function() {
+               var msg = Widget.preferences.getItem("message");
+               if (msg == undefined) {
+                       msg = 'Hello, tell us your name by editing the <a 
href="#settings" data-role="button" data-inline="true" 
data-icon="gear">Settings</a>';
+               }
+               return msg;
+       }               
+}
\ No newline at end of file


Reply via email to