org.tinyjee.maven.dim.extensions
Class MessageBoxParameterTransformer

java.lang.Object
  extended by org.tinyjee.maven.dim.extensions.MessageBoxParameterTransformer
All Implemented Interfaces:
RequestParameterTransformer

public class MessageBoxParameterTransformer
extends Object
implements RequestParameterTransformer

The message box extension is implemented as a RequestParameterTransformer that is triggered when the parameter "message-box" is set with the macro call. When "message-box=text to display" is present, the transformer sets "source" to a bundled velocity template that performs the actual rendering.

Note: Message boxes are rendered as pure HTML and will only work if a XhtmlSink or derived class is used for rendering the output (=> any HTML render target should be fine, including the standard Maven site generation). Furthermore all built-in icons are rendered using embedded SVG graphics, which is currently supported in: IE 9+, FF 4+, Chrome, Safari and Opera.

Author:
Juergen_Kellerer, 2011-10-06

Field Summary
static String PARAM_BACKGROUND_COLOR
          Optional parameter overriding the color of the message box background.
static String PARAM_COLOR
          Optional parameter overriding the border color of the message box.
static String PARAM_ICON
          Optional parameter setting a site resource path to the image that is used with the message box instead of the built-in SVG graphics.
static String PARAM_MESSAGE_BOX
          Enables this extension and sets the text to display inside the message box.
static String PARAM_TEXT_COLOR
          Optional parameter overriding the text color of the message box.
static String PARAM_TYPE
          Optional parameter specifying the type of message box to display.
 
Fields inherited from interface org.tinyjee.maven.dim.spi.RequestParameterTransformer
TRANSFORMERS
 
Constructor Summary
MessageBoxParameterTransformer()
           
 
Method Summary
 void transformParameters(Map<String,Object> requestParams)
          Transforms the specified request parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_MESSAGE_BOX

public static final String PARAM_MESSAGE_BOX
Enables this extension and sets the text to display inside the message box.

Note: Setting this property has no effect in case of "source" or "source-class" were specified with the macro call. This behaviour ensures that the parameter "message-box" can still be used with ordinary macro calls where a source or source-class was set.

Markup: The message box is rendered as pure HTML and text is added to the box as-is. As a consequence HTML can be used as markup inside the given message and it is also the only valid markup that may be used here.
E.g. %{include|message-box=Hello <b>World!</b>} can be used with the APT format, to have "World!" formatted in strong text style.

See Also:
Constant Field Values

PARAM_TYPE

public static final String PARAM_TYPE
Optional parameter specifying the type of message box to display.

See Also:
Constant Field Values

PARAM_TEXT_COLOR

public static final String PARAM_TEXT_COLOR
Optional parameter overriding the text color of the message box.

See Also:
Constant Field Values

PARAM_COLOR

public static final String PARAM_COLOR
Optional parameter overriding the border color of the message box.

See Also:
Constant Field Values

PARAM_BACKGROUND_COLOR

public static final String PARAM_BACKGROUND_COLOR
Optional parameter overriding the color of the message box background.

See Also:
Constant Field Values

PARAM_ICON

public static final String PARAM_ICON
Optional parameter setting a site resource path to the image that is used with the message box instead of the built-in SVG graphics.

Supported formats include GIF, PNG, JPG and SVG. The path has to be chosen relative to the site's web root, e.g.:
%{include|icon=images/alert.png|message-box=This is an alert message}

Note: If no type is specified, it will be set accordingly when the image path contains one of the keywords "alert" or "warn(ing)" ("info" remains the default message box type).

See Also:
Constant Field Values
Constructor Detail

MessageBoxParameterTransformer

public MessageBoxParameterTransformer()
Method Detail

transformParameters

public void transformParameters(Map<String,Object> requestParams)
Description copied from interface: RequestParameterTransformer
Transforms the specified request parameters.

Specified by:
transformParameters in interface RequestParameterTransformer
Parameters:
requestParams - the request params to modify.