|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.View
com.inet.html.views.BoxView
public abstract class BoxView
This class is the basic box used to represent and render all html elements. Any other type within the JWebEngine renderer have to extend this class. What this class does: - cache all relevant attributes for the underlying element - store the size and appearance of this box(borders, padding, font size, text align) by using BoxPainters - paint the box itself What this class does NOT: - have a layout(because not any box implementation requires a layout) - display content, this has to be done by the extensions
Field Summary | |
---|---|
static int |
BASELINE
const for getPreferredSize() |
static int |
STATUS_REQ_LAYOUT
View needs a relayout |
static int |
STATUS_REQ_PRELAYOUT
View needs a complete relayout including calculation of all fixed values |
static int |
STATUS_UPTODATE
View is up to date and will not pass down any layout requests |
Fields inherited from class javax.swing.text.View |
---|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary | |
---|---|
BoxView(javax.swing.text.Element elem)
Create a new View object |
|
BoxView(javax.swing.text.Element elem,
ViewPainter painter)
create a new View object with the given Painter |
Method Summary | |
---|---|
void |
addBoxPainter(javax.swing.text.Element elem,
IBoxPainter painter)
Registers a BoxPainter for one of the descendants of this view's element. |
void |
factoryPreset(byte floatValue,
byte display,
byte position)
Presets certain CSS values which have already been determined by the factory |
void |
forceLayout()
Forces a COMPLETE re-layout of the whole document! |
void |
forceLayout(long timeout)
Forces a COMPLETE re-layout of the whole document! |
float |
getAlignment(int axis)
|
int |
getAutoMarginJustify()
Gets the justification of this view according to the margins setting StyleConstants.ALIGN_LEFT StyleConstants.ALIGN_CENTER StyleConstants.ALIGN_RIGHT -1 if not margins is set to auto |
com.inet.html.parser.converter.ColorValue |
getBackgroundValue()
Returns the background color value if any |
com.inet.html.parser.converter.ColorValue |
getBorderBottomColor()
Returns the color of the bottom border, if any |
com.inet.html.parser.converter.ColorValue |
getBorderLeftColor()
Returns the color of the left border, if any |
com.inet.html.parser.converter.ColorValue |
getBorderRightColor()
Returns the color of the right border, if any |
com.inet.html.parser.converter.ColorValue |
getBorderTopColor()
Returns the color of the top border, if any |
int |
getBottomInset()
Gets the bottom inset. |
IBoxPainter |
getBox()
Returns the box painter. |
IBoxPainter |
getBoxPainter(javax.swing.text.Element descendant)
Returns the BoxPainter which has to be used to paint a descendants background and borders |
int |
getClear()
Returns the CSS "clear" attributes value |
int |
getCompleteHight()
This represents the real maximum-hight of all inner components including floats. |
int |
getContentHeight()
This is the layouted height in pixel. |
int |
getContentVerticalOffset()
Gets the content vertical offset. |
int |
getContentWidth()
This is the layouted width in pixel. |
int |
getDirection()
Returns the Base- Direction -value of this element |
int |
getDisplay()
Returns the DisplayValue constant for this view |
int |
getEndOffset()
|
int |
getFirstLineBaseLine()
Returns the baseline of the first content descendand of this view relative to the upper bound of this view |
int |
getFloat()
Returns the FloatValue constant of the floating setting of this view |
float |
getFontSize()
Returns the recently calculated font size |
com.inet.html.parser.converter.LengthUnit |
getHeightUnit()
This returns the length unit defined by CSS or a HTML tag |
HtmlRootView |
getHTMLRoot()
Returns the HTML root view or null, if this view was disposed |
int |
getJustification()
Get the value of the CSS attribute text-align. |
int |
getLeftInset()
Gets the left inset. |
com.inet.html.parser.converter.LengthUnit |
getLineHeight()
Returns the line height for this box. |
java.awt.Insets |
getMargins()
Get the CSS margins |
int |
getOuterHeight()
Returns the outer height of this box which is content+padding+border. |
int |
getOuterWidth()
Returns the outer width of this box which is content+padding+border. |
int |
getOverflow()
Returns the Overflow constant, which defines how to clip the content of this view |
ViewPainter |
getPainter()
returns the set view painter, can be null if no custom painter has been set |
int |
getPosition()
Returns the calculated Position constant for this view |
RenderContext |
getRenderContext()
Returns the render context used by this view |
int |
getResizeWeight(int axis)
|
int |
getRightInset()
Gets the right inset. |
java.awt.Rectangle |
getSpan()
Returns the span of this view. |
int |
getStartOffset()
|
int |
getStatus()
Returns the layout status of the current view |
int |
getSwingAlign(int axis)
Returns the SwingConstant for the requested axis |
int |
getTopInset()
Gets the top inset. |
int |
getUnicodeBidi()
Returns the unicode bidi algorithm mode flag |
ViewPositionInfo |
getViewForPosition(java.awt.Point position,
java.awt.Rectangle bounds)
Tries to find the view for the specified location |
int |
getViewIndex(int pos)
Returns the child view index representing the given position in the model. |
int |
getViewIndex(int pos,
javax.swing.text.Position.Bias b)
|
int |
getVisibility()
Returns the CSS vsibility attribute of the element of this view |
int |
getWhiteSpace()
Returns the CSS WhiteSpace Attribute for this View |
com.inet.html.parser.converter.LengthUnit |
getWidthUnit()
This returns the length unit defined by CSS or a HTML tag |
boolean |
isAbsolutePositioned()
Returns true, if this block has an absolute position |
boolean |
isBlock()
Returns true if this is a block by CSS display attribute |
boolean |
isBreak()
Returns true if this View refers to a BR element |
boolean |
isBreakable()
Returns true, if this view may be used to break an inline layout |
boolean |
isFloating()
Returns true, if this view is really a float |
boolean |
isInFlow()
If this returns false this view may be a normal block view or a positioned block view. |
boolean |
isListItemWithMarker()
Decides, whether this box requires a list marker. |
boolean |
isLTR()
This method combines all informations available on LTR-behavior for this block. |
boolean |
isMarker()
Returns true if this is a generated marker box |
boolean |
isNativeLTR()
Returns true, if this view is in a LTR content by the unicode bidi level, false otherwise |
boolean |
isTableCell()
Returns true, if this view represents a table cell. |
boolean |
isWidthSet()
If the width was explicit set with CSS or HTML attribute. |
void |
paint(java.awt.Graphics g,
java.awt.Shape allocation)
|
abstract java.awt.Rectangle |
performLayout(boolean hard)
This is the final layout method. |
abstract void |
performLayoutVAlign(int baseline)
If this box has a overall vertical align, like in table cells for instance, this method calculates teh offset to align the content. |
abstract void |
performLayoutWidth()
Layout what is required to determin the width of this view. |
void |
performPreLayout()
Causes this view to layout all fixed values and to calculate it's minimum and preferred width. |
void |
setBackgroundValue(com.inet.html.parser.converter.ColorValue backgroundValue)
Overwrites the CSS Background color value of this view. |
void |
setBorderBottomColor(com.inet.html.parser.converter.ColorValue borderBottomColor)
Sets the color of the bottom border. |
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. |
void |
setBorderTopColor(com.inet.html.parser.converter.ColorValue borderTopColor)
Sets the color of the top border. |
void |
setContentVerticalOffset(int contentVerticalOffset)
Set the content vertical offset. |
void |
setContentWidth(float newWidth)
Sets the width of the content area. |
void |
setFirstLineBaseLine(short firstLineBaseLine)
Sets the Y-offset of the baseline of the inner content of this view |
void |
setIsNativeLTR(boolean isLTR)
Sets the native LTR flag of this view. |
void |
setJustification(byte justification)
Set the value of the CSS attribute text-align. |
void |
setMarker(boolean isMarker)
Set to true if this is a generated marker box |
void |
setPainter(ViewPainter viewPainter)
sets the custom view painter, can be null if no custom painter is to be set |
void |
setParent(javax.swing.text.View parent)
|
void |
setRoot(HtmlRootView root)
Sets the view tree root of this view. |
void |
setSize(float newWidth,
float newHeight)
This method changes the OUTER box size, which is the box around the border of this box. |
void |
setSizeContent(float newWidth,
float newHeight)
This method changes the CONTENT size, which is the inner box of the box model. |
void |
setStartAndEndOffset(int start,
int end)
Set a new start and end position |
void |
setStatus(int status)
Set the layout status of this view and propagates it to any ancestor, which has a higher status. |
void |
setStatusLocal(int status)
Sets the layout status of only the current view |
Methods inherited from class javax.swing.text.View |
---|
append, breakView, changedUpdate, createFragment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getPreferredSpan, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, viewToModel, viewToModel |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BASELINE
public static final int STATUS_UPTODATE
public static final int STATUS_REQ_LAYOUT
public static final int STATUS_REQ_PRELAYOUT
Constructor Detail |
---|
public BoxView(javax.swing.text.Element elem)
elem
- Element to presentpublic BoxView(javax.swing.text.Element elem, ViewPainter painter)
elem
- elementpainter
- painter implementationMethod Detail |
---|
public IBoxPainter getBox()
public void setParent(javax.swing.text.View parent)
setParent
in class javax.swing.text.View
public void factoryPreset(byte floatValue, byte display, byte position)
floatValue
- the FloatValue
constantdisplay
- the DisplayValue
constantposition
- the Position
constantpublic void setJustification(byte justification)
justification
- one of the constpublic boolean isWidthSet()
public void setSize(float newWidth, float newHeight)
setSize
in class javax.swing.text.View
newWidth
- the new width in pxnewHeight
- the new height in pxpublic void setSizeContent(float newWidth, float newHeight)
newWidth
- the new width in pxnewHeight
- the new height in pxpublic void setContentWidth(float newWidth)
newWidth
- new width in pixelpublic com.inet.html.parser.converter.LengthUnit getWidthUnit()
public com.inet.html.parser.converter.LengthUnit getHeightUnit()
public int getJustification()
public int getAutoMarginJustify()
public float getAlignment(int axis)
getAlignment
in class javax.swing.text.View
public int getSwingAlign(int axis)
axis
- the axis to get the align of
public int getResizeWeight(int axis)
getResizeWeight
in class javax.swing.text.View
public int getContentWidth()
public int getContentHeight()
public int getOuterHeight()
public int getOuterWidth()
public int getCompleteHight()
public int getLeftInset()
public int getRightInset()
public int getTopInset()
public int getBottomInset()
public java.awt.Insets getMargins()
public int getViewIndex(int pos, javax.swing.text.Position.Bias b)
getViewIndex
in class javax.swing.text.View
public int getViewIndex(int pos)
pos
- the position >= 0
public int getStartOffset()
getStartOffset
in class javax.swing.text.View
public int getEndOffset()
getEndOffset
in class javax.swing.text.View
public void setStartAndEndOffset(int start, int end)
start
- the new start positionend
- must be larger as startpublic void paint(java.awt.Graphics g, java.awt.Shape allocation)
paint
in class javax.swing.text.View
public boolean isInFlow()
public float getFontSize()
public com.inet.html.parser.converter.LengthUnit getLineHeight()
public boolean isBlock()
public int getClear()
StackManager.CLEAR_NONE
,
StackManager.CLEAR_LEFT
,
StackManager.CLEAR_RIGHT
,
StackManager.CLEAR_BOTH
,
http://www.w3.org/TR/CSS21/visuren.html#propdef-clearpublic int getVisibility()
VisibilityValue.VISIBLE
,
VisibilityValue.HIDDEN
,
VisibilityValue.COLLAPSE
,
http://www.w3.org/TR/CSS21/visufx.html#propdef-visibilitypublic void performPreLayout()
public abstract void performLayoutWidth()
public abstract java.awt.Rectangle performLayout(boolean hard)
hard
- If set to true, the status of the children will be ignored and all views will be layouted. This
should be done on view-size changes. If set to false the status of the children will be respected and
up-to-date views will not be layouted again.
public abstract void performLayoutVAlign(int baseline)
baseline
- external prediction of the first baseline for BASELINE alignmentpublic void forceLayout()
public void forceLayout(long timeout)
timeout
- the timeout until the layout is performed(may be interesting to set it to 0 or for large images)public void setContentVerticalOffset(int contentVerticalOffset)
contentVerticalOffset
- Difference between upper edge and content in pxpublic int getContentVerticalOffset()
public boolean isMarker()
public void setMarker(boolean isMarker)
isMarker
- Set to true if this is a generated marker boxpublic com.inet.html.parser.converter.ColorValue getBackgroundValue()
public com.inet.html.parser.converter.ColorValue getBorderTopColor()
public com.inet.html.parser.converter.ColorValue getBorderLeftColor()
public com.inet.html.parser.converter.ColorValue getBorderRightColor()
public com.inet.html.parser.converter.ColorValue getBorderBottomColor()
public void setBorderBottomColor(com.inet.html.parser.converter.ColorValue borderBottomColor)
borderBottomColor
- the color to set.public void setBorderLeftColor(com.inet.html.parser.converter.ColorValue borderLeftColor)
borderLeftColor
- the color to set.public void setBorderRightColor(com.inet.html.parser.converter.ColorValue borderRightColor)
borderRightColor
- the color to set.public void setBorderTopColor(com.inet.html.parser.converter.ColorValue borderTopColor)
borderTopColor
- the color to set.public void setBackgroundValue(com.inet.html.parser.converter.ColorValue backgroundValue)
backgroundValue
- New background color or nullpublic int getFirstLineBaseLine()
public void setFirstLineBaseLine(short firstLineBaseLine)
firstLineBaseLine
- hte offset in PXpublic boolean isBreak()
public boolean isListItemWithMarker()
public void addBoxPainter(javax.swing.text.Element elem, IBoxPainter painter)
elem
- The element to paintpainter
- The painter to usepublic IBoxPainter getBoxPainter(javax.swing.text.Element descendant)
descendant
- the descendant to paint
public int getWhiteSpace()
WhiteSpace.NORMAL
,
WhiteSpace.PRE
,
WhiteSpace.NOWRAP
,
WhiteSpace.AUTOWRAP
,
http://www.w3.org/TR/CSS21/text.html#propdef-word-spacingpublic int getStatus()
public void setStatus(int status)
status
- the status constant to setpublic void setStatusLocal(int status)
status
- The status constantpublic ViewPositionInfo getViewForPosition(java.awt.Point position, java.awt.Rectangle bounds)
position
- the position to searchbounds
- the outer bounds of the search area
public HtmlRootView getHTMLRoot()
public void setRoot(HtmlRootView root)
root
- the html root view of this view treepublic ViewPainter getPainter()
public void setPainter(ViewPainter viewPainter)
viewPainter
- painter implementationpublic boolean isBreakable()
public int getDisplay()
DisplayValue
constant for this view
DisplayValue
constant for this viewDisplayValue
,
http://www.w3.org/TR/CSS21/visuren.html#propdef-displaypublic RenderContext getRenderContext()
public boolean isTableCell()
public int getOverflow()
Overflow
constant, which defines how to clip the content of this view
Overflow
constantOverflow.AUTO
,
Overflow.SCROLL
,
Overflow.HIDDEN
,
Overflow.VISIBLE
,
http://www.w3.org/TR/CSS21/visufx.html#propdef-overflowpublic boolean isFloating()
public int getFloat()
FloatValue
constant of the floating setting of this view
FloatValue
constant of the floating setting of this viewFloatValue.NONE
,
FloatValue.LEFT
,
FloatValue.CENTER
,
FloatValue.RIGHT
,
http://www.w3.org/TR/CSS21/visuren.html#propdef-floatpublic int getPosition()
Position
constant for this view
Position
constant for this viewPosition.STATIC
,
Position.RELATIVE
,
Position.ABSOLUTE
,
Position.FIXED
,
http://www.w3.org/TR/CSS21/visuren.html#propdef-positionpublic boolean isAbsolutePositioned()
public java.awt.Rectangle getSpan()
public int getDirection()
Direction
-value of this element
Direction
constantDirection.LTR
,
Direction.RTL
,
http://www.w3.org/TR/CSS21/visuren.html#propdef-directionpublic int getUnicodeBidi()
UnicodeBidi.NORMAL
,
UnicodeBidi.EMBED
,
UnicodeBidi.OVERRIDE
,
http://www.w3.org/TR/CSS21/visuren.html#propdef-unicode-bidipublic boolean isLTR()
public void setIsNativeLTR(boolean isLTR)
isLTR
- true for native LTR, false for native RTLpublic boolean isNativeLTR()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |