Class AbstractElementIElement>

Type Parameters:
T - the type of the implementation
All Implemented Interfaces:
IAbstractElement, IElement, IPropertyContainer
Direct Known Subclasses:
AreaBreak, BlockElement, FormField, Image, Tab, Text

public abstract class AbstractElementIElement> extends ElementPropertyContainer implements IAbstractElement
Defines the most common properties that most IElement implementations share.
  • Field Details

  • Constructor Details

    • AbstractElement

      public AbstractElement()
  • Method Details

    • getRenderer

      public IRenderer 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 by IElement.setNextRenderer(IRenderer) method call.
      Specified by:
      getRenderer in interface IElement
      Returns:
      a renderer for this element
    • setNextRenderer

      public void setNextRenderer (IRenderer renderer)
      Description copied from interface: IElement
      Overrides the IRenderer instance which will be returned by the next call to the IElement.getRenderer().
      Specified by:
      setNextRenderer in interface IElement
      Parameters:
      renderer - the renderer instance
    • createRendererSubTree

      public IRenderer createRendererSubTree()
      Description copied from interface: IElement
      Creates a renderer subtree with root in the current element. Compared to IElement.getRenderer(), the renderer returned by this method should contain all the child renderers for children of the current element.
      Specified by:
      createRendererSubTree in interface IElement
      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 to IPropertyContainer.hasOwnProperty(int), this method can check parent's properties, styles, etc, depending on the origin of the instance
      Specified by:
      hasProperty in interface IPropertyContainer
      Overrides:
      hasProperty in class ElementPropertyContainer<T extends IElement>
      Parameters:
      property - the property to be checked
      Returns:
      true if this instance has given property, false otherwise
    • getProperty

      public  T1 getProperty (int property)
      Description copied from interface: IPropertyContainer
      Gets the property from this entity. Compared to IPropertyContainer.getOwnProperty(int), this method can check parent's properties, styles, etc, depending on the origin of the instance
      Specified by:
      getProperty in interface IPropertyContainer
      Overrides:
      getProperty in class ElementPropertyContainer<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

      public T addStyle (Style style)
      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 on ElementPropertyContainer 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

      public List<IElement> getChildren()
      Gets the child elements of this elements
      Specified by:
      getChildren in interface IAbstractElement
      Returns:
      a list of children
    • isEmpty

      public boolean isEmpty()
      Returns true if this list contains no elements.
      Returns:
      true if this list contains no elements
    • setAction

      public T setAction (PdfAction action)
      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 - the PdfAction that should be performed
      Returns:
      this Element
    • setPageNumber

      public T setPageNumber (int pageNumber)
      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

      protected abstract IRenderer makeNewRenderer()
      Creates new renderer instance.
      Returns:
      new IRenderer