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

void com::jgoodies::forms::layout::FormLayout::setRowGroups ( int  rowGroupIndices[][]  )  [inline]

Sets the row groups, where each row in such a group gets the same group wide height. Each group is described by an array of integers that are interpreted as row indices. The parameter is an array of such group descriptions.

Examples:

 // Group rows 1 and 2.
 setRowGroups(new int[][]{ {1, 2}});

 // Group rows 1 and 2, and group rows 5, 7, and 9.
 setRowGroups(new int[][]{ {1, 2}, {5, 7, 9}});
 

Parameters:
rowGroupIndices a two-dimensional array of row group indices.
Exceptions:
IndexOutOfBoundsException if an index is outside the grid

Definition at line 783 of file FormLayout.java.

References deepClone(), and getRowCount().

Referenced by addGroupedRow(), com::jgoodies::forms::tutorial::building::RowCounterExample::buildPanel(), com::jgoodies::forms::layout::FormLayoutGroupsTest::testDeepCopyRowGroups(), com::jgoodies::forms::layout::FormLayoutGroupsTest::testRejectDuplicateRowIndex(), and com::jgoodies::forms::layout::FormLayoutGroupsTest::testRejectInvalidRowIndex().

                                                      {
        int rowCount = getRowCount();
        boolean[] usedIndices = new boolean[rowCount + 1];
        for (int i = 0; i < rowGroupIndices.length; i++) {
            for (int j = 0; j < rowGroupIndices[i].length; j++) {
                int rowIndex = rowGroupIndices[i][j];
                if (rowIndex < 1 || rowIndex > rowCount) {
                    throw new IndexOutOfBoundsException(
                        "Invalid row group index " + rowIndex + 
                        " in group " + (i+1)); 
                }
                if (usedIndices[rowIndex]) {
                    throw new IllegalArgumentException(
                        "Row index " + rowIndex + " must not be used in multiple row groups.");
                }
                usedIndices[rowIndex] = true;
            }
        }
        this.rowGroupIndices = deepClone(rowGroupIndices);
    }


Generated by  Doxygen 1.6.0   Back to index