public abstract class BoxRenderer extends ProtoRenderer
Modifier and Type | Field and Description |
---|---|
(package private) static java.awt.Color |
ARROW_COLOR
Arrow color
|
private static int |
BOTTOM_INSET
Bottom inset
|
protected Context |
context
Context
|
protected java.util.Map<java.lang.Integer,java.util.List<Drawable>> |
drawables
Boxes (indexed by line)
|
(package private) static java.awt.Color |
HEAD_COLOR
Head marker color
|
private HotSpots |
hotSpots
Tooltip hotspots
|
private static int |
LABEL_BOTTOM_INSET
Label bottom inset
|
private static int |
LABEL_TOP_INSET
Label top inset
|
protected static java.awt.Font |
tagFont
Tag font
|
private static int |
TOP_INSET
Top inset
|
private static int |
X_MARGIN
X margin
|
height, topOffset
Constructor and Description |
---|
BoxRenderer(java.awt.Graphics g,
HotSpots hotSpots,
boolean tagFlag)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private void |
addDrawable(Drawable drawable,
int lineId)
Add drawable to drawables
|
protected int |
computeBoxHeight(int slotCount,
int padHeight)
Compute box height giving each box an equal share of the pad height
|
protected static int |
computeUsed(int slotCount,
int boxHeight)
Compute used height
|
Context |
getContext()
Get context
|
protected int |
getDefaultHeight()
Get minimum box height to accept label
|
abstract int |
layout(Document document,
javax.swing.text.JTextComponent textComponent,
int padWidth,
int padTopOffset,
int padHeight,
int lineHeight)
Layout
|
protected void |
makeDrawable(java.util.List<Segment> segments,
Segment headSegment,
java.lang.String tag,
java.awt.Paint color,
int slot,
int padTopOffset,
int lineHeight,
ISource source,
javax.swing.text.JTextComponent textComponent)
Make drawable
|
protected abstract Drawable |
makeDrawable(java.awt.Rectangle boxRectangle,
java.awt.Paint backgroundColor,
java.lang.String tag,
int slot,
boolean hasPreviousFlag,
boolean hasNextFlag,
int headOffset,
ISource source)
Make drawable
|
void |
paint(java.awt.Graphics g)
Paint
|
protected void |
setHotSpots()
Set hotspots
|
getHeight, getTopOffset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBackColor
static final java.awt.Color HEAD_COLOR
static final java.awt.Color ARROW_COLOR
private static final int TOP_INSET
private static final int BOTTOM_INSET
private static final int LABEL_TOP_INSET
private static final int LABEL_BOTTOM_INSET
private static final int X_MARGIN
protected final java.util.Map<java.lang.Integer,java.util.List<Drawable>> drawables
protected static final java.awt.Font tagFont
protected final Context context
private final HotSpots hotSpots
public BoxRenderer(java.awt.Graphics g, HotSpots hotSpots, boolean tagFlag)
g
- graphic contexthotSpots
- hotspotstagFlag
- tag flagpublic Context getContext()
public abstract int layout(Document document, javax.swing.text.JTextComponent textComponent, int padWidth, int padTopOffset, int padHeight, int lineHeight) throws javax.swing.text.BadLocationException
IRenderer
document
- documenttextComponent
- text componentpadWidth
- annotation pad widthpadTopOffset
- annotation pad top offsetpadHeight
- annotation pad heightlineHeight
- text line heightjavax.swing.text.BadLocationException
- exceptionprotected void makeDrawable(java.util.List<Segment> segments, Segment headSegment, java.lang.String tag, java.awt.Paint color, int slot, int padTopOffset, int lineHeight, ISource source, javax.swing.text.JTextComponent textComponent) throws javax.swing.text.BadLocationException
segments
- segments for box to spanheadSegment
- head segmenttag
- box tagcolor
- box colorslot
- box slotpadTopOffset
- toplineHeight
- text line heightsource
- source objecttextComponent
- text component to provide segment locationsjavax.swing.text.BadLocationException
- exceptionprotected abstract Drawable makeDrawable(java.awt.Rectangle boxRectangle, java.awt.Paint backgroundColor, java.lang.String tag, int slot, boolean hasPreviousFlag, boolean hasNextFlag, int headOffset, ISource source)
boxRectangle
- drawable heightbackgroundColor
- drawable background colortag
- drawable tagslot
- drawable's allocated slothasPreviousFlag
- whether this drawable continues previous linehasNextFlag
- whether this drawable is continued on next lineheadOffset
- head x offset (from left) if anysource
- source objectprivate void addDrawable(Drawable drawable, int lineId)
drawable
- drawablelineId
- line idpublic void paint(java.awt.Graphics g)
IRenderer
g
- graphics contextprotected static int computeUsed(int slotCount, int boxHeight)
slotCount
- slot countboxHeight
- box heightprotected int computeBoxHeight(int slotCount, int padHeight)
slotCount
- number of slotspadHeight
- pad heightprotected int getDefaultHeight()
protected void setHotSpots()