## org.eclipse.jet.taglib
Class UserRegionHelper

    java.lang.Object
      org.eclipse.jet.taglib.UserRegionHelper

All Implemented Interfaces:
  IWriterListener, IWriterListenerExtension

    public final class UserRegionHelper

extends java.lang.Object
implements IWriterListener, IWriterListenerExtension

Utility class that allows implementation of user regions like <c:userRegion&;gt.

To consume this class, the document must include two regions, one nested inside the other. Two static methods are used to mark these regions: <bl>

- `markUserRegion()`
- `markInitialCode()`
</bl>

Method Summary
`void` `finalizeContent(JET2Writer writer, java.lang.Object file)` Perform any finalization of the content in the writer.
`void` `finalizeContent(JET2Writer writer, java.lang.Object fileObject, java.lang.String existingContent)` Perform any finalization of the content in the writer.
`static void` `markInitialCode(JET2Writer out, int initialCodeStart, int initialCodeEnd)` Mark the initial code portion of the user region.
`static void` `markInitialCode(JET2Writer out, int initialCodeStart, int initialCodeEnd, java.lang.String unmodifiedMarker)` Mark the initial code portion of the user region.
`static void` `markUserRegion(JET2Writer out, int regionStart, int regionEnd)` Mark the user region on the output writer
`void` `postCommitContent(JET2Writer writer, java.lang.Object file)` Perform any post processing on the committed file based on content written.

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

Method Detail

### finalizeContent

    public void finalizeContent(JET2Writer writer,
                                java.lang.Object file)

  Description copied from interface: `IWriterListener`
  Perform any finalization of the content in the writer.

  Specified by:
    `finalizeContent` in interface `IWriterListener`
  Parameters:
    `writer` - the writer in the process of being finalized
    `file` - a handle to object to which the content will ultimately be written. The standard JET2 Workspace tags pass an org.eclipse.core.resources.IFile, but other tags may pass objects of other types.

### postCommitContent

    public void postCommitContent(JET2Writer writer,
                                  java.lang.Object file)

  Description copied from interface: `IWriterListener`
  Perform any post processing on the committed file based on content written.

  Specified by:
    `postCommitContent` in interface `IWriterListener`
  Parameters:
    `writer` - the writer that provided the committed content.
    `file` - a handle to the object containing the comitted content. The standard JET2 Workspace tags pass an org.eclipse.core.resources.IFile, but other tags may pass objects of other types.

### markInitialCode

    public static void markInitialCode(JET2Writer out,
                                       int initialCodeStart,
                                       int initialCodeEnd,
                                       java.lang.String unmodifiedMarker)

  Mark the initial code portion of the user region.

  Parameters:
    `out` - a JET2Writer
    `initialCodeStart` - the inclusive offset (zero-based) of the start of the region's initial code block (immediately after the start tag).
    `initialCodeEnd` - the exclusive offset (zero-based) of the end of the region's initial code block (offset of the end tag).
    `unmodifiedMarker` - if non-null, indicates a string, that if present in the documents initial code indicates the initial code is unmodifiedand may be replaced
  Since:
    0.7.1

### markInitialCode

    public static void markInitialCode(JET2Writer out,
                                       int initialCodeStart,
                                       int initialCodeEnd)

  Mark the initial code portion of the user region. Equivalent to `markInitialCode(out, initialCodeStart, initialCodeEnd, null)`.

  Parameters:
    `out` - a JET2Writer
    `initialCodeStart` - the inclusive offset (zero-based) of the start of the region's initial code block (immediately after the start tag).
    `initialCodeEnd` - the exclusive offset (zero-based) of the end of the region's initial code block (offset of the end tag).
  See Also:
    `markInitialCode(JET2Writer, int, int, String)`

### markUserRegion

    public static void markUserRegion(JET2Writer out,
                                      int regionStart,
                                      int regionEnd)

  Mark the user region on the output writer

  Parameters:
    `out` - a JET2Writer
    `regionStart` - the inclusive offset (zero-based) of the start of the region's content (immediately after the start tag).
    `regionEnd` - the exclusive offset (zero-based) of the end of the region's content (offset of the end tag).

### finalizeContent

    public void finalizeContent(JET2Writer writer,
                                java.lang.Object fileObject,
                                java.lang.String existingContent)
                         throws JET2TagException

  Description copied from interface: `IWriterListenerExtension`
  Perform any finalization of the content in the writer. If the file represented by fileObject does not exist, then `IWriterListener.finalizeContent(JET2Writer, Object)` is called.

  Specified by:
    `finalizeContent` in interface `IWriterListenerExtension`
  Parameters:
    `writer` - the writer in the process of being finalized
    `existingContent` - the existing file content
  Throws:
    `JET2TagException` - if the method cannot complete normally

Copyright 2006 IBM Corporation and others. All Rights Reserved.