IHTMLWriter Interface

com.bea.ide.jspdesigner
IHTMLWriter Interface

public interface IHTMLWriter

Interface passed to custom tag renderers during HTML rendering process. Tags renderer themselves as HTML using this interface.

Related Topics

IHTMLWriter

Method Summary

public void
createDropPoint(IDOMNode nodeParent)
Causes the current tag to become a drop point which inserts into the specified node.
public void
createVirtualDropPoint(IDOMNode nodeParent, IDOMNode nodeParentVirtual)
Causes the current tag to become a drop point which inserts into nodeParentVirtual which in turn gets appended to nodeParent.
public String
escapeHTML(String str)
Escapes a string for output in an HTML document.
public String
extractFile(URL urlSrc)
Extracts a file from the specified location to the temporary directory, and returns the URL to that file, or null.
public IDOMDocument
getActiveDocument()
Returns the document which is actually the one being currently designed.
public String
getCurrentAttribute()
Returns the name of the current attribute that the HTML is inside, or null if not currently inside of an attribute.
public Object
getProperty(Object key)
Retrieves the value of a property.
public boolean
includeFile(URI uri)
Includes the contents of another file in the output.
public boolean
isSafeForTag(String strTagName)
Returns true if the specified tag can be output at this point.
public String
mapURL(String strSrc)
Takes an URL which is relative to the document, and maps it to a local file system URL.
public void
onExpression()
Notifies the IHTMLWriter that an expression appears at this point in the document.
public URI
pageRelativeURI(String str)
Maps a page-relative URI to an absolute URI.
public Object
setProperty(Object key, Object value)
Allows setting of properties for cross-renderer communication The key can be anything, but typically is equal to value.getClass().
public boolean
showScripts(IDOMNode node)
Determines if scripting/design information should be shown for a particular node.
public boolean
showTableBorders(IDOMNode node)
Determines if renderers should display table borders for a particular node.
public boolean
showTags(IDOMNode node)
Determines if renderers should show tags names when rendering design elements.
public void
write(String str)
Outputs a string to the HTML stream.
public void
writeChildren(IDOMNode node)
Writes out an HTML representation of all the children of the specified node.
public void
writeNode(IDOMNode node)
Writes out an HTML representation of the specified node.

Method Detail

createDropPoint(IDOMNode) Method

public void createDropPoint(IDOMNode nodeParent)
Causes the current tag to become a drop point which inserts into the specified node.

Parameters

nodeParent
DOM node into which drops should be inserted.

createVirtualDropPoint(IDOMNode, IDOMNode) Method

public void createVirtualDropPoint(IDOMNode nodeParent, 
                                   IDOMNode nodeParentVirtual)
Causes the current tag to become a drop point which inserts into nodeParentVirtual which in turn gets appended to nodeParent. nodeParentVirtual should be a node in the same document as nodeParent which has not yet been added to the tree.

Parameters

nodeParent
DOM node into which drops should be inserted.
nodeParentVirtual
Virtual parent into which drops are made.

escapeHTML(String) Method

public String escapeHTML(String str)
Escapes a string for output in an HTML document. Reserved HTML characters such as <, >, &, " and ' are escaped so as to not cause invalid HTML to be produced.

Parameters

str
String to be escaped.

Returns

str in escaped HTML format.

extractFile(URL) Method

public String extractFile(URL urlSrc)
Extracts a file from the specified location to the temporary directory, and returns the URL to that file, or null.

Parameters

urlSrc
URL of source file to be extracted.

Returns

Absolute path to extracted file. null if file not extracted.

getActiveDocument() Method

public IDOMDocument getActiveDocument()
Returns the document which is actually the one being currently designed. Use this to decide whether or not to output placeholder images.

Returns

Reference to DOM document being renderered.

getCurrentAttribute() Method

public String getCurrentAttribute()
Returns the name of the current attribute that the HTML is inside, or null if not currently inside of an attribute.

Returns

Name of current HTML attribute.

