This is a menu component for the Tapestry
Java web framework. The famous
JSCookMenu JavaScript menu
written by Heng Yuan is embedded in the component in a slightly modified version.
Both vertical or horizontal menues like the green example down on this page
can easily be created.
The look of the menues is highly customizable.
Arbitrary tapestry components can be placed into the menu.
+++++ New : Theme-Studio +++++
Finally, there is a WYSIWYG tool available to design new themes!
Add the js-cook-menu.jar from the distribution to the WEB-INF/lib of your web application
Declare the use of the component in your tapestry .application file
<library id="menu" specification-path="classpath:/net/sourceforge/tapestry_jsmenu/menu.library"/>
Have a look at the code belonging to the simple example menu on the left. It uses a build-in
theme ('SmartGreen') and default behaviour.
There are two ways, to make a menu:
1: With a Java-model : use the component JSCookMenu
2: With a static XML-based model: use the component XmlJSCookMenu
1: Java model
Like many other iterating Tapestry components the structure may be defined by a Java model
and is bound to the template by the 'source' attribute, whereas the iterating property is traditionally
specified by the 'value' attribute. The same does the JSCookMenu component.
The same example as above realized with the XmlJsCookMenu component and an XML-model:
The XmlJsCookMenu component works with a static XML-model. In contrast to the more
extendible JsCookMenu component, the links are also specified in the model
(in this example only DirectLinks are used).
No renderer-components must be specified.
If you want to make the above examples run, you also need the icons
(referred to in the asset definitions of QuickStart.page or in the quickstart-menu.xml respextively).
You can download them (icons.zip) and unzip them in your context directory.
On the projects
download area there is an example web application available that includes the
above example among some others.
Change Log
Version 1.0.1
In the previous releases, the value-parameter
of JSCookMenu was an 'in' parameter. Hence it could not be bound with OGNL to some Java setter method.
Instead, the parameter was an 'in' parameter expecting the name
of the setter.
This was very confusing, erroneous and against Tapestry best practices.
From 1.0.1 on this changed. The value-parameter
is an 'out' parameter now.
Just bind the Java-setter with OGNL as you are used to do with Table, For, etc...
As a consequence of this, all bindings to the value parameter must be changed to 'ognl:' to make it compatible to version 1.0.1
Version 1.0.2
'Bug' 1436285 fixed. It seems that in some deployment environments, ressources must be loaded
from the classpath with a leading '/' before their names.
Now, if loading with unslashed name fails, the slashed name is tried to load.
Line precise error reporting is supported. RuntimeExceptions have been replaced by
ApplicationRuntimeExceptions with the corresponding Locations
Version 1.1
There is a second, easier to use component available now
(XmlJsCookMenu)
that works with a static XML-model.
No content renderers. The links are specified in the model.
DirectLonk, ExternalLink, PageLink, GenericLink and ServerLink are supported.
Version 1.2
The component failed to work with 'pretty URLs'. Corresponding error messages were
very hard to associate to that cause (e.g. bug 1458016).
This is fixed now (thanks to bpsommerville, patches 1481613 and 1481592)
Links with anchors did not work correctly, because the browser cached them.
This is fixed now.
Version 1.21
Bug 1485342 fixed :XML-model in combination with friendly URLs and
PageLinked items didn't work
Examples changed to friendly URLs now (assets, direct and page). This is to demonstrate, that
friendly URLs are kind of working now.
Menu structure is created now as HTML-lists.
Links are then explorable by search robots.
New Parameters introduced : clickOpen, effect, offsetVMainAdjust, offsetVMainAdjust,
offsetSubAdjust according to the corresponding properties of JSCookMenu 2.0
The way of generating the item's action link has changed to the standart way given by JSCookMenu
- If the item's content is provided as an <a>-tag, the action-url is retrieved from that tag
- Otherwise no action-link is generated.
Parameters 'extendLinkOverWholeItemArea' and 'escapeApostrophs' are no longer necessary
Better performance and cleaner generated HTML
Timestamp url-decoration is done on the client now
Default javascript theme-properties are provided in a library.
Cleaner and simplified code
Version 2.01
Bug 1553349 fixed : JavaScript error thrown on mouse over separator
Version 2.11
XML version: In order to validate the xml, the dtd is no longer loaded
from the internet. It is included in the package.
Bug 1579505 fixed: Tap 4.1 @EventListener and Tapestry JSCookMenu JavaModel
didn't work together.
Checked with Tap 4.1 : I had to deactivate serviceLink in the XML version
because of incompatibilities between Tap40 and Tap41.
If anybody uses serviceLink with XML-model, please tell me, and I will work
on a solution.
Version 2.12
Bug 1609833 fixed. When the component was included in a library, there was
a ':' in a JS variable what made the JS crash.
Version 2.20
Bug 1622733 fixed. JavaScript links (javascript:...) didn't work
because of timestamp decoration.
In the XML-model example there has been added an item to demonstrate a JavaScript link.
Section about JavaScript links changed in the manual.
No nesting in span-tags necessary to make renderer.
Themes Office and SmartGreen: There was a broken
horizontal separator for submenues
Version 2.30
New parameter displayModeProvider for the XML-version.
Enables role-based hiding of items together with static XML-model.
DTD has changed: 'roles' attribute added to 'item' XML-tag