public abstract class

CodeDocumentPart

extends Object
implements ITextDocumentPart
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.output.code.CodeDocumentPart
Known Direct Subclasses

Class Overview

A document part specific to code outputs. Use with CodeDocument Remember to call registerAnchor(String) before generating content at a given anchor point.

The type of ILine used is CodeLine. The type of IAnchor used is CodeAnchor.

Clients must extend this class.

Summary

Public Constructors
CodeDocumentPart(long baseAnchorId)
Create a new code document part, attached to the given anchor.
Public Methods
void append(String s)
Append a chunk of text to the current line.
void appendAndRecord(String s, ItemClassIdentifiers classId, long itemId, int flags)
Append a chunk of text to the current line.
void appendAndRecord(String s, ItemClassIdentifiers classId, long itemId)
Append a chunk of text to the current line.
void appendAndRecord(String s, ItemClassIdentifiers classId)
Append a chunk of text to the current line.
void decrementIndentationLevel()
void disablePadding()
void enablePadding()
void eol()
End the current line.
void eol(ICodeCoordinates coord)
End the current line.
String format()
List<CodeAnchor> getAnchors()
Get the anchors within that part.
CodeAnchor getCurrentAnchor()
Get the currently active anchor.
ICodeCoordinates getCurrentCoordinates()
CodeLine getCurrentLine()
Get the last (unfinished) line
ICodeCoordinates getCurrentLineCoordinates()
int getCurrentLineIndex()
int getCurrentLineLength()
int getIndentationLevel()
String getIndentationString()
int getIndententionLevel()
int getLastLineIndex()
Get the index of the last finished line.
CodeLine getLine(int index)
int getLineCount()
Get the number of finished (EOL-terminated) lines in this part.
List<CodeLine> getLines()
Get the lines within that part.
void incrementIndentationLevel()
void indentReset()
boolean isCurrentLineEmpty()
void markCurrentPosition(String name, Object object)
boolean moveLastLine(int newIndex)
boolean moveLine(int index, int newIndex)
void prependCodePart(CodeDocumentPart part)
void recordCurrentCoordinates(ICodeCoordinates coordinates)
void recordLineCoordinates(ICodeCoordinates coordinates)
void registerAnchor(long anchorId, String name)
void registerAnchor(String name)
Create an anchor and register it at the current last line.
void resetPaddingString()
void setIndentationLevel(int level)
void setIndentationString(String indentString)
void setPaddingString(String paddingString)
void space()
Append a space to the current line.
void space(int cnt)
Append one or more spaces to the current line.
String toString()
void unrecordCurrentCoordinates()
void unrecordLineCoordinates()
void validate()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.output.text.ITextDocumentPart

Public Constructors

public CodeDocumentPart (long baseAnchorId)

Create a new code document part, attached to the given anchor. An 8-space padding and a 4-space indentation is selected by default.

Parameters
baseAnchorId the base anchor identifier

Public Methods

public void append (String s)

Append a chunk of text to the current line. The line should not contain CR/LF characters.

Parameters
s chunk of text, should not contain CR or LF characters. If found, they are replaced by slash ('/') characters

public void appendAndRecord (String s, ItemClassIdentifiers classId, long itemId, int flags)

Append a chunk of text to the current line.

Parameters
s a string
classId a class identifier
itemId an item identifier
flags flags

public void appendAndRecord (String s, ItemClassIdentifiers classId, long itemId)

Append a chunk of text to the current line.

Parameters
s a string
classId a class identifier
itemId an item identifier

public void appendAndRecord (String s, ItemClassIdentifiers classId)

Append a chunk of text to the current line.

Parameters
s a string
classId a class identifier

public void decrementIndentationLevel ()

public void disablePadding ()

public void enablePadding ()

public void eol ()

End the current line.

public void eol (ICodeCoordinates coord)

End the current line.

Parameters
coord optional chunk coordinates

public String format ()

public List<CodeAnchor> getAnchors ()

Get the anchors within that part. The last anchor object may be used to specify the first anchor id of the next, contiguous part. It is especially useful in cases where a line spans multiple anchor ids.

Returns
  • the list of anchors

public CodeAnchor getCurrentAnchor ()

Get the currently active anchor.

public ICodeCoordinates getCurrentCoordinates ()

public CodeLine getCurrentLine ()

Get the last (unfinished) line

Returns
  • the last line

public ICodeCoordinates getCurrentLineCoordinates ()

public int getCurrentLineIndex ()

Returns
  • the line count

public int getCurrentLineLength ()

public int getIndentationLevel ()

public String getIndentationString ()

public int getIndententionLevel ()

public int getLastLineIndex ()

Get the index of the last finished line.

Returns
  • the last finished line index

public CodeLine getLine (int index)

public int getLineCount ()

Get the number of finished (EOL-terminated) lines in this part. A line is finished by calling eol().

Returns
  • the number of lines, excluding the last (unfinished) line

public List<CodeLine> getLines ()

Get the lines within that part. The lines may span over one or more anchors.

Returns
  • the list of lines

public void incrementIndentationLevel ()

public void indentReset ()

public boolean isCurrentLineEmpty ()

public void markCurrentPosition (String name, Object object)

public boolean moveLastLine (int newIndex)

public boolean moveLine (int index, int newIndex)

public void prependCodePart (CodeDocumentPart part)

public void recordCurrentCoordinates (ICodeCoordinates coordinates)

public void recordLineCoordinates (ICodeCoordinates coordinates)

public void registerAnchor (long anchorId, String name)

public void registerAnchor (String name)

Create an anchor and register it at the current last line.

Parameters
name the anchor name

public void resetPaddingString ()

public void setIndentationLevel (int level)

public void setIndentationString (String indentString)

public void setPaddingString (String paddingString)

public void space ()

Append a space to the current line.

public void space (int cnt)

Append one or more spaces to the current line.

Parameters
cnt the number of spaces to be appended

public String toString ()

public void unrecordCurrentCoordinates ()

public void unrecordLineCoordinates ()

public void validate ()