org.openejb.util
Class HtmlUtilities

java.lang.Object
  extended by org.openejb.util.HtmlUtilities

public class HtmlUtilities
extends java.lang.Object

A class for HTML utilities; see http://www.w3.org/TR/html4 for more info

Author:
Tim Urberg

Field Summary
static java.lang.String ANCHOR_HREF_TYPE
          type for <a href="href"...>
static java.lang.String ANCHOR_NAME_TYPE
          type for <a name="name"...>
 
Method Summary
static java.lang.String createAnchor(java.lang.String value, java.lang.String display, java.lang.String type)
          Creates an HTML anchor.
static java.lang.String createFileFormField(java.lang.String name, java.lang.String value, int size)
          Creates an HTML file form field based on the parameters passed in
<input type="file" name="name" value="value" size="size">
static java.lang.String createHiddenFormField(java.lang.String name, java.lang.String value)
          Creates an HTML hidden form field based on the parameters passed in
<input type="hidden" name="name" value="value">
static java.lang.String createInputFormField(java.lang.String type, java.lang.String name, java.lang.String value, int size, int maxLength, java.lang.String onFocus, java.lang.String onBlur, java.lang.String onChange, java.lang.String onClick, boolean checked, boolean disabled, boolean readOnly)
          creates an input type, text, radio, button submit, etc
static java.lang.String createSelectFormField(java.lang.String name, java.lang.String onChange)
          Creates the beginning of an HTML select based on the name passed in
<select name="name" onChange="onChange">
static java.lang.String createSelectOption(java.lang.String value, java.lang.String display, boolean selected)
          Creates an HTML option used inside an HTML select
<option value="value" selected>display</option>
static java.lang.String createSubmitFormButton(java.lang.String name, java.lang.String value)
          Creates an HTML submit button based on the parameters passed in
<input type="submit" name="name" value="value">
static java.lang.String createTextArea(java.lang.String name, java.lang.String content, int rows, int columns, java.lang.String onFocus, java.lang.String onBlur, java.lang.String onChange)
          Creates an HTML textarea object
<textarea name="name" rows="rows" cols="columns" onfocus="onFocus" onblur="onBlur" onchange="onChange">
content
</textarea>
static java.lang.String createTextFormField(java.lang.String name, java.lang.String value, int size, int maxLength)
          Creates an HTML text form field based on the parameters passed in
<input type="text" name="name" value="value" size="size" maxlength="maxlength">
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANCHOR_NAME_TYPE

public static final java.lang.String ANCHOR_NAME_TYPE
type for <a name="name"...>

See Also:
Constant Field Values

ANCHOR_HREF_TYPE

public static final java.lang.String ANCHOR_HREF_TYPE
type for <a href="href"...>

See Also:
Constant Field Values
Method Detail

createAnchor

public static java.lang.String createAnchor(java.lang.String value,
                                            java.lang.String display,
                                            java.lang.String type)
Creates an HTML anchor. If ANCHOR_NAME_TYPE is passed in, it creates a name anchor:

<a name="value">display</a>

If ANCHOR_HREF_TYPE is passed in it creates an href anchor:

<a href="href">display</a>

Parameters:
value - the name or href value for this anchor
display - the display for this anchor
type - the type of this anchor (name or href)
Returns:
an HTML anchor element
See Also:
ANCHOR_NAME_TYPE, ANCHOR_HREF_TYPE

createSelectFormField

public static java.lang.String createSelectFormField(java.lang.String name,
                                                     java.lang.String onChange)
Creates the beginning of an HTML select based on the name passed in
<select name="name" onChange="onChange">

Parameters:
name - the name of the select form field
onChange - a JavaScript onChange event (pass in null for no onChange)
Returns:
the constructed select, similar to above

createSelectOption

public static java.lang.String createSelectOption(java.lang.String value,
                                                  java.lang.String display,
                                                  boolean selected)
Creates an HTML option used inside an HTML select
<option value="value" selected>display</option>

Parameters:
value - the value for this option
display - the display for this option
selected - whether or not this option should be selected
Returns:
the constructed option, similar to above

createTextFormField

public static java.lang.String createTextFormField(java.lang.String name,
                                                   java.lang.String value,
                                                   int size,
                                                   int maxLength)
Creates an HTML text form field based on the parameters passed in
<input type="text" name="name" value="value" size="size" maxlength="maxlength">

Parameters:
name - the name of the text form field
value - the value of the text form field
size - the size of the text form field (0 for no size)
maxLength - the maxlength of the text form field (0 for no maxlength)
Returns:
the constructed text form field, similar to above

createFileFormField

public static java.lang.String createFileFormField(java.lang.String name,
                                                   java.lang.String value,
                                                   int size)
Creates an HTML file form field based on the parameters passed in
<input type="file" name="name" value="value" size="size">

Parameters:
name - the name of the file form field
value - the value of the file form field
size - the size of the file form field (0 for no size)
Returns:
the constructed file form field, similar to above

createHiddenFormField

public static java.lang.String createHiddenFormField(java.lang.String name,
                                                     java.lang.String value)
Creates an HTML hidden form field based on the parameters passed in
<input type="hidden" name="name" value="value">

Parameters:
name - the name of hidden form field
value - the value of the hidden form field
Returns:
the constructed hidden form field, similar to above

createSubmitFormButton

public static java.lang.String createSubmitFormButton(java.lang.String name,
                                                      java.lang.String value)
Creates an HTML submit button based on the parameters passed in
<input type="submit" name="name" value="value">

Parameters:
name - the name of hidden form field
value - the value of the hidden form field
Returns:
the constructed hidden form field, similar to above

createInputFormField

public static java.lang.String createInputFormField(java.lang.String type,
                                                    java.lang.String name,
                                                    java.lang.String value,
                                                    int size,
                                                    int maxLength,
                                                    java.lang.String onFocus,
                                                    java.lang.String onBlur,
                                                    java.lang.String onChange,
                                                    java.lang.String onClick,
                                                    boolean checked,
                                                    boolean disabled,
                                                    boolean readOnly)
creates an input type, text, radio, button submit, etc

Parameters:
type - the type of input
name - the name of the input
value - the value of the input
size - the size of the input (0 for no size)
maxLength - the maxlength of the input (0 for no maxlength
onFocus - an onfocus event (null for no onfocus)
onBlur - an onblur event (null for no onblur)
onChange - an onchange event (null for no onchange)
onClick - an onclick event (null for no onclick)
checked - if this input is checked
disabled - if this input is disabled
readOnly - if this input is readonly
Returns:
the constructed input

createTextArea

public static java.lang.String createTextArea(java.lang.String name,
                                              java.lang.String content,
                                              int rows,
                                              int columns,
                                              java.lang.String onFocus,
                                              java.lang.String onBlur,
                                              java.lang.String onChange)
Creates an HTML textarea object
<textarea name="name" rows="rows" cols="columns" onfocus="onFocus" onblur="onBlur" onchange="onChange">
content
</textarea>

Parameters:
name - the name of the textarea
content - the content of the textarea
rows - the number of rows of the textarea
columns - the numbe of columns of the textarea
onFocus - a javascript onfocus event (null for no onfocus)
onBlur - a javascript onblur event (null for no onblur)
onChange - a javascript onchange event (null for no onchange)
Returns:
the constucted textarea string


Copyright © 1999-2011 OpenEJB. All Rights Reserved.