private void addVimFilesInvimCacheToBookAndAddBookToLibrary() {
boolean ISBNAlreadyExist = false;
boolean AllFieldsAreFilled = false;
int isbn = 0;
double price = 0.0;
Book b;
if (!abp.getTextFieldIsbn().getText().trim().contentEquals("")
&& !abp.getTextFieldTitle().getText().trim().contentEquals("")
&& !abp.getTextFieldAuthor().getText().trim().contentEquals("")
&& !abp.getTextFieldPrice().getText().trim().contentEquals("")) {
AllFieldsAreFilled = true;
}
if (AllFieldsAreFilled) {
try {
isbn = Integer
.parseInt(abp.getTextFieldIsbn().getText().trim());
price = Double.parseDouble(abp.getTextFieldPrice().getText()
.trim());
ISBNAlreadyExist = lib.doesISBNAlreadyExist(isbn);
if (ISBNAlreadyExist) {
JOptionPane.showMessageDialog(screen, isbn
+ " already exist!\nPlease use another isbn!");
} else {
b = new Book(isbn,
abp.getTextFieldTitle().getText().trim(), abp
.getTextFieldAuthor().getText().trim(),
price);
for (int i = 0; i < vimCache.size(); i++) {
b.addVIM(vimCache.get(i));
}
lib.addBook(b);
abp.getTextFieldIsbn().setText("");
abp.getTextFieldTitle().setText("");
abp.getTextFieldAuthor().setText("");
abp.getTextFieldPrice().setText("");
abp.getTextAreaLog().append(
"\n> " + b.getTitle()
+ " has been added to the library!");
vimCache = new ArrayList<VIM>();
}
} catch (NumberFormatException e) {