www.element4solution.com

e4s.html
Interface E4HtmlElement_Intf

All Known Subinterfaces:
E4Fieldset_Intf, E4FieldsetLayout_Intf, E4InputField_Intf, E4Label_Intf
All Known Implementing Classes:
A, A_Email, A_FORM, A_Multiple, A_Name, A_Popup, A_Reference, A_ReturnValue, B, BIG, BLOCKQUOTE, BODY, BUTTON, CENTER, CHECKBOX, CONSTANTFIELD, DATEFIELD, DEL, DIV, E4AjaxElement, E4AjaxElementGeneral, E4AjaxElementInputValueChanger, E4AjaxElementSelectOptionsChanger, E4BasicTextInput, E4BlockMenuElement, E4Box, E4BoxRoundCorners, E4DateElement, E4DivFader, E4DropdownMenu, E4EditingElement, E4EditingFrameset, E4Fieldset, E4FieldsetLayoutedElement, E4FieldsetTabbed, E4FieldsetTable, E4Grid, E4Hint, E4HtmlContent, E4HtmlContentElement, E4HtmlContentElementPersistant, E4HtmlElement, E4HtmlElementGeneralPersistant, E4HtmlElementPersistant, E4InlineEdit, E4InlineEditCached, E4InputField.A_PICK, E4InputList, E4InputMultiState, E4InputMultiValue, E4Label, E4LabelApp, E4LabelData, E4LabelNone, E4LabelSys, E4MenuElement, E4MenuFrameset, E4MenuItem, E4Message, E4MethodInlineElement, E4ModuleCalendar.UpDownSelector, E4ModuleEditingHandling02.buttonLine, E4NoScript, E4SimpleTag, E4SortedList, E4SortedListElement, E4SubEditingBODY, E4SystemError, E4TabbedMenu, E4TabbedMenuElement, E4TreeElement, FILESELECTION, FILEUPLOAD, FLOATFIELD, FONT, FORM, FORM_Button, FORM_Reset, FORM_Submit, FRAME, FRAMESET, HIDDENFIELD, HR, HTML, Hx, I, IFRAME, IMAGEFIELD, IMG, IMG.IMAP, INS, LABEL, LONGFIELD, NOBR, P, PASSWORDFIELD, PRE, SELECT, SMALL, SPAN, STRIKE, TABLE, TABLE.E4TableElement, TABLE.TBODY, TABLE.TFOOT, TABLE.THEAD, TD, TEXTAREA, TEXTFIELD, TR, UL, UL.LI

public interface E4HtmlElement_Intf

Common interface declaration for HTML elements. Basically this implements their sub (child) elements, how to render HTML and Java-Script handling.

Example_HtmlElement_Intf.java

Since:
JDK 1.4

Method Summary
 void addScript(E4HtmlElement_Intf element, E4ServletImplementation_Intf servlet)
          Add the E4JavaScript_Intf entries of the specified element to the current element.
 void addScript(E4JavaScript_Intf scriptname)
          Add this script to the scripts Vector.
 void addScript(E4JavaScript_Intf scriptname, boolean replace)
          Add this script to the scripts Vector.
 void collectScripts(E4ScriptsVec vec, E4ServletImplementation_Intf servlet)
          Get a vector of used scripts.
 void collectStylesForEditing(E4StylesHash v, E4ServletImplementation_Intf servlet)
          Build a list (Vector) with style definitions used so far during display of this page.
 void collectTranslationsForEditing(E4TranslationsVec v, E4ServletImplementation_Intf servlet)
          Build a list (Vector) with text definitions used so far during display of this page for translations
 java.lang.String debugToString(int n)
          Debug only, prints out a structure tree about the object dependencies.
 E4HtmlElement_Intf findElement(java.lang.Class clazz, boolean deeper)
          Find any element in the element vector by the given clazz.
 E4HtmlElement_Intf findElement(int id, boolean deeper)
          Find an element in the element vector by the given id.
 java.util.Enumeration getElements()
          Deprecated.  
 E4ElementsVec getElementsVec()
          The elements Vector.
 E4InputField_Intf getField(E4InputFieldName_Intf fieldname)
          Get the associated object for the specified field.
 int getId()
          Returns the unique identification id for this element.
 java.lang.String getStringContent()
          Get the pure string content of the elements and sub elements, without any tag information.
 boolean isContentClass()
          This function returns false always, except for the collecting class E4HtmlContent which is a special case.
 void removeAll()
          Remove all elements
 void removeElementById(int id)
          Remove an element by it's ID
 void removeElements(java.lang.Class clazz)
          Remove all elements after and including a specified class.
 void set_e4sID(E4ID parent_id)
          Define the parent E4ID
 void setId(int id)
          Sets a unique identification id for this element.
 void setReadOnly(boolean displayonly)
          Run throught all child elements recursivly, and if those elements implement interface E4InputField_Intf then set them to read-only state.
 void setValue(E4CgiParams params)
          Run throught all child elements recursivly, and if those elements implement interface E4InputField_Intf then store the parameter.
 void toHtml_hidden(E4StringBufferHtml buf, E4ServletImplementation_Intf servlet)
           
 void toHtml(E4StringBufferHtml buf, E4ServletImplementation_Intf servlet)
          Create the HTML output for this element.
 boolean validate(E4CgiParams params, E4ServletImplementation_Intf servlet)
          Run throught all child elements, and if those elements implement interface E4InputField_Intf then store the parameter and execute the E4InputField_Intf.validate() function.
 

