Package com.itextpdf.layout.element
Class AbstractElementIElement>
java.lang.Object
com.itextpdf.commons.actions.sequence.AbstractIdentifiableElement
com.itextpdf.layout.ElementPropertyContainer
com.itextpdf.layout.element.AbstractElement
- Type Parameters:
-
T
- the type of the implementation
- All Implemented Interfaces:
-
IAbstractElement
,IElement
,IPropertyContainer
- Direct Known Subclasses:
-
AreaBreak
,BlockElement
,Image
,Tab
,Text
public abstract class AbstractElementIElement> extends ElementPropertyContainer implements IAbstractElement
Defines the most common properties that most
IElement
implementations share.
-
Field Summary
FieldsFields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a new style to this element.Creates a renderer subtree with root in the current element.Gets the child elements of this elementsT1 getProperty
(int property) Gets the property from this entity.Gets a renderer for this element.boolean
hasProperty
(int property) Checks if this entity has the specified property.boolean
isEmpty()
Returnstrue
if this list contains no elements.protected abstract IRenderer
Creates new renderer instance.Sets an action on this Element.void
setNextRenderer
(IRenderer renderer) Overrides theIRenderer
instance which will be returned by the next call to theIElement.getRenderer()
.setPageNumber
(int pageNumber) Explicitly sets the page number this element should be put on.Methods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getDefaultProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBold, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setItalic, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getDefaultProperty, getOwnProperty, hasOwnProperty, setProperty
-
Field Details
-
nextRenderer
-
childElements
-
styles
-
-
Constructor Details
-
AbstractElement
public AbstractElement()
-
-
Method Details
-
getRenderer
Description copied from interface:IElement
Gets a renderer for this element. Note that this method can be called more than once. By default each element should define its own renderer, but the renderer can be overridden byIElement.setNextRenderer(IRenderer)
method call.- Specified by:
-
getRenderer
in interfaceIElement
- Returns:
- a renderer for this element
-
setNextRenderer
Description copied from interface:IElement
Overrides theIRenderer
instance which will be returned by the next call to theIElement.getRenderer()
.- Specified by:
-
setNextRenderer
in interfaceIElement
- Parameters:
-
renderer
- the renderer instance
-
createRendererSubTree
Description copied from interface:IElement
Creates a renderer subtree with root in the current element. Compared toIElement.getRenderer()
, the renderer returned by this method should contain all the child renderers for children of the current element.- Specified by:
-
createRendererSubTree
in interfaceIElement
- Returns:
- a renderer subtree for this element
-
hasProperty
public boolean hasProperty(int property) Description copied from interface:IPropertyContainer
Checks if this entity has the specified property. Compared toIPropertyContainer.hasOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance- Specified by:
-
hasProperty
in interfaceIPropertyContainer
- Overrides:
-
hasProperty
in classElementPropertyContainer<T extends IElement>
- Parameters:
-
property
- the property to be checked - Returns:
-
true
if this instance has given property,false
otherwise
-
getProperty
publicT1 getProperty (int property) Description copied from interface:IPropertyContainer
Gets the property from this entity. Compared toIPropertyContainer.getOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance- Specified by:
-
getProperty
in interfaceIPropertyContainer
- Overrides:
-
getProperty
in classElementPropertyContainer<T extends IElement>
- Type Parameters:
-
T1
- the return type associated with the property - Parameters:
-
property
- the property to be retrieved - Returns:
-
the value of the given property.
null
will be returned if the property value was not found
-
addStyle
Add a new style to this element. A style can be used as an effective way to define multiple equal properties to several elements, however its properties have lower priority than properties, directly set onElementPropertyContainer
Note that if several Style objects are added, iText checks them one by one in the order in which they were added and returns the property's value from the last Style object, which contains this property. So, if there are two Style objects added: the first has set width of 100 points and the second of 200 points, iText will get 200 points as width value.- Parameters:
-
style
- the style to be added - Returns:
- this element
-
getChildren
Gets the child elements of this elements- Specified by:
-
getChildren
in interfaceIAbstractElement
- Returns:
- a list of children
-
isEmpty
public boolean isEmpty()Returnstrue
if this list contains no elements.- Returns:
-
true
if this list contains no elements
-
setAction
Sets an action on this Element. An action is a general PDF concept that signifies anything that makes the document interactive, e.g. a hyperlink or a button.- Parameters:
-
action
- thePdfAction
that should be performed - Returns:
- this Element
-
setPageNumber
Explicitly sets the page number this element should be put on. The location on the page will be the same as if it were added at the end of the document, but it will be located on the specified page.This method should be used very carefully in client code.
- Parameters:
-
pageNumber
- the page number of the page this element should be placed on - Returns:
- this Element
-
makeNewRenderer
Creates new renderer instance.- Returns:
-
new
IRenderer
-