|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sssw.shr.page.AgpTag | +--com.sssw.shr.page.AgpControlBase | +--com.sssw.shr.page.AgpHTMLControl
The HTML control is the counterpart of the HTML edit control in the Java form environment.
The HTML control allows dynamic HTML content to be embedded into a page. The HTML may be taken from a database or it may be dynamically generated. The data can be a complete HTML file or a run of HTML snippet.
If the data is a complete HTML file, the HTML control optionally performs special processing on the HTML data so that it incorporates into the page correctly. For example, it can remove the header and footer of the embedded HTML file. The HTML control can also show the background color of the embedded file by setting the option of embedding the HTML in a table.
On the other hand, if all the application wants is some way to insert some raw HTML into the page, both options can be set to false. In that case, the content will be incoporated into the page without any further processing.
Note that unlike the HTML edit control in the form environment, this HTML control can only present the HTML. However, an application can use it together with the file upload control to provide an interactive way for the user to enter HTML data to a database. Refer to the example found in the openValueWriter method.
Fields inherited from class com.sssw.shr.page.AgpTag |
UNIT_PERCENT,
UNIT_PIXEL |
Constructor Summary | |
AgpHTMLControl()
|
Method Summary | |
void |
closeValueWriter()
Closes the value writer previously opened. |
AgpPage |
getContent()
Returns the HTML data of the control as a page. |
boolean |
getEmbedHTMLInTable()
Returns true if the subpage or HTML control should be embedded in a table. |
boolean |
getEnableHTMLParsing()
Returns whether the content should be parsed. |
int |
getHeight()
Returns the height of the control in pixels. |
String |
getValue()
Returns the HTML data of this control. |
int |
getWidth()
Returns the width of the control in pixels. |
PrintWriter |
openValueWriter()
Opens a writer for the value of the HTML control. |
void |
setEmbedHTMLInTable(boolean embed)
Specifies whether the subpage or HTML control should be embedded in a table. |
void |
setEnableHTMLParsing(boolean raw)
Specifies whether the content should be parsed. |
void |
setHeight(int height)
Sets the Height property of the control in pixels. |
void |
setValue(String value)
Sets the HTML data of this control. |
void |
setWidth(int width)
Sets the width of the control in pixels. |
Methods inherited from class com.sssw.shr.page.AgpControlBase |
getName |
Methods inherited from class com.sssw.shr.page.AgpTag |
getBoolProperty,
getEnableHTMLGeneration,
getIntArrayProperty,
getIntProperty,
getIntPropertyUnit,
getProperty,
getStringArrayProperty,
invalidateHTML,
removeProperty,
setEnableHTMLGeneration,
setIntProperty,
setProperty |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Methods implemented from interface com.sssw.shr.page.AgiJavaScriptEnhanced |
generateFunction,
generateRepaintScript,
generateScriptInitializers,
getFunctionNameForMethod,
getFunctionNames,
getMethodNames,
getScriptObjectName,
isHTMLRepaintPending,
isJavaScriptRepaintPending |
Methods implemented from interface com.sssw.shr.page.AgiPageControl |
generateHTML,
getPrefix,
notifyPageLoaded,
notifyPageRequestBegin,
notifyPageRequestEnd,
notifyPostValue,
notifyPostValues |
Methods implemented from interface java.io.Externalizable |
readExternal,
writeExternal |
Constructor Detail |
public AgpHTMLControl()
Method Detail |
public boolean getEmbedHTMLInTable()
AgpHTMLControl.setEmbedHTMLInTable(boolean embed)
public void setEmbedHTMLInTable(boolean embed)
embed
- true
to embed the
subpage or HTML control in a table, or
false
to make it "free-flow" into
the text.AgpHTMLControl.getEmbedHTMLInTable()
public int getWidth()
The dimension of the control is meaningful only if the control has EmbedHTMLInTable set.
AgpHTMLControl.setWidth(int width)
public void setWidth(int width)
width
- the number of pixels in the width.The dimension of the control is meaningful only if the control has EmbedHTMLInTable set.
AgpHTMLControl.getWidth()
public int getHeight()
The dimension of the control is meaningful only if the control has EmbedHTMLInTable set.
AgpHTMLControl.setHeight(int height)
public void setHeight(int height)
height
- the number of pixels in the height.The dimension of the control is meaningful only if the control has EmbedHTMLInTable set.
AgpHTMLControl.getHeight()
public String getValue()
AgpHTMLControl.setValue(String value)
public void setValue(String value)
value
- a string representing the value.AgpHTMLControl.getValue()
public boolean getEnableHTMLParsing()
AgpHTMLControl.setEnableHTMLParsing(boolean raw)
public void setEnableHTMLParsing(boolean raw)
raw
- true
if the content
should be parsed, otherwise false
.If EnableHTMLParsing is set, the HTML data is processed like an AgpPage. In general, set this to false if a snippet of dynamically generated HTML is the value of the control.
AgpHTMLControl.getEnableHTMLParsing()
public AgpPage getContent() throws ServletException, IOException
In order for getContent() to work, the control must have EnableHTMLParsing set. Otherwise, getContent() returns null.
public PrintWriter openValueWriter()
Assuming the users have some tools to create HTML files, the file upload control is a convenient way to get HTML files from the user. The following code fragment reads the content from a file upload event, treats it as an HTML file encoded in a specific charset, and sets the HTML to an HTML control. The user will see the content of the uploaded HTML file through the control.
AgpFileUploadEvent evt = ... AgpHTMLControl htmlcontrol = ... byte binary_content[] = evt.getContent(); ByteArrayInputStream binary_stream = new ByteArrayInputStream(binary_content); InputStreamReader reader = new InputStreamReader(binary_stream, "cp1252"); PrintWriter writer = htmlcontrol.openValueWriter(); char c = reader.read(); while (c != -1) { writer.write((char) c); c = reader.read(); } htmlcontrol.closeValueWriter();
AgpHTMLControl.closeValueWriter()
public void closeValueWriter()
AgpHTMLControl.openValueWriter()
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |