public void buildData() { Peer peer; int size = peerList.size(); data = null; data = new Object[size][6]; for (int i = 0; i < size; i++) { peer = peerList.get(i); data[i][0] = peer.getName(); data[i][1] = String.valueOf(peer.getPonderations().getPonderation(PeerActionKill.class)); data[i][2] = String.valueOf(peer.getPonderations().getPonderation(PeerActionAvg.class)); data[i][3] = String.valueOf(peer.getPonderations().getPonderation(PeerActionTalk.class)); data[i][4] = String.valueOf(peer.getPonderations().getPonderation(PeerActionQuery.class)); data[i][5] = String.valueOf(peer.getPonderations().getPonderation(PeerActionMove.class)); } fireTableChanged(new TableModelEvent(this)); }
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { data[rowIndex][columnIndex] = aValue; Peer p = peerList.get(rowIndex); Class c; if (columnIndex == 1) c = PeerActionKill.class; else if (columnIndex == 2) c = PeerActionAvg.class; else if (columnIndex == 3) c = PeerActionTalk.class; else if (columnIndex == 4) c = PeerActionQuery.class; else if (columnIndex == 5) c = PeerActionMove.class; else c = PeerActionQuery.class; p.getPonderations().setPonderation(c, Integer.parseInt(aValue.toString())); fireTableCellUpdated(rowIndex, columnIndex); }
public int getRowCount() { return peerList.size(); }
public void remove(int index) { peerList.remove(index); buildData(); }
public void remove(Peer peer) { peerList.remove(peer); buildData(); }
public void add(Peer peer) { peerList.add(peer); buildData(); }