GrammarScope  4.0.0
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Static Package Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
grammarscope.browser.renderer.BoxRenderer Class Referenceabstract
Inheritance diagram for grammarscope.browser.renderer.BoxRenderer:
Inheritance graph
[legend]
Collaboration diagram for grammarscope.browser.renderer.BoxRenderer:
Collaboration graph
[legend]

Public Member Functions

 BoxRenderer (final Graphics g, final HotSpots hotSpots, final boolean tagFlag)
 
Context getContext ()
 
abstract int layout (final Document document, final JTextComponent textComponent, final int padWidth, final int padTopOffset, final int padHeight, final int lineHeight) throws BadLocationException
 
void paint (final Graphics g)
 
- Public Member Functions inherited from grammarscope.browser.renderer.ProtoRenderer
int getTopOffset ()
 
int getHeight ()
 
- Public Member Functions inherited from grammarscope.browser.renderer.IRenderer
Color getBackColor ()
 

Protected Member Functions

void makeDrawable (final List< Segment > segments, final Segment headSegment, final String tag, final Paint color, final int slot, final int padTopOffset, final int lineHeight, final ISource source, final JTextComponent textComponent) throws BadLocationException
 
abstract Drawable makeDrawable (final Rectangle boxRectangle, final Paint backgroundColor, final String tag, final int slot, final boolean hasPreviousFlag, final boolean hasNextFlag, final int headOffset, final ISource source)
 
int computeBoxHeight (final int slotCount, final int padHeight)
 
int getDefaultHeight ()
 
void setHotSpots ()
 

Static Protected Member Functions

static int computeUsed (final int slotCount, final int boxHeight)
 

Protected Attributes

final Map< Integer, List< Drawable > > drawables
 
final Context context
 
- Protected Attributes inherited from grammarscope.browser.renderer.ProtoRenderer
int topOffset
 
int height
 

Static Protected Attributes

static final Font tagFont = new Font(Font.SANS_SERIF, Font.PLAIN, 9)
 

Static Package Attributes

static final Color HEAD_COLOR = Color.GRAY
 
static final Color ARROW_COLOR = Color.LIGHT_GRAY
 

Private Member Functions

void addDrawable (final Drawable drawable, final int lineId)
 

Private Attributes

final HotSpots hotSpots
 

Static Private Attributes

static final int TOP_INSET = 5
 
static final int BOTTOM_INSET = 5
 
static final int LABEL_TOP_INSET = 1
 
static final int LABEL_BOTTOM_INSET = 1
 
static final int X_MARGIN = 40
 

Detailed Description

Box renderer

Author
Bernard Bou

Constructor & Destructor Documentation

◆ BoxRenderer()

grammarscope.browser.renderer.BoxRenderer.BoxRenderer ( final Graphics  g,
final HotSpots  hotSpots,
final boolean  tagFlag 
)

Constructor

Parameters
ggraphic context
hotSpotshotspots
tagFlagtag flag

Member Function Documentation

◆ addDrawable()

void grammarscope.browser.renderer.BoxRenderer.addDrawable ( final Drawable  drawable,
final int  lineId 
)
private

Add drawable to drawables

Parameters
drawabledrawable
lineIdline id

◆ computeBoxHeight()

int grammarscope.browser.renderer.BoxRenderer.computeBoxHeight ( final int  slotCount,
final int  padHeight 
)
protected

Compute box height giving each box an equal share of the pad height

Parameters
slotCountnumber of slots
padHeightpad height
Returns
box height

◆ computeUsed()

static int grammarscope.browser.renderer.BoxRenderer.computeUsed ( final int  slotCount,
final int  boxHeight 
)
staticprotected

Compute used height

Parameters
slotCountslot count
boxHeightbox height
Returns
used height

◆ getContext()

Context grammarscope.browser.renderer.BoxRenderer.getContext ( )

Get context

Returns
context

◆ getDefaultHeight()

int grammarscope.browser.renderer.BoxRenderer.getDefaultHeight ( )
protected

Get minimum box height to accept label

Returns
minimum box height to accept label

◆ layout()

abstract int grammarscope.browser.renderer.BoxRenderer.layout ( final Document  document,
final JTextComponent  textComponent,
final int  padWidth,
final int  padTopOffset,
final int  padHeight,
final int  lineHeight 
) throws BadLocationException
abstract

Layout

