A small tacos update

No announcements yet, just this:

 [INFO] Tacos ................................................. SUCCESS [20.973s]
 [INFO] Tacos Site Skin ....................................... SUCCESS [1:39.694s]
 [INFO] Tacos Core ............................................ SUCCESS [1:16.806s]
 [INFO] Tacos Annotations ..................................... SUCCESS [9.568s]
 [INFO] Tacos Cometd .......................................... SUCCESS [8.425s]
 [INFO] Tacos Demo ............................................ SUCCESS [25.451s]
 [INFO] BeanForm .............................................. SUCCESS [0.169s]
 [INFO] BeanForm Core ......................................... SUCCESS [25.614s]
 [INFO] BeanForm Examples ..................................... SUCCESS [17.668s]
 [INFO] Tacos Dojo ............................................ SUCCESS [2.079s]
 [INFO] Tacos jQuery .......................................... SUCCESS [2.934s]
 [INFO] Tacos-Seam ............................................ SUCCESS [0.116s]
 [INFO] Tacos-Seam Core ....................................... SUCCESS [44.754s]
 [INFO] Tacos-Seam Demo ....................................... SUCCESS [8.213s]

Tacos 4.1.0 released

Here’s the announcement:

Hi all,
It’s a pleasure for me to announce the release of Tacos 4.1.0
(http://tacos.sourceforge.net/tacos4.1/) – the first stable tacos
release supporting Tapestry 4.1.x and offering:
  • Dojo Widget – Generic component for (almost) all dojo widgets.

  • script.aculo.us – brand new components based on script.aculo.us

  • Comet component

  • New Annotations – allow you to inject ILinks and easily check if
    component parameters are bound.

  • New binding prefixes – including ‘template’ that makes string
    related ognl expressions easier, and ‘absoluteAsset’ which works like
    the asset binding but makes sure that the created url is absolute.

  • BeanForm – All-in-one, flexible bean editor BeanForm has become a
    major part of Tacos. This update offers complete compatibility with
    Tapestry 4.1.2.

  • Tapdoc – though not yet properly released from within tacos, it
    offers a maven plugin for component reference generation.

Furthermore:

  • The jars have already been deployed over at ibiblio.org – more
    installation instructions can be found at
    http://tacos.sourceforge.net/tacos4.1/tacos-core/quick-start/downloading.html

  • Beanform (http://beanform.sourceforge.net/) and Tapdoc
    (http://www.erinors.com/developer/project/tapdoc/) have merged
    with Tacos.

  • Huge thanks to our latest committer Igor Drobiazko whose excitement
    has shed new life to the project.

  • Extra special thanks to all the people that contributed code, esp.
    Daniel Gredler, Norbert Sandor, Patrick Moore, Ming Jiang and Craig Spry

Have fun with it!

Tacos 4.0.1 and Tapestry Support for Netbeans 5.5

We had two tapestry-related releases today:

Tacos 4.0.1

Tacos 4.0.1 was released a few hours ago.  
 
It’s mainly a stability release fixing 2 subtle bugs and  
enhancing the ajax encoder (for very pretty and short ajax urls). 
 
Make sure to also check out the previously undocumented but powerful 
ajax-enabled Table component. 
 
Thanks to all that contributed… 
 
Changes: 

* Docs for tacos:Table component. 
* Load external js synchronously. Fixes Bug127. 
* AjaxSubmit posts all the AjaxLinkSubmits before it. Fixes Bug130. 
* Do not clear current document after error (a failed ajax-post). 
* Jdk1.4 compatible class format for maven generated artifacts. 
* Add StringToListConverter. Allows updateComponents parameter to be specified as a comma-delimited String. 

* Add uniqueNames parameter in AjaxForm – forces the html name of each input control to stem from the component’s idPath (instead of the component’s id). 
* Support validators and translator in HtmlArea. Fixes Bug128. 
* Make buttons in tacos:Palette work. Fixes Bug129. 
* Remove hardcoded class attribute from tacos:Table. 
* Easier way for defining ajax exception and stale-session pages. 
* Enhance AjaxDirectServiceEncoder for ever prettier ajax urls.  

* Corrected links to tapestry’s component docs. 

nbtapestrysupport

Just released the first version of nbtapestrysupport.

It provides:

  • Hyperlink support in Tapestry configuration files for class names, files and libraries… CTRL+click everywhere!!!
  • Autocomplete in Tapestry configuration files for class names, files and others
  • Templates for new Tapestry files

Download the 2 nbms, then install the generic module first and then the tapestry module.

Enjoy!

Tapestry in press – Beginning POJOs

Tapestry in press – Beginning POJOs

I recently came across
Beginning POJOs: Lightweight Java Web Development Using Plain Old Java Objects in Spring, Hibernate, and Tapestry. From the reviews i’ve found, it looked like a nice book and since it does contain a whole chapter on Tapestry, I thought it would be nice to add it in Tapestry‘s site.

So, in order to fill in some (Tapestry related) descriptions, I contacted the author, Brian Sam-Bodden, requesting a detailed table of contents for that chapter. I was pleasantly surprised with Brian’s reply: a 2MB email containing all 70 pages of that chapter – and all this so that I can write a few lines of description… Wow, thanks Brian!

Anyway, the Tapestry chapter is quite interesting, covering Tapestry 4.0.x versions. It starts by describing installation and configuration of the framework, then goes on to explain the concept of pages and components. Several form components are shown and then we learn how to configure and use Hivemind services, tie them to EJB3 services and make use of Application State Objects. Of course, Tapestry annotations are in the mix as well… The chapter ends with more than a dozen pages on AJAX and Tacos. Examples include dynamic user input validation and autocompleters.

Heck, had this book been written 2 months later, it would have also had my name in the tacos section : )

Tapestry: Building Trees with Tacos and Annotations

So, what’s it like using annotations in Tapestry along with complex, cool and ajaxified components?
Well, let’s find out!

Html Template

Assuming that we want our html template to be as clean as possible, our CategoryTree.html file will
look like this:

 <body jwcid="@Border" title="Tree Management">
   <div id="note" >
     <h2>Tree Management</h2>
     <p>
       <a jwcid="expandAllLink" href="#">Expand All</a> |
       <a jwcid="collapseAllLink" href="#">Collapse All</a>
     </p>
     <div id="treeArea">
 		<div jwcid="tree" id="tree" style="overflow: auto; width: auto; height: auto;">
 	        <a jwcid="nodeLink" href="folder.png">
 	            <img jwcid="icon" align="absbottom"/>
 	            <span jwcid="nodeLabel">Node 1</span>
 	        </a>
 		</div>
     </div>
   </div>
 </body>

This includes 2 links to expand and collapse all nodes and the tree component. Tacos tree component
can be thought of as a smart iteration component (think of For or ForeEach) but it also knows in which
order the (visible) nodes should be rendered and it knows the node depth of each one of them.

So, here’s how the template looks like if you directly preview it in a browser
,
and here how it looks when tapestry renders it
.

Page Class

Ok, now let’s move on to the only other file needed, the CategoryTree.java (we would need a
CategoryTree.jwc if we didn’t use annotations). Here it is:

 public abstract class CategoryTree extends BaseCmsPage
 {
 	@InjectObject("service:mobilecms.categoryService")
 	public abstract CategoryService getCategoryService();
 
 	@Bean
 	public abstract EvenOdd getEvenOdd(); 
 
 	@Persist
 	@InitialValue("new java.util.HashSet()")
 	public abstract Set getTreeState();
 
 	@Persist
 	public abstract Category getNodeToEdit();
 	public abstract void setNodeToEdit(Category node);
 
 	@Component(type="tacos:Tree", bindings={"contentProvider=contentProvider",
 			"keyProvider=keyProvider", "state=treeState", "value=current", "rowStyle=bean:evenOdd"} )
 	public abstract Tree getTree();
 
 	@Component(type="DirectLink", bindings={"listener=listener:editNode",
 			"parameters={current.id, current.name}"} )
 	public abstract DirectLink getNodeLink();
 
 	@Component(type="DirectLink", bindings={"listener=listener:collapseAll"} )
 	public abstract DirectLink getCollapseAllLink();	
 
 	@Component(type="DirectLink", bindings={"listener=listener:expandAll"} )
 	public abstract DirectLink getExpandAllLink();	
 
 	@Component(type="Insert", bindings={"value=current.langName",
 			"class=(nodeToEdit!=null and current.id == nodeToEdit.id) ? 'selected' : null"} )
 	public abstract Insert getNodeLabel();
 
 	public abstract Category getCurrent();
 
 	public IKeyProvider getKeyProvider() {
 		return new CategoryKeyProvider();
 	}
 
 	public ITreeContentProvider getContentProvider() {
 		return new CategoryTreeContentProvider(getCategoryService());
 	}	
 
 	public void editNode(String id, String name) {
 		setNodeToEdit(new Category(id, name, null, null));
 	}
 
 	public void collapseAll() {
 		getTreeManager().collapseAll();
 	}
 
 	public void expandAll() {
 		getTreeManager().expandAll();
 	}	
 
     public ITreeManager getTreeManager() {
         return new TreeManager(getTreeState(), getContentProvider(), getKeyProvider());
     }

Ok, so I lied (a bit). You still need a few extra classes to run this (i.e. your domain model)
but that’s obvious! Here, we make use of Category (our bean), CategoryService (our way of
finding Categories) and trivial implementations of IKeyProvider and ITreeContentProvider
(the tree’s way of accessing data).

Annotations Used

Now, from top to bottom, here are the annotations explained:

  1. @InjectObject: Inject the specified object-service in our class, simple and powerful. Services
    are defined using Hivemind or Spring -the one used here is a singleton.
  2. @Bean: Create (and inject) a simple javabean. The bean is constructed on each render. We use this
    to achieve alternate coloring of each tree’s node.
  3. @Persist: Store / remembers the value of the property across multiple renders. Uses session by default.
  4. @InitialValue: We don’t want that property to be null at the beggining, and we’re lazy to write java
    code to do this, so we simply add this annotation.
  5. @Component: This one defines the components that are used in this page. In 4.1.1+ versions of Tapestry
    the type attribute can be deduced by the framework if it matched the return type of the annotated method.
    The id of each component is not specified since the framework uses by default the related property name,
    i.e. getNodeLink() is for id nodeLink. This leaves us with the bindings attribute which i find quite
    easy to follow.

From then on, the code contains 6 more methods, all one-liners! Notice how easy it is to collapse or
expand all nodes, and how we add a specific style to the selected node (tip: see the bindings of
getNodeLabel() and the editNode() method).

Ajax Included???

Oh, and BTW, the tree you’ve just created is AJAX enabled! Clicking to expand or collapse a node will
result in only the tree refreshing. You’ll have to add a “nodeLinkAjax=false” to have normal, old-style
refreshes (http://tacos.sourceforge.net/components/Tree.html).

Hope you liked this annotations and tree tour! I’ll soon get back with some entries on Tapestry 4.1.1
new goodies. Always have fun!

Edit POJOs in Tapestry

Well, the idea is simple, use something like

<span jwcid="@edit:EditObject" object="ognl:pojo"/>

and instantly generate insert-delete-update pages of the given pojo.

I think there’s such a component over at Trails but i’ve yet to find time to check this out as much as i want to.

Recently, there was a post by Hugo Duncan describing a similar component with source code attached.

And now, we have BeanForms by Daniel Gredler, which is a detailed description of yet another solution.

Wow! That’s amazing! I’ll try to get some time this week to play with it + see how AJAX and TACOS can fit to it… What a great community Tapestry has!

Java Hellenic User Group

Today, I attended an event organized by our local JUG and I must say I had a really good time. Saw plenty of familiar faces, met some new ones and heard lots of interesting stuff.

The event started with lots of coffee : ) I think it was 4 cups but they were needed – I was up all night coding more AJAX goodies for TACOS and TAPESTRY.

Anyway, after the coffee we heard a quick intro on the history of the JUG and the first presentation was on ‘JBoss Status Update, Business Model, Products and Roadmaps’ by Dimitris Andreadis. It was a short and pleasant intro on the JBoss company, its model, its products and its future. I liked it, but I was also shocked by a few questions from the audience. It seems, some people are still afraid of open source – they think there’s a trap somewhere. Could it be the “not built here” syndrome, or the “it’s free it’s crap” one?

Well, there followed an ‘Introduction to Java Data Objects (JDO 2)’ by G.Kostaras. I must say I didn’t enjoy this one – at least for me it was useless. There wasn’t even a comparision with Hibernate, apart from some marketing stuff. But again, judging from the audience, it seems that many people simply do not get ORM tools. It must be the same syndromes again. We really need more training + be more open-minded…

Then, there was ‘Practical Iterative Development’ by K.Flokos. Due to my fatigue, I was planning to take a nap on this, but I simply couldn’t. Mr Flokos is an excellent presenter and knows his stuff thoroughtly. I’m sure the material presented stems from personal experience as well as general knowledge, and I’d sure like to download it when it gets available. It would also be very interesting and educating ( I believe for both of us ) to work together, but there’s no way I’m going to Belgium : )

Finally, we had ‘The clustering architecture of JBoss’ again by Mr Andreadis and again an excellent and thought-provoking presentation. I’ve never needed to really use JBoss, but I’m downloading it right now to witness its clustering capabilities. And I know that TAPESTRY is a really cluster-friendly web framework.

All in all, it was a nice Saturday morning. I hope there’ll be more of this, and perhaps I can arrange to present TAPESTRY as well as some AJAX magic there…

Recent changes

So many things have changed in the last six months!

Here are two of them:

  • I’ve moved out of my family house – I’ve been living with my love since 21 Oct 05

Let’s see what’s next!

Dojo and Tacos

Dojo and Tacos

There’s still a tiny little bug holding Tacos from the 4-beta-2 release. It’s simply Demo crashes under IE 6 : )

It appears to happen when dojo javascript is included inside <HEAD> but after a <BASE> tag.

So, i did some diffs on dojo code from rev.2889 to rev.3301, noticed lots of nice things. Here they are (so that i can remember them, will do more research in a few hours):

  • What happenned to dojo.dom.getContentAsString? (not in rev.2889, initially in rev.3301 but not now )
  • Check out dojo.undo.browser.
  • Added timeout: function(type){ } and timeoutSeconds: 0 in dojo.io.Request (and perhaps bind?)
  • dojo.string.has contains wrong documentation.
  • Check out dojo_ie_clobber
  • Check out dojo.style.insertCssFile
  • Use dojo.lang.mixin for adding properties to object ( i.e. dojo.lang.mixin(this, kwArgs) ).
  • Try some explode effects using dojo.fx.html.explode([0,0,0,0], node, duration, callback);

Regarding the bug we’re facing, perhaps it has to do with this new code:

 try {
 	if (dojo.render.html.ie) {
 		//	easier and safer VML addition.  Thanks Emil!
 		document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
 		document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML)");
 	}
 

that replaced this:

 try {
 	if (dojo.render.html.ie) {
 		document.write('<style>v\:*{ behavior:url(#default#VML); }</style>');
 		document.write('<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/>');
 	}
 }
 

Will check all these as soon as i get to a win box. bye!