Infrastructure
About Dialog is a custom Tapestry component based on dojo Dialog. It has a defined look & feel (dialog css class in layout.css)
It contains a div layer that contains a velocity output and a Close button (to close the dialog)
The velocity parsing mechanism consists on:
- about.vm (velocity template)
- AboutContext (spring bean responsible to put variables in the template and generate the output)
- New Classpath velocity engine (used by the AboutContext to find about.vm in classpath)
- AboutBean (spring bean used as a variable in the velocity template that has access to the contained Tapestry Page) variable name: defaultAbout
- Generic bean (a spring bean defined in a potential plugin, also used as a variable template) variable name: about
Benefits
No static text displayed
if a different, more complicated AboutPage needs to be implemented, simply only the about.vm template and AboutBean has to be changed to get new wanted data (dinamically)
Plugin capabilities
- create plugin specific about.vm template that simply overwrites the original about.vm (overwrite the about.vm path in the sipxplugin.beans.xml spring configuration file - can be automatically picked up by the newly created velocity engine that reads resources from classpath)
- create a plugin specific About Bean (it is automatically added as a variable in the about.vm by the AboutContext) that should have properties to retrieve any dinamic data needed
- localization support (IPage object is available in the about.vm - can be retrieved from the default AboutBean
Look & Feel
Specific dialog look&fell kept in a css class (in layout.css - can be easily overwritten in a potential plugin)
Example
about.vm
Panel |
---|
<table width="100%" align="left"> <td><H3>${defaultAbout.title}</H3></td> <td colspan="2">${defaultAbout.name}${defaultAbout.details}</td> <td colspan="2">${defaultAbout.copyright}</td> |
plugin: sipxplugin.beans.xml
Panel |
---|
<?xml version="1.0" encoding="UTF-8"?> <bean id="ezuceOverrider"> |
Please note the overriden property: <prop key="aboutContext.aboutPluginBeanId">aboutObject</prop>
This injects the plugin about bean id to the about context. Based on it, the About Context retrieves the bean and adds the "about" velocity variable