public void selectUsers(Object tbl_clients) { Object row = ui.getSelectedItem(tbl_clients); // TODO: Only Working partially with single selection; // Algo is not worth cracking the head Object cell = ui.getItem(row, 0); ui.remove(cell); Client attachedClient = (Client) ui.getAttachedObject(row); if (attachedClient.isSelected()) { attachedClient.setSelected(false); selectedClients.remove(attachedClient); markCell(cell, false); } else { attachedClient.setSelected(true); selectedClients.add(attachedClient); markCell(cell, true); } ui.add(row, cell, 0); }
private void markAllCells(boolean choice) { Object[] rows = ui.getItems(this.tableClients); for (Object row : rows) { Object cell = ui.getItem(row, 0); ui.remove(cell); Client attachedClient = (Client) ui.getAttachedObject(row); if (!attachedClient.isSelected()) { attachedClient.setSelected(choice); markCell(cell, choice); } ui.add(row, cell, 0); } }