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.
|
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. |
<T1> T1 |
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() |
<T1> T1 |
getOwnProperty(int property)
Gets own property from this entity.
|
<T1> T1 |
getProperty(int key)
Gets the property from this entity.
|
<T1> T1 |
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.
|
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.
|
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 rendererprotected AbstractRenderer(AbstractRenderer other)
public void addChild(IRenderer renderer)
IRendererpublic IPropertyContainer getModelElement()
IRenderergetModelElement in interface IRenderercontainer of propertiespublic List<IRenderer> getChildRenderers()
IRendererIRenderers.getChildRenderers in interface IRendererrenderers of this instancepublic boolean hasProperty(int property)
IPropertyContainerIPropertyContainer.hasOwnProperty(int),
this method can check parent's properties, styles, etc, depending on the origin of the instancehasProperty in interface IPropertyContainerproperty - the property to be checkedtrue if this instance has given property, false otherwisepublic boolean hasOwnProperty(int property)
IPropertyContainerhasOwnProperty in interface IPropertyContainerproperty - the property to be checkedtrue if this instance has given own property, false otherwisepublic void deleteOwnProperty(int property)
IPropertyContainerdeleteOwnProperty in interface IPropertyContainerproperty - the property to be deletedpublic void deleteProperty(int property)
property - the property key to be deletedpublic <T1> T1 getProperty(int key)
IPropertyContainerIPropertyContainer.getOwnProperty(int),
this method can check parent's properties, styles, etc, depending on the origin of the instancegetProperty in interface IPropertyContainerT1 - the return type associated with the propertykey - the property to be retrievednull will be returned if the property value was not foundpublic <T1> T1 getOwnProperty(int property)
IPropertyContainernull will be returned.getOwnProperty in interface IPropertyContainerT1 - the return type associated with the propertyproperty - the property to be retrievednull will be returned if the property value was not foundpublic <T1> T1 getProperty(int property,
T1 defaultValue)
IRendererdefaultValue will be returned.getProperty in interface IRendererT1 - the return type associated with the propertyproperty - the property to be retrieveddefaultValue - a fallback valuepublic void setProperty(int property,
Object value)
IPropertyContainersetProperty in interface IPropertyContainerproperty - the property to be setvalue - the value of the propertypublic <T1> T1 getDefaultProperty(int property)
IPropertyContainergetDefaultProperty in interface IPropertyContainerT1 - the return type associated with the propertyproperty - the property to be retrievednull will be returnedpublic PdfFont getPropertyAsFont(int property)
property - an enum valuePdfFontpublic Color getPropertyAsColor(int property)
property - an enum valueColorpublic Float getPropertyAsFloat(int property)
property - an enum valueFloatpublic Boolean getPropertyAsBoolean(int property)
property - an enum valueBooleanpublic Integer getPropertyAsInteger(int property)
property - an enum valueIntegerpublic LayoutArea getOccupiedArea()
IRendererIRenderer.layout(LayoutContext) method.getOccupiedArea in interface IRendererLayoutArea instancepublic void draw(DrawContext drawContext)
IRendererPdfDocument etc.draw in interface IRendererdrawContext - 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 drawingpublic 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()
IRendererIRenderer.draw(DrawContext) has already
been called.public IRenderer setParent(IRenderer parent)
IRendererIRenderer in
the renderer hierarchy. Some implementations also use this method
internally to create a consistent hierarchy tree.public void move(float dxRight,
float dyUp)
IRendererpublic List<Rectangle> initElementAreas(LayoutArea area)
IRenderer can draw upon in the given area.area - a physical area on the DrawContextrectanglespublic Rectangle getOccupiedAreaBBox()
DrawContext by this IRenderer.Rectangle that surrounds the contentpublic 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 borderprotected AbstractRenderer setBorders(Border border, int borderNumber)
Copyright © 1998–2016 iText Group NV. All rights reserved.