Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fujitsu.iflow.model.util
Class QuickForm

    java.lang.Object
      com.fujitsu.iflow.model.util.QuickForm

public class QuickForm
extends java.lang.Object

This class represents an instance of a "Quick Form" and it manages a cache of them in memory.

Quick Forms are a simple form technology based on HTML files. Inside the HTML files are text tokens which are replaced with HTML encoded values or HTML markup at run time.

This manager class takes care of

1. Loading the form from an attachment.
2. Compiling the form to a squence of op codes.
3. Caching the results.
4. Interpreting the sequence of op codes.

Nested Class Summary
`protected static class` | `QuickForm.FormElement` Thin wrapper holding general information of a form element.

Field Summary
`QuickFormOperation[]` | `opList` The Quick Form is compiled to this list of these instructions.

Constructor Summary
`QuickForm(java.lang.String name, java.io.Reader formFile)` Generates a new `QuickForm` object with the specified name containing the form data of the supplied reader.

Method Summary
`static void` | `flush()` This method clears the "Quick Forms" cache that is in the memory.
`static void` | `generateNewQuickForm(java.lang.String formTitle, java.lang.Object[][] data, java.lang.String css, java.lang.String[] wrkProAttch, java.io.Writer out, boolean templateFlag, java.lang.String HeaderTemplate, java.lang.String FooterTemplate, java.lang.String templateStartTag, java.lang.String templateEndTag)` Generates a new QuickForm with the specified title and supplied list of User Defined Attributes (UDA) names.
`static void` | `generateQuickForm(java.lang.String formTitle, java.lang.Object[][] data, java.io.Writer out)` Deprecated. instead use `generateQuickForm(String, String[], Writer)`
`static void` | `generateQuickForm(java.lang.String formTitle, java.lang.String[] udaNames, java.io.Writer out)` Generates a new Quick Form with the specified title and the supplied list of User Defined Attribute (UDA) names.
`static QuickForm` | `getDefaultQuickForm()` Returns the default Quick Form object.
`static QuickForm` | `getQuickForm(java.lang.String name, java.lang.String path)` Returns the `QuickForm` object for the supplied path.
`static QuickForm` | `readQuickForm(java.lang.String name, java.lang.String path)` New function has been introduced to be used while updating the form.
`static void` | `urlEncode(java.lang.StringBuffer dest, java.lang.String source)` Encodes the supplied source value and adds it to the dest `StringBuffer`.
`static void` | `writeHtml(java.io.Writer out, java.lang.String source)` An HTML stream encoder.
`static void` | `writeHtmlToJScript(java.io.Writer out, java.lang.String source)` An JavaScript stream encoder.
`static void` | `writeHtmlWithLineBreaks(java.io.Writer out, java.lang.String source)` Converts text to be encoded into HTML.
`static void` | `writeHtmlWithNBSPs(java.io.Writer out, java.lang.String source)` An HTML stream encoder.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### opList

    public QuickFormOperation[] opList

  The Quick Form is compiled to this list of these instructions.

Constructor Detail

### QuickForm

    public QuickForm(java.lang.String name,
                     java.io.Reader formFile)
              throws java.lang.Exception

  Generates a new `QuickForm` object with the specified name containing the form data of the supplied reader.

Parameters:
  `name` - The name for the new generated Quick Form.
  `formFile` - The `Reader` object holding the access to the form data.
Throws:
  `java.lang.Exception` - Thrown when the supplied reader or name is `null`.

Method Detail

### getDefaultQuickForm

    public static QuickForm getDefaultQuickForm()
                                         throws java.lang.Exception

  Returns the default Quick Form object.

  The default Quick Form contains following form data:

       <html>
          <head>
             <title>WorkItem</title>
             <link href="styles/iflow.css" rel="stylesheet" type="text/css">
          </head>
          <body class="bodyClass" onload="resetWorkTimer()" onunload="stopWorkTimer()">
            {{WorkItemHeader}}
            <form name="wiForm" method="post" action="WorkItemAction.jsp">
               {{ProcessPanel}}
               {{DefaultUDAs}}
               {{AttachmentPanel}}
            </form>
          </body>
       </html>

  Returns:
    A `QuickForm` object containing the default QuickForm data.
  Throws:
    `java.lang.Exception`

### getQuickForm

    public static QuickForm getQuickForm(java.lang.String name,
                                         java.lang.String path)
                                  throws java.lang.Exception

  Returns the `QuickForm` object for the supplied path.

  The path specifies the location of a file or an URL which data shall be loaded into an `QuickForm` object.

  Parameters:
    `name` - A name for the Quick Form to make identification easier.
    `path` - The path of File or URL which shall be loaded into the `QuickForm` object.
  Returns:
    The `QuickForm` object for the supplied path. Returns the default `QuickForm` object if the path is `null` or empty.
  Throws:
    `java.lang.Exception` - Thrown if the supplied name is `null`.

### readQuickForm

    public static QuickForm readQuickForm(java.lang.String name,
                                          java.lang.String path)
                                   throws java.lang.Exception

  New function has been introduced to be used while updating the form.

  Throws:
    `java.lang.Exception`

