Logo Search packages:      
Sourcecode: libjgoodies-forms-java version File versions  Download package

void com::jgoodies::forms::layout::FormLayout::removeRow ( int  rowIndex  )  [inline]

Removes the row with the given row index from the layout. Components will be rearranged and row groups will be readjusted. Therefore, the row must not contain components and must not be part of a row group.

The component shift works as follows: components that were located below the removed row are moved up one row; component row span is decreased by one if it intersects the removed row.

Row group indices that are greater than the row index will be decreased by one.

Note: If one of the constraints mentioned above is violated, this layout's state becomes illegal and it is unsafe to work with this layout. A typical layout implementation can ensure that these constraints are not violated. However, in some cases you may need to check these conditions before you invoke this method. The Forms extras contain source code for class FormLayoutUtils that provides the required test methods:
rowContainsComponents(Container, int) and
isGroupedRow(FormLayout, int).

Parameters:
rowIndex index of the row to remove
Exceptions:
IndexOutOfBoundsException if the row index is out of range
IllegalStateException if the row contains components or if the row is already grouped
See also:
com.jgoodies.forms.extras.FormLayoutUtils::rowContainsComponent(Container, int)

com.jgoodies.forms.extras.FormLayoutUtils::isGroupedRow(FormLayout, int)

Definition at line 534 of file FormLayout.java.

References adjustGroupIndices(), getRowCount(), rowGroupIndices, rowSpecs, and shiftComponentsVertically().

                                        {
        if (rowIndex < 1 || rowIndex > getRowCount()) {
            throw new IndexOutOfBoundsException(
                    "The row index " + rowIndex + 
                    "must be in the range [1, " + getRowCount() + "].");
        }
        rowSpecs.remove(rowIndex - 1);
        shiftComponentsVertically(rowIndex, true);
        adjustGroupIndices(rowGroupIndices, rowIndex, true);
    }


Generated by  Doxygen 1.6.0   Back to index