org.millstone.webadapter
Class WebPaintTarget

java.lang.Object
  |
  +--org.millstone.webadapter.WebPaintTarget
All Implemented Interfaces:
PaintTarget

public class WebPaintTarget
extends java.lang.Object
implements PaintTarget

User Interface Description Language Target.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Constructor Summary
WebPaintTarget(HttpVariableMap variableMap, UIDLTransformerType type, WebAdapterServlet webAdapterServlet, Theme theme)
          Create a new XMLPrintWriter, without automatic line flushing.
 
Method Summary
 void addAttribute(java.lang.String name, boolean value)
          Adds a boolean attribute to component.
 void addAttribute(java.lang.String name, int value)
          Adds a integer attribute to component.
 void addAttribute(java.lang.String name, long value)
          Adds a long attribute to component.
 void addAttribute(java.lang.String name, Resource value)
          Adds a resource attribute to component.
 void addAttribute(java.lang.String name, java.lang.String value)
          Adds a string attribute to component.
 void addSection(java.lang.String sectionTagName, java.lang.String sectionData)
          Print single text section.
 void addText(java.lang.String str)
          Print XML-escaped text.
 void addUIDL(java.lang.String xml)
          Add XML dirctly to UIDL
 void addUploadStreamVariable(VariableOwner owner, java.lang.String name)
          Add a upload stream type variable.
 void addVariable(VariableOwner owner, java.lang.String name, boolean value)
          Add a boolean type variable.
 void addVariable(VariableOwner owner, java.lang.String name, int value)
          Add a int type variable.
 void addVariable(VariableOwner owner, java.lang.String name, java.lang.String value)
          Add a string type variable.
 void addVariable(VariableOwner owner, java.lang.String name, java.lang.String[] value)
          Add a string array type variable.
 void addXMLSection(java.lang.String sectionTagName, java.lang.String sectionData, java.lang.String namespace)
          Add XML section with namespace
 void close()
          Close the paint target.
 void endTag(java.lang.String tagName)
          Print element end tag.
static java.lang.String escapeXML(java.lang.String xml)
          Substitute the XML sensitive characters with predefined XML entities.
static java.lang.StringBuffer escapeXML(java.lang.StringBuffer xml)
          Substitute the XML sensitive characters with predefined XML entities.
 java.lang.String getUIDL()
          Get the UIDL already printed to stream.
 void startTag(java.lang.String tagName)
          Print element start tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebPaintTarget

public WebPaintTarget(HttpVariableMap variableMap,
                      UIDLTransformerType type,
                      WebAdapterServlet webAdapterServlet,
                      Theme theme)
               throws PaintException
Create a new XMLPrintWriter, without automatic line flushing.

Method Detail

startTag

public void startTag(java.lang.String tagName)
              throws PaintException
Print element start tag.
Todo:
 Checking of input values
 

Specified by:
startTag in interface PaintTarget
Parameters:
tagName - The name of the start tag
PaintException

endTag

public void endTag(java.lang.String tagName)
            throws PaintException
Print element end tag. If the parent tag is closed before every child tag is closed an MillstoneException is raised.

Specified by:
endTag in interface PaintTarget
PaintException

escapeXML

public static java.lang.String escapeXML(java.lang.String xml)
Substitute the XML sensitive characters with predefined XML entities.

Returns:
A new string instance where all occurrences of XML sensitive characters are substituted with entities.

escapeXML

public static java.lang.StringBuffer escapeXML(java.lang.StringBuffer xml)
Substitute the XML sensitive characters with predefined XML entities.

Parameters:
xml - the String to be substituted
Returns:
A new StringBuffer instance where all occurrences of XML sensitive characters are substituted with entities.

addText

public void addText(java.lang.String str)
             throws PaintException
Print XML-escaped text.

Specified by:
addText in interface PaintTarget
Parameters:
str - Text to add
PaintException

addAttribute

public void addAttribute(java.lang.String name,
                         boolean value)
                  throws PaintException
Adds a boolean attribute to component. Atributes must be added before any content is written.

