public abstract class AbstractRenderer extends Object implements IRenderer
IRenderer implementations. All default Renderers are subclasses of this default implementation.
| Modifier and Type | Field and Description |
|---|---|
protected List<IRenderer> |
childRenderers |
static float |
EPS |
protected boolean |
flushed |
static float |
INF |
protected boolean |
isLastRendererForModelElement |
protected IPropertyContainer |
modelElement |
protected LayoutArea |
occupiedArea |
protected IRenderer |
parent |
protected List<IRenderer> |
positionedRenderers |
protected Map<Integer,Object> |
properties |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRenderer()
Creates a renderer.
|
protected |
AbstractRenderer(AbstractRenderer other) |
protected |
AbstractRenderer(IElement modelElement)
Creates a renderer for the specified layout element.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAllProperties(Map<Integer,Object> properties) |
void |
addChild(IRenderer renderer)
Adds a child to the current renderer
|
protected void |
alignChildHorizontally(IRenderer childRenderer, float availableWidth) |
protected void |
applyAbsolutePositioningTranslation(boolean reverse) |
protected void |
applyAction(PdfDocument document) |
protected Rectangle |
applyBorderBox(Rectangle rect, boolean reverse) |
protected void |
applyDestination(PdfDocument document) |
protected Rectangle |
applyMargins(Rectangle rect, boolean reverse) |
protected Rectangle |
applyPaddings(Rectangle rect, boolean reverse) |
void |
deleteOwnProperty(int property)
Deletes the own property of this entity.
|
void |
deleteProperty(int property)
Deletes property from this very renderer, or in case the property is specified on its model element, the property of the model element is deleted
|
void |
draw(DrawContext drawContext)
Flushes the renderer subtree contents, i.e. draws itself on canvas, adds necessary objects to the PdfDocument etc.
|
void |
drawBackground(DrawContext drawContext)
Draws a background layer if it is defined by a key Property.BACKGROUND in either the layout element or this IRenderer itself.
|
void |
drawBorder(DrawContext drawContext)
Performs the drawing operation for the border of this renderer, if defined by any of the Property.BORDER values in either the layout element or this IRenderer itself.
|
void |
drawChildren(DrawContext drawContext)
Performs the drawing operation for all children of this renderer.
|
Rectangle |
getBorderAreaBBox()
Gets the border box of a renderer.
|
protected Border[] |
getBorders()
Gets borders of the element in the specified order: top, right, bottom, left.
|
List<IRenderer> |
getChildRenderers()
Gets the child IRenderers.
|
|
getDefaultProperty(int property)
Gets the default property from this entity.
|
protected Float |
getFirstYLineRecursively()
Gets the first yLine of the nested children recursively.
|
Rectangle |
getInnerAreaBBox() |
IPropertyContainer |
getModelElement()
Gets the model element associated with this renderer.
|
LayoutArea |
getOccupiedArea()
Gets the resultant occupied area after the last call to the IRenderer.layout(LayoutContext) method.
|
Rectangle |
getOccupiedAreaBBox()
Gets the bounding box that contains all content written to the DrawContext by this IRenderer.
|
protected Map<Integer,Object> |
getOwnProperties() |
|
getOwnProperty(int property)
Gets own property from this entity.
|
|
getProperty(int key)
Gets the property from this entity.
|
|
getProperty(int property, T1 defaultValue)
Gets a property from this entity or one of its hierarchical parents.
|
Boolean |
getPropertyAsBoolean(int property)
Returns a property with a certain key, as a boolean value.
|
Color |
getPropertyAsColor(int property)
Returns a property with a certain key, as a color.
|
Float |
getPropertyAsFloat(int property)
Returns a property with a certain key, as a floating point value.
|
PdfFont |
getPropertyAsFont(int property)
Returns a property with a certain key, as a font object.
|
Integer |
getPropertyAsInteger(int property)
Returns a property with a certain key, as an integer value.
|
boolean |
hasOwnProperty(int property)
Checks if this entity has the specified property, i.e. if it was set to this very element earlier
|
boolean |
hasProperty(int property)
Checks if this entity has the specified property.
|
List<Rectangle> |
initElementAreas(LayoutArea area)
Gets all rectangles that this IRenderer can draw upon in the given area.
|
protected boolean |
isFixedLayout() |
boolean |
isFlushed()
Indicates whether this renderer is flushed or not, i.e. if IRenderer.draw(DrawContext) has already been called.
|
protected boolean |
isNotFittingHeight(LayoutArea layoutArea) |
protected boolean |
isPositioned() |
void |
move(float dxRight, float dyUp)
Moves the renderer subtree by the specified offset.
|
protected Float |
retrieveHeight() |
protected Float |
retrieveUnitValue(float basePercentValue, int property) |
protected Float |
retrieveWidth(float parentBoxWidth) |
protected AbstractRenderer |
setBorders(Border border, int borderNumber) |
IRenderer |
setParent(IRenderer parent)
Explicitly sets this object as the child of another IRenderer in the renderer hierarchy.
|
void |
setProperty(int property, Object value)
Sets a property for this entity.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetNextRenderer, layoutpublic static final float EPS
public static final float INF
protected IPropertyContainer modelElement
protected boolean flushed
protected LayoutArea occupiedArea
protected IRenderer parent
protected boolean isLastRendererForModelElement
protected AbstractRenderer()
protected AbstractRenderer(IElement modelElement)
modelElement - the layout element that will be drawn by this renderer
protected AbstractRenderer(AbstractRenderer other)
public void addChild(IRenderer renderer)
IRenderer
public IPropertyContainer getModelElement()
IRenderer
getModelElement in interface IRenderer
container of properties
public List<IRenderer> getChildRenderers()
IRenderer
IRenderers.
getChildRenderers in interface IRenderer
renderers of this instance
public boolean hasProperty(int property)
IPropertyContainer
IPropertyContainer.hasOwnProperty(int), this method can check parent's properties, styles, etc, depending on the origin of the instance
hasProperty in interface IPropertyContainer
property - the property to be checked
true if this instance has given property, false otherwise
public boolean hasOwnProperty(int property)
IPropertyContainer
hasOwnProperty in interface IPropertyContainer
property - the property to be checked
true if this instance has given own property, false otherwise
public void deleteOwnProperty(int property)
IPropertyContainer
deleteOwnProperty in interface IPropertyContainer
property - the property to be deleted
public void deleteProperty(int property)
property - the property key to be deleted
publicT1 getProperty(int key)
IPropertyContainer
IPropertyContainer.getOwnProperty(int), this method can check parent's properties, styles, etc, depending on the origin of the instance
getProperty in interface IPropertyContainer
T1 - the return type associated with the property
key - the property to be retrieved
null will be returned if the property value was not found
publicT1 getOwnProperty(int property)
IPropertyContainer
null will be returned.
getOwnProperty in interface IPropertyContainer
T1 - the return type associated with the property
property - the property to be retrieved
null will be returned if the property value was not found
publicT1 getProperty(int property, T1 defaultValue)
IRenderer
defaultValue will be returned.
getProperty in interface IRenderer
T1 - the return type associated with the property
property - the property to be retrieved
defaultValue - a fallback value
public void setProperty(int property,
Object value)
IPropertyContainer
setProperty in interface IPropertyContainer
property - the property to be set
value - the value of the property
publicT1 getDefaultProperty(int property)
IPropertyContainer
getDefaultProperty in interface IPropertyContainer
T1 - the return type associated with the property
property - the property to be retrieved
null will be returned
public PdfFont getPropertyAsFont(int property)
property - an enum value
PdfFont
public Color getPropertyAsColor(int property)
property - an enum value
Color
public Float getPropertyAsFloat(int property)
property - an enum value
Float
public Boolean getPropertyAsBoolean(int property)
property - an enum value
Boolean
public Integer getPropertyAsInteger(int property)
property - an enum value
Integer
public LayoutArea getOccupiedArea()
IRenderer
IRenderer.layout(LayoutContext) method.
getOccupiedArea in interface IRenderer
LayoutArea instance
public void draw(DrawContext drawContext)
IRenderer
PdfDocument etc.
draw in interface IRenderer
drawContext - contains the PdfDocument to which the renderer subtree if flushed, the PdfCanvas on which the renderer subtree is drawn and other additional parameters needed to perform drawing
public void drawBackground(DrawContext drawContext)
Property.BACKGROUND in either the layout element or this IRenderer itself.
drawContext - the context (canvas, document, etc) of this drawing operation.
public void drawChildren(DrawContext drawContext)
children of this renderer.
drawContext - the context (canvas, document, etc) of this drawing operation.
public void drawBorder(DrawContext drawContext)
Property.BORDER values in either the layout element or this IRenderer itself.
drawContext - the context (canvas, document, etc) of this drawing operation.
public boolean isFlushed()
IRenderer
IRenderer.draw(DrawContext) has already been called.
public IRenderer setParent(IRenderer parent)
IRenderer
IRenderer in the renderer hierarchy. Some implementations also use this method internally to create a consistent hierarchy tree.
public void move(float dxRight,
float dyUp)
IRenderer
public List<Rectangle> initElementAreas(LayoutArea area)
IRenderer can draw upon in the given area.
area - a physical area on the DrawContext
rectangles
public Rectangle getOccupiedAreaBBox()
DrawContext by this IRenderer.
Rectangle that surrounds the content
public Rectangle getBorderAreaBBox()
public Rectangle getInnerAreaBBox()
protected Float retrieveWidth(float parentBoxWidth)
protected Float retrieveHeight()
protected Float retrieveUnitValue(float basePercentValue, int property)
protected Float getFirstYLineRecursively()
protected void applyAbsolutePositioningTranslation(boolean reverse)
protected void applyDestination(PdfDocument document)
protected void applyAction(PdfDocument document)
protected boolean isNotFittingHeight(LayoutArea layoutArea)
protected boolean isPositioned()
protected boolean isFixedLayout()
protected void alignChildHorizontally(IRenderer childRenderer, float availableWidth)
protected Border[] getBorders()
Property.BORDER is used, and if Property.BORDER is also not set then null is returned on position of this border
-
setBorders
protected AbstractRenderer setBorders(Border border,
int borderNumber)
Copyright © 1998–2016 iText Group NV. All rights reserved.