org.lobobrowser.html.renderer

Class RBlock

Implemented Interfaces:
ImageObserver, BoundableRenderable, ImageObserver, org.lobobrowser.html.renderer.RCollection, Renderable, RenderableContainer, RElement, UINode

public class RBlock
extends org.lobobrowser.html.renderer.BaseElementRenderable
implements RenderableContainer, ImageObserver

Author:
J. H. S.

Field Summary

protected RBlockViewport
bodyLayout
protected int
defaultOverflow
protected RenderableSpot
endSelection
protected FrameContext
frameContext
protected JScrollBar
hScrollBar
protected boolean
hasHScrollBar
protected boolean
hasVScrollBar
protected int
listNesting
protected HtmlRendererContext
rendererContext
protected RenderableSpot
startSelection
protected JScrollBar
vScrollBar

Fields inherited from class org.lobobrowser.html.renderer.BaseElementRenderable

BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_GROOVE, BORDER_STYLE_HIDDEN, BORDER_STYLE_INSET, BORDER_STYLE_NONE, BORDER_STYLE_OUTSET, BORDER_STYLE_RIDGE, BORDER_STYLE_SOLID, OVERFLOW_AUTO, OVERFLOW_HIDDEN, OVERFLOW_NONE, OVERFLOW_SCROLL, OVERFLOW_VERTICAL, OVERFLOW_VISIBLE, SCROLL_BAR_THICKNESS, backgroundColor, backgroundImage, borderBottomColor, borderInsets, borderLeftColor, borderRightColor, borderStyles, borderTopColor, defaultMarginInsets, delayedPairs, lastBackgroundImageUri, layoutDeepCanBeInvalidated, userAgentContext, zIndex

Fields inherited from class org.lobobrowser.html.renderer.BaseBoundableRenderable

SELECTION_COLOR, SELECTION_XOR, container, height, layoutUpTreeCanBeInvalidated, logger, modelNode, originalParent, parent, width, x, y

Fields inherited from interface org.lobobrowser.html.renderer.Renderable

EMPTY_ARRAY

Fields inherited from interface org.lobobrowser.html.renderer.RElement

VALIGN_ABSBOTTOM, VALIGN_ABSMIDDLE, VALIGN_BASELINE, VALIGN_BOTTOM, VALIGN_MIDDLE, VALIGN_TOP

Constructor Summary

RBlock(NodeImpl modelNode, int listNesting, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext, RenderableContainer parentContainer)
RBlock(NodeImpl modelNode, int listNesting, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext, RenderableContainer parentContainer, int defaultOverflow)

Method Summary

boolean
couldBeScrollable()
protected Dimension
doCellLayout(int width, int height, boolean expandWidth, boolean expandHeight)
void
doLayout(int availWidth, int availHeight, boolean expandWidth, boolean expandHeight)
void
doLayout(int availWidth, int availHeight, boolean expandWidth, boolean expandHeight, int tentativeY)
void
doLayout(int availWidth, int availHeight, boolean expandWidth, boolean expandHeight, org.lobobrowser.html.renderer.FloatingBounds floatBounds, int tentativeY, int defaultOverflow)
Lays out and sets dimensions only if RBlock is invalid (or never before layed out), if the parameters passed differ from the last layout, or if the current font differs from the font for the last layout.
void
ensureVisible(Point point)
void
finalize()
int
getFirstBaselineOffset()
int
getFirstLineHeight()
RenderableSpot
getLowestRenderableSpot(int x, int y)
protected Insets
getPaddingInsets(RenderState rs)
Color
getPaintedBackgroundColor()
RBlockViewport
getRBlockViewport()
Iterator
getRenderables()
int
getVAlign()
int
getVScrollBarWidth()
Gets the width the vertical scrollbar has when shown.
int
getViewportListNesting(int blockNesting)
void
invalidateLayoutLocal()
RBlocks should only be invalidated if one of their properties change, or if a descendent changes, or if a style property of an ancestor is such that it could produce layout changes in this RBlock.
void
layout(int availWidth, int availHeight, boolean expandWidth, boolean expandHeight, int defaultOverflow)
void
layout(int availWidth, int availHeight, boolean expandWidth, boolean expandHeight, org.lobobrowser.html.renderer.FloatingBounds floatBounds, int tentativeY)
void
layout(int availWidth, int availHeight, boolean expandWidth, boolean expandHeight, org.lobobrowser.html.renderer.FloatingBounds floatBounds, int tentativeY, int defaultOverflow)
boolean
onDoubleClick(MouseEvent event, int x, int y)
boolean
onMouseClick(MouseEvent event, int x, int y)
boolean
onMouseDisarmed(MouseEvent event)
boolean
onMousePressed(MouseEvent event, int x, int y)
Returns false if the event is consumed.
boolean
onMouseReleased(MouseEvent event, int x, int y)
void
paint(Graphics g)
boolean
paintSelection(Graphics g, boolean inSelection, RenderableSpot startPoint, RenderableSpot endPoint)
Asks the Renderable to paint the selection between two points.
void
repaint(ModelNode modelNode)
void
scrollBy(int orientation, int offset)
void
scrollByUnits(int orientation, int units)
void
scrollHorizontalTo(int newX)
void
scrollVerticalTo(int newY)
void
setDefaultMarginInsets(Insets insets)
void
setDefaultPaddingInsets(Insets insets)
void
setSelectionEnd(RenderableSpot rpoint)
void
setSelectionStart(RenderableSpot rpoint)
String
toString()
void
updateWidgetBounds(int guiX, int guiY)
Updates bounds of all descendent's GUI components, based on root bounds.

