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

Object
  extended by TagSupport
      extended by BodyTagSupport
          extended by AbstractClassicTag
              extended by ScriptContainer
                  extended by Html
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, IErrorReporter, INetuiTag, IScriptReporter

public class Html
extends ScriptContainer
implements IErrorReporter

Generates the html element and performs error handling within its body.

See Also:
Serialized Form
Example
In this sample, the <netui:html> tag uses the default locale and the direction of the HTML is left-to-right (LTR).
<netui:html dir="LTR" useLocale="true"  />

JavaScript

The <netui:html> tag writes out the following JavaScript functions:

 function getNetuiTagName(id) {
     return netui_names[id]; }

 function getNetuiTagName(id, tag) {
     if (scopeId == "")
         return netui_names[id];
     else
         return netui_names[portletId__id]; }

 function getIdScope(tag) {
     if (tag == null) return "";
     if (tag.scopeId != null) return tag.scopeId;
         return getIdScope(tag.parentElement); }

 results.append("\nfunction getNetuiTagName(id) {\n");
      results.append("\treturn ");
      results.append(NAMES_OBJECT);
      results.append("[id]; }\n\n");

      results.append("\nfunction getNetuiTagName(id, tag) {\n");
      results.append("\tvar scopeId = getIdScope(tag);\n");
      results.append("\tif (scopeId == \"\")\n");
      results.append("\t\treturn ");
      results.append(NAMES_OBJECT);
      results.append("[id];\n");
      results.append("\telse\n\t\treturn ");
      results.append(NAMES_OBJECT);
      results.append("[portletId + \"__\" + id]; }\n\n");

      results.append("\nfunction getIdScope(tag) {\n");
      results.append("\tif (tag == null) return \"\";\n");
      results.append("\tif (tag.scopeId != null) return tag.scopeId;\n");
      results.append("\treturn getIdScope(tag.parentElement);\n}\n\n");
 

Field Summary
static String DOC_TYPE_OVERRIDE
          This is an override of the Document type set in the request
static String HTML_401
          Constant representing the document type html 4.01
static String HTML_401_QUIRKS
          Constant representing the document type html 4.01
static String HTML_TAG_ID
          The HTML tag is registered into the request with this name.
static String XHTML_10
          Constant representing the document type XHTML 1.0 Transitional.
 
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 IErrorReporter
CONTAINER_ERRORS
 
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
Html()
           
 
Method Summary
 void addError(AbstractPageError ape)
          Add an error to the errors being reported by this tag.
protected  Locale currentLocale()
          Return the current Locale for this request, creating a new one if necessary.
 int doEndTag()
          Write out the body content and report any errors that occured.
 int doStartTag()
           
 void endScope(WriteRenderAppender _writer)
          This will close the HTML div associated with the idScope.
 String getTagName()
          Returns the name of the Tag.
 int getTargetDocumentType()
          This method will return the TagRenderBase enum value for the document type.
 boolean isReporting()
          This boolean indicates if an ErrorReporter is reporting errors or not.
 boolean isUseLocale()
          Gets whether the default locale's language should be used.
protected  void localRelease()
          Release any acquired resources.
 ArrayList returnErrors()
          Return an ArrayList of the errors
 void setDir(String dir)
          Sets the dir value of the html.
 void setDocumentType(String docType)
           
 void setUseLocale(boolean locale)
          Sets whether the default locale's language should be used.
 
Methods inherited from class ScriptContainer
addLegacyTagIdMappings, addScriptFunction, addTagIdMappings, getIdScope, getRealIdScope, setGenerateIdScope, setIdScope, writeAfterBlocks, writeBeforeBlocks, writeFrameworkScript, writeScript
 
Methods inherited from class AbstractClassicTag
applyNamingChain, getErrorsReport, getIdForTagId, getNamingChain, getNextId, getScriptReporter, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class BodyTagSupport
doAfterBody, doInitBody, 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
 

Field Detail

HTML_TAG_ID

public static final String HTML_TAG_ID
The HTML tag is registered into the request with this name. This allows tags reporting errors to find the top level ErrorReporter.

See Also:
Constant Field Values

DOC_TYPE_OVERRIDE

public static final String DOC_TYPE_OVERRIDE
This is an override of the Document type set in the request

See Also:
Constant Field Values

HTML_401

public static final String HTML_401
Constant representing the document type html 4.01

See Also:
Constant Field Values

HTML_401_QUIRKS

public static final String HTML_401_QUIRKS
Constant representing the document type html 4.01

See Also:
Constant Field Values

XHTML_10

public static final String XHTML_10
Constant representing the document type XHTML 1.0 Transitional.

See Also:
Constant Field Values
Constructor Detail

Html

public Html()
Method Detail

getTagName

public String getTagName()
Returns the name of the Tag.

Specified by:
getTagName in interface INetuiTag
Overrides:
getTagName in class ScriptContainer
Returns:
the name of the tag.

getTargetDocumentType

public int getTargetDocumentType()
This method will return the TagRenderBase enum value for the document type. The default value is HTML 4.01.

Returns:
int

setDir

public void setDir(String dir)
Sets the dir value of the html.

Parameters:
dir - - "LTR" or "RTL"

isUseLocale

public boolean isUseLocale()
Gets whether the default locale's language should be used.

Returns:
true or false

setUseLocale

public void setUseLocale(boolean locale)
Sets whether the default locale's language should be used.

Parameters:
locale - - true or false

setDocumentType

public void setDocumentType(String docType)

doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class ScriptContainer
Throws:
JspException

doEndTag

public int doEndTag()
             throws JspException
Write out the body content and report any errors that occured.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class ScriptContainer
Throws:
JspException - if a JSP exception has occurred

endScope

public void endScope(WriteRenderAppender _writer)
This will close the HTML div associated with the idScope. This may be called by the Body tag so the div ends before the body ends.

Parameters:
_writer - a writer to write the close tag into

addError

public void addError(AbstractPageError ape)
Add an error to the errors being reported by this tag.

Specified by:
addError in interface IErrorReporter
Parameters:
ape - - The AbstractPageError to add

returnErrors

public ArrayList returnErrors()
Return an ArrayList of the errors

Specified by:
returnErrors in interface IErrorReporter
Returns:
an ArrayList of all errors.

isReporting

public boolean isReporting()
This boolean indicates if an ErrorReporter is reporting errors or not. The caller should check this before calling addError because the ErrorReporter may be off for some reason.

Specified by:
isReporting in interface IErrorReporter
Returns:
a boolean indicating if the tag is reporting errors or not.

currentLocale

protected Locale currentLocale()
Return the current Locale for this request, creating a new one if necessary. If there is no current Locale, and locale support is not requested, return null.


localRelease

protected void localRelease()
Release any acquired resources.

Overrides:
localRelease in class ScriptContainer