### urlEncode

    public static void urlEncode(java.lang.StringBuffer dest,
                                 java.lang.String source)

  Encodes the supplied source value and adds it to the dest `StringBuffer`. The source value is encoded to UTF-8. Before an encoded value the escaping character % is added.

  Note: This URL encoder is not meant for high performance applications, but only for small String conversions.

  Note that this properly encodes into UTF-8 before then % escaping things

  Parameters:
    `dest` - The `StringBuffer` where the encoded String value is added to.
    `source` - The String value to be encoded.

### generateNewQuickForm

    public static void generateNewQuickForm(java.lang.String formTitle,
                                            java.lang.Object[][] data,
                                            java.lang.String css,
                                            java.lang.String[] wrkProAttch,
                                            java.io.Writer out,
                                            boolean templateFlag,
                                            java.lang.String HeaderTemplate,
                                            java.lang.String FooterTemplate,
                                            java.lang.String templateStartTag,
                                            java.lang.String templateEndTag)
                                     throws java.lang.Exception

  Generates a new QuickForm with the specified title and supplied list of User Defined Attributes (UDA) names.

  Parameters:
    `formTitle` - - The title of the form to be generated.
    `data` - - the 2 dimensional array object containing the uda's and their property.
    `out` - - The writer to which to write the output.
  Throws:
    `-` - Exception Thrown when the supplied list of `udaNames` or the writer is `null`.
    `java.lang.Exception`

### generateQuickForm

    public static void generateQuickForm(java.lang.String formTitle,
                                         java.lang.String[] udaNames,
                                         java.io.Writer out)
                                  throws java.lang.Exception

  Generates a new Quick Form with the specified title and the supplied list of User Defined Attribute (UDA) names. The writer is used to write the generated Quick Form.

  Parameters:
    `formTitle` - The title of the form to be generated.
    `udaNames` - List of UDA names to be included in the Quick Form.
    `out` - The writer to which to write the output.
  Throws:
    `java.lang.Exception` - Thrown when the supplied list of `udaNames` or the writer is `null`.

### generateQuickForm

    public static void generateQuickForm(java.lang.String formTitle,
                                         java.lang.Object[][] data,
                                         java.io.Writer out)
                                  throws java.lang.Exception

  Deprecated. instead use `generateQuickForm(String, String[], Writer)`

  Generates a new Quick Form with the specified title and the supplied list of User Defined Attributes (UDA). The writer is used to write the generated Quick Form.

  Parameters:
    `formTitle` - The title of the Quick Form to be generated.
    `data` - The UDAs to be included in the Quick Form and their types of displays.
    `out` - The writer to which to write the output.
  Throws:
    `java.lang.Exception` - Thrown when the supplied writer is null, or if the list of UDA data is `null` or contains invalid values.
  See Also:
    `generateQuickForm(String, String[], Writer)`

### writeHtmlWithNBSPs

    public static void writeHtmlWithNBSPs(java.io.Writer out,
                                          java.lang.String source)
                                   throws java.lang.Exception

  An HTML stream encoder. Give a String to a writer and this will make sure that the data is encoded correctly for inclusion in an HTML page. It also convert each space character into

  Parameters:
    `out` - The writer to which to write the output.
    `source` - The value to be encoded and written to the writer.
  Throws:
    `java.lang.Exception` - Thrown when the supplied writer is `null`.

### writeHtml

    public static void writeHtml(java.io.Writer out,
                                 java.lang.String source)
                          throws java.lang.Exception

  An HTML stream encoder. Give a String to a writer and this will make sure that the data is encoded correctly for inclusion in an HTML page.

  Parameters:
    `out` - The writer to which to write the output.
    `source` - The value to be encoded and written to the writer.
  Throws:
    `java.lang.Exception` - Thrown when the supplied writer is `null`.

### writeHtmlToJScript

    public static void writeHtmlToJScript(java.io.Writer out,
                                          java.lang.String source)
                                   throws java.lang.Exception

  An JavaScript stream encoder. Give a String to a writer and this will make sure that the data is encoded correctly for inclusion in the JavaScript.

  Parameters:
    `out` - The Writer to which to write the output
    `source` - The value to be encoded and written to the writer
  Throws:
    `java.lang.Exception` - Thrown when the supplied writer is `null`.

### writeHtmlWithLineBreaks

    public static void writeHtmlWithLineBreaks(java.io.Writer out,
                                               java.lang.String source)
                                        throws java.lang.Exception

  Converts text to be encoded into HTML. Also, it detects return characters and generates a
  tag. This allows line oriented text to be easily displayed in HTML.

  Parameters:
    `out` - The Writer to which to write the output
    `source` - The value to be encoded and written to the writer
  Throws:
    `java.lang.Exception` - Thrown when the supplied writer is `null`.

### flush

    public static void flush()
                      throws java.lang.Exception

  This method clears the "Quick Forms" cache that is in the memory.

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD