org.cafesip.gwtcomp.client.utils
Class HTMLHelper

java.lang.Object
  extended by org.cafesip.gwtcomp.client.utils.HTMLHelper

public class HTMLHelper
extends Object

A set of helper methods for generating HTML segments that are commonly used. Whether you use GWT, JSF or any other GUI framework, there is no getting away from HTML coding (I guess that is why GWT also provides a HTML widget). This class contains method that help you generate commly-used HTML segments. For example you can use:

  String important = HTMLHelper.bold ("Important!"); 
  
  instead of
  
  String important = "<b> + "Important" + "</b>";
 

Author:
Amit Chatterjee

Constructor Summary
HTMLHelper()
           
 
Method Summary
static String bold(String text)
          HTML rendition of bold text.
static String boxedText(String text)
          HTML rendition of boxed text.
static String bulletList(String[] items)
          HTML rendition of a bullet (unordered) list.
static String header(int i, String title)
          HTML rendition of a header element.
static String hr(String color)
          HTML rendition of a horizontal rule.
static String imageWithText(String url, String text)
          HTML rendition of a image next to a text.
static String italics(String text)
          HTML rendition of italicized text.
static String newline()
          HTML rendition of newline.
static String orderedList(String[] items)
          HTML rendition of a numbered (ordered) list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLHelper

public HTMLHelper()
Method Detail

bold

public static String bold(String text)
HTML rendition of bold text.

Parameters:
text - text to be rendered in bold.
Returns:
the HTMLized string

italics

public static String italics(String text)
HTML rendition of italicized text.

Parameters:
text - text to be rendered in italicized format.
Returns:
the HTMLized string

newline

public static String newline()
HTML rendition of newline.

Returns:
the HTMLized string

hr

public static String hr(String color)
HTML rendition of a horizontal rule.

Parameters:
color - Color of the line. Use the HTML color-definition conventions.
Returns:
the HTMLized string

boxedText

public static String boxedText(String text)
HTML rendition of boxed text. The style is controlled by the style element:
.gwtcomp-BoxedText

Parameters:
text - text to be boxed.
Returns:
the HTMLized string

imageWithText

public static String imageWithText(String url,
                                   String text)
HTML rendition of a image next to a text. You can create image buttons using this method.

Parameters:
url - URL of the image
text - text
Returns:
the HTMLized string

orderedList

public static String orderedList(String[] items)
HTML rendition of a numbered (ordered) list.

Parameters:
items - items in the list
Returns:
the HTMLized string

bulletList

public static String bulletList(String[] items)
HTML rendition of a bullet (unordered) list.

Parameters:
items - items in the list.
Returns:
the HTMLized string

header

public static String header(int i,
                            String title)
HTML rendition of a header element.

Parameters:
i - header level (1, 2, 3, 4, etc.)
title - header text
Returns:
the HTMLized string


Copyright © 2010 Cafesip.org. All Rights Reserved.