satc.swing
Class SyntaxView
java.lang.Object
|
+--javax.swing.text.View
|
+--javax.swing.text.PlainView
|
+--satc.swing.SyntaxView
- All Implemented Interfaces:
- javax.swing.SwingConstants, javax.swing.text.TabExpander
- public class SyntaxView
- extends javax.swing.text.PlainView
A View for simple multi-line text with support for syntax highlight.
When a line is to be rendered, the document lexer is called to break
the line into tokens, and each token is rendered according to its type.
Fields inherited from class javax.swing.text.PlainView |
metrics |
Fields inherited from class javax.swing.text.View |
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary |
SyntaxView(javax.swing.text.Element elem)
|
Method Summary |
void |
changedUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
On a document change event we simply redraw the entire text area. |
void |
drawLine(int lineIndex,
java.awt.Graphics g,
int x,
int y)
Draw a new line with syntax highlighting. |
int |
drawSegment(javax.swing.text.Segment segment,
java.awt.Graphics g,
int x,
int y,
int docOffset)
|
protected int |
drawUnselectedSegment(javax.swing.text.Segment segment,
java.awt.Graphics g,
int x,
int y,
int docOffset)
|
protected int |
getTabSize()
|
void |
insertUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
On a document change event we simply redraw the entire text area. |
void |
removeUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
On a document change event we simply redraw the entire text area. |
void |
setTokenContext(TokenContext tokenContext)
Sets the token rendering context (colors, fonts ...). |
Methods inherited from class javax.swing.text.PlainView |
drawSelectedText, drawUnselectedText, getLineBuffer, getPreferredSpan, modelToView, nextTabStop, paint, viewToModel |
Methods inherited from class javax.swing.text.View |
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getView, getViewCount, getViewFactory, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SyntaxView
public SyntaxView(javax.swing.text.Element elem)
getTabSize
protected int getTabSize()
- Overrides:
getTabSize
in class javax.swing.text.PlainView
drawLine
public void drawLine(int lineIndex,
java.awt.Graphics g,
int x,
int y)
- Draw a new line with syntax highlighting. A token rendering
action is registered with the document lexer and the lexer
is called to break the line into tokens.
- Overrides:
drawLine
in class javax.swing.text.PlainView
drawSegment
public int drawSegment(javax.swing.text.Segment segment,
java.awt.Graphics g,
int x,
int y,
int docOffset)
throws javax.swing.text.BadLocationException
drawUnselectedSegment
protected int drawUnselectedSegment(javax.swing.text.Segment segment,
java.awt.Graphics g,
int x,
int y,
int docOffset)
throws javax.swing.text.BadLocationException
removeUpdate
public void removeUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
- On a document change event we simply redraw the entire text area.
- Overrides:
removeUpdate
in class javax.swing.text.PlainView
insertUpdate
public void insertUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
- On a document change event we simply redraw the entire text area.
- Overrides:
insertUpdate
in class javax.swing.text.PlainView
changedUpdate
public void changedUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
- On a document change event we simply redraw the entire text area.
- Overrides:
changedUpdate
in class javax.swing.text.PlainView
setTokenContext
public void setTokenContext(TokenContext tokenContext)
- Sets the token rendering context (colors, fonts ...).