Set<String> acceptedEulas = new HashSet<>();
outer:
for (int line : lines) {
ImageryInfo info = defaultModel.getRow(line);
// Check if an entry with exactly the same values already exists
for (int j = 0; j < activeModel.getRowCount(); j++) {
if (info.equalsBaseValues(activeModel.getRow(j))) {
// Select the already existing row so the user has
// some feedback in case an entry exists
activeTable.getSelectionModel().setSelectionInterval(j, j);
activeTable.scrollRectToVisible(activeTable.getCellRect(j, 0, true));
continue outer;
}
}
String eulaURL = info.getEulaAcceptanceRequired();
// If set and not already accepted, ask for EULA acceptance
if (eulaURL != null && !acceptedEulas.contains(eulaURL)) {
if (confirmEulaAcceptance(gui, eulaURL)) {
acceptedEulas.add(eulaURL);
} else {
continue outer;
}
}
activeModel.addRow(new ImageryInfo(info));
int lastLine = activeModel.getRowCount() - 1;
activeTable.getSelectionModel().setSelectionInterval(lastLine, lastLine);
activeTable.scrollRectToVisible(activeTable.getCellRect(lastLine, 0, true));
}
}