org.ceryle.wiki.plugin.flag
Class FlagPlugin
java.lang.Object
org.ceryle.wiki.plugin.flag.FlagPlugin
- All Implemented Interfaces:
- WikiPlugin
- Direct Known Subclasses:
- Flag
public class FlagPlugin
- extends Object
- implements WikiPlugin
A JSPWiki plugin to display a country flag icon provided its two
character ISO code.
Parameters
- code = 'ISO code'. Required.
The value of code must be a two digit ISO 3166 Country Code.
- alt = 'alternate text'. Optional.
If provided, the value will be used as the alt attribute
of the image, overriding use of the lookup of the country
code.
Notes
This relies on the flag icons being available as PNG images for each
country, as located in $WIKI_HOME/images/flags/(code).png.
There is no checking for availability of the image.
The flag images in the associated zip archive are from the
Horde Groupware Webmail Edition
distribution, licensed LGPL.
The plugin includes a static lookup method Flag.isoCodeToCountryName()
for the known list of ISO country codes. If any of the ISO codes is used,
the alt text will include the country name (in English) if no
alt parameter has been provided, otherwise the value will contain
the alt parameter value. If an invalid ISO code is used an error
message is returned. This plugin does not attempt to maintain compatibility
with the current state of the
ISO country codes.
The output is enclosed in a <div class="flag"> element.
- Since:
- 2.5.x
- Author:
- Murray Altheim
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FlagPlugin
public FlagPlugin()
execute
public String execute(WikiContext context,
Map params)
throws PluginException
- Specified by:
execute in interface WikiPlugin
- Throws:
PluginException
isoCodeToCountryName
public static String isoCodeToCountryName(String code)
- Returns the country name in English, provided the ISO country code.
The String match is case insensitive. If the code is unknown, null
is returned. Since this is a static method it may be used as a general
lookup utility.
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.