Package org.eclipse.help.ui.internal
Class StyledLineWrapper
java.lang.Object
org.eclipse.help.ui.internal.StyledLineWrapper
- All Implemented Interfaces:
- StyledTextContent
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidCalled by StyledText to add itself as an Observer to content changes.intReturn the number of characters in the content.getLine(int i) Return the line at the given line index without delimiters.intgetLineAtOffset(int offset) Return the line index at the given character offset.intReturn the number of lines.Return the line delimiter that should be used by the StyledText widget when inserting new lines.intgetOffsetAtLine(int line) Return the character offset of the first character of the given line.Returns the array of styles.getTextRange(int start, int end) Returns a string representing the content at the given range.voidRemove the specified text changed listener.voidreplaceTextRange(int arg0, int arg1, String arg2) Replace the text with "newText" starting at position "start" for a length of "replaceLength".voidSet text to "text".
- 
Field Details- 
BOLD_CLOSE_TAGInternal representation of <b> - unlikely to occur in a text- See Also:
 
- 
BOLD_TAGInternal representation of <b> - unlikely to occur in a text- See Also:
 
- 
DEFAULT_WIDTHpublic static final int DEFAULT_WIDTHBeyond this length (pixels), lines should wrap- See Also:
 
- 
maxWidthpublic int maxWidth
 
- 
- 
Constructor Details- 
StyledLineWrapperConstructor
 
- 
- 
Method Details- 
addTextChangeListenerDescription copied from interface:StyledTextContentCalled by StyledText to add itself as an Observer to content changes. See TextChangeListener for a description of the listener methods that are called when text changes occur.- Specified by:
- addTextChangeListenerin interface- StyledTextContent
- Parameters:
- l- the listener
 
- 
getCharCountpublic int getCharCount()Description copied from interface:StyledTextContentReturn the number of characters in the content.- Specified by:
- getCharCountin interface- StyledTextContent
- Returns:
- the number of characters in the content.
 
- 
getLineDescription copied from interface:StyledTextContentReturn the line at the given line index without delimiters.- Specified by:
- getLinein interface- StyledTextContent
- Parameters:
- i- index of the line to return. Does not include delimiters of preceding lines. Index 0 is the first line of the content.
- Returns:
- the line text without delimiters
        For example, if text = "\r\n\r\n", and delimiter = "\r\n", then:
 - getLine(0) == ""
- getLine(1) == ""
- getLine(2) == ""
 - getLine(0) == "A"
- getLine(1) == "BC"
- getLine(2) == "D"
 
 
- 
getLineAtOffsetpublic int getLineAtOffset(int offset) Description copied from interface:StyledTextContentReturn the line index at the given character offset.- Specified by:
- getLineAtOffsetin interface- StyledTextContent
- Parameters:
- offset- offset of the line to return. The first character of the document is at offset 0. An offset of- StyledTextContent.getCharCount()is valid and should answer the line index of the last line.
- Returns:
- the line index. The first line is at index 0.  If the character
        at offset is a delimiter character, answer the line index of the line
        that is delimited.
        For example, if text = "\r\n\r\n", and delimiter = "\r\n", then:
 - getLineAtOffset(0) == 0
- getLineAtOffset(1) == 0
- getLineAtOffset(2) == 1
- getLineAtOffset(3) == 1
- getLineAtOffset(4) == 2
 - getLineAtOffset(0) == 0
- getLineAtOffset(1) == 0
- getLineAtOffset(2) == 1
- getLineAtOffset(3) == 1
- getLineAtOffset(4) == 1
- getLineAtOffset(5) == 2
- getLineAtOffset(6) == 2
 
 
- 
getLineCountpublic int getLineCount()Description copied from interface:StyledTextContentReturn the number of lines. Should answer 1 when no text is specified. The StyledText widget relies on this behavior for drawing the cursor.- Specified by:
- getLineCountin interface- StyledTextContent
- Returns:
- the number of lines.  For example:
 - text value ==> getLineCount
- null ==> 1
- "" ==> 1
- "a\n" ==> 2
- "\n\n" ==> 3
 
 
- 
getLineDelimiterDescription copied from interface:StyledTextContentReturn the line delimiter that should be used by the StyledText widget when inserting new lines. New lines entered using key strokes and paste operations use this line delimiter. Implementors may use System.lineSeparator() to return the platform line delimiter.- Specified by:
- getLineDelimiterin interface- StyledTextContent
- Returns:
- the line delimiter that should be used by the StyledText widget when inserting new lines.
 
- 
getOffsetAtLinepublic int getOffsetAtLine(int line) Description copied from interface:StyledTextContentReturn the character offset of the first character of the given line.NOTE: When there is no text (i.e., no lines), getOffsetAtLine(0) is a valid call that should return 0. - Specified by:
- getOffsetAtLinein interface- StyledTextContent
- Parameters:
- line- index of the line. The first line is at index 0.
- Returns:
- offset offset of the first character of the line. The first
        character of the document is at offset 0.  The return value should
        include line delimiters.
        For example, if text = "\r\ntest\r\n" and delimiter = "\r\n", then:
 - getOffsetAtLine(0) == 0
- getOffsetAtLine(1) == 2
- getOffsetAtLine(2) == 8
 
 
- 
getTextRangeDescription copied from interface:StyledTextContentReturns a string representing the content at the given range.- Specified by:
- getTextRangein interface- StyledTextContent
- Parameters:
- start- the start offset of the text to return. Offset 0 is the first character of the document.
- end- the length of the text to return
- Returns:
- the text at the given range
 
- 
removeTextChangeListenerDescription copied from interface:StyledTextContentRemove the specified text changed listener.- Specified by:
- removeTextChangeListenerin interface- StyledTextContent
- Parameters:
- arg0- the listener which should no longer be notified
 
- 
replaceTextRangeDescription copied from interface:StyledTextContentReplace the text with "newText" starting at position "start" for a length of "replaceLength".Implementors have to notify the TextChangeListeners that were added using addTextChangeListenerbefore and after the content is changed. ATextChangingEventhas to be sent to the textChanging method before the content is changed and aTextChangedEventhas to be sent to the textChanged method after the content has changed. The text change that occurs after theTextChangingEventhas been sent has to be consistent with the data provided in theTextChangingEvent. This data will be cached by the widget and will be used when theTextChangedEventis received.The TextChangingEventshould be set as follows:- event.start = start of the replaced text
- event.newText = text that is going to be inserted or empty String if no text will be inserted
- event.replaceCharCount = length of text that is going to be replaced
- event.newCharCount = length of text that is going to be inserted
- event.replaceLineCount = number of lines that are going to be replaced
- event.newLineCount = number of new lines that are going to be inserted
 - (replaceText, newText) ==> (replaceLineCount, newLineCount)
- ("", "\n") ==> (0, 1)
- ("\n\n", "a") ==> (2, 0)
- ("a", "\n\n") ==> (0, 2)
- ("\n", "") ==> (1, 0)
 - Specified by:
- replaceTextRangein interface- StyledTextContent
- Parameters:
- arg0- start offset of text to replace, none of the offsets include delimiters of preceding lines, offset 0 is the first character of the document
- arg1- length of text to replace
- arg2- text to replace
- See Also:
 
- 
setTextDescription copied from interface:StyledTextContentSet text to "text". Implementors have to send aTextChangedEventto the textSet method of the TextChangeListeners that were added usingaddTextChangeListener.- Specified by:
- setTextin interface- StyledTextContent
- Parameters:
- text- the new text
- See Also:
 
- 
getStylesReturns the array of styles.
 
-