public void updateLibrary(ContributedLibrary lib) { // Find the row interested in the change int row = -1; for (ContributedLibraryReleases releases : contributions) { if (releases.shouldContain(lib)) row = contributions.indexOf(releases); } updateContributions(); // If the library is found in the list send update event // or insert event on the specific row... for (ContributedLibraryReleases releases : contributions) { if (releases.shouldContain(lib)) { if (row == -1) { row = contributions.indexOf(releases); fireTableRowsInserted(row, row); } else { fireTableRowsUpdated(row, row); } return; } } // ...otherwise send a row deleted event fireTableRowsDeleted(row, row); }
private void addContribution(ContributedLibrary lib) { for (ContributedLibraryReleases contribution : contributions) { if (!contribution.shouldContain(lib)) continue; contribution.add(lib); return; } contributions.add(new ContributedLibraryReleases(lib)); }