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

void com::jgoodies::forms::layout::FormLayout::shiftComponentsHorizontally ( int  columnIndex,
boolean  remove 
) [inline, private]

Shifts components horizontally, either to the right if a column has been inserted or to the left if a column has been removed.

Parameters:
columnIndex index of the column to remove
remove true for remove, false for insert
Exceptions:
IllegalStateException if a removed column contains components

Definition at line 554 of file FormLayout.java.

References constraintMap, com::jgoodies::forms::layout::CellConstraints::gridWidth, and com::jgoodies::forms::layout::CellConstraints::gridX.

Referenced by insertColumn(), and removeColumn().

                                                                              {
        final int offset = remove ? -1 : 1;
        for (Iterator i = constraintMap.entrySet().iterator(); i.hasNext(); ) {
            Map.Entry entry = (Map.Entry) i.next();
            CellConstraints constraints = (CellConstraints) entry.getValue();
            int x1 = constraints.gridX;
            int w  = constraints.gridWidth;
            int x2 = x1 + w - 1;
            if (x1 == columnIndex && remove) {
                throw new IllegalStateException(
                    "The removed column " + columnIndex + 
                    " must not contain component origins.\n" +
                    "Illegal component=" + entry.getKey());
            } else if (x1 >= columnIndex) {
                constraints.gridX += offset;
            } else if (x2 >= columnIndex) {
                constraints.gridWidth += offset;
            }
        }
    }


Generated by  Doxygen 1.6.0   Back to index