|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prosyst.util.template.HTMLTemplateFileImpl
public class HTMLTemplateFileImpl
A class, representing a layer of abstraction for a HTML Template file The HTML template file is a text file containing HTML text with labels in the place(s) where runtime info will be inserted. A label has the following format - $LABEL_NAME$. The LABEL_NAME can be any String. Two labels can have the same name. This class is used in the following way: First, an HTMLTemplate object is created from the template file. This object contains the parsed image of the template. Then every time the page is to be sent to a user, a new TemplateWriter object is got from the HTMLTemplate object with the writer from the current response. The writeToNextLabel() method of this TemplateWriter is called repeatedly to write all the staic HTML content, while between the calls the servlet generates only the corresponding runtime info.
| Constructor Summary | |
|---|---|
HTMLTemplateFileImpl(java.net.URL url,
java.lang.String[][] initLabels,
org.osgi.framework.BundleContext bc)
This method prepares a template for use. |
|
| Method Summary | |
|---|---|
void |
close()
Cleans up any internal data, connections, etc. |
void |
close(boolean closeFs)
|
java.lang.String |
getElementAt(int position)
Returns the element in the given position in the template. |
int |
getLength()
Returns the number of pieces the template was separated into (the number of constant HTML pieces + the number of labels) |
TemplateWriter |
getTemplateWriter(java.io.PrintWriter writer)
Creates a new TemplateWriter with initialized writer and internal pointer. |
void |
templateWriterFinished(TemplateWriter tw)
Called to notify the template that the work with one of the writers was finished. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HTMLTemplateFileImpl(java.net.URL url,
java.lang.String[][] initLabels,
org.osgi.framework.BundleContext bc)
throws java.lang.Exception
url - An input stream to read the template from.initLabels - A String[][] containing the labels to be replaced directly
after loading the template. If null no labels will be replaced.
The syntax is [[label1, value1], [label2, value2],... [labeln, valuen]]
java.lang.Exception| Method Detail |
|---|
public TemplateWriter getTemplateWriter(java.io.PrintWriter writer)
getTemplateWriter in interface HTMLTemplatepublic void templateWriterFinished(TemplateWriter tw)
HTMLTemplate
templateWriterFinished in interface HTMLTemplatepublic void close()
HTMLTemplate
close in interface HTMLTemplate
public void close(boolean closeFs)
throws java.io.IOException
java.io.IOExceptionpublic int getLength()
getLength in interface HTMLTemplatepublic java.lang.String getElementAt(int position)
getElementAt in interface HTMLTemplateposition - The position of the element.
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||