com.inet.html.views
Interface IBoxPainter

All Superinterfaces:
IBackgroundPainter
All Known Implementing Classes:
BlankBoxPainter, BoxPainter, TableBoxPainter

public interface IBoxPainter
extends IBackgroundPainter

This is the basic box painter interface. the Box painter defines the box of a view in style and size. NOTE: BoxPainter are dedicated to a view in the means of relative values. Nevertheless it can be bound to a model element to reuse the painter for in-line boxes or content painters. http://www.w3.org/TR/1998/REC-CSS2/box.html


Field Summary
static java.awt.Insets EMPTY_INSETS
           
static int PAINT_MODE_CENTER
          paints the center of a inline box(no left/right borders/padding)
static int PAINT_MODE_LEFTEDGE
          paints the left edge of an inline box
static int PAINT_MODE_NORMAL
          paints a normal box as usual
static int PAINT_MODE_RIGHTEDGE
          paints the right edge of an inline box
 
Method Summary
 com.inet.html.parser.converter.ColorValue getBorderBottomColor()
          Returns the color of the bottom border, may be null
 java.awt.Insets getBorderInsets()
          Get the border sizes set by html or CSS.
 com.inet.html.parser.converter.ColorValue getBorderLeftColor()
          Returns the color of the left border, may be null
 com.inet.html.parser.converter.ColorValue getBorderRightColor()
          Returns the color of the right border, may be null
 java.awt.Insets getBorderStyles()
          Get the border styles set by CSS.
 com.inet.html.parser.converter.ColorValue getBorderTopColor()
          Returns the color of the top border, may be null
 int getBottomBorderPadding()
          Returns the bottom border width + padding width
 int getLeftBorderPadding()
          Returns the distance between the outer border and the content area on the left side
 java.awt.Insets getMargins()
          Get the CSS margins.
 java.awt.Insets getPadding()
          This are the padding values set by the CSS.
 int getRightBorderPadding()
          Returns the right border width + padding width
 int getTopBorderPadding()
          Returns the top border width + padding width
 int getTotalHeightGain()
          Returns the total difference in width between the content and the box around the margin
 int getTotalLeftGain()
          Distance between the margins outer border to the left end the left border of the content
 int getTotalTopGain()
          Distance between the margins outer border on the top and the top border of the content
 int getTotalWidthGain()
          Returns the total difference in width between the content and the box around the margin
 BoxView getView()
          Returns the view this painter is bound to, will not be null
 boolean isRelevant()
          Returns true if this box painter has any visible effect (note: padding is visible as well!)
 void paint(java.awt.Graphics g, int x, int y, int width, int height, int paintMode, BoxView paintRef)
          Paints the box or a part of the box represented by this painter.
 void paint(java.awt.Graphics g, java.awt.Rectangle r, int paintMode, BoxView paintRef)
          Paints the box or a part of the box represented by this painter.
 void setBorderBottomColor(com.inet.html.parser.converter.ColorValue borderBottomColor)
          Sets the color of the bottom border
 java.awt.Insets setBorderInsets()
          Returns a mutable insets object to manipulate the border width
 void setBorderInsets(java.awt.Insets borderInsets)
          Sets the border insets.
 void setBorderLeftColor(com.inet.html.parser.converter.ColorValue borderLeftColor)
          Sets the color of the left border
 void setBorderRightColor(com.inet.html.parser.converter.ColorValue borderRightColor)
          Sets the color of the right border
 java.awt.Insets setBorderStyles()
          Returns a mutable insets object to manipulate the border styles
 void setBorderStyles(java.awt.Insets borderStyles)
          Sets the border styles.
 void setBorderTopColor(com.inet.html.parser.converter.ColorValue borderTopColor)
          Sets the color of the top border
 java.awt.Insets setMargins()
          Returns a mutable insets object to manipulate the margin width
 void setMargins(java.awt.Insets margins)
          Sets the margin insets
 java.awt.Insets setPadding()
          Returns a mutable insets object to manipulate the padding width
 void setPadding(java.awt.Insets padding)
          Sets the padding insets
 void updateRelativeValues(int parentWidth)
          Checks whether this view has relative paddings or margins an updates them.
 void updateRelevance()
          Updates the internal relevance flag.
 
Methods inherited from interface com.inet.html.views.IBackgroundPainter
getBackgroundValue, getElement, getLastPaint, getReferenceView, isInitDone, paintBackground, setBackgroundValue, setInitDone, setLastPaint, setReferenceView
 

Field Detail

PAINT_MODE_NORMAL

static final int PAINT_MODE_NORMAL
paints a normal box as usual

See Also:
Constant Field Values

PAINT_MODE_LEFTEDGE

static final int PAINT_MODE_LEFTEDGE
paints the left edge of an inline box

See Also:
Constant Field Values

PAINT_MODE_CENTER

static final int PAINT_MODE_CENTER
paints the center of a inline box(no left/right borders/padding)

See Also:
Constant Field Values

PAINT_MODE_RIGHTEDGE

static final int PAINT_MODE_RIGHTEDGE
paints the right edge of an inline box

See Also:
Constant Field Values

EMPTY_INSETS

static final java.awt.Insets EMPTY_INSETS
Method Detail

updateRelativeValues

void updateRelativeValues(int parentWidth)
Checks whether this view has relative paddings or margins an updates them.

Parameters:
parentWidth - The width of the parent view

getPadding

java.awt.Insets getPadding()
This are the padding values set by the CSS. WARNING: This object is immutable!

Returns:
the view insets.

getMargins

java.awt.Insets getMargins()
Get the CSS margins. WARNING: This object is immutable!

Returns:
never null

getBorderInsets

