danger.text.span
Class BulletSpan

java.lang.Object
  extended by danger.text.span.BulletSpan
All Implemented Interfaces:
LeftMarginSpan, LineHeightSpan, MetricAffectingSpan, ParagraphSpan


public class BulletSpan
extends Object
implements LeftMarginSpan, LineHeightSpan

BulletSpan is a LeftMarginSpan that draws a bullet or a specified string of text in front of the first line it affects.


Nested Class Summary
 
Nested classes/interfaces inherited from interface danger.text.span.LeftMarginSpan
LeftMarginSpan.Standard
 
Nested classes/interfaces inherited from interface danger.text.span.ParagraphSpan
ParagraphSpan.Set
 
Nested classes/interfaces inherited from interface danger.text.span.ParagraphSpan
ParagraphSpan.Set
 
Field Summary
 
Fields inherited from interface danger.text.span.ParagraphSpan
PARAGRAPH_SPAN_TYPE
 
Fields inherited from interface danger.text.span.ParagraphSpan
PARAGRAPH_SPAN_TYPE
 
Constructor Summary
BulletSpan()
          Create a new BulletSpan with the standard bullet for its tag.
BulletSpan(String tag)
          Create a new BulletSpan with the specified string for its tag.
 
Method Summary
 int drawLeftMargin(Pen p, int x, int top, int baseline, int bottom, Object[] spans, CharSequence text, int parStart, int lineStart, int paragraphDistance, Object[] characterSpans)
          Draws the left margin.
 CharSequence getTag()
           
 int getVerticalDimensions(Font f, CharSequence text, int parStart, int lineStart, int lineEnd, Object[] rulerSpans, int ascent, int descent, int paragraphDistance)
          The first line of the paragraph has to be as tall as the bullet.
 int modifyLeftMargin(int margin, Object[] spans, Font f, CharSequence text, int parStart, int lineStart, int paragraphDistance)
          Returns the new left margin, which is incremented by the width of the tag plus the width of a space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BulletSpan

public BulletSpan()
Create a new BulletSpan with the standard bullet for its tag.


BulletSpan

public BulletSpan(String tag)
Create a new BulletSpan with the specified string for its tag.

Method Detail

modifyLeftMargin

public int modifyLeftMargin(int margin,
                            Object[] spans,
                            Font f,
                            CharSequence text,
                            int parStart,
                            int lineStart,
                            int paragraphDistance)
Returns the new left margin, which is incremented by the width of the tag plus the width of a space.

Specified by:
modifyLeftMargin in interface LeftMarginSpan

drawLeftMargin

public int drawLeftMargin(Pen p,
                          int x,
                          int top,
                          int baseline,
                          int bottom,
                          Object[] spans,
                          CharSequence text,
                          int parStart,
                          int lineStart,
                          int paragraphDistance,
                          Object[] characterSpans)
Draws the left margin. In the first affected line, the tag is drawn; in other lines, the margin is blank.

Specified by:
drawLeftMargin in interface LeftMarginSpan

getVerticalDimensions

public int getVerticalDimensions(Font f,
                                 CharSequence text,
                                 int parStart,
                                 int lineStart,
                                 int lineEnd,
                                 Object[] rulerSpans,
                                 int ascent,
                                 int descent,
                                 int paragraphDistance)
The first line of the paragraph has to be as tall as the bullet.

Specified by:
getVerticalDimensions in interface LineHeightSpan

getTag

public CharSequence getTag()