com.inet.html.views
Class BlankBoxPainter

java.lang.Object
  extended by com.inet.html.views.BlankBoxPainter
All Implemented Interfaces:
IBackgroundPainter, IBoxPainter

public class BlankBoxPainter
extends java.lang.Object
implements IBoxPainter

A BoxPainter which represents a transparent box without borders, padding and margin. This class is used for runtime and memory optimization. The Insets instances of this class must never be modified!


Field Summary
 
Fields inherited from interface com.inet.html.views.IBoxPainter
EMPTY_INSETS, PAINT_MODE_CENTER, PAINT_MODE_LEFTEDGE, PAINT_MODE_NORMAL, PAINT_MODE_RIGHTEDGE
 
Constructor Summary
BlankBoxPainter()
           
 
Method Summary
 com.inet.html.parser.converter.ColorValue getBackgroundValue()
          Returns the background color, may be null
 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
 javax.swing.text.Element getElement()
          Returns the element which is the value source for this painter
 java.awt.Rectangle getLastPaint()
          Returns the coordinates of the last paint operation
 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.
 BoxView getReferenceView()
          Returns the view this painter is bound to, will not be null
 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 isInitDone()
          Returns true if a table layout has modified this painter
 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 paintBackground(java.awt.Graphics g, int x, int y, int width, int height, BoxView currentView)
          Paints the background fill and/or image
 void setBackgroundValue(com.inet.html.parser.converter.ColorValue backgroundValue)
          Set the background color of this painter, may be null
 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
 void setInitDone()
          To be used in table context.
 void setLastPaint(java.awt.Rectangle lastPaint)
          Sets the coordinates of the last paint operation
 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 setReferenceView(BoxView view)
          Sets the view which is the first view to be painted by this painter.
 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 class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlankBoxPainter

public BlankBoxPainter()
Method Detail

getBorderBottomColor

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

Specified by:
getBorderBottomColor in interface IBoxPainter
Returns:
the color of the bottom border, may be null

getBorderInsets

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

Specified by:
getBorderInsets in interface IBoxPainter
Returns:
never null

getBorderLeftColor

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

Specified by:
getBorderLeftColor in interface IBoxPainter
Returns:
the color of the left border, may be null

getBorderRightColor

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

Specified by:
getBorderRightColor in interface IBoxPainter
Returns:
the color of the right border, may be null

getBorderStyles

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

Specified by:
getBorderStyles in interface IBoxPainter
Returns:
never null

getBorderTopColor

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

Specified by:
getBorderTopColor in interface IBoxPainter
Returns:
the color of the top border, may be null

getBottomBorderPadding

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

Specified by:
getBottomBorderPadding in interface IBoxPainter
Returns:
the bottom border width + padding width

getLeftBorderPadding

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

Specified by:
getLeftBorderPadding in interface IBoxPainter
Returns:
distance in pixel

getMargins

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

Specified by:
getMargins in interface IBoxPainter
Returns:
never null

getPadding

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

Specified by:
getPadding in interface IBoxPainter
Returns:
the view insets.

getRightBorderPadding

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

Specified by:
getRightBorderPadding in interface IBoxPainter
Returns:
the right border width + padding width

getTopBorderPadding

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

Specified by:
getTopBorderPadding in interface IBoxPainter
Returns:
the top border width + padding width

getTotalHeightGain

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

Specified by:
getTotalHeightGain in interface IBoxPainter
Returns:
height in pixel

getTotalLeftGain

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

Specified by:
getTotalLeftGain in interface IBoxPainter
Returns:
distance in pixel

getTotalTopGain

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

Specified by:
getTotalTopGain in interface IBoxPainter
Returns:
distance in pixel

getTotalWidthGain

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

Specified by:
getTotalWidthGain in interface IBoxPainter
Returns:
width in pixel

getView

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

Specified by:
getView in interface IBoxPainter
Returns:
the view this painter is bound to, will not be null

isRelevant

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

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

paint

public 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

Specified by:
paint in interface IBoxPainter
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:
IBoxPainter.PAINT_MODE_NORMAL, IBoxPainter.PAINT_MODE_LEFTEDGE, IBoxPainter.PAINT_MODE_CENTER, IBoxPainter.PAINT_MODE_RIGHTEDGE

paint

public 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