Method Detail

getElements

java.util.Enumeration getElements()
Deprecated. 

The Enumeration of the elements Vector

Returns:
represents the Enumeration for the elements Vector
See Also:
getElementsVec()

getElementsVec

E4ElementsVec getElementsVec()
The elements Vector.

Returns:
represents the Enumeration for the elements Vector

findElement

E4HtmlElement_Intf findElement(int id,
                               boolean deeper)
Find an element in the element vector by the given id.

Parameters:
id - the unique id to look for. Note that most elements have a value of -1 if undefined, and that there could be multiple elements having the same id (in this case, the first one is returned).
deeper - true: run throught the whole hirachy, false only the current level of child elements
Returns:
the element found of null if not
See Also:
getId(), setId(int), #findElement(Class)

findElement

E4HtmlElement_Intf findElement(java.lang.Class clazz,
                               boolean deeper)
                               throws java.lang.Exception
Find any element in the element vector by the given clazz.

Parameters:
clazz - the class of the element to look for
deeper - true: run throught the whole hirachy, false only the current level of child elements
Returns:
the first element found of null if not
Throws:
java.lang.Exception
See Also:
#findElement(int)

collectScripts

void collectScripts(E4ScriptsVec vec,
                    E4ServletImplementation_Intf servlet)
Get a vector of used scripts.

Parameters:
vec - collect the names of all scripts
servlet - the servlet context

addScript

void addScript(E4JavaScript_Intf scriptname)
Add this script to the scripts Vector. If the script does exist, it is not replaced. Note: a script can only occure once within the scriptvector by the same name.

Parameters:
scriptname - the script to add

addScript

void addScript(E4JavaScript_Intf scriptname,
               boolean replace)
Add this script to the scripts Vector. Note: a script can only occure once within the scriptvector by the same name.

Parameters:
scriptname - the script to add
replace - false: if the script already exists, it is not changed true: in any case the script will be replaced.

addScript

void addScript(E4HtmlElement_Intf element,
               E4ServletImplementation_Intf servlet)
Add the E4JavaScript_Intf entries of the specified element to the current element. This normally happens automatically, as long as HTML elements are linked together using the E4HtmlElement.addElement(e4s.html.E4HtmlElement_Intf) function. But in some cases, this might not be the case but scripts are required in the above element. Propably, this method shall be called after toHtml(e4s.util.E4StringBufferHtml, e4s.servlet.E4ServletImplementation_Intf) as scripts might be added in there latley.

Parameters:
element - element where the scripts shall be taken from
servlet - the servlet context
See Also:
addScript(E4JavaScript_Intf), addScript(E4JavaScript_Intf,boolean), e4s.html.E4HtmlElement_Intf#collectScripts...

toHtml

void toHtml(E4StringBufferHtml buf,
            E4ServletImplementation_Intf servlet)
            throws java.lang.Exception