java.awt.Insets getBorderInsets()
Get the border sizes set by html or CSS. WARNING: This object is immutable!

Returns:
never null

getBorderStyles

java.awt.Insets getBorderStyles()
Get the border styles set by CSS. WARNING: This object is immutable!

Returns:
never null

getTotalWidthGain

int getTotalWidthGain()
Returns the total difference in width between the content and the box around the margin

Returns:
width in pixel

getTotalHeightGain

int getTotalHeightGain()
Returns the total difference in width between the content and the box around the margin

Returns:
height in pixel

getLeftBorderPadding

int getLeftBorderPadding()
Returns the distance between the outer border and the content area on the left side

Returns:
distance in pixel

getTopBorderPadding

int getTopBorderPadding()
Returns the top border width + padding width

Returns:
the top border width + padding width

getBottomBorderPadding

int getBottomBorderPadding()
Returns the bottom border width + padding width

Returns:
the bottom border width + padding width

getRightBorderPadding

int getRightBorderPadding()
Returns the right border width + padding width

Returns:
the right border width + padding width

getTotalLeftGain

int getTotalLeftGain()
Distance between the margins outer border to the left end the left border of the content

Returns:
distance in pixel

getTotalTopGain

int getTotalTopGain()
Distance between the margins outer border on the top and the top border of the content

Returns:
distance in pixel

paint

void paint(java.awt.Graphics g,
           java.awt.Rectangle r,
           int paintMode,
           BoxView paintRef)
Paints the box or a part of the box represented by this painter.
NOTE: Partial painting is required for inline boxes since these boxes are likely to span several lines

Parameters:
g - the graphics to paint to
r - the area do draw to
paintMode - the paint mode constant
paintRef - the coordinate reference for inline background images
See Also:
PAINT_MODE_NORMAL, PAINT_MODE_LEFTEDGE, PAINT_MODE_CENTER, PAINT_MODE_RIGHTEDGE

paint

void paint(java.awt.Graphics g,
           int x,
           int y,
           int width,
           int height,
           int paintMode,
           BoxView paintRef)
Paints the box or a part of the box represented by this painter.
NOTE: Partial painting is required for inline boxes since these boxes are likely to span several lines

Parameters:
g - the graphics to paint to
x - the x coordinate of the paint area
y - the y coordinate of the paint area
width - the width coordinate of the paint area
height - the height coordinate of the paint area
paintMode - the paint mode constant
paintRef - the coordinate reference for inline background images
See Also:
PAINT_MODE_NORMAL, PAINT_MODE_LEFTEDGE, PAINT_MODE_CENTER, PAINT_MODE_RIGHTEDGE

getView

BoxView getView()
Returns the view this painter is bound to, will not be null

Returns:
the view this painter is bound to, will not be null

getBorderTopColor

com.inet.html.parser.converter.ColorValue getBorderTopColor()
Returns the color of the top border, may be null

Returns:
the color of the top border, may be null

getBorderLeftColor

com.inet.html.parser.converter.ColorValue getBorderLeftColor()
Returns the color of the left border, may be null

Returns:
the color of the left border, may be null

getBorderRightColor

com.inet.html.parser.converter.ColorValue getBorderRightColor()
Returns the color of the right border, may be null

Returns:
the color of the right border, may be null

getBorderBottomColor

com.inet.html.parser.converter.ColorValue getBorderBottomColor()
Returns the color of the bottom border, may be null

Returns:
the color of the bottom border, may be null

setBorderBottomColor

void setBorderBottomColor(com.inet.html.parser.converter.ColorValue borderBottomColor)
Sets the color of the bottom border

Parameters:
borderBottomColor - the color of the bottom border

setBorderLeftColor

void setBorderLeftColor(com.inet.html.parser.converter.ColorValue borderLeftColor)
Sets the color of the left border

Parameters:
borderLeftColor - color of the left border

setBorderRightColor

void setBorderRightColor(com.inet.html.parser.converter.ColorValue borderRightColor)
Sets the color of the right border

Parameters:
borderRightColor - color of the right border

setBorderTopColor

void setBorderTopColor(com.inet.html.parser.converter.ColorValue borderTopColor)
Sets the color of the top border

Parameters:
borderTopColor - color of the top border

isRelevant

boolean isRelevant()
Returns true if this box painter has any visible effect (note: padding is visible as well!)

Specified by:
isRelevant in interface IBackgroundPainter
Returns:
true if this box painter has any visible effect

updateRelevance

void updateRelevance()
Updates the internal relevance flag. This is required, if the box values were changes externally and may cause this painter to change it's relevance


setBorderStyles

void setBorderStyles(java.awt.Insets borderStyles)
Sets the border styles.

Parameters:
borderStyles - the border styles

setBorderInsets

void setBorderInsets(java.awt.Insets borderInsets)
Sets the border insets.

Parameters:
borderInsets - the border insets

setPadding

void setPadding(java.awt.Insets padding)
Sets the padding insets

Parameters:
padding - the padding insets

setMargins

void setMargins(java.awt.Insets margins)
Sets the margin insets

Parameters:
margins - the margin insets

setBorderInsets

java.awt.Insets setBorderInsets()
Returns a mutable insets object to manipulate the border width

Returns:
a mutable insets object to manipulate the border width

setBorderStyles

java.awt.Insets setBorderStyles()
Returns a mutable insets object to manipulate the border styles

Returns:
a mutable insets object to manipulate the border styles

setMargins

java.awt.Insets setMargins()
Returns a mutable insets object to manipulate the margin width

Returns:
a mutable insets object to manipulate the margin width

setPadding

java.awt.Insets setPadding()
Returns a mutable insets object to manipulate the padding width

Returns:
a mutable insets object to manipulate the padding width