com.sun.rave.web.ui.model
Class Markup

java.lang.Object
  extended bycom.sun.rave.web.ui.model.Markup
Direct Known Subclasses:
ScriptMarkup

public class Markup
extends java.lang.Object

Utility bean that serves as an accumulating buffer for well formed markup fragments typically generated by renderers. The fundamental API is modelled after ResponseWriter in JavaServer Faces.


Constructor Summary
Markup()
           
 
Method Summary
 void clear()
          Clear any accumulated markup stored in this object, making it suitable for reuse.
protected  void close()
          Close the currently open starting element, if any.
 void endElement(java.lang.String name)
          Accumulate the end of an element, after closing any open element created by a call to startElement().
 java.lang.String getEncoding()
          Return the character encoding assumed to be used when the markup contained in this instance is ultimately rendered.
 java.lang.String getMarkup()
          Return the markup that has been accumulated in this element, as a String suitable for direct transcription to the response buffer.
protected  void hexadecimal(int i)
          Append the hexadecimal equivalent of the specified numeric value.
protected  void hexadecimals(char ch)
          Append the specified character as an escaped two-hex-digit value.
protected  void numeric(char ch)
          Append a numeric escape for the specified character.
 void setEncoding(java.lang.String encoding)
          Set the character encoding assumed to be used when the markup contained in this instance is ultimately rendered.
 void startElement(java.lang.String name, javax.faces.component.UIComponent component)
          Accumulate the start of a new element, up to and including the element name.
 java.lang.String toString()
          Return the markup that has been accumulated in this element.
 void writeAttribute(java.lang.String name, java.lang.Object value, java.lang.String property)
          Accumulate an attribute name and corresponding value.
 void writeComment(java.lang.Object comment)
          Accumulate a comment containing the specified text, after converting that text to a String (if necessary) and performing any escaping appropriate for the markup language being rendered.
 void writeRaw(java.lang.Object raw, java.lang.String property)
          Accumulate an object, after converting it to a String (if necessary) WITHOUT performing escaping appropriate for the markup language being rendered.
 void writeText(java.lang.Object text, java.lang.String property)
          Accumulate an object, after converting it to a String (if necessary) and after performing any escaping appropriate for the markup language being rendered.
 void writeURIAttribute(java.lang.String name, java.lang.Object value, java.lang.String property)
          Accumulate an attribute name and corresponding URI value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Markup

public Markup()
Method Detail

getEncoding

public java.lang.String getEncoding()

Return the character encoding assumed to be used when the markup contained in this instance is ultimately rendered.


setEncoding

public void setEncoding(java.lang.String encoding)

Set the character encoding assumed to be used when the markup contained in this instance is ultimately rendered.

Parameters:
encoding - The new character encoding

getMarkup

public java.lang.String getMarkup()

Return the markup that has been accumulated in this element, as a String suitable for direct transcription to the response buffer.


clear

public void clear()

Clear any accumulated markup stored in this object, making it suitable for reuse.


toString

public java.lang.String toString()

Return the markup that has been accumulated in this element. This is an alias for the getMarkup() method.


startElement

public void startElement(java.lang.String name,
                         javax.faces.component.UIComponent component)

Accumulate the start of a new element, up to and including the element name. Once this method has been called, clients can call writeAttribute() or writeURIAttriute() to add attributes and their corresponding values. The starting element will be closed on any subsequent call to startElement(), writeComment(), writeText(), writeRaw(), endElement(), or getMarkup().

Parameters:
name - Name of the element to be started
component - The UIComponent (if any) to which this element corresponds
Throws:
java.lang.NullPointerException - if name is null

endElement

public void endElement(java.lang.String name)

Accumulate the end of an element, after closing any open element created by a call to startElement(). Elements must be closed in the inverse order from which they were opened; it is an error to do otherwise.

Parameters:
name - Name of the element to be ended
Throws:
java.lang.NullPointerException - if name is null

writeAttribute

public void writeAttribute(java.lang.String name,
                           java.lang.Object value,
                           java.lang.String property)

Accumulate an attribute name and corresponding value. This method may only be called after a call to startElement() and before the opened element has been closed.

Parameters:
name - Attribute name to be added
value - Attribute value to be added
property - Name of the component property or attribute (if any) of the UIComponent associated with the containing element, to which the generated attribute corresponds
Throws:
java.lang.IllegalStateException - if this method is called when there is no currently open element
java.lang.NullPointerException - if name or value is null

writeURIAttribute

public void writeURIAttribute(java.lang.String name,
                              java.lang.Object value,
                              java.lang.String property)

Accumulate an attribute name and corresponding URI value. This method may only be called after a call to startElement() and before the opened element has been closed.

Parameters:
name - Attribute name to be added
value - Attribute value to be added
property - Name of the component property or attribute (if any) of the UIComponent associated with the containing element, to which the generated attribute corresponds
Throws:
java.lang.IllegalStateException - if this method is called when there is no currently open element
java.lang.NullPointerException - if name or value is null

writeComment

public void writeComment(java.lang.Object comment)

Accumulate a comment containing the specified text, after converting that text to a String (if necessary) and performing any escaping appropriate for the markup language being rendered.

If there is an open element that has been created by a call to startElement(), that element will be closed first.

Parameters:
comment - Text content of the comment
Throws:
java.lang.NullPointerException - if comment is null

writeRaw

public void writeRaw(java.lang.Object raw,
                     java.lang.String property)

Accumulate an object, after converting it to a String (if necessary) WITHOUT performing escaping appropriate for the markup language being rendered.

If there is an open element that has been created by a call to startElement(), that element will be closed first.

Parameters:
raw - Raw content to be written
property - Name of the component property or attribute (if any) of the UIComponent associated with the containing element, to which the generated content corresponds
Throws:
java.lang.NullPointerException - if text is null

writeText

public void writeText(java.lang.Object text,
                      java.lang.String property)

Accumulate an object, after converting it to a String (if necessary) and after performing any escaping appropriate for the markup language being rendered.

If there is an open element that has been created by a call to startElement(), that element will be closed first.

Parameters:
text - Text to be written
property - Name of the component property or attribute (if any) of the UIComponent associated with the containing element, to which the generated attribute corresponds
Throws:
java.lang.NullPointerException - if text is null

close

protected void close()

Close the currently open starting element, if any.


hexadecimal

protected void hexadecimal(int i)

Append the hexadecimal equivalent of the specified numeric value.


hexadecimals

protected void hexadecimals(char ch)

Append the specified character as an escaped two-hex-digit value.

Parameters:
ch - Character to be escaped

numeric

protected void numeric(char ch)

Append a numeric escape for the specified character.

Parameters:
ch - Character to be escaped