org.lobobrowser.html.renderer

Class RBlockViewport

Implemented Interfaces:
BoundableRenderable, org.lobobrowser.html.renderer.RCollection, Renderable

public class RBlockViewport
extends org.lobobrowser.html.renderer.BaseRCollection

A substantial portion of the HTML rendering logic of the package can be found in this class. This class is in charge of laying out the DOM subtree of a node, usually on behalf of an RBlock. It creates a renderer subtree consisting of RLine's or RBlock's. RLine's in turn contain RWord's and so on. This class also happens to be used as an RBlock scrollable viewport.
Author:
J. H. S.

Field Summary

static Insets
ZERO_INSETS

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

Constructor Summary

RBlockViewport(ModelNode modelNode, RenderableContainer container, int listNesting, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext, org.lobobrowser.html.renderer.RCollection parent)
Constructs an HtmlBlockLayout.

Method Summary

void
align(int alignXPercent, int alignYPercent, int canvasWidth, int canvasHeight, Insets paddingInsets)
Applies any horizonal or vertical alignment.
int
getAvailContentWidth()
int
getFirstBaselineOffset()
int
getFirstLineHeight()
RenderableSpot
getLowestRenderableSpot(int x, int y)
BoundableRenderable
getRenderable(int x, int y)
BoundableRenderable
getRenderable(java.awt.Point point)
Iterator
getRenderables()
Iterator
getRenderables(Rectangle clipBounds)
Iterator
getRenderables(int pointx, int pointy)
Iterator
getRenderables(java.awt.Point point)
Renderable[]
getRenderablesArray()
void
invalidateLayoutLocal()
boolean
isContainedByNode()
Returns true if the renderable is fully contained by its modelNode, but said modelNode does not fully contain an ancestor renderable.
void
layout(int desiredWidth, int desiredHeight, Insets paddingInsets, NodeImpl rootNode, int yLimit, org.lobobrowser.html.renderer.FloatingBounds floatBounds)
Builds the layout/renderer tree from scratch.
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)
String
toString()

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

ZERO_INSETS

public static final Insets ZERO_INSETS

Constructor Details

RBlockViewport

public RBlockViewport(ModelNode modelNode,
                      RenderableContainer container,
                      int listNesting,
                      UserAgentContext pcontext,
                      HtmlRendererContext rcontext,
                      FrameContext frameContext,
                      org.lobobrowser.html.renderer.RCollection parent)
Constructs an HtmlBlockLayout.
Parameters:
container - This is usually going to be an RBlock.
listNesting - The nesting level for lists. This is zero except inside a list.
pcontext - The HTMLParserContext instance.
frameContext - This is usually going to be HtmlBlock, an object where text selections are contained.
parent - This is usually going to be the parent of container.

Method Details

align

public void align(int alignXPercent,
                  int alignYPercent,
                  int canvasWidth,
                  int canvasHeight,
                  Insets paddingInsets)
Applies any horizonal or vertical alignment. It may also adjust width and height if necessary.
Parameters:
canvasWidth -
canvasHeight -
paddingInsets -

getAvailContentWidth

public int getAvailContentWidth()

getFirstBaselineOffset

public int getFirstBaselineOffset()

getFirstLineHeight

public int getFirstLineHeight()

getLowestRenderableSpot

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

getRenderable

public BoundableRenderable getRenderable(int x,
                                         int y)
Overrides:
getRenderable in interface org.lobobrowser.html.renderer.BaseRCollection

getRenderable

public BoundableRenderable getRenderable(java.awt.Point point)

getRenderables

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

getRenderables

public Iterator getRenderables(Rectangle clipBounds)

getRenderables

public Iterator getRenderables(int pointx,
                               int pointy)

getRenderables

public Iterator getRenderables(java.awt.Point point)

getRenderablesArray

public Renderable[] getRenderablesArray()

invalidateLayoutLocal

public void invalidateLayoutLocal()
Overrides:
invalidateLayoutLocal in interface org.lobobrowser.html.renderer.BaseBoundableRenderable

isContainedByNode

public boolean isContainedByNode()
Returns true if the renderable is fully contained by its modelNode, but said modelNode does not fully contain an ancestor renderable.
Specified by:
isContainedByNode in interface BoundableRenderable

layout

public void layout(int desiredWidth,
                   int desiredHeight,
                   Insets paddingInsets,
                   NodeImpl rootNode,
                   int yLimit,
                   org.lobobrowser.html.renderer.FloatingBounds floatBounds)
Builds the layout/renderer tree from scratch. Note: Returned dimension needs to be actual size needed for rendered content, not the available container size. This is relied upon by table layout.
Parameters:
yLimit - If other than -1, layout will throw SizeExceededException in the event that the layout goes beyond this y-coordinate point.

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

toString

public String toString()