Package org.lobobrowser.html.renderer
Class RImgControl
java.lang.Object
org.lobobrowser.html.renderer.RImgControl
- All Implemented Interfaces:
ImageObserver
,UINode
,BoundableRenderable
,RCollection
,RElement
,Renderable
,RenderableContainer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Color
Background color which may be different to that from RenderState in the case of a Document node.protected Image
protected Color
protected BorderInfo
protected Insets
protected Color
protected Color
protected Color
protected final RenderableContainer
protected Insets
protected Insets
protected Collection
A list of absolute positioned or float parent-child pairs.int
protected static final Integer
protected URL
protected boolean
protected boolean
Starts as true because ancestors could be invalidated.protected static final Logger
protected Insets
protected final ModelNode
protected RCollection
Parent for invalidation.protected int
protected int
protected Insets
protected RCollection
Parent for graphics coordinates.protected static final int
protected static final Color
protected static final Color
protected final UserAgentContext
final org.lobobrowser.html.renderer.UIControl
int
int
int
protected int
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface org.lobobrowser.html.renderer.RElement
VALIGN_ABSBOTTOM, VALIGN_ABSMIDDLE, VALIGN_BASELINE, VALIGN_BOTTOM, VALIGN_MIDDLE, VALIGN_TOP
Fields inherited from interface org.lobobrowser.html.renderer.Renderable
EMPTY_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionRImgControl
(ModelNode me, org.lobobrowser.html.renderer.UIControl widget, RenderableContainer container, FrameContext frameContext, UserAgentContext ucontext) -
Method Summary
Modifier and TypeMethodDescriptionaddComponent
(Component component) void
addDelayedPair
(DelayedPair pair) protected void
applyStyle
(int availWidth, int availHeight) void
blur()
final void
protected final void
protected void
clearStyle
(boolean isRootBlock) boolean
contains
(int x, int y) void
doLayout
(int availWidth, int availHeight, boolean sizeOnly) boolean
extractSelectionText
(StringBuffer buffer, boolean inSelection, RenderableSpot startPoint, RenderableSpot endPoint) void
focus()
float
float
int
int
protected Integer
getDeclaredHeight
(RenderState renderState, int actualAvailHeight) protected int
getDeclaredHeightImpl
(RenderState renderState, int availHeight) protected Integer
getDeclaredWidth
(RenderState renderState, int actualAvailWidth) final Collection
getGUIPoint
(int clientX, int clientY) int
getInsets
(boolean hscroll, boolean vscroll) Gets insets of content area.getLowestRenderableSpot
(int x, int y) int
int
int
int
int
ReturnsBoundableRenderable.getOriginalParent()
if not null.This is the parent based on the original element hierarchy.getOriginRelativeTo
(RCollection ancestor) Gets the parent where the renderable is rendered.getRenderable
(int x, int y) getRenderablePoint
(int guiX, int guiY) Gets the collection ofRenderable
children.getSize()
int
Vertical alignment for elements rendered in a line.int
getWidth()
int
getX()
int
getY()
int
boolean
final boolean
boolean
imageUpdate
(Image img, int infoflags, int x, int y, int w, int h) final void
Invalidates this Renderable and all descendents.final void
final void
Invalidates this Renderable and its parent (i.e.void
boolean
Returns true if the renderable is fully contained by its modelNode, but said modelNode does not fully contain an ancestor renderable.protected boolean
protected boolean
isValid()
final void
layout
(int availWidth, int availHeight, boolean sizeOnly) Lays out children, and deals with "valid" state.protected void
loadBackgroundImage
(URL imageURL) void
boolean
onDoubleClick
(MouseEvent event, int x, int y) boolean
onMouseClick
(MouseEvent event, int x, int y) boolean
onMouseDisarmed
(MouseEvent event) void
onMouseMoved
(MouseEvent event, int x, int y, boolean triggerEvent, ModelNode limit) void
onMouseOut
(MouseEvent event, int x, int y, ModelNode limit) boolean
onMousePressed
(MouseEvent event, int x, int y) Returns false if the event is consumed.boolean
onMouseReleased
(MouseEvent event, int x, int y) boolean
onRightClick
(MouseEvent event, int x, int y) final void
All overriders should call super implementation.boolean
paintSelection
(Graphics g, boolean inSelection, RenderableSpot startPoint, RenderableSpot endPoint) Asks the Renderable to paint the selection between two points.final void
Paints by either creating a new clipped graphics context corresponding to the bounds of the Renderable, or by translating the origin.final void
May be called by controls when they wish to modifiy their preferred size (e.g.protected void
void
relayout()
Invalidates the current Renderable (which invalidates its ancestors) and then requests the top level GUI container to do the layout and repaint.void
void
repaint()
void
repaint
(int x, int y, int width, int height) void
Calledprotected final void
protected final void
void
setBounds
(int x, int y, int width, int height) void
setDefaultMarginInsets
(Insets insets) void
setDefaultPaddingInsets
(Insets insets) void
setHeight
(int height) void
setOrdinal
(int ordinal) void
setOrigin
(int x, int y) void
setOriginalParent
(RCollection origParent) void
setParent
(RCollection parent) void
setWidth
(int width) void
setX
(int x) void
setY
(int y) protected final Point
translateDescendentPoint
(BoundableRenderable descendent, int x, int y) void
void
Updates widget bounds below this node only.void
updateWidgetBounds
(int guiX, int guiY) Updates bounds of all descendent's GUI components, based on root bounds.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.lobobrowser.html.renderer.BoundableRenderable
getBounds, getGUIPoint, getHeight, getModelNode, getOrdinal, getOrigin, getOriginalOrCurrentParent, getOriginalParent, getOriginRelativeTo, getParent, getRenderablePoint, getSize, getWidth, getX, getY, getZIndex, invalidateLayoutUpTree, isContainedByNode, onMouseMoved, onMouseOut, onRightClick, paintTranslated, relayout, repaint, repaint, setBounds, setHeight, setOrdinal, setOrigin, setOriginalParent, setParent, setWidth, setX, setY
Methods inherited from interface org.lobobrowser.html.renderer.RCollection
blur, invalidateLayoutDeep
Methods inherited from interface org.lobobrowser.html.renderer.RElement
getCollapsibleMarginBottom, getCollapsibleMarginTop, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, layout
Methods inherited from interface org.lobobrowser.html.renderer.RenderableContainer
getGUIPoint, invalidateLayoutUpTree, relayout, repaint
Methods inherited from interface org.lobobrowser.html.domimpl.UINode
blur, getBounds, getBoundsRelativeToBlock
-
Field Details
-
widget
public final org.lobobrowser.html.renderer.UIControl widget -
modelNode
-
INVALID_SIZE
-
delayedPairs
A list of absolute positioned or float parent-child pairs. -
backgroundColor
Background color which may be different to that from RenderState in the case of a Document node. -
backgroundImage
-
zIndex
protected int zIndex -
borderTopColor
-
borderLeftColor
-
borderBottomColor
-
borderRightColor
-
borderInsets
-
marginInsets
-
paddingInsets
-
borderInfo
-
lastBackgroundImageUri
-
defaultMarginInsets
-
defaultPaddingInsets
-
overflowX
protected int overflowX -
overflowY
protected int overflowY -
userAgentContext
-
layoutDeepCanBeInvalidated
protected boolean layoutDeepCanBeInvalidated -
SCROLL_BAR_THICKNESS
protected static final int SCROLL_BAR_THICKNESS- See Also:
-
logger
-
SELECTION_COLOR
-
SELECTION_XOR
-
container
-
x
public int x -
y
public int y -
width
public int width -
height
public int height -
layoutUpTreeCanBeInvalidated
protected boolean layoutUpTreeCanBeInvalidatedStarts as true because ancestors could be invalidated. -
parent
Parent for graphics coordinates. -
originalParent
Parent for invalidation.
-
-
Constructor Details
-
RImgControl
public RImgControl(ModelNode me, org.lobobrowser.html.renderer.UIControl widget, RenderableContainer container, FrameContext frameContext, UserAgentContext ucontext)
-
-
Method Details
-
applyStyle
protected void applyStyle(int availWidth, int availHeight) -
focus
public void focus()- Specified by:
focus
in interfaceRCollection
- Specified by:
focus
in interfaceRenderableContainer
- Specified by:
focus
in interfaceUINode
-
invalidateLayoutLocal
public final void invalidateLayoutLocal() -
getVAlign
public int getVAlign()Description copied from interface:RElement
Vertical alignment for elements rendered in a line. Returns one of the constants defined in this class. -
hasBackground
public boolean hasBackground() -
paint
All overriders should call super implementation.- Specified by:
paint
in interfaceRenderable
-
onMouseClick
- Specified by:
onMouseClick
in interfaceBoundableRenderable
-
onDoubleClick
- Specified by:
onDoubleClick
in interfaceBoundableRenderable
-
onMousePressed
Description copied from interface:BoundableRenderable
Returns false if the event is consumed. True to propagate further.- Specified by:
onMousePressed
in interfaceBoundableRenderable
-
onMouseReleased
- Specified by:
onMouseReleased
in interfaceBoundableRenderable
-
onMouseDisarmed
- Specified by:
onMouseDisarmed
in interfaceBoundableRenderable
-
invalidateRenderStyle
public void invalidateRenderStyle() -
repaint
Description copied from interface:UINode
Called -
updateWidgetBounds
public void updateWidgetBounds(int guiX, int guiY) Updates bounds of all descendent's GUI components, based on root bounds.- Specified by:
updateWidgetBounds
in interfaceRCollection
-
getBlockBackgroundColor
-
paintSelection
public boolean paintSelection(Graphics g, boolean inSelection, RenderableSpot startPoint, RenderableSpot endPoint) Description copied from interface:BoundableRenderable
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 interfaceBoundableRenderable
- Returns:
- True iff it's in selection when finished painting.
-
extractSelectionText
public boolean extractSelectionText(StringBuffer buffer, boolean inSelection, RenderableSpot startPoint, RenderableSpot endPoint) - Specified by:
extractSelectionText
in interfaceBoundableRenderable
-
getLowestRenderableSpot
- Specified by:
getLowestRenderableSpot
in interfaceBoundableRenderable
-
doLayout
public void doLayout(int availWidth, int availHeight, boolean sizeOnly) -
preferredSizeInvalidated
public final void preferredSizeInvalidated()May be called by controls when they wish to modifiy their preferred size (e.g. an image after it's loaded). This method must be called in the GUI thread. -
getRenderables
Description copied from interface:RCollection
Gets the collection ofRenderable
children.- Specified by:
getRenderables
in interfaceRCollection
-
getPaintedBackgroundColor
- Specified by:
getPaintedBackgroundColor
in interfaceRenderableContainer
-
getForegroundColor
-
setDefaultPaddingInsets
-
setDefaultMarginInsets
-
getAlignmentX
public float getAlignmentX() -
getAlignmentY
public float getAlignmentY() -
invalidateLayoutDeep
public final void invalidateLayoutDeep()Invalidates this Renderable and all descendents. This is only used in special cases, such as when a new style sheet is added.- Specified by:
invalidateLayoutDeep
in interfaceRCollection
-
getDeclaredWidth
-
hasDeclaredWidth
public final boolean hasDeclaredWidth() -
getDeclaredHeight
-
getDeclaredHeightImpl
-
layout
public final void layout(int availWidth, int availHeight, boolean sizeOnly) Lays out children, and deals with "valid" state. Override doLayout method instead of this one. -
sendGUIComponentsToParent
protected final void sendGUIComponentsToParent() -
clearGUIComponents
protected final void clearGUIComponents() -
addComponent
- Specified by:
addComponent
in interfaceRenderableContainer
-
updateAllWidgetBounds
public void updateAllWidgetBounds()- Specified by:
updateAllWidgetBounds
in interfaceRenderableContainer
-
updateWidgetBounds
public void updateWidgetBounds()Updates widget bounds below this node only. Should not be called during general rendering. -
getBoundsRelativeToBlock
- Specified by:
getBoundsRelativeToBlock
in interfaceUINode
-
clearStyle
protected void clearStyle(boolean isRootBlock) -
loadBackgroundImage
-
getZIndex
public int getZIndex()- Specified by:
getZIndex
in interfaceBoundableRenderable
-
prePaint
-
imageUpdate
- Specified by:
imageUpdate
in interfaceImageObserver
-
getInsets
Gets insets of content area. It includes margin, borders and scrollbars, but not padding. -
sendDelayedPairsToParent
protected final void sendDelayedPairsToParent() -
clearDelayedPairs
public final void clearDelayedPairs()- Specified by:
clearDelayedPairs
in interfaceRenderableContainer
-
getDelayedPairs
- Specified by:
getDelayedPairs
in interfaceRenderableContainer
-
addDelayedPair
- Specified by:
addDelayedPair
in interfaceRenderableContainer
-
getParentContainer
- Specified by:
getParentContainer
in interfaceRenderableContainer
-
isContainedByNode
public boolean isContainedByNode()Description copied from interface:BoundableRenderable
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 interfaceBoundableRenderable
-
getCollapsibleMarginBottom
public int getCollapsibleMarginBottom()- Specified by:
getCollapsibleMarginBottom
in interfaceRElement
-
isMarginBoundary
protected boolean isMarginBoundary() -
getCollapsibleMarginTop
public int getCollapsibleMarginTop()- Specified by:
getCollapsibleMarginTop
in interfaceRElement
-
getMarginBottom
public int getMarginBottom()- Specified by:
getMarginBottom
in interfaceRElement
-
getMarginLeft
public int getMarginLeft()- Specified by:
getMarginLeft
in interfaceRElement
-
getMarginRight
public int getMarginRight()- Specified by:
getMarginRight
in interfaceRElement
-
getMarginTop
public int getMarginTop()- Specified by:
getMarginTop
in interfaceRElement
-
blur
public void blur()- Specified by:
blur
in interfaceRCollection
-
onMouseMoved
- Specified by:
onMouseMoved
in interfaceBoundableRenderable
-
onMouseOut
- Specified by:
onMouseOut
in interfaceBoundableRenderable
-
getRenderable
-
onRightClick
- Specified by:
onRightClick
in interfaceBoundableRenderable
-
markLayoutValid
public void markLayoutValid() -
getGUIPoint
- Specified by:
getGUIPoint
in interfaceBoundableRenderable
-
getRenderablePoint
- Specified by:
getRenderablePoint
in interfaceBoundableRenderable
-
getHeight
public int getHeight()- Specified by:
getHeight
in interfaceBoundableRenderable
-
getWidth
public int getWidth()- Specified by:
getWidth
in interfaceBoundableRenderable
-
setWidth
public void setWidth(int width) - Specified by:
setWidth
in interfaceBoundableRenderable
-
getX
public int getX()- Specified by:
getX
in interfaceBoundableRenderable
-
getY
public int getY()- Specified by:
getY
in interfaceBoundableRenderable
-
contains
public boolean contains(int x, int y) -
getBounds
- Specified by:
getBounds
in interfaceBoundableRenderable
-
getSize
- Specified by:
getSize
in interfaceBoundableRenderable
-
getModelNode
- Specified by:
getModelNode
in interfaceBoundableRenderable
- Specified by:
getModelNode
in interfaceRenderable
-
setBounds
public void setBounds(int x, int y, int width, int height) - Specified by:
setBounds
in interfaceBoundableRenderable
-
setX
public void setX(int x) - Specified by:
setX
in interfaceBoundableRenderable
-
setY
public void setY(int y) - Specified by:
setY
in interfaceBoundableRenderable
-
setHeight
public void setHeight(int height) - Specified by:
setHeight
in interfaceBoundableRenderable
-
setOrigin
public void setOrigin(int x, int y) - Specified by:
setOrigin
in interfaceBoundableRenderable
-
invalidateLayoutUpTree
public final void invalidateLayoutUpTree()Invalidates this Renderable and its parent (i.e. all ancestors).- Specified by:
invalidateLayoutUpTree
in interfaceBoundableRenderable
-
isValid
protected boolean isValid() -
relayout
public void relayout()Invalidates the current Renderable (which invalidates its ancestors) and then requests the top level GUI container to do the layout and repaint. It's safe to call this method outside the GUI thread.- Specified by:
relayout
in interfaceBoundableRenderable
-
relayoutIfValid
public void relayoutIfValid() -
setParent
- Specified by:
setParent
in interfaceBoundableRenderable
-
getParent
Description copied from interface:BoundableRenderable
Gets the parent where the renderable is rendered.- Specified by:
getParent
in interfaceBoundableRenderable
-
setOriginalParent
- Specified by:
setOriginalParent
in interfaceBoundableRenderable
-
getOriginalParent
This is the parent based on the original element hierarchy.- Specified by:
getOriginalParent
in interfaceBoundableRenderable
-
getOriginalOrCurrentParent
Description copied from interface:BoundableRenderable
ReturnsBoundableRenderable.getOriginalParent()
if not null. Otherwise it returnsBoundableRenderable.getParent()
.- Specified by:
getOriginalOrCurrentParent
in interfaceBoundableRenderable
-
repaint
public void repaint(int x, int y, int width, int height) - Specified by:
repaint
in interfaceBoundableRenderable
-
repaint
public void repaint()- Specified by:
repaint
in interfaceBoundableRenderable
-
paintTranslated
Description copied from interface:BoundableRenderable
Paints by either creating a new clipped graphics context corresponding to the bounds of the Renderable, or by translating the origin.- Specified by:
paintTranslated
in interfaceBoundableRenderable
- Parameters:
g
- Parent's Graphics context.
-
translateDescendentPoint
-
getOrigin
- Specified by:
getOrigin
in interfaceBoundableRenderable
-
getOriginRelativeTo
- Specified by:
getOriginRelativeTo
in interfaceBoundableRenderable
-
getOrdinal
public int getOrdinal() -
setOrdinal
public void setOrdinal(int ordinal)
-