Methods inherited from class org.lobobrowser.html.renderer.BaseElementRenderable

add, addDelayedPair, applyStyle, clearDelayedPairs, clearGUIComponents, doLayout, getAlignmentX, getAlignmentY, getDeclaredHeight, getDeclaredWidth, getDelayedPairs, getInsets, getMarginInsets, getOverflow, getParentContainer, getZIndex, imageUpdate, invalidateLayoutDeep, invalidateLayoutLocal, isContainedByNode, layout, layout, loadBackgroundImage, paint, prePaint, sendDelayedPairsToParent, sendGUIComponentsToParent, updateAllWidgetBounds, updateWidgetBounds

Methods inherited from class org.lobobrowser.html.renderer.BaseRCollection

blur, extractSelectionText, focus, getRenderable, invalidateLayoutDeep, onMouseMoved, onMouseOut, onRightClick, paintSelection, updateWidgetBounds

Methods inherited from class org.lobobrowser.html.renderer.BaseBoundableRenderable

contains, getBlockBackgroundColor, getBounds, getGUIPoint, getHeight, getModelNode, getOriginalOrCurrentParent, getOriginalParent, getParent, getRenderablePoint, getSize, getWidth, getX, getY, invalidateLayoutLocal, invalidateLayoutUpTree, isValid, markLayoutValid, onMouseMoved, onMouseOut, paintTranslated, relayout, relayoutImpl, repaint, repaint, setBounds, setHeight, setOrigin, setOriginalParent, setParent, setWidth, setX, setY, translateDescendentPoint

Methods inherited from class org.lobobrowser.html.renderer.BaseRenderable

getOrdinal, getZIndex, setOrdinal

Field Details

bodyLayout

protected final RBlockViewport bodyLayout

defaultOverflow

protected final int defaultOverflow

endSelection

protected RenderableSpot endSelection

frameContext

protected final FrameContext frameContext

hScrollBar

protected JScrollBar hScrollBar

hasHScrollBar

protected boolean hasHScrollBar

hasVScrollBar

protected boolean hasVScrollBar

listNesting

protected final int listNesting

rendererContext

protected final HtmlRendererContext rendererContext

startSelection

protected RenderableSpot startSelection

vScrollBar

protected JScrollBar vScrollBar

Constructor Details

RBlock

public RBlock(NodeImpl modelNode,
              int listNesting,
              UserAgentContext pcontext,
              HtmlRendererContext rcontext,
              FrameContext frameContext,
              RenderableContainer parentContainer)

RBlock

public RBlock(NodeImpl modelNode,
              int listNesting,
              UserAgentContext pcontext,
              HtmlRendererContext rcontext,
              FrameContext frameContext,
              RenderableContainer parentContainer,
              int defaultOverflow)

Method Details

couldBeScrollable

public final boolean couldBeScrollable()

doCellLayout

protected Dimension doCellLayout(int width,
                                 int height,
                                 boolean expandWidth,
                                 boolean expandHeight)
Parameters:
width - The width available, including insets.
height - The height available, including insets.

doLayout

public final void doLayout(int availWidth,
                           int availHeight,
                           boolean expandWidth,
                           boolean expandHeight)
Overrides:
doLayout in interface org.lobobrowser.html.renderer.BaseElementRenderable

doLayout

public final void doLayout(int availWidth,
                           int availHeight,
                           boolean expandWidth,
                           boolean expandHeight,
                           int tentativeY)

doLayout

public void doLayout(int availWidth,
                     int availHeight,
                     boolean expandWidth,
                     boolean expandHeight,
                     org.lobobrowser.html.renderer.FloatingBounds floatBounds,
                     int tentativeY,
                     int defaultOverflow)
Lays out and sets dimensions only if RBlock is invalid (or never before layed out), if the parameters passed differ from the last layout, or if the current font differs from the font for the last layout.
Parameters:
availWidth -
availHeight -