Parameters
documentdocument
textComponenttext component
padWidthannotation pad width
padTopOffsetannotation pad top offset
padHeightannotation pad height
lineHeighttext line height
Returns
used pad height
Exceptions
BadLocationExceptionexception

Implements grammarscope.browser.renderer.IRenderer.

Reimplemented in grammarscope.browser.renderer.RelationsRenderer, grammarscope.browser.renderer.CoreferencesRenderer, grammarscope.browser.renderer.NamedEntitiesRenderer, grammarscope.browser.renderer.PosesRenderer, and grammarscope.browser.renderer.SentimentRenderer.

◆ makeDrawable() [1/2]

void grammarscope.browser.renderer.BoxRenderer.makeDrawable ( final List< Segment segments,
final Segment  headSegment,
final String  tag,
final Paint  color,
final int  slot,
final int  padTopOffset,
final int  lineHeight,
final ISource  source,
final JTextComponent  textComponent 
) throws BadLocationException
protected

Make drawable

Parameters
segmentssegments for box to span
headSegmenthead segment
tagbox tag
colorbox color
slotbox slot
padTopOffsettop
lineHeighttext line height
sourcesource object
textComponenttext component to provide segment locations
Exceptions
BadLocationExceptionexception

◆ makeDrawable() [2/2]

abstract Drawable grammarscope.browser.renderer.BoxRenderer.makeDrawable ( final Rectangle  boxRectangle,
final Paint  backgroundColor,
final String  tag,
final int  slot,
final boolean  hasPreviousFlag,
final boolean  hasNextFlag,
final int  headOffset,
final ISource  source 
)
abstractprotected

Make drawable

Parameters
boxRectangledrawable height
backgroundColordrawable background color
tagdrawable tag
slotdrawable's allocated slot
hasPreviousFlagwhether this drawable continues previous line
hasNextFlagwhether this drawable is continued on next line
headOffsethead x offset (from left) if any
sourcesource object
Returns
drawable

Reimplemented in grammarscope.browser.renderer.RelationsRenderer, grammarscope.browser.renderer.CoreferencesRenderer, grammarscope.browser.renderer.NamedEntitiesRenderer, grammarscope.browser.renderer.SentimentRenderer, and grammarscope.browser.renderer.PosesRenderer.

◆ paint()

void grammarscope.browser.renderer.BoxRenderer.paint ( final Graphics  graphics)

Paint

Parameters
graphicsgraphics context

Implements grammarscope.browser.renderer.IRenderer.

◆ setHotSpots()

void grammarscope.browser.renderer.BoxRenderer.setHotSpots ( )
protected

Set hotspots

Member Data Documentation

◆ ARROW_COLOR

final Color grammarscope.browser.renderer.BoxRenderer.ARROW_COLOR = Color.LIGHT_GRAY
staticpackage

Arrow color

◆ BOTTOM_INSET

final int grammarscope.browser.renderer.BoxRenderer.BOTTOM_INSET = 5
staticprivate

Bottom inset

◆ context

final Context grammarscope.browser.renderer.BoxRenderer.context
protected

◆ drawables

final Map<Integer, List<Drawable> > grammarscope.browser.renderer.BoxRenderer.drawables
protected

Boxes (indexed by line)

◆ HEAD_COLOR

final Color grammarscope.browser.renderer.BoxRenderer.HEAD_COLOR = Color.GRAY
staticpackage

Head marker color

◆ hotSpots

final HotSpots grammarscope.browser.renderer.BoxRenderer.hotSpots
private

Tooltip hotspots

◆ LABEL_BOTTOM_INSET

final int grammarscope.browser.renderer.BoxRenderer.LABEL_BOTTOM_INSET = 1
staticprivate

Label bottom inset

◆ LABEL_TOP_INSET

final int grammarscope.browser.renderer.BoxRenderer.LABEL_TOP_INSET = 1
staticprivate

Label top inset

◆ tagFont

final Font grammarscope.browser.renderer.BoxRenderer.tagFont = new Font(Font.SANS_SERIF, Font.PLAIN, 9)
staticprotected

Tag font

◆ TOP_INSET

final int grammarscope.browser.renderer.BoxRenderer.TOP_INSET = 5
staticprivate

Top inset

◆ X_MARGIN

final int grammarscope.browser.renderer.BoxRenderer.X_MARGIN = 40
staticprivate

X margin


The documentation for this class was generated from the following file: