Class StaticTextDocument
java.lang.Object
com.pnfsoftware.jeb.util.events.EventSource
com.pnfsoftware.jeb.core.output.text.impl.AbstractTextDocument
com.pnfsoftware.jeb.core.output.text.impl.StaticTextDocument
- All Implemented Interfaces:
IGenericDocument
,ITextDocument
,IEventSource
A simple text document. Such text document objects do not listen to unit changes events; in fact,
they are unaware of the
IUnit
family of classes. They are ideal to distribute static,
immutable contents. More complex text documents should implement ITextDocument
and/or
extend AbstractTextDocument
.
In this simple implementation, a line maps to one anchor. Therefore, the "line" part of a
coordinates becomes redundant within the default addressing scheme provided by
AbstractTextDocument
. The addressing scheme has been simplified to
"anchorId,columnOffset".
-
Field Summary
Fields inherited from class com.pnfsoftware.jeb.util.events.EventSource
onEventCallCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Get the range of anchor points in the document.getDocumentPart
(long anchorId, int linesAfter, int linesBefore) Retrieve a document part.toString()
protected boolean
Specify ifAbstractTextDocument.coordinatesToAddress(ICoordinates, AddressConversionPrecision)
andAbstractTextDocument.addressToCoordinates(String, CoordinatesConversionPrecision)
will use the anchor inner value or should display as a text editor (where first line is line 1).protected boolean
Specify ifAbstractTextDocument.coordinatesToAddress(ICoordinates, AddressConversionPrecision)
andAbstractTextDocument.addressToCoordinates(String, CoordinatesConversionPrecision)
will use the line Delta.Methods inherited from class com.pnfsoftware.jeb.core.output.text.impl.AbstractTextDocument
addressToCoordinates, addressToCoordinates, coordinatesToAddress, coordinatesToAddress, dispose, format, getDocumentPart, getDocumentPart2, getFirstAnchor, getInitialAnchor, getPropertyManager
Methods inherited from class com.pnfsoftware.jeb.util.events.EventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, notifyListeners, notifyListeners, relay, removeListener, setParentSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pnfsoftware.jeb.util.events.IEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, removeListener, setParentSource
Methods inherited from interface com.pnfsoftware.jeb.core.output.IGenericDocument
getUnit
Methods inherited from interface com.pnfsoftware.jeb.core.output.text.ITextDocument
getBinaryRepresentation, hasBinaryRepresentation
-
Constructor Details
-
StaticTextDocument
-
StaticTextDocument
-
-
Method Details
-
getAnchorCount
public long getAnchorCount()Description copied from interface:ITextDocument
Get the range of anchor points in the document. Returning 1 means that the document returns a single part, holding the entire contents.Note that the anchor at "
ITextDocument.getFirstAnchor()
+ITextDocument.getAnchorCount()
" is the "end" anchor (one after the last), and lies outside the document. It is not a valid anchor.- Returns:
- the count/range of anchors in this document, must be greater than zero
-
getDocumentPart
Description copied from interface:ITextDocument
Retrieve a document part. Clients call this method to retrieve a document part starting at a specific anchor, and containing the given amount of lines after and before the anchor. It is the responsibility of the implementor to sanitize the input (eg, negative number of lines, invalid anchor, etc.) and provide appropriate response (eg, truncating). It is recommended that implementors try not to raise an exception on error. In the worst case scenario, an empty document can be returned.- Parameters:
anchorId
- the anchor identifierlinesAfter
- hint lines count to return after the given anchor, could be more or lesslinesBefore
- hint lines count to return before the given anchor, could be more or less- Returns:
- a document part containing as many anchors as required to honor the client requests. If linesAfter is non-null, the first anchor within the document part may not be anchorId, but one anchor before that. THis method should return null if an invalid anchor was provided
-
useLineDelta
protected boolean useLineDelta()Description copied from class:AbstractTextDocument
Specify ifAbstractTextDocument.coordinatesToAddress(ICoordinates, AddressConversionPrecision)
andAbstractTextDocument.addressToCoordinates(String, CoordinatesConversionPrecision)
will use the line Delta. Default is true, but implementations can decide to use only one line for an anchor.- Overrides:
useLineDelta
in classAbstractTextDocument
- Returns:
-
useDisplayLineNumber
protected boolean useDisplayLineNumber()Description copied from class:AbstractTextDocument
Specify ifAbstractTextDocument.coordinatesToAddress(ICoordinates, AddressConversionPrecision)
andAbstractTextDocument.addressToCoordinates(String, CoordinatesConversionPrecision)
will use the anchor inner value or should display as a text editor (where first line is line 1). Line Delta and column offset are not modified.- Overrides:
useDisplayLineNumber
in classAbstractTextDocument
-
toString
- Overrides:
toString
in classAbstractTextDocument
-