|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fife.ui.rsyntaxtextarea.Token
org.fife.ui.rsyntaxtextarea.DefaultToken
org.fife.ui.rsyntaxtextarea.VisibleWhitespaceToken
public class VisibleWhitespaceToken
This token class paints spaces and tabs with special symbols so the user can see the whitespace in his document. Rendering hints are honored.
The current implementation paints as follows:
A problem with this implementation is that FontMetrics.charsWidth() is still
used to calculate the width of a group of chars painted. Thus, the group of
characters will be painted with the rendering hints specified, but the
following tab (or group of characters if the current group was the end of a
token) will not necessarily be painted at the proper x-coordinate (as
FontMetrics.charsWidth() returns an int
and not a
float
). The way around this would be to calculate the token's
width in such a way that a float is returned (Font.getStringBounds()?).
Token
,
DefaultToken
Field Summary |
---|
Fields inherited from class org.fife.ui.rsyntaxtextarea.Token |
---|
COMMENT_DOCUMENTATION, COMMENT_EOL, COMMENT_MULTILINE, DATA_TYPE, ERROR_CHAR, ERROR_IDENTIFIER, ERROR_NUMBER_FORMAT, ERROR_STRING_DOUBLE, FUNCTION, IDENTIFIER, LITERAL_BACKQUOTE, LITERAL_BOOLEAN, LITERAL_CHAR, LITERAL_NUMBER_DECIMAL_INT, LITERAL_NUMBER_FLOAT, LITERAL_NUMBER_HEXADECIMAL, LITERAL_STRING_DOUBLE_QUOTE, MARKUP_TAG_ATTRIBUTE, MARKUP_TAG_DELIMITER, MARKUP_TAG_NAME, NULL, NUM_TOKEN_TYPES, offset, OPERATOR, PREPROCESSOR, RESERVED_WORD, SEPARATOR, text, textCount, textOffset, type, VARIABLE, WHITESPACE |
Constructor Summary | |
---|---|
VisibleWhitespaceToken()
Creates a "null token." |
|
VisibleWhitespaceToken(char[] line,
int beg,
int end,
int startOffset,
int type)
Constructor. |
|
VisibleWhitespaceToken(Segment line,
int beg,
int end,
int startOffset,
int type)
Constructor. |
Method Summary | |
---|---|
float |
paint(Graphics2D g,
float x,
float y,
RSyntaxTextArea host,
TabExpander e,
float clipStart)
Paints this token, using special symbols for whitespace characters. |
Methods inherited from class org.fife.ui.rsyntaxtextarea.DefaultToken |
---|
getListOffset, getWidthUpTo, listOffsetToView |
Methods inherited from class org.fife.ui.rsyntaxtextarea.Token |
---|
appendHTMLRepresentation, containsPosition, copyFrom, documentToToken, getHTMLRepresentation, getLastNonCommentNonWhitespaceToken, getLastPaintableToken, getLexeme, getNextToken, getOffsetBeforeX, getWidth, is, isComment, isHyperlink, isLeftCurly, isPaintable, isRightCurly, isSingleChar, isWhitespace, makeStartAt, moveOffset, paint, paintBackground, set, setHyperlink, setNextToken, tokenToDocument, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VisibleWhitespaceToken()
public VisibleWhitespaceToken(Segment line, int beg, int end, int startOffset, int type)
line
- The segment from which to get the token.beg
- The first character's position in line
.end
- The last character's position in line
.startOffset
- The offset into the document at which this
token begins.type
- A token type listed as "generic" above.public VisibleWhitespaceToken(char[] line, int beg, int end, int startOffset, int type)
line
- The segment from which to get the token.beg
- The first character's position in line
.end
- The last character's position in line
.startOffset
- The offset into the document at which this
token begins.type
- A token type listed as "generic" above.Method Detail |
---|
public final float paint(Graphics2D g, float x, float y, RSyntaxTextArea host, TabExpander e, float clipStart)
paint
in class DefaultToken
g
- The graphics context in which to paint.x
- The x-coordinate at which to paint.y
- The y-coordinate at which to paint.host
- The text area this token is in.e
- How to expand tabs.clipStart
- The left boundary of the clip rectangle in which we're
painting. This optimizes painting by allowing us to not paint
not paint when this token is "to the left" of the clip rectangle.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |