Monday, November 26, 2012

jQuery dynatree adapter for JSF 2

Introduction

dynatree-for-jsf is a JSF 2 adapter for dynatree jQuery plugin (http://code.google.com/p/dynatree/). dynatree allows to dynamically create html tree view controls using JavaScript.

Why this adapter though Richfaces or Primefaces already implements> tree components ? Because dynatree has more features, is more mature, robust and is a prooven component.

Source code and sample are available on https://github.com/nithril/dynatree-for-jsf 
Sample is running on Cloudbees at http://dynatree.nithril.cloudbees.net/tree.jsf

Features

This adapter handles events for all of the dynatree events. All events can be mapped to JSF ajax events.
Here is a typical use of the adapter

onLazyRead and onActivate ajax events are binded to methods of the managed bean treeBean.
  • lazyRead populates the tree dynamicaly.
  • activate refresh a JSF panel with the selected node key.
All with Ajax.
This project does not include jquery, nor dynatree. You should include their by yourself.

Example

I have create an example with an infinite ajax tree
Browse to http://localhost:8080/tree/tree.jsf
alt Screenshot


Licenses

Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0

 


Credits

Authors of dynatree, a great component. Authors of Primefaces and Mojarra, a source of inspiration on how to create an JSF 2 component with Ajax behaviour

Monday, April 30, 2012

Lucene Generic Highlighter

I have pushed on GitHub a projet on how to create a generic highlighter with Apache Lucene.

Original Lucene Highlighter is too much coupled with snippet highlighting and :
  • Do not allow easily to highlight a whole text 
  • Handles only text with a formatter strongly coupled to text 
 I have modified the original Lucene Highlighter to allow highlighting of "anything". The highlighter is a callback instead of a formatter and it's purpose is to find terms in a whole text with a score. I used this code to highlight XML, PDF, HTML... with or without Solr.

Note : This project is an extract of a large project with submodule.