public void setMatch(Match match) { ItemCell cell1 = null, cell2 = null; if (selection != null) { cell1 = getCell(selection); selection = null; updateCell(cell1); } selection = match; if (selection != null) { cell2 = getCell(selection); updateCell(cell2); } if (cell1 != null) { decorator.redraw(cell1); } if (cell2 != null && cell2 != cell1) { decorator.redraw(cell2); } }
public void setMatches(Match[] matches) { cellToMatches = new HashMap<ItemCell, List<Match>>(); for (Match match : matches) { ItemCell cell = getCell(match); List<Match> list = cellToMatches.get(cell); if (list == null) { list = new ArrayList<Match>(); cellToMatches.put(cell, list); } list.add(match); } decorator.clearStyles(); for (ItemCell cell : cellToMatches.keySet()) { updateCell(cell); } decorator.redraw(); }