private void getInventory(Image canvasImage) { for (Brick b : this.canvas.getBricks()) { boolean found = false; int foundOnRow = 0; int foundQuantity = 0; for (int i = 0; i < this.getRowCount(); i++) { final ConstructionRow row = this.rows.get(i); // TODO: I don't like this here...need a more robust solution // for equals in Brick if (row.getCut().getDescription().equals(b.getDescription())) { found = true; foundOnRow = i; foundQuantity = row.getCutCount(); break; } } if (found) { this.setValueAt(foundQuantity + 1, foundOnRow, 2); } else { Brick newBrick = new Brick(b.getCuttable(), this.colorAssigned(b.getDescription())); this.rows.add(new ConstructionRow(canvasImage, 1, newBrick.getDescription(), newBrick)); } } }
private void resetColors() { for (Brick b : this.canvas.getBricks()) { b.setColor(b.getColor()); } }
private void assignColors() { for (Brick b : this.canvas.getBricks()) { b.setColorForReport(this.colorAssigned(b.getDescription())); } }