Added:
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/view/GatewayRegistrationView.js
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/StatusBox.js
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/__package__.js
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/template/
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/template/
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/template/StatusBox-style.css
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/template/StatusBox-template.html
Modified:
branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html
Log:
added a quick StatusBox widget to get a feel for how they are created.
Added:
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/view/GatewayRegistrationView.js
==============================================================================
--- (empty file)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/view/GatewayRegistrationView.js
Tue Aug 5 17:28:04 2008
@@ -0,0 +1,36 @@
+dojo.provide("soashable.view.GatewayRegistrationView");
+
+
+dojo.declare("soashable.view.GatewayRegistrationView",
Xmpp4Js.Event.EventProvider, {
+ constructor: function(application, gatewayModel) {
+ this.application = application;
+ this.gatewayModel = gatewayModel;
+
+
+ },
+
+ render: function() {
+ jQuery("<div id=\"login\"><dl>"
+ + "<dt>username</dt><dd><input type=\"text\"
id=\"login-node\"/></dd>"
+ + "<dt>password</dt><dd><input type=\"text\"
id=\"login-password\"/></dd>"
+ + "<dt></dt><dd><button
id=\"login-button\">Login</button></dd>"
+ + "<dt></dt><dd><button
id=\"login-register-button\">Registration Form</button></dd>"
+ + "</dl></div>").appendTo(jQuery("body"));
+
+ this.mainEl = document.getElementById("login");
+ this.nodeEl = document.getElementById("login-node");
+ this.passwordEl = document.getElementById("login-password");
+ this.buttonEl = document.getElementById("login-button");
+ this.registerButtonEl =
document.getElementById("login-register-button");
+
+ var self = this;
+ this.buttonEl.addEventListener("click", function() {
self.loginClicked(); }, false);
+ this.registerButtonEl.addEventListener("click", function() {
self.registerClicked(); }, false);
+ },
+ destroy: function() {
+ jQuery(this.mainEl).remove();
+ this.mainEl = null;
+ },
+
+});
+
Added:
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/StatusBox.js
==============================================================================
--- (empty file)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/StatusBox.js
Tue Aug 5 17:28:04 2008
@@ -0,0 +1,44 @@
+dojo.provide("soashable.widget.StatusBox");
+
+dojo.require("dijit._Widget");
+dojo.require("dijit._Templated");
+
+
+dojo.declare(
+// widget name and class
+"soashable.widget.StatusBox",
+// superclass
+[dijit._Widget, dijit._Templated],
+{
+ status: "normal",
+ message: "",
+ templatePath:
dojo.moduleUrl("soashable.widget", "template/StatusBox-template.html"),
+ templateCssPath:
dojo.moduleUrl("soashable.widget", "template/StatusBox-style.css"),
+ isContainer: false,
+ snarfChildDomOutput: false,
+
+
+ setStatus: function(status) {
+ // summary: sets the "strength" percentage, and updates the
display acordingly
+ this.status = status;
+
+ for( var i = 0; i < this.status.options.length; i++ ) {
+ if( this.status.options[i].value == this.status ) {
+ this.status.selectedIndex = i;
+ break;
+ }
+ }
+ },
+ setMessage: function(message) {
+ this.message.innerHTML = message;
+ },
+
+ messageBlurred: function() {
+ alert("message blurred");
+ },
+
+ statusBlurred: function() {
+ alert("status blurred");
+ }
+}
+);
\ No newline at end of file
Added:
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/__package__.js
==============================================================================
--- (empty file)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/widget/__package__.js
Tue Aug 5 17:28:04 2008
@@ -0,0 +1,8 @@
+dojo.kwCompoundRequire({
+ common: [
+ "soashable.widget.StatusBox"
+ ],
+ browser: [ ]
+});
+
+dojo.provide("soashable.widget.*");
\ No newline at end of file
Added:
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/template/StatusBox-style.css
==============================================================================
--- (empty file)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/template/StatusBox-style.css
Tue Aug 5 17:28:04 2008
@@ -0,0 +1,3 @@
+.status-box .label {
+ font-weight: strong;
+}
\ No newline at end of file
Added:
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/template/StatusBox-template.html
==============================================================================
--- (empty file)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/resources/scripts/widget/template/StatusBox-template.html
Tue Aug 5 17:28:04 2008
@@ -0,0 +1,12 @@
+<div class="status-box" dojoAttachPoint="container">
+ <span class="label">Status</span>
+ <select dojoAttachPoint="status"
+ dojoAttachEvent="onblur:statusBlurred">
+ <option value="normal">Available</option>
+ <option value="away">Away</option>
+ </select>
+ <input type="text"
+ dojoAttachEvent="onblur:messageBlurred"
+ dojoAttachPoint="message"
+ value="${message}"/>
+</div>
\ No newline at end of file
Modified:
branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html
==============================================================================
---
branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html
(original)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html
Tue Aug 5 17:28:04 2008
@@ -10,10 +10,10 @@
<!--
<script type="text/javascript"
src="http://o.aolcdn.com/dojo/1.1.1/dojo/dojo.xd.js" djConfig="parseOnLoad:
false"></script>
-->
- <script type="text/javascript" src="scripts/dojo/dojo.js"
djConfig="parseOnLoad: false, debugAtAllCosts: true"></script>
+ <script type="text/javascript" src="scripts/dojo/dojo/dojo.js"
djConfig="parseOnLoad: false, debugAtAllCosts: true"></script>
<script type="text/javascript">
// for some reason it knows to look under scripts. relative to
dojo?
- dojo.registerModulePath("soashable","../../scripts");
+ dojo.registerModulePath("soashable","../../../scripts");
</script>
<script type="text/javascript"
src="scripts/lib/crypto/crypto.js"></script>
<script type="text/javascript"
src="scripts/lib/xml4script/dom-all.js"> </script>
@@ -26,10 +26,14 @@
<script type="text/javascript">
dojo.require("soashable.Application");
+ dojo.require("soashable.widget.StatusBox");
dojo.addOnLoad(function(){
application = new soashable.Application();
application.start();
+
+ sb = new soashable.widget.StatusBox();
+ document.body.appendChild( sb.domNode );
});
</script>
</head>