getProperty(Object) Method

public Object getProperty(Object key)
Retrieves the value of a property.

Parameters

key
Property key to lookup.

Returns

Value of property key.

Related Topics

IHTMLWriter.setProperty(Object, Object)


includeFile(URI) Method

public boolean includeFile(URI uri)
Includes the contents of another file in the output. Clicking on that portion of the output will result in the specified file being selected as a whole. Individual elements will not be selectable.

Parameters

uri
URI of the document to be displayed. Only documents in the current project can be displayed.

Returns

true if the document was able to be displayed. False if not (so that the caller can display a placeholder icon instead).

isSafeForTag(String) Method

public boolean isSafeForTag(String strTagName)
Returns true if the specified tag can be output at this point. False if not, (e.g. because we're inside of an attribute, or not in the <body>, or inside of a <tr>, etc.

Parameters

strTagName
Name of tag.

Returns

true if writer state is safe for strTagName tag.

mapURL(String) Method

public String mapURL(String strSrc)
Takes an URL which is relative to the document, and maps it to a local file system URL. The file referred to by strSrc is not moved.

Parameters

strSrc
Source URL to be mapped to a local file.

Returns

Absolute path of mapped URL.

onExpression() Method

public void onExpression()
Notifies the IHTMLWriter that an expression appears at this point in the document. If appropriate, the IHTMLWriter will fix up the value of the current attribute (such as, for <img src="{expression}">, it will change the 'src' attribute to point to valid placeholder image.


pageRelativeURI(String) Method

public URI pageRelativeURI(String str)
Maps a page-relative URI to an absolute URI.

Parameters

str
Page relative URI to map.

Returns

Absolute URI, null if str is not a project file.

setProperty(Object, Object) Method

public Object setProperty(Object key, 
                          Object value)
Allows setting of properties for cross-renderer communication The key can be anything, but typically is equal to value.getClass(). Returns the previous value of the property, or null if the property was not set before. Renderers should use this to store rendering state information, using this.getClass() as the property key.

Parameters

key
Property key.
value
Property value.

Returns

Previous property value, null if not set.

Related Topics

IHTMLWriter.getProperty(Object)


showScripts(IDOMNode) Method

public boolean showScripts(IDOMNode node)
Determines if scripting/design information should be shown for a particular node. Explicitly returns false for nodes that aren't from the active document, e.g. nodes from includes.

Parameters

node
Node to examine.

Returns

true if renderer should show Jsp script elements or design time wysiwyg type helpers.

Related Topics

IHTMLWriter.showTableBorders(IDOMNode)
IHTMLWriter.showTags(IDOMNode)


showTableBorders(IDOMNode) Method

public boolean showTableBorders(IDOMNode node)
Determines if renderers should display table borders for a particular node. Explicitly returns false for nodes that aren't from the active document, e.g. nodes from includes.

Parameters

node
Node to examine.

Returns

true if renderer should draw table borders.

Related Topics

IHTMLWriter.showScripts(IDOMNode)
IHTMLWriter.showTags(IDOMNode)


showTags(IDOMNode) Method

public boolean showTags(IDOMNode node)
Determines if renderers should show tags names when rendering design elements.

Parameters

node
Node to examine.

Returns

true if renderer should show tag names for node.

Related Topics

IHTMLWriter.showScripts(IDOMNode)
IHTMLWriter.showTableBorders(IDOMNode)


write(String) Method

public void write(String str)
Outputs a string to the HTML stream. String contents are not escaped when written to the HTML stream.

Parameters

str
String to write to the HTML stream.

writeChildren(IDOMNode) Method

public void writeChildren(IDOMNode node)
Writes out an HTML representation of all the children of the specified node.

Parameters

node
Node whose children should be written as HTML.

writeNode(IDOMNode) Method

public void writeNode(IDOMNode node)
Writes out an HTML representation of the specified node. If the user clicks on the HTML in the designer, then the node which generated that HTML will be selected.

Parameters

node
Node to be write as HTML.