Package org.eclipse.epsilon.egl.output
Class OutputBuffer
java.lang.Object
org.eclipse.epsilon.egl.output.OutputBuffer
- All Implemented Interfaces:
IOutputBuffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuffer
protected boolean
protected IEglContext
protected List<CommentBlockPartitioner>
protected boolean
protected boolean
protected Collection<String>
protected String
protected OutdentationFormatter
protected IOutputBuffer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assertNoMixedRegions
(RegionType regionType) calculateIndentationToMatch
(String previousLine) void
chop
(int chars) Removes the specified number of characters from the end of the buffer.void
formatWith
(Formatter formatter) Reformats the contents of the buffer with the givenFormatter
.int
Returns the line number of the last character in the buffer.int
int
Returns the size of the buffer.Returns the outdentation formattervoid
Appends a string representation of the given object to the buffer.void
Appends a string representation of the given object to the buffer, correcting the indentation of the string representation to match the indentation level of the previous line in the buffer.void
println()
Appends a new line the buffer.protected void
replaceContentsWith
(String newContents) void
setContentType
(String name) Specifies the type of output in the buffer, such as Java or HTML.void
setIndenters
(Collection<String> indentation) void
setParent
(IOutputBuffer parent) startControl
(String id, boolean enabled) Appends the starting tag for a controlled region to the buffer.startControl
(String startComment, String endComment, String id, boolean enabled) Appends the starting tag for a protected region to the buffer.startLocate
(String id, boolean enabled, RegionType regionType) startLocate
(String startComment, String endComment, String id, boolean enabled, RegionType regionType) startPreserve
(String id, boolean enabled) Appends the starting tag for a protected region to the buffer.startPreserve
(String startComment, String endComment, String id, boolean enabled) Appends the starting tag for a protected region to the buffer.void
stop()
Halts execution of the current template.Appends a closing tag for a protected region to the buffer.Appends a closing tag for a protected region to the buffer.toString()
Converts the contents of the buffer to a string.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.epsilon.egl.output.IOutputBuffer
control, control, getCurrentColumnNumber, getNewline, getSpaces, preserve, preserve, println, prinx
-
Field Details
-
buffer
-
context
-
customPartitioners
-
contentTypeSet
protected boolean contentTypeSet -
lastLine
-
hasProtectedRegions
protected boolean hasProtectedRegions -
hasControlledRegions
protected boolean hasControlledRegions -
outdentationFormatter
-
indenters
-
parent
-
-
Constructor Details
-
OutputBuffer
-
OutputBuffer
public OutputBuffer()
-
-
Method Details
-
chop
public void chop(int chars) Description copied from interface:IOutputBuffer
Removes the specified number of characters from the end of the buffer.- Specified by:
chop
in interfaceIOutputBuffer
-
print
Description copied from interface:IOutputBuffer
Appends a string representation of the given object to the buffer.- Specified by:
print
in interfaceIOutputBuffer
-
printdyn
Description copied from interface:IOutputBuffer
Appends a string representation of the given object to the buffer, correcting the indentation of the string representation to match the indentation level of the previous line in the buffer. Used to output EGL dynamic sections.- Specified by:
printdyn
in interfaceIOutputBuffer
-
getLastLineInBuffer
-
calculateIndentationToMatch
-
println
public void println()Description copied from interface:IOutputBuffer
Appends a new line the buffer.- Specified by:
println
in interfaceIOutputBuffer
-
setContentType
Description copied from interface:IOutputBuffer
Specifies the type of output in the buffer, such as Java or HTML.- Specified by:
setContentType
in interfaceIOutputBuffer
- Throws:
EglRuntimeException
- if the content type is not supported.
-
startPreserve
Description copied from interface:IOutputBuffer
Appends the starting tag for a protected region to the buffer.- Specified by:
startPreserve
in interfaceIOutputBuffer
- Parameters:
id
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
- ifIOutputBuffer.setContentType(String)
has not been called
-
startControl
Description copied from interface:IOutputBuffer
Appends the starting tag for a controlled region to the buffer.- Specified by:
startControl
in interfaceIOutputBuffer
- Parameters:
id
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
- ifIOutputBuffer.setContentType(String)
has not been called
-
startLocate
public String startLocate(String id, boolean enabled, RegionType regionType) throws EglRuntimeException - Throws:
EglRuntimeException
-
startControl
public String startControl(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException Description copied from interface:IOutputBuffer
Appends the starting tag for a protected region to the buffer.- Specified by:
startControl
in interfaceIOutputBuffer
- Parameters:
startComment
- - the character sequence used to denote the start of a comment for the type of output in the bufferendComment
- - the character sequence used to denote the end of a comment for the type of output in the bufferid
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
-
startPreserve
public String startPreserve(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException Description copied from interface:IOutputBuffer
Appends the starting tag for a protected region to the buffer.- Specified by:
startPreserve
in interfaceIOutputBuffer
- Parameters:
startComment
- - the character sequence used to denote the start of a comment for the type of output in the bufferendComment
- - the character sequence used to denote the end of a comment for the type of output in the bufferid
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
-
startLocate
public String startLocate(String startComment, String endComment, String id, boolean enabled, RegionType regionType) throws EglRuntimeException - Throws:
EglRuntimeException
-
assertNoMixedRegions
- Throws:
EglRuntimeException
-
stopControl
Description copied from interface:IOutputBuffer
Appends a closing tag for a protected region to the buffer.- Specified by:
stopControl
in interfaceIOutputBuffer
- Throws:
EglRuntimeException
- if there is no unclosed protected region in the buffer.
-
stopPreserve
Description copied from interface:IOutputBuffer
Appends a closing tag for a protected region to the buffer.- Specified by:
stopPreserve
in interfaceIOutputBuffer
- Throws:
EglRuntimeException
- if there is no unclosed protected region in the buffer.
-
stopLocate
- Throws:
EglRuntimeException
-
stop
Description copied from interface:IOutputBuffer
Halts execution of the current template.- Specified by:
stop
in interfaceIOutputBuffer
- Throws:
EglStoppedException
-
getCurrentLineNumber
public int getCurrentLineNumber()Description copied from interface:IOutputBuffer
Returns the line number of the last character in the buffer.- Specified by:
getCurrentLineNumber
in interfaceIOutputBuffer
-
getOffset
public int getOffset()Description copied from interface:IOutputBuffer
Returns the size of the buffer.- Specified by:
getOffset
in interfaceIOutputBuffer
-
formatWith
Description copied from interface:IOutputBuffer
Reformats the contents of the buffer with the givenFormatter
.- Specified by:
formatWith
in interfaceIOutputBuffer
-
replaceContentsWith
-
toString
Description copied from interface:IOutputBuffer
Converts the contents of the buffer to a string.- Specified by:
toString
in interfaceIOutputBuffer
- Overrides:
toString
in classObject
-
getOutdentationFormatter
Description copied from interface:IOutputBuffer
Returns the outdentation formatter- Specified by:
getOutdentationFormatter
in interfaceIOutputBuffer
-
setIndenters
- Specified by:
setIndenters
in interfaceIOutputBuffer
-
getIndenters
- Specified by:
getIndenters
in interfaceIOutputBuffer
-
setParent
- Specified by:
setParent
in interfaceIOutputBuffer
-
getParent
- Specified by:
getParent
in interfaceIOutputBuffer
-
getLength
public int getLength()
-