/** * Handle a list element being removed by adjusting the layout. */ public void removeIndex(int index) { int logicalColumnCountBefore = logicalColumnCount(); int logicalRowCountBefore = logicalRowCount(); gridComponents.remove(index); fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Handle a list element being removed by adjusting the layout. */ public void removeIndex(int index) { int logicalColumnCountBefore = logicalColumnCount(); int logicalRowCountBefore = logicalRowCount(); gridComponents.remove(index); fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Handle a list element being removed by adjusting the layout. */ public void removeIndex(int index) { int logicalColumnCountBefore = logicalColumnCount(); int logicalRowCountBefore = logicalRowCount(); gridComponents.remove(index); fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Adjust the number of logical rows and columns and how elements are wrapped * into those cells. */ private void setElementRowsAndColumns(int elementRows, int elementColumns) { int logicalRowCountBefore = logicalRowCount(); int logicalColumnCountBefore = logicalColumnCount(); this.elementRows = elementRows; this.elementColumns = elementColumns; fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Adjust the number of logical rows and columns and how elements are wrapped * into those cells. */ private void setElementRowsAndColumns(int elementRows, int elementColumns) { int logicalRowCountBefore = logicalRowCount(); int logicalColumnCountBefore = logicalColumnCount(); this.elementRows = elementRows; this.elementColumns = elementColumns; fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Adjust the number of logical rows and columns and how elements are wrapped * into those cells. */ private void setElementRowsAndColumns(int elementRows, int elementColumns) { int logicalRowCountBefore = logicalRowCount(); int logicalColumnCountBefore = logicalColumnCount(); this.elementRows = elementRows; this.elementColumns = elementColumns; fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Handle a list element being inserted by adjusting the layout. */ public void insertIndex(int index) { int logicalColumnCountBefore = logicalColumnCount(); int logicalRowCountBefore = logicalRowCount(); gridComponents.add(index, new CellComponents()); fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Handle a list element being inserted by adjusting the layout. */ public void insertIndex(int index) { int logicalColumnCountBefore = logicalColumnCount(); int logicalRowCountBefore = logicalRowCount(); gridComponents.add(index, new CellComponents()); fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * Handle a list element being inserted by adjusting the layout. */ public void insertIndex(int index) { int logicalColumnCountBefore = logicalColumnCount(); int logicalRowCountBefore = logicalRowCount(); gridComponents.add(index, new CellComponents()); fixCellCount(logicalRowCountBefore, logicalColumnCountBefore); }
/** * 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); } }