Specified by:
addAttribute in interface PaintTarget
Parameters:
name - Attribute name
value - Attribute value
Returns:
this object
PaintException

addAttribute

public void addAttribute(java.lang.String name,
                         Resource value)
                  throws PaintException
Adds a resource attribute to component. Atributes must be added before any content is written.

Specified by:
addAttribute in interface PaintTarget
Parameters:
name - Attribute name
value - Attribute value
Returns:
this object
PaintException

addAttribute

public void addAttribute(java.lang.String name,
                         int value)
                  throws PaintException
Adds a integer attribute to component. Atributes must be added before any content is written.

Specified by:
addAttribute in interface PaintTarget
Parameters:
name - Attribute name
value - Attribute value
Returns:
this object
PaintException

addAttribute

public void addAttribute(java.lang.String name,
                         long value)
                  throws PaintException
Adds a long attribute to component. Atributes must be added before any content is written.

Specified by:
addAttribute in interface PaintTarget
Parameters:
name - Attribute name
value - Attribute value
Returns:
this object
PaintException

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String value)
                  throws PaintException
Adds a string attribute to component. Atributes must be added before any content is written.

Specified by:
addAttribute in interface PaintTarget
Parameters:
name - Boolean attribute name
value - Boolean attribute value
Returns:
this object
PaintException

addVariable

public void addVariable(VariableOwner owner,
                        java.lang.String name,
                        java.lang.String value)
                 throws PaintException
Add a string type variable.

Specified by:
addVariable in interface PaintTarget
Parameters:
owner - Listener for variable changes
name - Variable name
value - Variable initial value
Returns:
Reference to this.
PaintException

addVariable

public void addVariable(VariableOwner owner,
                        java.lang.String name,
                        int value)
                 throws PaintException
Add a int type variable.

Specified by:
addVariable in interface PaintTarget
Parameters:
owner - Listener for variable changes
name - Variable name
value - Variable initial value
Returns:
Reference to this.
PaintException

addVariable

public void addVariable(VariableOwner owner,
                        java.lang.String name,
                        boolean value)
                 throws PaintException
Add a boolean type variable.

Specified by:
addVariable in interface PaintTarget
Parameters:
owner - Listener for variable changes
name - Variable name
value - Variable initial value
Returns:
Reference to this.
PaintException

addVariable

public void addVariable(VariableOwner owner,
                        java.lang.String name,
                        java.lang.String[] value)
                 throws PaintException
Add a string array type variable.

Specified by:
addVariable in interface PaintTarget
Parameters:
owner - Listener for variable changes
name - Variable name
value - Variable initial value
Returns:
Reference to this.
PaintException

addUploadStreamVariable

public void addUploadStreamVariable(VariableOwner owner,
                                    java.lang.String name)
                             throws PaintException
Add a upload stream type variable.

Specified by:
addUploadStreamVariable in interface PaintTarget
Parameters:
owner - Listener for variable changes
name - Variable name
Returns:
Reference to this.
PaintException

addSection

public void addSection(java.lang.String sectionTagName,
                       java.lang.String sectionData)
                throws PaintException
Print single text section. Prints full text section. The section data is escaped from XML tags and surrounded by XML start and end-tags.

Specified by:
addSection in interface PaintTarget
PaintException

addUIDL

public void addUIDL(java.lang.String xml)
             throws PaintException
Add XML dirctly to UIDL

Specified by:
addUIDL in interface PaintTarget
PaintException

addXMLSection

public void addXMLSection(java.lang.String sectionTagName,
                          java.lang.String sectionData,
                          java.lang.String namespace)
                   throws PaintException
Add XML section with namespace

Specified by:
addXMLSection in interface PaintTarget
PaintException
See Also:
PaintTarget.addXMLSection(String, String, String)

getUIDL

public java.lang.String getUIDL()
Get the UIDL already printed to stream. Paint target must be closed before the getUIDL() cn be called.


close

public void close()
           throws PaintException
Close the paint target. Paint target must be closed before the getUIDL() cn be called. Subsequent attempts to write to paint target. If the target was already closed, call to this function is ignored. will generate an exception.

PaintException


Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.