Create the HTML output for this element. Also run throught all child elements, and call their toHtml(e4s.util.E4StringBufferHtml, e4s.servlet.E4ServletImplementation_Intf) function to generate output of those objects which becomes appended. Normally, there is no need to call this function anyway, and this also might result in side effects of too-early relasing of objects in some cases. This function is called by E4ServletImplementation_Intf.write(e4s.html.E4HtmlElement) on the top level HTML element (common this is a HTML or BODY element) and branches down to all child elements.

Parameters:
servlet - the servlet environment currently running in
Throws:
java.lang.Exception

toHtml_hidden

void toHtml_hidden(E4StringBufferHtml buf,
                   E4ServletImplementation_Intf servlet)
                   throws java.lang.Exception
Throws:
java.lang.Exception

isContentClass

boolean isContentClass()
This function returns false always, except for the collecting class E4HtmlContent which is a special case. It is detected, if it is the end of the elements. If not, such a class is added, othervise only a string is appended. This avoids excessive creation of objects.


debugToString

java.lang.String debugToString(int n)
Debug only, prints out a structure tree about the object dependencies. Should be called with a parameter n = 0 initially


removeAll

void removeAll()
Remove all elements


setId

void setId(int id)
Sets a unique identification id for this element. This value is optional and can be used to identify a particular element by the id which must be unique within the element vector of the above object.

Parameters:
id - the unique identificatin id
See Also:
#findElement(int), removeElementById(int), getId()

getId

int getId()
Returns the unique identification id for this element.

Returns:
the unique identificatin id if defined, -1 if not defined
See Also:
#findElement(int), setId(int)

set_e4sID

void set_e4sID(E4ID parent_id)
Define the parent E4ID

Parameters:
parent_id - the E4ID to be set

collectStylesForEditing

void collectStylesForEditing(E4StylesHash v,
                             E4ServletImplementation_Intf servlet)
Build a list (Vector) with style definitions used so far during display of this page.

Parameters:
v - the Vector where the styles will be collected
servlet - the servlet context
See Also:
E4ServletImplementation_Intf.sessionCanEditStyles()

collectTranslationsForEditing

void collectTranslationsForEditing(E4TranslationsVec v,
                                   E4ServletImplementation_Intf servlet)
Build a list (Vector) with text definitions used so far during display of this page for translations

Parameters:
v - the Vector where the translations will be collected
servlet - the servlet context
See Also:
E4ServletImplementation_Intf.sessionCanEditTranslations()

validate

boolean validate(E4CgiParams params,
                 E4ServletImplementation_Intf servlet)
                 throws java.lang.Exception
Run throught all child elements, and if those elements implement interface E4InputField_Intf then store the parameter and execute the E4InputField_Intf.validate() function.

Parameters:
params - the current cgi parameters
Returns:
true, if all defined validations will return true. false, if at least one validation returns false. Note, that in any case all validations must be performed to set the fields error-messages.
Throws:
java.lang.Exception
See Also:
E4InputField_Intf.validate()

setValue

void setValue(E4CgiParams params)
Run throught all child elements recursivly, and if those elements implement interface E4InputField_Intf then store the parameter.

Parameters:
params - the current cgi parameters
See Also:
E4InputField_Intf.setValue(e4s.html.E4CgiParams), #validate(e4s.html.E4CgiParams)

getField

E4InputField_Intf getField(E4InputFieldName_Intf fieldname)
Get the associated object for the specified field.

Parameters:
fieldname - the name of the field
Returns:
the input field or null if not available

removeElements

void removeElements(java.lang.Class clazz)
Remove all elements after and including a specified class. Example: if your DOM looks like <TABLE><TR><TD><TR><TD> then a call to removeElements(TD.class) would remove both <TD> entries.

Parameters:
clazz - the class to be removed
See Also:
#removeElements()

removeElementById

void removeElementById(int id)
Remove an element by it's ID

Parameters:
id - the ID of the element.
See Also:
setId(int)

setReadOnly

void setReadOnly(boolean displayonly)
Run throught all child elements recursivly, and if those elements implement interface E4InputField_Intf then set them to read-only state.

Parameters:
displayonly - true sets the display-only mode
See Also:
E4InputField_Intf.setReadOnly(boolean)

getStringContent

java.lang.String getStringContent()
Get the pure string content of the elements and sub elements, without any tag information.

Returns:
the pure string content or null if none

www.element4solution.com