Class Row

  • All Implemented Interfaces:
    Element

    public class Row
    extends java.lang.Object
    implements Element
    A Row is part of a Table and contains some Cells.

    All Rows are constructed by a Table-object. You don't have to construct any Row yourself. In fact you can't construct a Row outside the package.

    Since a Cell can span several rows and/or columns a row can contain reserved space without any content.

    See Also:
    Element, Cell, Table
    • Field Detail

      • columns

        protected int columns
        This is the number of columns in the Row.
      • currentColumn

        protected int currentColumn
        This is a valid position the Row.
      • reserved

        protected boolean[] reserved
        This is the array that keeps track of reserved cells.
      • cells

        protected java.lang.Object[] cells
        This is the array of Objects (Cell or Table).
      • horizontalAlignment

        protected int horizontalAlignment
        This is the vertical alignment.
    • Constructor Detail

      • Row

        protected Row​(int columns)
        Constructs a Row with a certain number of columns.
        Parameters:
        columns - a number of columns
    • Method Detail

      • process

        public boolean process​(ElementListener listener)
        Processes the element by adding it (or the different parts) to a ElementListener.
        Specified by:
        process in interface Element
        Parameters:
        listener - an ElementListener
        Returns:
        true if the element was processed successfully
      • type

        public int type()
        Gets the type of the text element.
        Specified by:
        type in interface Element
        Returns:
        a type
      • getChunks

        public java.util.ArrayList getChunks()
        Gets all the chunks in this element.
        Specified by:
        getChunks in interface Element
        Returns:
        an ArrayList
      • isContent

        public boolean isContent()
        Description copied from interface: Element
        Checks if this element is a content object. If not, it's a metadata object.
        Specified by:
        isContent in interface Element
        Returns:
        true if this is a 'content' element; false if this is a 'metadata' element
        Since:
        iText 2.0.8
        See Also:
        Element.isContent()
      • isNestable

        public boolean isNestable()
        Description copied from interface: Element
        Checks if this element is nestable.
        Specified by:
        isNestable in interface Element
        Returns:
        true if this element can be nested inside other elements.
        Since:
        iText 2.0.8
        See Also:
        Element.isNestable()
      • deleteColumn

        void deleteColumn​(int column)
        Returns a Row that is a copy of this Row in which a certain column has been deleted.
        Parameters:
        column - the number of the column to delete
      • addElement

        int addElement​(java.lang.Object element)
        Adds a Cell to the Row.
        Parameters:
        element - the element to add (currently only Cells and Tables supported)
        Returns:
        the column position the Cell was added, or -1 if the element couldn't be added.
      • addElement

        int addElement​(java.lang.Object element,
                       int column)
        Adds an element to the Row at the position given.
        Parameters:
        element - the element to add. (currently only Cells and Tables supported
        column - the position where to add the cell.
        Returns:
        the column position the Cell was added, or -1 if the Cell couldn't be added.
      • setElement

        void setElement​(java.lang.Object aElement,
                        int column)
        Puts Cell to the Row at the position given, doesn't reserve colspan.
        Parameters:
        aElement - the cell to add.
        column - the position where to add the cell.
      • reserve

        boolean reserve​(int column)
        Reserves a Cell in the Row.
        Parameters:
        column - the column that has to be reserved.
        Returns:
        true if the column was reserved, false if not.
      • reserve

        boolean reserve​(int column,
                        int size)
        Reserves a Cell in the Row.
        Parameters:
        column - the column that has to be reserved.
        size - the number of columns
        Returns:
        true if the column was reserved, false if not.
      • isReserved

        boolean isReserved​(int column)
        Returns true/false when this position in the Row has been reserved, either filled or through a colspan of an Element.
        Parameters:
        column - the column.
        Returns:
        true if the column was reserved, false if not.
      • getElementID

        int getElementID​(int column)
        Returns the type-id of the element in a Row.
        Parameters:
        column - the column of which you'd like to know the type
        Returns:
        the type-id of the element in the row
      • getObjectID

        int getObjectID​(java.lang.Object element)
        Returns the type-id of an Object.
        Parameters:
        element - the object of which you'd like to know the type-id, -1 if invalid
        Returns:
        the type-id of an object
      • getCell

        public java.lang.Object getCell​(int column)
        Gets a Cell or Table from a certain column.
        Parameters:
        column - the column the Cell/Table is in.
        Returns:
        the Cell,Table or Object if the column was reserved or null if empty.
      • isEmpty

        public boolean isEmpty()
        Checks if the row is empty.
        Returns:
        true if none of the columns is reserved.
      • getColumns

        public int getColumns()
        Gets the number of columns.
        Returns:
        a value
      • setHorizontalAlignment

        public void setHorizontalAlignment​(int value)
        Sets the horizontal alignment.
        Parameters:
        value - the new value
      • getHorizontalAlignment

        public int getHorizontalAlignment()
        Gets the horizontal alignment.
        Returns:
        a value