javax.swing.text.html
Class StyleSheet.ListPainter

java.lang.Object
  extended byjavax.swing.text.html.StyleSheet.ListPainter
All Implemented Interfaces:
Serializable
Enclosing class:
StyleSheet

public static class StyleSheet.ListPainter
extends Object
implements Serializable

Class to carry out some of the duties of CSS list formatting. Implementations of this class enable views to present the CSS formatting while not knowing anything about how the CSS values are being cached.

See Also:
Serialized Form

Field Summary
private  int bulletgap
           
private  boolean checkedForStart
           
(package private)  URL imageurl
           
(package private)  Icon img
           
private  Rectangle paintRect
           
(package private) static char[][] romanChars
           
private  int start
           
private  CSS.Value type
           
 
Constructor Summary
(package private) StyleSheet.ListPainter(AttributeSet attr, StyleSheet ss)
           
 
Method Summary
(package private)  void drawIcon(Graphics g, int ax, int ay, int ah, float align, Component c)
          Draws the bullet icon specified by the list-style-image argument.
(package private)  void drawLetter(Graphics g, char letter, int ax, int ay, int ah, float align, int index)
          Draws the letter or number for an ordered list.
(package private)  void drawShape(Graphics g, CSS.Value type, int ax, int ay, int ah, float align)
          Draws the graphical bullet item specified by the type argument.
(package private)  String formatAlphaNumerals(int itemNum)
          Converts the item number into an alphabetic character
(package private)  String formatItemNum(int itemNum, char type)
          Converts the item number into the ordered list number (i.e. 1 2 3, i ii iii, a b c, etc.
(package private)  String formatRomanDigit(int level, int digit)
          Converts the item number into a roman numeral
(package private)  String formatRomanNumerals(int num)
          Converts the item number into a roman numeral
(package private)  String formatRomanNumerals(int level, int num)
          Converts the item number into a roman numeral
private  CSS.Value getChildType(View childView)
          Returns a string that represents the value of the HTML.Attribute.TYPE attribute.
private  int getRenderIndex(View parentView, int childIndex)
          Returns an integer that should be used to render the child at childIndex with.
private  void getStart(View parent)
          Obtains the starting index from parent.
 void paint(Graphics g, float x, float y, float w, float h, View v, int item)
          Paints the CSS list decoration according to the attributes given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

romanChars

static final char[][] romanChars

paintRect

private Rectangle paintRect

checkedForStart

private boolean checkedForStart

start

private int start

type

private CSS.Value type

imageurl

URL imageurl

img

Icon img

bulletgap

private int bulletgap
Constructor Detail

StyleSheet.ListPainter

StyleSheet.ListPainter(AttributeSet attr,
                       StyleSheet ss)
Method Detail

getChildType

private CSS.Value getChildType(View childView)
Returns a string that represents the value of the HTML.Attribute.TYPE attribute. If this attributes is not defined, then then the type defaults to "disc" unless the tag is on Ordered list. In the case of the latter, the default type is "decimal".


getStart

private void getStart(View parent)
Obtains the starting index from parent.


getRenderIndex

private int getRenderIndex(View parentView,
                           int childIndex)
Returns an integer that should be used to render the child at childIndex with. The retValue will usually be childIndex + 1, unless parentView has some Views that do not represent LI's, or one of the views has a HTML.Attribute.START specified.


paint

public void paint(Graphics g,
                  float x,
                  float y,
                  float w,
                  float h,
                  View v,
                  int item)
Paints the CSS list decoration according to the attributes given.

Parameters:
g - the rendering surface.
x - the x coordinate of the list item allocation
y - the y coordinate of the list item allocation
w - the width of the list item allocation
h - the height of the list item allocation
v - the allocated area to paint into.
item - which list item is being painted. This is a number greater than or equal to 0.

drawIcon

void drawIcon(Graphics g,
              int ax,
              int ay,
              int ah,
              float align,
              Component c)
Draws the bullet icon specified by the list-style-image argument.

Parameters:
g - the graphics context
ax - x coordinate to place the bullet
ay - y coordinate to place the bullet
ah - height of the container the bullet is placed in
align - preferred alignment factor for the child view

drawShape

void drawShape(Graphics g,
               CSS.Value type,
               int ax,
               int ay,
               int ah,
               float align)
Draws the graphical bullet item specified by the type argument.

Parameters:
g - the graphics context
type - type of bullet to draw (circle, square, disc)
ax - x coordinate to place the bullet
ay - y coordinate to place the bullet
ah - height of the container the bullet is placed in
align - preferred alignment factor for the child view

drawLetter

void drawLetter(Graphics g,
                char letter,
                int ax,
                int ay,
                int ah,
                float align,
                int index)
Draws the letter or number for an ordered list.

Parameters:
g - the graphics context
letter - type of ordered list to draw
ax - x coordinate to place the bullet
ay - y coordinate to place the bullet
ah - height of the container the bullet is placed in
index - position of the list item in the list

formatItemNum

String formatItemNum(int itemNum,
                     char type)
Converts the item number into the ordered list number (i.e. 1 2 3, i ii iii, a b c, etc.

Parameters:
itemNum - number to format
type - type of ordered list

formatAlphaNumerals

String formatAlphaNumerals(int itemNum)
Converts the item number into an alphabetic character

Parameters:
itemNum - number to format

formatRomanNumerals

String formatRomanNumerals(int num)
Converts the item number into a roman numeral

Parameters:
num - number to format

formatRomanNumerals

String formatRomanNumerals(int level,
                           int num)
Converts the item number into a roman numeral

Parameters:
num - number to format

formatRomanDigit

String formatRomanDigit(int level,
                        int digit)
Converts the item number into a roman numeral

Parameters:
level - position