org.mmbase.applications.mmbob.util.transformers
Class Smilies

java.lang.Object
  extended by org.mmbase.util.transformers.StringTransformer
      extended by org.mmbase.applications.mmbob.util.transformers.Smilies
All Implemented Interfaces:
Serializable, CharTransformer, Transformer

public class Smilies
extends StringTransformer
implements CharTransformer

Replaces known smilies with their graphical version. It uses the thememanager for defining the smilies.

Since:
MMBob-1.0
Version:
$Id: Smilies.java 35620 2009-06-03 13:46:59Z michiel $
Author:
Gerard van Enk
See Also:
Serialized Form

Field Summary
protected static Map smileyMatchers
          Compiled regexps
protected static Map smileyPatterns
          Smiley patterns translated into their regexp version
protected static Map smileySets
          All known smileysets
protected static Map smilies
          All known smilies
 
Constructor Summary
Smilies()
           
Smilies(String defaultid, String defaultcontext)
           
 
Method Summary
protected  void initMatchers(String themeID, String smileySetID, String smileyKey)
          Initializes regexp matchers for the combination of (themeID,smileySetID,smileyKey,smilies)
protected  void initPatterns(String themeID, String smileySetID, String smileyKey)
          Initializes regexp patterns for the combination of (themeID,smileySetID,smileyKey,smilies)
protected  void initSmileySets(String themeID, String smileySetID, String smileyKey)
          Initializes a specific smileySet in a specific theme.
 String toString()
           
 String transform(String originalString)
          Default transform method (with no other params).
 String transform(String originalString, String themeID, String imagecontext)
          Transform the originalString into a version with the graphical version of the smilies
 
Methods inherited from class org.mmbase.util.transformers.StringTransformer
transform, transform, transformBack, transformBack, transformBack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.util.transformers.CharTransformer
transform, transform, transformBack, transformBack, transformBack
 

Field Detail

smilies

protected static final Map smilies
All known smilies


smileySets

protected static final Map smileySets
All known smileysets


smileyPatterns

protected static final Map smileyPatterns
Smiley patterns translated into their regexp version


smileyMatchers

protected static final Map smileyMatchers
Compiled regexps

Constructor Detail

Smilies

public Smilies()

Smilies

public Smilies(String defaultid,
               String defaultcontext)
Method Detail

initSmileySets

protected void initSmileySets(String themeID,
                              String smileySetID,
                              String smileyKey)
Initializes a specific smileySet in a specific theme.

Parameters:
themeID - id of of the theme to be used to access the smileyset
smileySetID - the id of the smileyset to be used to access the smiley
smileyKey - the unique key of the smileyset

initPatterns

protected void initPatterns(String themeID,
                            String smileySetID,
                            String smileyKey)
Initializes regexp patterns for the combination of (themeID,smileySetID,smileyKey,smilies)

Parameters:
themeID - id of of the theme to be used to access the smileyset
smileySetID - the id of the smileyset to be used to access the smiley
smileyKey - the id of the smiley (this is the text version of the smiley)

initMatchers

protected void initMatchers(String themeID,
                            String smileySetID,
                            String smileyKey)
Initializes regexp matchers for the combination of (themeID,smileySetID,smileyKey,smilies)

Parameters:
themeID - id of of the theme to be used to access the smileyset
smileySetID - the id of the smileyset to be used to access the smiley
smileyKey - the id of the smiley (this is the text version of the smiley)

transform

public String transform(String originalString)
Default transform method (with no other params). It will transform the originalString into a version with the graphical version of the smilies

Specified by:
transform in interface CharTransformer
Specified by:
transform in class StringTransformer
Parameters:
originalString - the string which must be transformed
Returns:
the transformed string

transform

public String transform(String originalString,
                        String themeID,
                        String imagecontext)
Transform the originalString into a version with the graphical version of the smilies

Parameters:
originalString - the string which must be transformed
themeID - the id of the theme to be used
imagecontext - the image path to be used
Returns:
the transformed string

toString

public String toString()
Specified by:
toString in interface Transformer
Overrides:
toString in class Object


MMBase 2.0-SNAPSHOT - null