|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.LayeredHighlighter
javax.swing.text.DefaultHighlighter
edu.rice.cs.drjava.ui.ReverseHighlighter
public class ReverseHighlighter
Implements the Highlighter interfaces. Implements a simple highlight painter, but stores the highlights in reverse order. That means that the selection (for copying) is always the foremost hightlight, and after that, the highlights are drawn from most recent to oldest. Based on DefaultHighlighter by Timothy Prinzing, version 1.39 12/19/03 Unfortunately, as the vector of highlights in DefaultHighlighter was private, there was no efficient way to make use of inheritance.
Nested Class Summary | |
---|---|
static class |
ReverseHighlighter.DefaultFrameHighlightPainter
Simple highlight painter that draws a rectangular box around text. |
static class |
ReverseHighlighter.DefaultUnderlineHighlightPainter
Simple highlight painter that underlines text. |
static class |
ReverseHighlighter.DrJavaHighlightPainter
This class is a wrapper for the DefaultHighlightPainter that allows us to tell whether a highlight was requested by DrJava or by Swing (as in selected text). |
Nested classes/interfaces inherited from class javax.swing.text.DefaultHighlighter |
---|
DefaultHighlighter.DefaultHighlightPainter |
Nested classes/interfaces inherited from class javax.swing.text.LayeredHighlighter |
---|
LayeredHighlighter.LayerPainter |
Nested classes/interfaces inherited from interface javax.swing.text.Highlighter |
---|
Highlighter.Highlight, Highlighter.HighlightPainter |
Field Summary |
---|
Fields inherited from class javax.swing.text.DefaultHighlighter |
---|
DefaultPainter |
Constructor Summary | |
---|---|
ReverseHighlighter()
Creates a new ReverseHighlighter object. |
Method Summary | |
---|---|
Object |
addHighlight(int p0,
int p1,
Highlighter.HighlightPainter p)
Adds a highlight to the view. |
void |
changeHighlight(Object tag,
int p0,
int p1)
Changes a highlight. |
void |
deinstall(JTextComponent c)
Called when the UI is being removed from the interface of a JTextComponent. |
boolean |
getDrawsLayeredHighlights()
|
Highlighter.Highlight[] |
getHighlights()
Makes a copy of the highlights. |
void |
install(JTextComponent c)
Called when the UI is being installed into the interface of a JTextComponent. |
void |
paint(Graphics g)
Renders the highlights. |
void |
paintLayeredHighlights(Graphics g,
int p0,
int p1,
Shape viewBounds,
JTextComponent editor,
View view)
When leaf Views (such as LabelView) are rendering they should call into this method. |
void |
removeAllHighlights()
Removes all highlights. |
void |
removeHighlight(Object tag)
Removes a highlight from the view. |
void |
setDrawsLayeredHighlights(boolean newValue)
If true, highlights are drawn as the Views draw the text. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReverseHighlighter()
Method Detail |
---|
public void paint(Graphics g)
paint
in interface Highlighter
paint
in class DefaultHighlighter
g
- the graphics contextpublic void install(JTextComponent c)
install
in interface Highlighter
install
in class DefaultHighlighter
c
- the editor componentHighlighter.install(javax.swing.text.JTextComponent)
public void deinstall(JTextComponent c)
deinstall
in interface Highlighter
deinstall
in class DefaultHighlighter
c
- the componentHighlighter.deinstall(javax.swing.text.JTextComponent)
public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter p) throws BadLocationException
addHighlight
in interface Highlighter
addHighlight
in class DefaultHighlighter
p0
- the start offset of the range to highlight >= 0p1
- the end offset of the range to highlight >= p0p
- the painter to use to actually render the highlight
BadLocationException
- if the specified location is invalidpublic void removeHighlight(Object tag)
removeHighlight
in interface Highlighter
removeHighlight
in class DefaultHighlighter
tag
- the reference to the highlightpublic void removeAllHighlights()
removeAllHighlights
in interface Highlighter
removeAllHighlights
in class DefaultHighlighter
public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException
changeHighlight
in interface Highlighter
changeHighlight
in class DefaultHighlighter
tag
- the highlight tagp0
- the beginning of the range >= 0p1
- the end of the range >= p0
BadLocationException
- if the specified location is invalidpublic Highlighter.Highlight[] getHighlights()
getHighlights
in interface Highlighter
getHighlights
in class DefaultHighlighter
Highlighter.getHighlights()
public void paintLayeredHighlights(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view)
paintLayeredHighlights
in class DefaultHighlighter
g
- Graphics used to drawp0
- starting offset of viewp1
- ending offset of viewviewBounds
- Bounds of Vieweditor
- JTextComponentview
- View instance being renderedpublic void setDrawsLayeredHighlights(boolean newValue)
paintLayeredHighlight
which
will result in a rectangle being drawn before the text is drawn
(if the offsets are in a highlighted region that is). For this to
work the painter supplied must be an instance of
LayeredHighlightPainter.
setDrawsLayeredHighlights
in class DefaultHighlighter
public boolean getDrawsLayeredHighlights()
getDrawsLayeredHighlights
in class DefaultHighlighter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |