public abstract class SyntaxHighlightingView extends FoldingPlainView
Note: The Editor package is based on the JavaEditorKit example as described in the article 'Customizing a Text Editor' by Timothy Prinzing . See: http://java.sun.com/products/jfc/tsc/articles/text/editor_kit/
metrics
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
SyntaxHighlightingView(SyntaxHighlightingScanner scanner,
StyleContext context,
Element elem)
Construct a colorized view of xml text for the element.
|
Modifier and Type | Method and Description |
---|---|
protected int |
drawSelectedText(Graphics g,
int x,
int y,
int start,
int end)
Renders the given range in the model as selected text.
|
protected int |
drawUnselectedText(Graphics g,
int x,
int y,
int start,
int end)
Renders the given range in the model as normal unselected text.
|
static int |
getFontStyle(Style style)
Fetch the font to use for a lexical token with the given scan value.
|
protected abstract boolean |
isErrorHighlighting() |
void |
paint(Graphics g,
Shape a)
Invalidates the scanner, to make sure a new range is set later.
|
protected abstract void |
updateScanner(SyntaxHighlightingScanner scanner,
Document doc,
int start,
int end) |
calculateLongestLine, changedUpdate, damageLineRange, drawLine, getNextVisualPositionFrom, getPreferredSpan, insertUpdate, lineToRect, modelToView, nextTabStop, removeUpdate, setSize, updateDamage, updateMetrics, viewToModel
getLineBuffer, getTabSize
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, updateChildren, updateLayout, viewToModel
public SyntaxHighlightingView(SyntaxHighlightingScanner scanner, StyleContext context, Element elem) throws IOException
context
- the styles used to colorize the view.elem
- the element to create the view for.IOException
- input/output exception while reading documentpublic void paint(Graphics g, Shape a)
paint
in class FoldingPlainView
g
- the graphics context.a
- the shape.View.paint(Graphics g, Shape a)
protected int drawUnselectedText(Graphics g, int x, int y, int start, int end) throws BadLocationException
drawUnselectedText
in class FoldingPlainView
g
- the graphics contextx
- the starting X coordinatey
- the starting Y coordinatestart
- the beginning position in the modelend
- the ending position in the modelBadLocationException
- if the range is invalidprotected abstract boolean isErrorHighlighting()
protected int drawSelectedText(Graphics g, int x, int y, int start, int end) throws BadLocationException
drawSelectedText
in class FoldingPlainView
g
- the graphics contextx
- the starting X coordinatey
- the starting Y coordinatestart
- the beginning position in the modelend
- the ending position in the modelBadLocationException
- if the range is invalidprotected abstract void updateScanner(SyntaxHighlightingScanner scanner, Document doc, int start, int end)
public static int getFontStyle(Style style)
style
- the style.Copyright © 2002-2013 Edwin Dankert. All Rights Reserved.