Specified by:
paint in interface IBoxPainter
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:
IBoxPainter.PAINT_MODE_NORMAL, IBoxPainter.PAINT_MODE_LEFTEDGE, IBoxPainter.PAINT_MODE_CENTER, IBoxPainter.PAINT_MODE_RIGHTEDGE

setBorderBottomColor

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

Specified by:
setBorderBottomColor in interface IBoxPainter
Parameters:
borderBottomColor - the color of the bottom border

setBorderLeftColor

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

Specified by:
setBorderLeftColor in interface IBoxPainter
Parameters:
borderLeftColor - color of the left border

setBorderRightColor

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

Specified by:
setBorderRightColor in interface IBoxPainter
Parameters:
borderRightColor - color of the right border

setBorderTopColor

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

Specified by:
setBorderTopColor in interface IBoxPainter
Parameters:
borderTopColor - color of the top border

updateRelativeValues

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

Specified by:
updateRelativeValues in interface IBoxPainter
Parameters:
parentWidth - The width of the parent view

updateRelevance

public 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

Specified by:
updateRelevance in interface IBoxPainter

getBackgroundValue

public com.inet.html.parser.converter.ColorValue getBackgroundValue()
Returns the background color, may be null

Specified by:
getBackgroundValue in interface IBackgroundPainter
Returns:
the background color, may be null

getElement

public javax.swing.text.Element getElement()
Returns the element which is the value source for this painter

Specified by:
getElement in interface IBackgroundPainter
Returns:
the element which is the value source for this painter

getLastPaint

public java.awt.Rectangle getLastPaint()
Returns the coordinates of the last paint operation

Specified by:
getLastPaint in interface IBackgroundPainter
Returns:
the coordinates of the last paint operation

getReferenceView

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

Specified by:
getReferenceView in interface IBackgroundPainter
Returns:
the view this painter is bound to, will not be null

isInitDone

public boolean isInitDone()
Returns true if a table layout has modified this painter

Specified by:
isInitDone in interface IBackgroundPainter
Returns:
true if a table layout has modified this painter

paintBackground

public void paintBackground(java.awt.Graphics g,
                            int x,
                            int y,
                            int width,
                            int height,
                            BoxView currentView)
Paints the background fill and/or image

Specified by:
paintBackground in interface IBackgroundPainter
Parameters:
g - the graphics to draw on, must not be null
x - the x offset in pixel relative to the graphics
y - the y offset in pixel relative to the graphics
width - the width to draw in pixel
height - the height to draw in pixel
currentView - the view for which the background is painted, required to create seamless BG-Images

setBackgroundValue

public void setBackgroundValue(com.inet.html.parser.converter.ColorValue backgroundValue)
Set the background color of this painter, may be null

Specified by:
setBackgroundValue in interface IBackgroundPainter
Parameters:
backgroundValue - the background color of this painter, may be null

setInitDone

public void setInitDone()
To be used in table context. The table changes several layout settings - this has to be done only once! This flag has to be set to true afterwards.

Specified by:
setInitDone in interface IBackgroundPainter

setLastPaint

public void setLastPaint(java.awt.Rectangle lastPaint)
Sets the coordinates of the last paint operation

Specified by:
setLastPaint in interface IBackgroundPainter
Parameters:
lastPaint - the coordinates of the last paint operation

setReferenceView

public void setReferenceView(BoxView view)
Sets the view which is the first view to be painted by this painter. All subsequent calls will be painted relatively to this view

Specified by:
setReferenceView in interface IBackgroundPainter
Parameters:
view - the coordinate root for this painter

setBorderInsets

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

Specified by:
setBorderInsets in interface IBoxPainter
Parameters:
borderInsets - the border insets

setBorderStyles

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

Specified by:
setBorderStyles in interface IBoxPainter
Parameters:
borderStyles - the border styles

setMargins

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

Specified by:
setMargins in interface IBoxPainter
Parameters:
margins - the margin insets

setPadding

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

Specified by:
setPadding in interface IBoxPainter
Parameters:
padding - the padding insets

setBorderInsets

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

Specified by:
setBorderInsets in interface IBoxPainter
Returns:
a mutable insets object to manipulate the border width

setBorderStyles

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

Specified by:
setBorderStyles in interface IBoxPainter
Returns:
a mutable insets object to manipulate the border styles

setMargins

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

Specified by:
setMargins in interface IBoxPainter
Returns:
a mutable insets object to manipulate the margin width

setPadding

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

Specified by:
setPadding in interface IBoxPainter
Returns:
a mutable insets object to manipulate the padding width