|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.inet.html.views.BackgroundPainter
com.inet.html.views.BoxPainter
public class BoxPainter
This is the basic box painter. It reads the required borders, margins and padding itself. 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 |
---|
Fields inherited from interface com.inet.html.views.IBoxPainter |
---|
EMPTY_INSETS, PAINT_MODE_CENTER, PAINT_MODE_LEFTEDGE, PAINT_MODE_NORMAL, PAINT_MODE_RIGHTEDGE |
Method Summary | |
---|---|
static IBoxPainter |
createBoxPainter(BoxView view)
Creates a box painter for a specified view. |
static IBoxPainter |
createBoxPainter(BoxView parent,
BoxView paintRef,
javax.swing.text.Element descendant)
Creates a box painter for a specified view. |
static IBoxPainter |
createBoxPainter(BoxView parent,
javax.swing.text.Element descendant)
Creates a box painter for a specified view. |
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 class com.inet.html.views.BackgroundPainter |
---|
getBackgroundValue, getElement, getLastPaint, getReferenceView, isInitDone, paintBackground, setBackgroundValue, setInitDone, setLastPaint, setReferenceView |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.inet.html.views.IBackgroundPainter |
---|
getBackgroundValue, getElement, getLastPaint, getReferenceView, isInitDone, paintBackground, setBackgroundValue, setInitDone, setLastPaint, setReferenceView |
Method Detail |
---|
public static IBoxPainter createBoxPainter(BoxView parent, javax.swing.text.Element descendant)
parent
- Parent view of the painter, will be used as a reference in case of relative valuesdescendant
- If this is set , the painter will be registered at the parent to always paint
descendants of this element. This will be used for splitted inline boxes.
Note: descendant
is supposed to be a descendant of the parent view's element!
public static IBoxPainter createBoxPainter(BoxView parent, BoxView paintRef, javax.swing.text.Element descendant)
parent
- Parent view of the painter, will be used as a reference in case of relative valuespaintRef
- the first view in the flow, which will use this painter - required as a reference
for seamless background imagesdescendant
- If this is set , the painter will be registered at the parent to always paint
descendants of this element. This will be used for splitted inline boxes.
Note: descendant
is supposed to be a descendant of the parent view's element!
public static IBoxPainter createBoxPainter(BoxView view)
view
- Parent view of the painter, will be used as a reference in case of relative values
of the view's element. It this element has already a painter attached, this painter will be returned.
That way a painter can be used for several views in an inline layout,
public void updateRelativeValues(int parentWidth)
updateRelativeValues
in interface IBoxPainter
parentWidth
- The width of the parent viewpublic java.awt.Insets getPadding()
getPadding
in interface IBoxPainter
public java.awt.Insets getMargins()
getMargins
in interface IBoxPainter
public java.awt.Insets getBorderInsets()
getBorderInsets
in interface IBoxPainter
public java.awt.Insets getBorderStyles()
getBorderStyles
in interface IBoxPainter
public int getTotalWidthGain()
getTotalWidthGain
in interface IBoxPainter
public int getTotalHeightGain()
getTotalHeightGain
in interface IBoxPainter
public int getLeftBorderPadding()
getLeftBorderPadding
in interface IBoxPainter
public int getTopBorderPadding()
getTopBorderPadding
in interface IBoxPainter
public int getBottomBorderPadding()
getBottomBorderPadding
in interface IBoxPainter
public int getRightBorderPadding()
getRightBorderPadding
in interface IBoxPainter
public int getTotalLeftGain()
getTotalLeftGain
in interface IBoxPainter
public int getTotalTopGain()
getTotalTopGain
in interface IBoxPainter
public void paint(java.awt.Graphics g, java.awt.Rectangle r, int paintMode, BoxView paintRef)
paint
in interface IBoxPainter
g
- the graphics to paint tor
- the area do draw topaintMode
- the paint mode constantpaintRef
- the coordinate reference for inline background imagesIBoxPainter.PAINT_MODE_NORMAL
,
IBoxPainter.PAINT_MODE_LEFTEDGE
,
IBoxPainter.PAINT_MODE_CENTER
,
IBoxPainter.PAINT_MODE_RIGHTEDGE
public void paint(java.awt.Graphics g, int x, int y, int width, int height, int paintMode, BoxView paintRef)
paint
in interface IBoxPainter
g
- the graphics to paint tox
- the x coordinate of the paint areay
- the y coordinate of the paint areawidth
- the width coordinate of the paint areaheight
- the height coordinate of the paint areapaintMode
- the paint mode constantpaintRef
- the coordinate reference for inline background imagesIBoxPainter.PAINT_MODE_NORMAL
,
IBoxPainter.PAINT_MODE_LEFTEDGE
,
IBoxPainter.PAINT_MODE_CENTER
,
IBoxPainter.PAINT_MODE_RIGHTEDGE
public BoxView getView()
getView
in interface IBoxPainter
public com.inet.html.parser.converter.ColorValue getBorderTopColor()
getBorderTopColor
in interface IBoxPainter
public com.inet.html.parser.converter.ColorValue getBorderLeftColor()
getBorderLeftColor
in interface IBoxPainter
public com.inet.html.parser.converter.ColorValue getBorderRightColor()
getBorderRightColor
in interface IBoxPainter
public com.inet.html.parser.converter.ColorValue getBorderBottomColor()
getBorderBottomColor
in interface IBoxPainter
public void setBorderBottomColor(com.inet.html.parser.converter.ColorValue borderBottomColor)
setBorderBottomColor
in interface IBoxPainter
borderBottomColor
- the color of the bottom borderpublic void setBorderLeftColor(com.inet.html.parser.converter.ColorValue borderLeftColor)
setBorderLeftColor
in interface IBoxPainter
borderLeftColor
- color of the left borderpublic void setBorderRightColor(com.inet.html.parser.converter.ColorValue borderRightColor)
setBorderRightColor
in interface IBoxPainter
borderRightColor
- color of the right borderpublic void setBorderTopColor(com.inet.html.parser.converter.ColorValue borderTopColor)
setBorderTopColor
in interface IBoxPainter
borderTopColor
- color of the top borderpublic boolean isRelevant()
isRelevant
in interface IBackgroundPainter
isRelevant
in interface IBoxPainter
isRelevant
in class BackgroundPainter
public void updateRelevance()
updateRelevance
in interface IBoxPainter
public void setBorderStyles(java.awt.Insets borderStyles)
setBorderStyles
in interface IBoxPainter
borderStyles
- the border stylespublic void setBorderInsets(java.awt.Insets borderInsets)
setBorderInsets
in interface IBoxPainter
borderInsets
- the border insetspublic void setPadding(java.awt.Insets padding)
setPadding
in interface IBoxPainter
padding
- the padding insetspublic void setMargins(java.awt.Insets margins)
setMargins
in interface IBoxPainter
margins
- the margin insetspublic java.awt.Insets setBorderInsets()
setBorderInsets
in interface IBoxPainter
public java.awt.Insets setBorderStyles()
setBorderStyles
in interface IBoxPainter
public java.awt.Insets setMargins()
setMargins
in interface IBoxPainter
public java.awt.Insets setPadding()
setPadding
in interface IBoxPainter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |