org.apache.beehive.netui.tags.html
Class HtmlBaseTag

Object
  extended by TagSupport
      extended by BodyTagSupport
          extended by AbstractClassicTag
              extended by HtmlBaseTag
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, HtmlConstants, IAttributeConsumer, IHtmlAttrs, IHtmlCore, IHtmlEvents, IHtmlI18n, INetuiTag
Direct Known Subclasses:
AnchorBase, Body, Form, HtmlFocusBaseTag, Image, LabelBase, SelectOption

public abstract class HtmlBaseTag
extends AbstractClassicTag
implements HtmlConstants, IAttributeConsumer, IHtmlAttrs

[Base] Anchor, Form, Image, ImageAnchor (Image), Label, SelectOption [FocusBase] Button, CheckBoxOption, ImageButton, RadioButtonOption [DataSource] FileUpload [DefaultableDatSource] CheckBox, TextArea, TextBox [OptionsDataSource] Select [GroupDataSource] CheckBoxGroup, RadioButtonGroup

See Also:
Serialized Form

Field Summary
 
Fields inherited from class AbstractClassicTag
DefaultNamingChain, EMPTY_STRING, NETUI_UNIQUE_CNT
 
Fields inherited from class BodyTagSupport
bodyContent
 
Fields inherited from class TagSupport
id, pageContext
 
Fields inherited from interface HtmlConstants
ABBR, ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, AREA, AXIS, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COLSPAN, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEADERS, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LANGUAGE, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, ROWSPAN, RULES, SCOPE, SCRIPT, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TBODY, TD, TEXT, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
HtmlBaseTag()
           
 
Method Summary
protected  String getJavaScriptAttribute(String name)
           
protected  Form getNearestForm()
          Returns the closest parent form tag, or null if there is none.
 String getOnClick()
          Gets the onClick javascript event.
protected abstract  AbstractHtmlState getState()
          This method will return the state associated with the tag.
 String getTagId()
          Return the ID of the tag.
protected  void localRelease()
          Free the state variables of this base class.
protected  String qualifyUrlToContext(String url)
          This method will take any absolute URL that doesn't contain the scheme part and append the context path.
protected  String renderDefaultNameAndId(HttpServletRequest request, AbstractHtmlState state, String id, String name)
           
protected  String renderNameAndId(HttpServletRequest request, AbstractHtmlState state, Form parentForm)
          Assumptions: The state.name must be fully formed or the "real name" of the form.
 void setAttribute(String name, String value, String facet)
          Base support for the attribute tag.
 void setDir(String dir)
          Sets the lang attribute for the HTML element.
 void setLang(String lang)
          Sets the lang attribute for the HTML element.
 void setOnClick(String onclick)
          Sets the onClick javascript event.
 void setOnDblClick(String ondblclick)
          Sets the onDblClick javascript event.
 void setOnKeyDown(String onkeydown)
          Sets the onKeyDown javascript event.
 void setOnKeyPress(String onkeypress)
          Sets the onKeyPress javascript event.
 void setOnKeyUp(String onkeyup)
          Sets the onKeyUp javascript event.
 void setOnMouseDown(String onmousedown)
          Sets the onMouseDown javascript event.
 void setOnMouseMove(String onmousemove)
          Sets the onMouseMove javascript event.
 void setOnMouseOut(String onmouseout)
          Sets the onMouseOut javascript event.
 void setOnMouseOver(String onmouseover)
          Sets the onMouseOver javascript event.
 void setOnMouseUp(String onmouseup)
          Sets the onMouseUp javascript event.
protected  void setStateAttribute(String name, String value, AbstractHtmlState tsh)
          Attribute implementation.
 void setStyle(String style)
          Sets the style of the rendered html tag.
 void setStyleClass(String styleClass)
          Sets the style class of the rendered html tag.
 void setTagId(String tagId)
          Set the ID of the tag.
 void setTitle(String title)
          Sets the value of the title attribute.
 
Methods inherited from class AbstractClassicTag
applyNamingChain, getErrorsReport, getIdForTagId, getNamingChain, getNextId, getScriptReporter, getTagName, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class BodyTagSupport
doAfterBody, doEndTag, doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Tag
getParent, setPageContext, setParent
 

Constructor Detail

HtmlBaseTag

public HtmlBaseTag()
Method Detail

getState

protected abstract AbstractHtmlState getState()
This method will return the state associated with the tag. This is used by this base class to access the individual state objects created by the tags.

Returns:
a subclass of the AbstractHtmlState class.

setStyle

public void setStyle(String style)
Sets the style of the rendered html tag.

Specified by:
setStyle in interface IHtmlCore
Parameters:
style - - the html style.

setStyleClass

public void setStyleClass(String styleClass)
Sets the style class of the rendered html tag.

Specified by:
setStyleClass in interface IHtmlCore
Parameters:
styleClass - - the html style class.

setTagId

public void setTagId(String tagId)
              throws JspException
Set the ID of the tag.

Specified by:
setTagId in interface IHtmlCore
Parameters:
tagId - - the tagId. A value is required.
Throws:
JspException

