Package ro.sync.ecss.extensions.api
Interface Content
-
@API(type=NOT_EXTENDABLE, src=PUBLIC) public interface Content
Interface to describe a sequence of character content that can be edited.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.swing.text.Position
createPosition(int offset)
Creates a position within the content.void
getChars(int where, int len, javax.swing.text.Segment chars)
Retrieves a portion of the content into the specifiedSegment
.int
getLength()
The length in characters of the content.java.lang.String
getString(int where, int len)
Fetches a string of characters contained in the content sequence.void
insertChars(int where, char[] ch, int start, int length)
Inserts a sequence of characters into the content at a given offset.void
remove(int where, int nitems)
Removes some portion of the content sequence.
-
-
-
Method Detail
-
createPosition
javax.swing.text.Position createPosition(int offset) throws javax.swing.text.BadLocationException
Creates a position within the content. The position offset is changed as the content is edited.- Parameters:
offset
- The offset in the content >= 0- Returns:
- A new
Position
. - Throws:
javax.swing.text.BadLocationException
- For an invalid offset
-
getLength
int getLength()
The length in characters of the content.- Returns:
- The length >= 0
-
insertChars
void insertChars(int where, char[] ch, int start, int length) throws javax.swing.text.BadLocationException
Inserts a sequence of characters into the content at a given offset.- Parameters:
where
- Offset into the content to make the insertion >= 0ch
- The char buffer to insert from.start
- Start of useful data in the char buffer.length
- Length of useful data in the char buffer.- Throws:
javax.swing.text.BadLocationException
- thrown if the offset indicated by thewhere
argument is not contained in the boundaries of the content character sequence.
-
remove
void remove(int where, int nitems) throws javax.swing.text.BadLocationException
Removes some portion of the content sequence.- Parameters:
where
- The offset into the sequence to make the removal >= 0.nitems
- The number of items in the sequence to be removed >= 0.- Throws:
javax.swing.text.BadLocationException
- Thrown if the area covered by thewhere
andnitems
parameters is not contained in the content character sequence.
-
getString
java.lang.String getString(int where, int len) throws javax.swing.text.BadLocationException
Fetches a string of characters contained in the content sequence.- Parameters:
where
- Offset into the sequence to fetch >= 0.len
- Number of characters to copy >= 0.- Returns:
- The extracted String.
- Throws:
javax.swing.text.BadLocationException
- Thrown if the area covered by the arguments is not contained in the content character sequence.
-
getChars
void getChars(int where, int len, javax.swing.text.Segment chars) throws javax.swing.text.BadLocationException
Retrieves a portion of the content into the specifiedSegment
. If the desired content spans the gap, we copy the content. If the desired content does not span the gap, the actual store is returned to avoid the copy since it is contiguous.- Parameters:
where
- The starting position >= 0, where + len <= length()len
- The number of characters to be retrieved >= 0chars
- TheSegment
object to return the characters into.- Throws:
javax.swing.text.BadLocationException
- If the specified position or length are invalid.
-
-