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
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.booleanhasProperty(int property) Checks if this entity has the specified property.booleanisEmpty()Returnstrueif this list contains no elements.protected abstract IRendererCreates a new renderer instance.Sets an action on this Element.voidsetNextRenderer(IRenderer renderer) Overrides theIRendererinstance 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, getTransparentStrokeColor, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDashPattern, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalicMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:IElementGets 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:
-
getRendererin interfaceIElement - Returns:
- a renderer for this element
-
setNextRenderer
Description copied from interface:IElementOverrides theIRendererinstance which will be returned by the next call to theIElement.getRenderer().- Specified by:
-
setNextRendererin interfaceIElement - Parameters:
-
renderer- the renderer instance
-
createRendererSubTree
Description copied from interface:IElementCreates 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:
-
createRendererSubTreein interfaceIElement - Returns:
- a renderer subtree for this element
-
hasProperty
public boolean hasProperty(int property) Description copied from interface:IPropertyContainerChecks 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:
-
hasPropertyin interfaceIPropertyContainer - Overrides:
-
hasPropertyin classElementPropertyContainer<T extends IElement> - Parameters:
-
property- the property to be checked - Returns:
-
trueif this instance has given property,falseotherwise
-
getProperty
publicT1 getProperty (int property) Description copied from interface:IPropertyContainerGets 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:
-
getPropertyin interfaceIPropertyContainer - Overrides:
-
getPropertyin 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.
nullwill 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 onElementPropertyContainerNote 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:
-
getChildrenin interfaceIAbstractElement - Returns:
- a list of children
-
isEmpty
public boolean isEmpty()Returnstrueif this list contains no elements.- Returns:
-
trueif 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- thePdfActionthat 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 a new renderer instance.- Returns:
-
new
IRenderer
-