org.ceryle.wiki.plugin.flag
Class FlagPlugin

java.lang.Object
  extended by 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

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

Field Summary
 
Fields inherited from interface com.ecyrd.jspwiki.plugin.WikiPlugin
CORE_PLUGINS_RESOURCEBUNDLE
 
Constructor Summary
FlagPlugin()
           
 
Method Summary
 String execute(WikiContext context, Map params)
           
static String isoCodeToCountryName(String code)
          Returns the country name in English, provided the ISO country code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlagPlugin

public FlagPlugin()
Method Detail

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.