ensureVisible

public void ensureVisible(Point point)

finalize

public void finalize()
            throws Throwable

getFirstBaselineOffset

public int getFirstBaselineOffset()

getFirstLineHeight

public int getFirstLineHeight()

getLowestRenderableSpot

public RenderableSpot getLowestRenderableSpot(int x,
                                              int y)
Specified by:
getLowestRenderableSpot in interface BoundableRenderable

getPaddingInsets

protected final Insets getPaddingInsets(RenderState rs)

getPaintedBackgroundColor

public Color getPaintedBackgroundColor()
Specified by:
getPaintedBackgroundColor in interface RenderableContainer

getRBlockViewport

public RBlockViewport getRBlockViewport()

getRenderables

public Iterator getRenderables()
Specified by:
getRenderables in interface org.lobobrowser.html.renderer.RCollection

getVAlign

public int getVAlign()
Specified by:
getVAlign in interface RElement

getVScrollBarWidth

public int getVScrollBarWidth()
Gets the width the vertical scrollbar has when shown.

getViewportListNesting

public int getViewportListNesting(int blockNesting)

invalidateLayoutLocal

public void invalidateLayoutLocal()
RBlocks should only be invalidated if one of their properties change, or if a descendent changes, or if a style property of an ancestor is such that it could produce layout changes in this RBlock.
Overrides:
invalidateLayoutLocal in interface org.lobobrowser.html.renderer.BaseElementRenderable

layout

public final void layout(int availWidth,
                         int availHeight,
                         boolean expandWidth,
                         boolean expandHeight,
                         int defaultOverflow)

layout

public final void layout(int availWidth,
                         int availHeight,
                         boolean expandWidth,
                         boolean expandHeight,
                         org.lobobrowser.html.renderer.FloatingBounds floatBounds,
                         int tentativeY)

layout

public final void layout(int availWidth,
                         int availHeight,
                         boolean expandWidth,
                         boolean expandHeight,
                         org.lobobrowser.html.renderer.FloatingBounds floatBounds,
                         int tentativeY,
                         int defaultOverflow)

onDoubleClick

public boolean onDoubleClick(MouseEvent event,
                             int x,
                             int y)
Specified by:
onDoubleClick in interface BoundableRenderable

onMouseClick

public boolean onMouseClick(MouseEvent event,
                            int x,
                            int y)
Specified by:
onMouseClick in interface BoundableRenderable

onMouseDisarmed

public boolean onMouseDisarmed(MouseEvent event)
Specified by:
onMouseDisarmed in interface BoundableRenderable

onMousePressed

public boolean onMousePressed(MouseEvent event,
                              int x,
                              int y)
Returns false if the event is consumed. True to propagate further.
Specified by:
onMousePressed in interface BoundableRenderable

onMouseReleased

public boolean onMouseReleased(MouseEvent event,
                               int x,
                               int y)
Specified by:
onMouseReleased in interface BoundableRenderable

paint

public void paint(Graphics g)
Specified by:
paint in interface Renderable
Overrides:
paint in interface org.lobobrowser.html.renderer.BaseElementRenderable

paintSelection

public boolean paintSelection(Graphics g,
                              boolean inSelection,
                              RenderableSpot startPoint,
                              RenderableSpot endPoint)
Asks the Renderable to paint the selection between two points. Nothing will be done if the points are outside the Renderable.
Specified by:
paintSelection in interface BoundableRenderable
Overrides:
paintSelection in interface org.lobobrowser.html.renderer.BaseRCollection
Parameters:
g -
inSelection -
startPoint -
endPoint -
Returns:
True iff it's in selection when finished painting.

repaint

public void repaint(ModelNode modelNode)
Specified by:
repaint in interface UINode

scrollBy

public void scrollBy(int orientation,
                     int offset)

scrollByUnits

public void scrollByUnits(int orientation,
                          int units)

scrollHorizontalTo

public void scrollHorizontalTo(int newX)

scrollVerticalTo

public void scrollVerticalTo(int newY)

setDefaultMarginInsets

public void setDefaultMarginInsets(Insets insets)

setDefaultPaddingInsets

public void setDefaultPaddingInsets(Insets insets)

setSelectionEnd

public void setSelectionEnd(RenderableSpot rpoint)

setSelectionStart

public void setSelectionStart(RenderableSpot rpoint)

toString

public String toString()

updateWidgetBounds

public void updateWidgetBounds(int guiX,
                               int guiY)
Updates bounds of all descendent's GUI components, based on root bounds.
Specified by:
updateWidgetBounds in interface org.lobobrowser.html.renderer.RCollection
Overrides:
updateWidgetBounds in interface org.lobobrowser.html.renderer.BaseRCollection