getTagId

public String getTagId()
Return the ID of the tag. The id may be rewritten by the container (such as a portal) to make sure it is unique. JavaScript my lookup the actual id of the element by looking it up in the netui_names table written into the HTML.

Returns:
the tagId.

setTitle

public void setTitle(String title)
Sets the value of the title attribute.

Specified by:
setTitle in interface IHtmlCore
Parameters:
title -

setLang

public void setLang(String lang)
Sets the lang attribute for the HTML element.

Specified by:
setLang in interface IHtmlI18n
Parameters:
lang -

setDir

public void setDir(String dir)
Sets the lang attribute for the HTML element.

Specified by:
setDir in interface IHtmlI18n
Parameters:
dir -

getOnClick

public String getOnClick()
Gets the onClick javascript event.

Returns:
the onClick event.

setOnClick

public void setOnClick(String onclick)
Sets the onClick javascript event.

Specified by:
setOnClick in interface IHtmlEvents
Parameters:
onclick - - the onClick event.

setOnDblClick

public void setOnDblClick(String ondblclick)
Sets the onDblClick javascript event.

Specified by:
setOnDblClick in interface IHtmlEvents
Parameters:
ondblclick - - the onDblClick event.

setOnKeyDown

public void setOnKeyDown(String onkeydown)
Sets the onKeyDown javascript event.

Specified by:
setOnKeyDown in interface IHtmlEvents
Parameters:
onkeydown - - the onKeyDown event.

setOnKeyPress

public void setOnKeyPress(String onkeypress)
Sets the onKeyPress javascript event.

Specified by:
setOnKeyPress in interface IHtmlEvents
Parameters:
onkeypress - - the onKeyPress event.

setOnKeyUp

public void setOnKeyUp(String onkeyup)
Sets the onKeyUp javascript event.

Specified by:
setOnKeyUp in interface IHtmlEvents
Parameters:
onkeyup - - the onKeyUp event.

setOnMouseDown

public void setOnMouseDown(String onmousedown)
Sets the onMouseDown javascript event.

Specified by:
setOnMouseDown in interface IHtmlEvents
Parameters:
onmousedown - - the onMouseDown event.

setOnMouseMove

public void setOnMouseMove(String onmousemove)
Sets the onMouseMove javascript event.

Specified by:
setOnMouseMove in interface IHtmlEvents
Parameters:
onmousemove - - the onMouseMove event.

setOnMouseOut

public void setOnMouseOut(String onmouseout)
Sets the onMouseOut javascript event.

Specified by:
setOnMouseOut in interface IHtmlEvents
Parameters:
onmouseout - - the onMouseOut event.

setOnMouseOver

public void setOnMouseOver(String onmouseover)
Sets the onMouseOver javascript event.

Specified by:
setOnMouseOver in interface IHtmlEvents
Parameters:
onmouseover - - the onMouseOver event.

setOnMouseUp

public void setOnMouseUp(String onmouseup)
Sets the onMouseUp javascript event.

Specified by:
setOnMouseUp in interface IHtmlEvents
Parameters:
onmouseup - - the onMouseUp event.

getJavaScriptAttribute

protected String getJavaScriptAttribute(String name)

setStateAttribute

protected void setStateAttribute(String name,
                                 String value,
                                 AbstractHtmlState tsh)
                          throws JspException
Attribute implementation.

Parameters:
name -
value -
tsh -
Throws:
JspException

setAttribute

public void setAttribute(String name,
                         String value,
                         String facet)
                  throws JspException
Base support for the attribute tag. This requires that the tag buffer their body and write attribute in the end tag. For the HTML tags it is not legal to set the id or name attributes. In addition, the base tag does not allow facets to be set. If the attribute is legal it will be added to the general expression map stored in the AbstractHtmlState of the tag.

Specified by:
setAttribute in interface IAttributeConsumer
Parameters:
name - The name of the attribute. This value may not be null or the empty string.
value - The value of the attribute. This may contain an expression.
facet - The name of a facet to which the attribute will be applied. This is optional.
Throws:
JspException - A JspException may be thrown if there is an error setting the attribute.

getNearestForm

protected Form getNearestForm()
Returns the closest parent form tag, or null if there is none.


renderNameAndId

protected final String renderNameAndId(HttpServletRequest request,
                                       AbstractHtmlState state,
                                       Form parentForm)
Assumptions:

Parameters:
state -
parentForm -
Returns:

renderDefaultNameAndId

protected String renderDefaultNameAndId(HttpServletRequest request,
                                        AbstractHtmlState state,
                                        String id,
                                        String name)

localRelease

protected void localRelease()
Free the state variables of this base class.

Overrides:
localRelease in class AbstractClassicTag

qualifyUrlToContext

protected String qualifyUrlToContext(String url)
This method will take any absolute URL that doesn't contain the scheme part and append the context path. In other words, if the URL starts with '/' and the context path isn't present it will be added.

Parameters:
url - The url to be added.
Returns:
a url with the context path if the url begins with '/' otherwise the unchanged url.