Clover coverage report - Code Coverage for tapestry release 3.1-alpha-1
Coverage timestamp: Mon Feb 21 2005 09:16:14 EST
file stats: LOC: 252   Methods: 0
NCLOC: 25   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
IMarkupWriter.java - - - -
coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry;
 16   
 
 17   
 /**
 18   
  *  Defines an object that can write markup (XML, HTML, XHTML) style output.
 19   
  *  A <code>IMarkupWriter</code> handles translation from unicode to
 20   
  *  the markup language (escaping characters such as '&lt;' and '&gt;' to
 21   
  *  their entity equivalents, '&amp;lt;' and '&amp;gt;') as well as assisting
 22   
  *  with nested elements, closing tags, etc.
 23   
  *
 24   
  *  @author Howard Ship, David Solis
 25   
  **/
 26   
 
 27   
 public interface IMarkupWriter
 28   
 {
 29   
     /**
 30   
      * Writes an integer attribute into the currently open tag.
 31   
      *
 32   
      * @throws IllegalStateException if there is no open tag.
 33   
      *
 34   
      **/
 35   
 
 36   
     public void attribute(String name, int value);
 37   
 
 38   
     /**
 39   
      * Writes a boolean attribute into the currently open tag.
 40   
      *
 41   
      * @throws IllegalStateException if there is no open tag.
 42   
      *
 43   
      * @since 3.0
 44   
      **/
 45   
 
 46   
     public void attribute(String name, boolean value);
 47   
 
 48   
     /**
 49   
      * Writes an attribute into the most recently opened tag. This must be called after
 50   
      * {@link #begin(String)}
 51   
      * and before any other kind of writing (which closes the tag).
 52   
      *
 53   
      * <p>The value may be null.
 54   
      *
 55   
      * @throws IllegalStateException if there is no open tag.
 56   
      **/
 57   
 
 58   
     public void attribute(String name, String value);
 59   
 
 60   
     /**
 61   
      * Similar to {@link #attribute(String, String)} but no escaping of invalid elements
 62   
      * is done for the value.
 63   
      * 
 64   
      * @throws IllegalStateException if there is no open tag.
 65   
      *
 66   
      * @since 3.0
 67   
      **/
 68   
 
 69   
     public void attributeRaw(String name, String value);
 70   
 
 71   
     /**
 72   
      * Closes any existing tag then starts a new element. The new element is pushed
 73   
      * onto the active element stack.
 74   
      **/
 75   
 
 76   
     public void begin(String name);
 77   
 
 78   
     /**
 79   
      * Starts an element that will not later be matched with an <code>end()</code>
 80   
      * call. This is useful for elements that
 81   
      * do not need closing tags.
 82   
      *
 83   
      **/
 84   
 
 85   
     public void beginEmpty(String name);
 86   
 
 87   
     /**
 88   
      * Invokes checkError() on the <code>PrintWriter</code> used to
 89   
      *  format output.
 90   
      **/
 91   
 
 92   
     public boolean checkError();
 93   
 
 94   
     /**
 95   
      * Closes this <code>IMarkupWriter</code>. Close tags are
 96   
      * written for any active elements. The <code>PrintWriter</code>
 97   
      * is then sent <code>close()</code>.  A nested writer will commit
 98   
      * its buffer to its containing writer.
 99   
      *
 100   
      **/
 101   
 
 102   
     public void close();
 103   
 
 104   
     /**
 105   
      * Closes the most recently opened element by writing the '&gt;' that ends
 106   
      * it. Once this is invoked, the <code>attribute()</code> methods
 107   
      * may not be used until a new element is opened with {@link #begin(String)} or
 108   
      * or {@link #beginEmpty(String)}.
 109   
      **/
 110   
 
 111   
     public void closeTag();
 112   
 
 113   
     /**
 114   
      * Writes an XML/HTML comment. Any open tag is first closed. 
 115   
      * The method takes care of
 116   
      * providing the <code>&lt;!--</code> and <code>--&gt;</code>, and
 117   
      * provides a blank line after the close of the comment.
 118   
      *
 119   
      * <p><em>Most</em> characters are valid inside a comment, so no check
 120   
      * of the contents is made (much like {@link #printRaw(String)}.
 121   
      *
 122   
      **/
 123   
 
 124   
     public void comment(String value);
 125   
 
 126   
     /**
 127   
      * Ends the element most recently started by {@link
 128   
      * #begin(String)}.  The name of the tag is popped off of the
 129   
      * active element stack and used to form an HTML close tag.
 130   
      *
 131   
      **/
 132   
 
 133   
     public void end();
 134   
 
 135   
     /**
 136   
      * Ends the most recently started element with the given
 137   
      * name. This will also end any other intermediate
 138   
      * elements. This is very useful for easily ending a table or
 139   
      * even an entire page.
 140   
      *
 141   
      **/
 142   
 
 143   
     public void end(String name);
 144   
 
 145   
     /**
 146   
      * Forwards <code>flush()</code> to this 
 147   
      * <code>IMarkupWriter</code>'s <code>PrintWriter</code>.
 148   
      *
 149   
      **/
 150   
 
 151   
     public void flush();
 152   
 
 153   
     /**
 154   
      *  Returns a nested writer, one that accumulates its changes in a
 155   
      *  buffer.  When the nested  writer is closed, it writes its
 156   
      *  buffer into its containing <code>IMarkupWriter</code>.
 157   
      *
 158   
      **/
 159   
 
 160   
     public IMarkupWriter getNestedWriter();
 161   
 
 162   
     /**
 163   
      *
 164   
      * The primary <code>print()</code> method, used by most other
 165   
      * methods.
 166   
      *
 167   
      * <p>Prints the character array, first closing any open tag. Problematic characters
 168   
      * ('&lt;', '&gt;' and '&amp;') are converted to appropriate
 169   
      * entities.
 170   
      *
 171   
      * <p>Does <em>nothing</em> if <code>data</code> is null.
 172   
      *
 173   
      * <p>Closes any open tag.
 174   
      *
 175   
      **/
 176   
 
 177   
     public void print(char[] data, int offset, int length);
 178   
 
 179   
     /**
 180   
      * Prints a single character, or its equivalent entity.
 181   
      *
 182   
      * <p>Closes any open tag.
 183   
      *
 184   
      **/
 185   
 
 186   
     public void print(char value);
 187   
 
 188   
     /**
 189   
      * Prints an integer.
 190   
      *
 191   
      * <p>Closes any open tag.
 192   
      *
 193   
      **/
 194   
 
 195   
     public void print(int value);
 196   
 
 197   
     /**
 198   
      * Invokes {@link #print(char[], int, int)} to print the string.  Use
 199   
      * {@link #printRaw(String)} if the character data is known to be safe.
 200   
      *
 201   
      * <p>Does <em>nothing</em> if <code>value</code> is null.
 202   
      *
 203   
      * <p>Closes any open tag.
 204   
      *
 205   
      * @see #print(char[], int, int)
 206   
      *
 207   
      **/
 208   
 
 209   
     public void print(String value);
 210   
 
 211   
     /**
 212   
      * Closes the open tag (if any), then prints a line seperator to
 213   
      * the output stream.
 214   
      *
 215   
      **/
 216   
 
 217   
     public void println();
 218   
 
 219   
     /**
 220   
      * Prints a portion of an output buffer to the stream.
 221   
      * No escaping of invalid elements is done, which
 222   
      * makes this more effecient than <code>print()</code>. 
 223   
      * Does <em>nothing</em> if <code>buffer</code>
 224   
      * is null.
 225   
      *
 226   
      * <p>Closes any open tag.
 227   
      *
 228   
      **/
 229   
 
 230   
     public void printRaw(char[] buffer, int offset, int length);
 231   
 
 232   
     /**
 233   
      * Prints output to the stream. No escaping of invalid elements is done, which
 234   
      * makes this more effecient than <code>print()</code>.
 235   
      *
 236   
      * <p>Does <em>nothing</em> if <code>value</code>
 237   
      * is null.
 238   
      *
 239   
      * <p>Closes any open tag.
 240   
      *
 241   
      **/
 242   
 
 243   
     public void printRaw(String value);
 244   
 
 245   
     /**
 246   
      *  Returns the type of content generated by this response writer, as
 247   
      *  a MIME type.
 248   
      *
 249   
      **/
 250   
 
 251   
     public String getContentType();
 252   
 }