Re: How to extend StrutsMenu?

Ahmed Mohombe <amohombe-/[email protected]>
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
>> I would like to make this this for "velocity-nicetabs".
>> Has someone any hints or idea how/where to make the changes?
> 
> 
> Since you're using Velocity for your menu, you should be able to alter 
> the template that you use for this menu.  You could add a "name" 
> attribute to the item and then use that in the "id" attribute of your link.
Sorry, but "globalMacros.vm" looks in now way similar(for me) to what's 
generated :( , so I have no idea where and how "name" would fit in there.
The only place where it looks similar to the generated HTML is 
"DisplayerStrings.properties".
Velocity was just an example. However It would be good to know a general 
solution. I looked in "AbstractMenuDisplayer.java", but I have no idea 
how the ID would come there.
It's embarrasing for me, but it seems I can't see the "big picture" of 
how StrutsMenu works :(.

There are a few usages of this extension to StrutsMenu:
- in a lot of cases an ID or other attributes are required by the 
project requirements.
- Improved "menu activation": If the framework problem is solved, it's a 
pice of cake to extend the javascripts to use the "body ID" or a "DIV 
ID" in case an URL doesn't return the desired activation.
This way, a Body/Div Id can alwyas be set in the page(as a last backup), 
to ensure that the right menu will be activated if the URL doesn't 
match. I found a lot of situations where the URL doesn't match and 
cookies don't play well with submenus, so this would be a useful 
improvement for the StrutsMenu framework IMHO.

>> P.S. Is there a DTD for the menu config.xml (to allow xml editors to 
>> check for the right syntax, and autocomplete for smarter editors :) ) ?
> 
> 
> No, not right now.  A few folks have submitted some, but they were just 
> generated from their editors.  I do need to create one and hope to as 
> part of the next release.
Great :). I can't wait to use it in my IDE :).
Runtime errors are not very pleasent, so if IDEs can detect errors while 
one is editing, it's a great productivity/test improvement.

Ahmed.



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.