com.jidesoft.editor.margin
Interface LineMarginPainter
- All Superinterfaces:
- RowMarginPainter
- All Known Implementing Classes:
- AbstractLineMarginPainter
public interface LineMarginPainter
- extends RowMarginPainter
A painter interface to paint the margin area line by line. This painter is mainly used to add extra content to an
existing line margin. For example, you have a line number margin. Now you want to use the same space to add extra
information about breakpoints. For example, instead of displaying a line number, we will paint a breakpoint icon to
override the line number if that line has a breakpoint. You can certainly create a new margin to do it but it will
take extra space. So we can use this LineMarginPainter
to paint a layer on top of the line number
margin.
The difference of this LineMarginPainter
from the MarginPainter
is this one will paint line
by line and will only paint the lines that are visible to users. In comparison, MarginPainter
's
paintMargin method will be called in all cases.
You can add many LineMarginPainter
s to AbstractLineMargin
. In order to decide the order to
paint them, each LineMarginPainter
has layer index. The lower the layer index is, the earlier it gets
painted. In the other word, the painter has a higher index will overwrite those that have lower index. The default
layer index is defined as RowMarginPainter.LAYER_DEFAULT_INDEX
. The original content of the margin is painted at this layer.
For example, in code folding margin, code folding information is painted on LAYER_DEFAULT_INDEX
. If you
want to your painter painted before code folding information, use a layer index smaller than
LAYER_DEFAULT_INDEX
. If you want it painted after the code folding, use an index larger than
LAYER_DEFAULT_INDEX
.
paintLineMargin
void paintLineMargin(Graphics g,
CodeEditor editor,
Rectangle rect,
int line)
- Paints the margin.
- Parameters:
g
- the graphicseditor
- The Code Editorrect
- the rectline
- the line index.