/** * We can improve this method by replacing the before counts as parameters * by figuring out what the counts are by examining the layout. */ private void fixCellCount(int logicalRowCountBefore, int logicalColumnCountBefore) { int logicalColumnCountAfter = logicalColumnCount(); int logicalRowCountAfter = logicalRowCount(); // make sure we have enough cells for(int r = logicalRowCountBefore; r < logicalRowCountAfter; r++) { insertLogicalRow(r); } for(int c = logicalColumnCountBefore; c < logicalColumnCountAfter; c++) { insertLogicalColumn(c); } // we have too many cells in one dimension, the perfect time to // reassign constraints safely reassignConstraints(); // make sure we don't have too many cells for(int r = logicalRowCountBefore - 1; r >= logicalRowCountAfter; r--) { removeLogicalRow(r); } for(int c = logicalColumnCountBefore - 1; c >= logicalColumnCountAfter; c--) { removeLogicalColumn(c); } }
/** * We can improve this method by replacing the before counts as parameters * by figuring out what the counts are by examining the layout. */ private void fixCellCount(int logicalRowCountBefore, int logicalColumnCountBefore) { int logicalColumnCountAfter = logicalColumnCount(); int logicalRowCountAfter = logicalRowCount(); // make sure we have enough cells for(int r = logicalRowCountBefore; r < logicalRowCountAfter; r++) { insertLogicalRow(r); } for(int c = logicalColumnCountBefore; c < logicalColumnCountAfter; c++) { insertLogicalColumn(c); } // we have too many cells in one dimension, the perfect time to // reassign constraints safely reassignConstraints(); // make sure we don't have too many cells for(int r = logicalRowCountBefore - 1; r >= logicalRowCountAfter; r--) { removeLogicalRow(r); } for(int c = logicalColumnCountBefore - 1; c >= logicalColumnCountAfter; c--) { removeLogicalColumn(c); } }
/** * We can improve this method by replacing the before counts as parameters * by figuring out what the counts are by examining the layout. */ private void fixCellCount(int logicalRowCountBefore, int logicalColumnCountBefore) { int logicalColumnCountAfter = logicalColumnCount(); int logicalRowCountAfter = logicalRowCount(); // make sure we have enough cells for(int r = logicalRowCountBefore; r < logicalRowCountAfter; r++) { insertLogicalRow(r); } for(int c = logicalColumnCountBefore; c < logicalColumnCountAfter; c++) { insertLogicalColumn(c); } // we have too many cells in one dimension, the perfect time to // reassign constraints safely reassignConstraints(); // make sure we don't have too many cells for(int r = logicalRowCountBefore - 1; r >= logicalRowCountAfter; r--) { removeLogicalRow(r); } for(int c = logicalColumnCountBefore - 1; c >= logicalColumnCountAfter; c--) { removeLogicalColumn(c); } }