com.cc.framework.ui.html
Class HtmlUtil

java.lang.Object
  extended bycom.cc.framework.ui.html.HtmlUtil

public abstract class HtmlUtil
extends java.lang.Object

Helper Class for HTML-Resources

Since:
1.0
Version:
$Revision: 1.33 $
Author:
Harald Schulz

Field Summary
static CharacterConverter converter
          The Converter instance used by the framework to convert Strings into HTML representation.
 
Constructor Summary
private HtmlUtil()
          Constructor
 
Method Summary
static java.lang.String encodeAttribute(java.lang.Object obj)
          Method encodeAttribute
static java.lang.String encodeAttribute(java.lang.Object raw, boolean filter)
          Converts a String to an equivalent HTML-String
static java.lang.String encodeHtml(java.lang.Object obj)
          Method encodeHtml
static java.lang.String encodeHtml(java.lang.Object raw, boolean filter)
          Converts a String to an equivalent HTML-String
private static java.lang.String encodeInternAttribute(java.lang.String source)
          Method encodeAttribute
private static java.lang.String encodeInternHtml(java.lang.String source)
          Method encodeHtml
static java.lang.String encodeTextarea(java.lang.String source)
          This method replaces every occurrence of & into &
static java.lang.String encodeUrl(java.lang.String str)
          Method encodeUrl
static java.lang.String removeHtml(java.lang.Object html)
          Removes all HTML formatting from the given HTML-String
static java.lang.String removeHtml(java.lang.Object html, boolean filter)
          Removes all HTML formatting from the given HTML-String depending on the filter setting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

converter

public static CharacterConverter converter
The Converter instance used by the framework to convert Strings into HTML representation.

Constructor Detail

HtmlUtil

private HtmlUtil()
Constructor

Method Detail

removeHtml

public static java.lang.String removeHtml(java.lang.Object html)
Removes all HTML formatting from the given HTML-String

Parameters:
html - Object in HTML format
Returns:
String

removeHtml

public static java.lang.String removeHtml(java.lang.Object html,
                                          boolean filter)
Removes all HTML formatting from the given HTML-String depending on the filter setting

Parameters:
html - Object in HTML format
filter - The HTML filter setting of the control
  • when set to true we assume the control converts from raw text to HTML. So the given string is already in plain text format and there is nothing to do.
  • when set to false we assume the control does not convert to HTML because the string resources are already given in HTML format. So we need to strip off all HTML tags.
Returns:
String

encodeHtml

public static final java.lang.String encodeHtml(java.lang.Object obj)
Method encodeHtml

Parameters:
obj - Object
Returns:
String

encodeHtml

public static final java.lang.String encodeHtml(java.lang.Object raw,
                                                boolean filter)
Converts a String to an equivalent HTML-String

Parameters:
raw - Object
filter - Filter
Returns:
String

encodeInternHtml

private static final java.lang.String encodeInternHtml(java.lang.String source)
Method encodeHtml

Parameters:
source - String to encode
Returns:
String

encodeAttribute

public static final java.lang.String encodeAttribute(java.lang.Object obj)
Method encodeAttribute

Parameters:
obj - Object
Returns:
String

encodeAttribute

public static final java.lang.String encodeAttribute(java.lang.Object raw,
                                                     boolean filter)
Converts a String to an equivalent HTML-String

Parameters:
raw - Object
filter - Filter
Returns:
String

encodeInternAttribute

private static final java.lang.String encodeInternAttribute(java.lang.String source)
Method encodeAttribute

Parameters:
source - String to encode
Returns:
String

encodeTextarea

public static final java.lang.String encodeTextarea(java.lang.String source)
This method replaces every occurrence of & into &

Parameters:
source - String to encode
Returns:
encoded String

encodeUrl

public static final java.lang.String encodeUrl(java.lang.String str)
Method encodeUrl

Parameters:
str - URL
Returns:
String


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.