@Override protected Object getRow(Client client) { Object row = ui.createTableRow(client); Object cell = ui.createTableCell(""); markCell(cell, false); ui.add(row, cell); ui.add(row, ui.createTableCell(client.getFirstName() + " " + client.getOtherName())); ui.add(row, ui.createTableCell(client.getPhoneNumber())); ui.setAttachedObject(row, client); return addCustomData(client, row); }
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); } }
public void showFooter() { if (ui.getSelectedIndex(this.tableClients) >= 0) { Object selectedItem = ui.getSelectedItem(this.tableClients); Client attachedClient = ui.getAttachedObject(selectedItem, Client.class); ui.setText(ui.find(LBL_CLIENT_NAME), NAME + attachedClient.getFullName()); ui.setText(ui.find(LBL_TO_SAVE), TO_SAVE + reviewHandler.getTotalAmount()); ui.setText(ui.find(LBL_START_DATE), STARTING_ON + sdf.format(reviewHandler.getStartDate())); ui.setText(ui.find(LBL_END_DATE), ENDING_ON + sdf.format(reviewHandler.getEndDate())); } else { Client fstClient = reviewHandler.getSelectedClients().get(0); ui.setText(ui.find(LBL_CLIENT_NAME), NAME + fstClient.getFirstName()); ui.setText(ui.find(LBL_TO_SAVE), TO_SAVE + reviewHandler.getTotalAmount()); ui.setText(ui.find(LBL_START_DATE), STARTING_ON + sdf.format(reviewHandler.getStartDate())); ui.setText(ui.find(LBL_END_DATE), ENDING_ON + sdf.format(reviewHandler.getEndDate())); } }
protected Object getRow(Client client) { Object row = ui.createTableRow(client); ui.add(row, ui.createTableCell(client.getFullName())); ui.add(row, ui.createTableCell(client.getPhoneNumber())); String neededitems = ""; for (TargetServiceItem tsi : reviewHandler.getSelectedServiceItems()) { if (neededitems.length() == 0) { neededitems = tsi.getServiceItem().getTargetName(); } else { neededitems = neededitems + ", " + tsi.getServiceItem().getTargetName(); } } ui.add(row, ui.createTableCell(neededitems)); return addCustomData(client, row); }
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); }