/** * Refresh the information on the panel. * * @param transfers List of transfers to show. */ public final void refresh(List<PlayerTransfer> transfers) { this.transfers = transfers; final DefaultTableSorter sorter = (DefaultTableSorter) transferTable.getModel(); sorter.setTableModel(new TransferTableModel(transfers)); transferTable.getColumnModel().getColumn(3).setPreferredWidth(150); transferTable.getColumnModel().getColumn(4).setCellRenderer(new IconCellRenderer()); transferTable.getColumnModel().getColumn(4).setMaxWidth(20); transferTable.getColumnModel().getColumn(5).setPreferredWidth(150); transferTable.getColumnModel().getColumn(8).setCellRenderer(greenColumn); transferTable.getColumnModel().getColumn(8).setPreferredWidth(30); transferTable.getColumnModel().getColumn(9).setCellRenderer(greenColumn); transferTable.getColumnModel().getColumn(9).setPreferredWidth(30); transferTable.getColumnModel().getColumn(10).setCellRenderer(greenColumn); transferTable.getColumnModel().getColumn(10).setPreferredWidth(30); transferTable.getColumnModel().getColumn(11).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(11).setPreferredWidth(30); transferTable.getColumnModel().getColumn(12).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(12).setPreferredWidth(30); transferTable.getColumnModel().getColumn(13).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(13).setPreferredWidth(30); transferTable.getColumnModel().getColumn(14).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(14).setPreferredWidth(30); transferTable.getColumnModel().getColumn(15).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(15).setPreferredWidth(30); transferTable.getColumnModel().getColumn(16).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(16).setPreferredWidth(30); transferTable.getColumnModel().getColumn(17).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(17).setPreferredWidth(30); transferTable.getColumnModel().getColumn(18).setCellRenderer(yellowColumn); transferTable.getColumnModel().getColumn(18).setPreferredWidth(30); }
/** {@inheritDoc} */ public final void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { final DefaultTableSorter sorter = (DefaultTableSorter) transferTable.getModel(); if (transferTable.getSelectedRow() >= 0) { final int index = sorter.modelIndex(transferTable.getSelectedRow()); final PlayerTransfer transfer = (PlayerTransfer) this.transfers.get(index); this.playerDetailPanel.setPlayer(transfer.getPlayerId(), transfer.getPlayerName()); } else { this.playerDetailPanel.clearPanel(); } } }