You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/09/20 15:44:38 UTC
cvs commit: jakarta-commons-sandbox/jelly/xdocs tutorial.xml gettingstarted.xml navigation.xml
jstrachan 2002/09/20 06:44:38
Modified: jelly/xdocs navigation.xml
Added: jelly/xdocs tutorial.xml gettingstarted.xml
Log:
Added Otto von Wachter's first cut of his excellent tutorial - many thanks Otto! - plus a few getting started instructions
Revision Changes Path
1.16 +3 -2 jakarta-commons-sandbox/jelly/xdocs/navigation.xml
Index: navigation.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/xdocs/navigation.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- navigation.xml 9 Sep 2002 11:25:03 -0000 1.15
+++ navigation.xml 20 Sep 2002 13:44:38 -0000 1.16
@@ -8,21 +8,22 @@
<menu name="Jelly">
<item name="Overview" href="/index.html"/>
<item name="FAQ" href="/faq.html"/>
+ <item name="Getting Started" href="/gettingstarted.html"/>
+ <item name="Tutorial" href="/tutorial.html"/>
<item name="Detail" href="/overview.html"/>
<item name="Tag Reference" href="/tags.html"/>
<item name="Download" href="http://www.ibiblio.org/maven/commons-jelly/distributions/"/>
- <item name="To Do List" href="/todo.html"/>
</menu>
<menu name="Community">
<item name="News Blog" href="http://blogs.werken.com/projects/jelly/"/>
<item name="IRC" href="/irc.html"/>
<item name="Powered By" href="/powered.html"/>
+ <item name="To Do List" href="/todo.html"/>
</menu>
<menu name="Libraries">
<item name="JellyUnit" href="/jellyunit.html"/>
<item name="JellySwing" href="/jellyswing.html"/>
</menu>
-
<menu name="Jakarta Community">
<item name="Get Involved" href="http://jakarta.apache.org/site/getinvolved.html"/>
1.1 jakarta-commons-sandbox/jelly/xdocs/tutorial.xml
Index: tutorial.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<title>Jelly Tutorials</title>
<author email="vonwao@yahoo.com">Otto von Wachter</author>
</properties>
<body>
<section name="Jelly Tutorials">
<p>
The best way to get acquainted with Jelly, and get an idea what it can be
used for, is to see it in action. So you want to get started as quickly as
possible? Luckily for you Jelly comes with several demos that can be run
from the command line using Maven.
</p>
<p>
Before going any further it might be worth checking out the <a href="gettingstarted.html">Getting Started</a> guide.
</p>
<p>
The goal of the tutorials is to guide you through running some of the Jelly
demos and give you some ideas of other potential uses of Jelly (and
hopefully make your first experience with Jelly enjoyable and fun).
</p>
<p>
Once you have tried a few of demos, you can explore Jelly further by writing
some Jelly scripts on your own, or by modifying some of the demos provided.
You may also want to define your own Jelly taglib, and in some cases
you may want to know how to embed Jelly into your own Java program (tutorials
on how to do these things are in the works).
</p>
<p>
To see a list of the Jelly demos that you can run, type "maven -g" in the
Jelly root directory (there should be a project.xml file there). Among the
other maven goals, you will see the the demos available under the "demo"
goal (incidentally, Maven is a project automation tool that uses Jelly as
its xml processing engine, and Jelly in turn uses Maven as its build tool.
Neat!)
</p>
<p>
The following tutorials are currently available:
</p>
<ul>
<li>
<a href="#jellyswing">JellySwing Demo</a>
</li>
</ul>
<br/>
<a name="jellyswing"/>
<section name="JellySwing Demo">
<p>
This demo shows how you can use Jelly (using the <a href="tags.html#jelly:jellyswing">JellySwing</a> library) to build the UI for a Swing java program.
</p>
<p>
Why would you want to do this? If you have ever written a large Swing
application, you will probably agree that coding a GUI in java can be a tedious task.
Jelly allows you to define the View (in an MVC approach)
in XML and bind it to a Model and Controller written in Java. Or you can
define actions (Controller) directly in Jelly by using the <action> tag.
</p>
<p>
Jelly is also a great way for a designer to prototype a UI and avoid the
learning curve of Java. In fact, a designer could develop a full-featured
application using a rich set of functions and beans exposed via jelly tags.
</p>
<p>
To run the swing demo type "maven demo:swing"
(View the <a href="http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/swing/example.jelly?rev=HEAD">demo script</a>). You should see a window open with
some swing components. You can test the actions by selecting a menu item or
pressing the button. The actions in this demo simply output a message to the
console. A more practical action could be to invoke a bean, call a script
that opens another window, etc.
</p>
<p>
If you look at the jelly code for this demo (link to the code), you will see
that building a UI is pretty simple. For example, a menu bar is simply:
</p>
<pre>
<menuBar>
<menu text="File">
<menuItem>
<action name="New">
... some action ...
</action>
</menuItem>
</menu>
... more menus/menu items
</menuBar>
</pre>
<p>
As you can see, nested elements are automatically added to parent components
(unlike Java, where you have to call parent.add(child) ).
</p>
<p>
For the table, you can see that it was added to the scrollPane using the
"new" tag (from the jelly:core taglib):
</p>
<pre>
<scrollPane>
<j:new className="org.apache.commons.jelly.swing.MyTableModel" var="tableModel"/>
<table model="${tableModel}"/>
</scrollPane>
</pre>
<p>
The nice thing about this is that any component (or model in this case) that
is not available in the JellySwing taglib or is too complex to express using
Jelly, can be written in java and added by this method.
</p>
</section>
<section name="Other Ideas for JellySwing">
<ul>
<li>
You could write a taglib to allow you to bind data to various models
(TreeModel, TableModel, etc) using Jelly.
</li>
<li>
You could allow the end user of an application to easily customize (or localize) the UI, and even add
custom actions from a library of possible actions!
</li>
<li>
You could you use JellySwing implement a "thin client", so that the entire UI of an application
can be downloaded from a web server at runtime. In some applications, this would provide a lot of flexibility.
</li>
</ul>
</section>
</section>
</body>
</document>
1.1 jakarta-commons-sandbox/jelly/xdocs/gettingstarted.xml
Index: gettingstarted.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<title>Getting Started</title>
<author email="jstrachan@apache.org">James Strachan</author>
</properties>
<body>
<section name="Getting Started">
<p>
The easiest way to get started with Jelly is to try out the <a href="tutorial.html">tutorials</a>.
Before you try out any of the tutorials, you'll need to install Maven first.
For more details on how to install Maven please refer to the
<a href="http://jakarta.apache.org/turbine/maven/start/install.html">Maven documentation</a>
</p>
<p>
Here's a brief overview of what you need to do.
<ul>
<li>
Download a binary distribution of Maven.
</li>
<li>
Set the environment variable MAVEN_HOME to point to where you installed Maven
</li>
<li>
Change your PATH environment variable so that it points to MAVEN_HOME/bin
</li>
<li>
Get a source distribution of Jelly.
The easiest way to do this is (until we have nightly builds working) is to grab a CVS checkout.
Jelly currently resides in the jelly directory inside jakarta-commons-sandbox.
There are instructions on performing CVS checkouts
<a href="http://jakarta.apache.org/site/cvsindex.html">here</a>
</li>
</ul>
</p>
<p>
To verify that your Maven installation is working, change directory into your <i>jelly</i> directory
which should contain a <i>project.xml</i> file required by Maven. Then type
</p>
<pre>
maven test
</pre>
<p>
This should download all the required jars required to build and run all the example Jelly scripts,
compile all the code and build and run all the unit test cases.
</p>
<p>
Once you've got this far, it might be time to try out one of the <a href="tutorial.html">tutorials</a>
</p>
</section>
</body>
</document>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>