Hi Justin. I completely agree on the Java part. I'm trying very hard to
not have to do any more Java coding - ever. It's harder than it sounds,
though. From what I know of JavascriptMVC it's strength lies very much
in its enforcing logic, which sounds really nice. Since Server-side JS
is becoming more popular, non-bling toolkits will also become more
important.
I hope to be able to briefly describe how Dojo helps me in throwing up quick mockups. Let's see.
Dojo can be used 'under the covers' entirely, even with graphically
intensive components, but likewise almost all components / widgets /
'Dijits' can be declared inside the page, including ones you've made
yourself.
Here's a quick example, which define some settings for Dojo, including
where to search for my custom component. Also, it sets parseOnLoad to
true, which tells Dojo to scan through the page and create all
components it finds. The dojo.require statement loads specific components so that they can be used in markup later.
----- inside head -----
<script type="text/javascript">
djConfig=
{
parseOnLoad: true,
isDebug: true,
modulePaths: {scaffold: "../test/scaffold"}
}
</script>
<script src="../dojo/dojo.js" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("scaffold.main");
</script>
---- Inside body -------
What the below markup does is to define an instance of a widget (that
I've made) called scaffold.main. The name scaffold is declared in the
djConfig setting modulePaths to be at a specific relative url. Under
that url, Dojo will search for a file called main.js . The rest of the
markup proeprties are provided as properties to the class which defines
the component, if already present. This means that if the component
have defined a property called 'content' (which it has), it will be
filled with the value in the markup.
<div dojoType="scaffold.main" style="height:110px;"
content="{'news':
'
http://localhost/dojodev/test/scaffold/content/news.html', 'products':
'scaffold/content/products.html', 'partners':
'scaffold/content/partners.html', 'people' :
'scaffold/content/people.html'}">
</div>
---- js code -------
This is the beginning of the file called 'main.js' udner the
../test/scaffold directory. It begins be declaring that it provides the
specific class. Why this is necessary is because one file sometimes
declare several classes / components. After that it require in what it
needs, so all requires for all components in the page need not be
listed and maintained in the page using components, which is a good
modularization.
Further down comes the content property. And then a couple of magic
functions, which are called by Dojo at certain points in the component
lifecycle. There's a destry as well (if you want, et.c.).
dojo.provide("scaffold.main");
dojo.require("dijit._Templated");
dojo.require("dijit._Widget");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.StackContainer");
dojo.require("dojox.fx");
dojo.require("dojox.fx.easing");
dojo.declare("scaffold.main", [ dijit._Widget, dijit._Templated ],
{
templatePath : dojo.moduleUrl("scaffold","templates/main.html"),
widgetsInTemplate : true,
content : {}, // name - url pairs for menu building
lastitem : "",
constructor: function()
{
console.log("constructor for scaffold.main called");
},
postCreate: function()
{
console.log("postCreate for scaffold.main called");
for(var k in this.content)
{
...
...
note the 'tempalePath' property, which defines a file which contain the
HTML snippet that the component use (if any), which can use basic
templating ( ${foo} to insert a 'this.foo' of the component class on
creation), or DTL (Django Templating System).
Dojo also have a build system, similar (but 100x more hairy :) to
JavascriptMVC, which inline templates as strings, compresses and
concatenates many files to few, et.c.
Ahem.. Thanks for listening :) Sorry for the off-topic!