org.lobobrowser.html.renderer

Class RBlockViewport

Implemented Interfaces:
BoundableRenderable, 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, RCollection parent)
Constructs an HtmlBlockLayout.

Method Summary

void
adjust(int desiredWidth, int desiredHeight, Insets paddingInsets, org.lobobrowser.html.renderer.FloatingBounds floatBounds)
Performs layout adjustment step.
void
alignX(int alignXPercent, int canvasWidth, Insets paddingInsets)
Applies any horizonal aLignment.
void
alignY(int alignYPercent, int canvasHeight, Insets paddingInsets)
Applies vertical alignment.
int
getAvailContentWidth()
org.lobobrowser.html.renderer.FloatingBounds
getExportableFloatingBounds()
Gets FloatingBounds from this viewport that should be considered by an ancestor block.
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()
void
layout(int desiredWidth, int desiredHeight, Insets paddingInsets, 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)
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, getOrigin, getOriginRelativeTo, 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,
                      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

adjust

public void adjust(int desiredWidth,
                   int desiredHeight,
                   Insets paddingInsets,
                   org.lobobrowser.html.renderer.FloatingBounds floatBounds)
Performs layout adjustment step.
Parameters:
desiredWidth - The desired viewport width, including padding.
desiredHeight - The desired viewport height, including padding.
paddingInsets - The padding insets.
floatBounds - The starting float bounds, including floats in ancestors.

alignX

public void alignX(int alignXPercent,
                   int canvasWidth,
                   Insets paddingInsets)
Applies any horizonal aLignment. It may adjust height if necessary.
Parameters:
canvasWidth - The new width of the viewport. It could be different to the previously calculated width.
paddingInsets -

alignY

public void alignY(int alignYPercent,
                   int canvasHeight,
                   Insets paddingInsets)
Applies vertical alignment.
Parameters:
canvasHeight -
paddingInsets -

getAvailContentWidth

public int getAvailContentWidth()

getExportableFloatingBounds

public org.lobobrowser.html.renderer.FloatingBounds getExportableFloatingBounds()
Gets FloatingBounds from this viewport that should be considered by an ancestor block.

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 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()
Specified by:
isContainedByNode in interface BoundableRenderable

layout

public void layout(int desiredWidth,
                   int desiredHeight,
                   Insets paddingInsets,
                   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)
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()