diff --git a/data/covers/1.jpg b/data/covers/1.jpg index 5e7bb32..6eea682 100644 Binary files a/data/covers/1.jpg and b/data/covers/1.jpg differ diff --git a/data/covers/10.jpg b/data/covers/10.jpg index 5e7bb32..45eb190 100644 Binary files a/data/covers/10.jpg and b/data/covers/10.jpg differ diff --git a/data/covers/2.jpg b/data/covers/2.jpg index 5e7bb32..1818948 100644 Binary files a/data/covers/2.jpg and b/data/covers/2.jpg differ diff --git a/data/covers/3.jpg b/data/covers/3.jpg index 5e7bb32..7ea1ef8 100644 Binary files a/data/covers/3.jpg and b/data/covers/3.jpg differ diff --git a/data/covers/4.jpg b/data/covers/4.jpg index 5e7bb32..ec45449 100644 Binary files a/data/covers/4.jpg and b/data/covers/4.jpg differ diff --git a/data/covers/5.jpg b/data/covers/5.jpg index 5e7bb32..24b44d1 100644 Binary files a/data/covers/5.jpg and b/data/covers/5.jpg differ diff --git a/data/covers/6.jpg b/data/covers/6.jpg index 5e7bb32..f67ac1a 100644 Binary files a/data/covers/6.jpg and b/data/covers/6.jpg differ diff --git a/data/covers/7.jpg b/data/covers/7.jpg index 5e7bb32..da0e97d 100644 Binary files a/data/covers/7.jpg and b/data/covers/7.jpg differ diff --git a/data/covers/8.jpg b/data/covers/8.jpg index 5e7bb32..204280f 100644 Binary files a/data/covers/8.jpg and b/data/covers/8.jpg differ diff --git a/data/covers/9.jpg b/data/covers/9.jpg index 5e7bb32..37e5b13 100644 Binary files a/data/covers/9.jpg and b/data/covers/9.jpg differ diff --git a/src/main/java/com/asu/librarysystem/AllBooksController.java b/src/main/java/com/asu/librarysystem/AllBooksController.java index 5790fcf..d86705b 100644 --- a/src/main/java/com/asu/librarysystem/AllBooksController.java +++ b/src/main/java/com/asu/librarysystem/AllBooksController.java @@ -44,14 +44,30 @@ else if(account instanceof Borrower){ public void backButton(ActionEvent event){ try { - FXMLLoader loader = new FXMLLoader(getClass().getResource("name.fxml")); - Parent root = loader.load(); + Account account = Library.getActiveAccount(); + if (account instanceof Customer) { + Customer customer =(Customer) account; + FXMLLoader loader = new FXMLLoader(getClass().getResource("name of.fxml")); + Parent root = loader.load(); // clsssName objName = loader.getController(); // objName.method; - Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); - Scene scene= new Scene(root); - stage.setScene(scene); - stage.show(); + Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + Scene scene= new Scene(root); + stage.setScene(scene); + stage.show(); + } + else if(account instanceof Borrower){ + Borrower borrower =(Borrower) account; + FXMLLoader loader = new FXMLLoader(getClass().getResource("name.fxml")); + Parent root = loader.load(); +// clsssName objName = loader.getController(); +// objName.method; + Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + Scene scene= new Scene(root); + stage.setScene(scene); + stage.show(); + } + } catch (IOException e) { e.printStackTrace(); } @@ -102,7 +118,7 @@ private ArrayList arrayReadyToSearch(String word){ } return foundBooks; } - public void searshBook(){ + public void searchBook(){ String word = searshText.getText(); ArrayListfoundBooks=arrayReadyToSearch(word); int colm=0; @@ -139,10 +155,10 @@ public void searshBook(){ } } public void searshBookByKey(KeyEvent event){ - searshBook(); + searchBook(); } public void searshBookByAction(ActionEvent event){ - searshBook(); + searchBook(); } } diff --git a/src/main/java/com/asu/librarysystem/BookController.java b/src/main/java/com/asu/librarysystem/BookController.java index 8e1f53d..13f391d 100644 --- a/src/main/java/com/asu/librarysystem/BookController.java +++ b/src/main/java/com/asu/librarysystem/BookController.java @@ -40,7 +40,7 @@ public class BookController implements Initializable { @FXML ImageView bookCover, statusImage, oneStarIcon, twoStarsIcon, threeStarsIcon, fourStarsIcon, fiveStarsIcon, notifyMe; @FXML - Label name, author, releaseDate, price, description, countRatings, totalRating, textAreaCharCount, categories; + Label name, author, releaseDate, price, description, countRatings, totalRating, textAreaCharCount, categories, userName; @FXML Text warningMessage; @FXML @@ -68,6 +68,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { } public void setScene(Book book) throws IOException { + displayUserName(); currentBook = book; setCover(book.getCoverPath()); @@ -428,4 +429,15 @@ public void backButton(ActionEvent event){ e.printStackTrace(); } } + private void displayUserName(){ + Account account = Library.getActiveAccount(); + if (account instanceof Customer) { + Customer customer =(Customer) account; + userName.setText(customer.getUserName()); + } + else if(account instanceof Borrower){ + Borrower borrower =(Borrower) account; + userName.setText(borrower.getUserName()); + } + } } diff --git a/src/main/java/com/asu/librarysystem/Library.java b/src/main/java/com/asu/librarysystem/Library.java index 153ee87..b40d4c4 100644 --- a/src/main/java/com/asu/librarysystem/Library.java +++ b/src/main/java/com/asu/librarysystem/Library.java @@ -308,7 +308,7 @@ public static ArrayList copyElementOfArrayList() { } public static ArrayList searchInArrayListBookByTitle(String word , ArrayList arr) { - ArrayList fondBooks = new ArrayList(); + ArrayList foundBooks = new ArrayList(); for (int i = 0; i < arr.size(); i++) { String fullTitle = arr.get(i).getTitle().toLowerCase(); for (int j = 0; j < fullTitle.length() - word.length(); j++) { @@ -321,16 +321,16 @@ public static ArrayList searchInArrayListBookByTitle(String word , ArrayLi } if (counter == word.length()) { - fondBooks.add(arr.get(i)); + foundBooks.add(arr.get(i)); break; } } } - return fondBooks; + return foundBooks; } public static ArrayList searchInArrayListBookByAuthor(String word , ArrayList arr) { - ArrayList fondBooks = new ArrayList(); + ArrayList foundBooks = new ArrayList(); for (int i = 0; i < arr.size(); i++) { String authorName = arr.get(i).getAuthor().toLowerCase(); for (int j = 0; j < authorName.length() - word.length(); j++) { @@ -343,12 +343,12 @@ public static ArrayList searchInArrayListBookByAuthor(String word , ArrayL } if (counter == word.length()) { - fondBooks.add(arr.get(i)); + foundBooks.add(arr.get(i)); break; } } } - return fondBooks; + return foundBooks; } public static ArrayList searchBookByTitleInArray(String word) { @@ -359,76 +359,76 @@ public static ArrayList searchBookByAuthorInArray(String word) { return searchInArrayListBookByAuthor(word, books); } - public static void writeLibrary() { - try { - FileOutputStream write1=new FileOutputStream("books_data.txt"); - for (Book obj : books) { - write1.write((obj.getId()+","+obj.getTitle()+","+obj.getAuthor()+","+obj.getPublicationYear()+","+obj.isStatus()+","+obj.getPrice()+","+obj.getCoverPath()+"\n").getBytes()); - } - write1.close(); - } catch (FileNotFoundException e) { - System.out.println("can't write"); - } catch (IOException e) { - System.out.println("can't write"); - } - - try { - FileOutputStream write2=new FileOutputStream("customers_data.txt"); - for (Customer obj : customers) { - write2.write((obj.getId()+","+obj.getUserName()+","+obj.getPassword()+","+obj.getPhoneNumber()+"\n").getBytes()); - } - write2.close(); - } catch (FileNotFoundException e) { - System.out.println("can't write"); - } catch (IOException e) { - System.out.println("can't write"); - } - try { - FileOutputStream write3=new FileOutputStream("borrowers_data.txt"); - for (Borrower obj : borrowers) { - write3.write((obj.getId()+","+obj.getUserName()+","+obj.getPassword()+","+obj.getPhoneNumber()+"\n").getBytes()); - } - write3.close(); - } catch (FileNotFoundException e) { - System.out.println("can't write"); - } catch (IOException e) { - System.out.println("can't write"); - } - - for(Borrower borrower : borrowers){ - ArrayList transactions =borrower.copyElementOfArrayList(); - try { - FileOutputStream write=new FileOutputStream("transaction_data_"+borrower.getUserName()+".txt"); - for (Transaction obj : transactions ) { - String bookName=searchBookById(obj.getBookId()).getTitle(); - write.write((obj.getTransactionId()+","+bookName+","+obj.getBorrowerId()+","+obj.getBorrowDate()+","+obj.getReturnDate()+"\n").getBytes()); - } - write.close(); - } catch (FileNotFoundException e) { - System.out.println("can't write"); - } catch (IOException e) { - System.out.println("can't write"); - } - - } - - for(Customer customer : customers){ - ArrayList orders =customer.copyElementOfArrayList(); - try { - FileOutputStream write=new FileOutputStream("order_data_"+customer.getUserName()+".txt"); - for (Order obj : orders ) { - String bookName=searchBookById(obj.getBookId()).getTitle(); - write.write((obj.getId()+","+bookName+","+obj.getQuantity()+"\n").getBytes()); - } - write.close(); - } catch (FileNotFoundException e) { - System.out.println("can't write"); - } catch (IOException e) { - System.out.println("can't write"); - } - - } - } +// public static void writeLibrary() { +// try { +// FileOutputStream write1=new FileOutputStream("books_data.txt"); +// for (Book obj : books) { +// write1.write((obj.getId()+","+obj.getTitle()+","+obj.getAuthor()+","+obj.getPublicationYear()+","+obj.isStatus()+","+obj.getPrice()+","+obj.getCoverPath()+"\n").getBytes()); +// } +// write1.close(); +// } catch (FileNotFoundException e) { +// System.out.println("can't write"); +// } catch (IOException e) { +// System.out.println("can't write"); +// } +// +// try { +// FileOutputStream write2=new FileOutputStream("customers_data.txt"); +// for (Customer obj : customers) { +// write2.write((obj.getId()+","+obj.getUserName()+","+obj.getPassword()+","+obj.getPhoneNumber()+"\n").getBytes()); +// } +// write2.close(); +// } catch (FileNotFoundException e) { +// System.out.println("can't write"); +// } catch (IOException e) { +// System.out.println("can't write"); +// } +// try { +// FileOutputStream write3=new FileOutputStream("borrowers_data.txt"); +// for (Borrower obj : borrowers) { +// write3.write((obj.getId()+","+obj.getUserName()+","+obj.getPassword()+","+obj.getPhoneNumber()+"\n").getBytes()); +// } +// write3.close(); +// } catch (FileNotFoundException e) { +// System.out.println("can't write"); +// } catch (IOException e) { +// System.out.println("can't write"); +// } +// +// for(Borrower borrower : borrowers){ +// ArrayList transactions =borrower.copyElementOfArrayList(); +// try { +// FileOutputStream write=new FileOutputStream("transaction_data_"+borrower.getUserName()+".txt"); +// for (Transaction obj : transactions ) { +// String bookName=searchBookById(obj.getBookId()).getTitle(); +// write.write((obj.getTransactionId()+","+bookName+","+obj.getBorrowerId()+","+obj.getBorrowDate()+","+obj.getReturnDate()+"\n").getBytes()); +// } +// write.close(); +// } catch (FileNotFoundException e) { +// System.out.println("can't write"); +// } catch (IOException e) { +// System.out.println("can't write"); +// } +// +// } +// +// for(Customer customer : customers){ +// ArrayList orders =customer.copyElementOfArrayList(); +// try { +// FileOutputStream write=new FileOutputStream("order_data_"+customer.getUserName()+".txt"); +// for (Order obj : orders ) { +// String bookName=searchBookById(obj.getBookId()).getTitle(); +// write.write((obj.getId()+","+bookName+","+obj.getQuantity()+"\n").getBytes()); +// } +// write.close(); +// } catch (FileNotFoundException e) { +// System.out.println("can't write"); +// } catch (IOException e) { +// System.out.println("can't write"); +// } +// +// } +// } // public static void readLibrary() { // Scanner scanner1 = null; diff --git a/src/main/java/com/asu/librarysystem/MainApplication.java b/src/main/java/com/asu/librarysystem/MainApplication.java index 6bd53d8..296dea3 100644 --- a/src/main/java/com/asu/librarysystem/MainApplication.java +++ b/src/main/java/com/asu/librarysystem/MainApplication.java @@ -50,19 +50,19 @@ public static void main(String[] args) { /*Book book100 = new Book("Jane Eyre", "Charlotte Bronte", 1847, true, 8 , 1, "Orphaned Jane is sent to work as a governess for brooding Mr. Rochester's daughter, Adele. Love begins to grow between Jane and her moody employer, but his mysterious first wife threatens to ruin their chance at happiness." , """", new Category[]{Category.HORROR, Category.DRAMA});*/ - Book book100 = new Book("Harry Potter and the Prisoner of Azkaban","J. K. Rowling",2023,true,200,4,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.HORROR}); - - - Book book1 = new Book("Harry Potter and the Prisoner of Azkaban","J. K. Rowling",2023,true,200,4,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.HORROR}); - Book book2 = new Book("Harry Potter and the Chamber of Secrets","J. K. Rowling",2020,true,200,3,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); - Book book3 = new Book("The Alchemist ","Paulo Coelho ",2021,true,200,2,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); - Book book4 = new Book("A Tale of Two Cities","Charles Dickens",2023,true,200,4,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); - Book book5 = new Book("The Little Prince ","Antoine de Saint-Exupéry",2020,true,200,3,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); - Book book6 = new Book("Harry Potter and the Philosopher's Stone","J. K. Rowling",2021,true,200,2,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); - Book book7 = new Book("And Then There Were None","Agatha Christie",2023,true,200,4,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); - Book book8 = new Book("The Hobbit","J. R. R. Tolkien",2020,true,200,3,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE, Category.HORROR}); - Book book9 = new Book("She: A History of Adventure","H. Rider Haggard",2021,true,200,2,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); - Book book10 = new Book("The Da Vinci Code","Dan Brown",2021,true,200,2,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.ADVENTURE}); + //Book book100 = new Book("Harry Potter and the Prisoner of Azkaban","J. K. Rowling",2023,true,200,4,"A very interesting book", "src/main/resources/image/330px-BlackBeautyCoverFirstEd1877.jpeg", new Category[]{Category.HORROR}); + + + Book book1 = new Book("Harry Potter and the Prisoner of Azkaban","J. K. Rowling",2023,true,200,4,"Harry Potter and the Prisoner of Azkaban is a fantasy novel written by British author J. K. Rowling and is the third in the Harry Potter series. The book follows Harry Potter, a young wizard, in his third year at Hogwarts School of Witchcraft and Wizardry. Along with friends Ronald Weasley and Hermione Granger, Harry investigates Sirius Black, an escaped prisoner from Azkaban, the wizard prison, believed to be one of Lord Voldemort's old allies.", "src/main/resources/image/Harry_Potter_and_the_Prisoner_of_Azkaban.jpg", new Category[]{Category.HORROR}); + Book book2 = new Book("Harry Potter and the Chamber of Secrets","J. K. Rowling",2020,true,200,3,"Harry Potter and the Chamber of Secrets is a fantasy novel written by British author J. K. Rowling and the second novel in the Harry Potter series. The plot follows Harry's second year at Hogwarts School of Witchcraft and Wizardry, during which a series of messages on the walls of the school's corridors warn that the \"Chamber of Secrets\" has been opened and that the \"heir of Slytherin\" would kill all pupils who do not come from all-magical families. These threats are found after attacks that leave residents of the school petrified. Throughout the year, Harry and his friends Ron and Hermione investigate the attacks.", "src/main/resources/image/Harry_Potter_and_the_Chamber_of_Secrets.jpg", new Category[]{Category.ADVENTURE}); + Book book3 = new Book("The Alchemist ","Paulo Coelho ",2021,true,200,2,"The Alchemist (Portuguese: O Alquimista) is a novel by Brazilian author Paulo Coelho which was first published in 1988. Originally written in Portuguese, it became a widely translated international bestseller.[1][2] The story follows the shepherd boy Santiago in his journey across northern Africa to the pyramids of Egypt after he dreams of finding a treasure there.", "src/main/resources/image/TheAlchemist.jpg", new Category[]{Category.ADVENTURE}); + Book book4 = new Book("A Tale of Two Cities","Charles Dickens",2023,true,200,4,"A Tale of Two Cities is a historical novel published in 1859 by Charles Dickens, set in London and Paris before and during the French Revolution. The novel tells the story of the French Doctor Manette, his 18-year-long imprisonment in the Bastille in Paris, and his release to live in London with his daughter Lucie whom he had never met. The story is set against the conditions that led up to the French Revolution and the Reign of Terror.", "src/main/resources/image/Tales_serial.jpg", new Category[]{Category.ADVENTURE}); + Book book5 = new Book("The Little Prince ","Antoine de Saint-Exupéry",2020,true,200,3,"The Little Prince (French: Le Petit Prince, pronounced [lə p(ə)ti pʁɛ̃s]) is a novella written and illustrated by French aristocrat, writer, and military pilot Antoine de Saint-Exupéry. It was first published in English and French in the United States by Reynal & Hitchcock in April 1943 and was published posthumously in France following liberation; Saint-Exupéry's works had been banned by the Vichy Regime. The story follows a young prince who visits various planets, including Earth, and addresses themes of loneliness, friendship, love, and loss. Despite its style as a children's book, The Little Prince makes observations about life, adults, and human nature.", "src/main/resources/image/Littleprince.jpeg", new Category[]{Category.ADVENTURE}); + Book book6 = new Book("Harry Potter and the Philosopher's Stone","J. K. Rowling",2021,true,200,2,"Harry Potter and the Philosopher's Stone is a fantasy novel written by British author J. K. Rowling. The first novel in the Harry Potter series and Rowling's debut novel, it follows Harry Potter, a young wizard who discovers his magical heritage on his eleventh birthday, when he receives a letter of acceptance to Hogwarts School of Witchcraft and Wizardry. Harry makes close friends and a few enemies during his first year at the school and with the help of his friends, Ron Weasley and Hermione Granger, he faces an attempted comeback by the dark wizard Lord Voldemort, who killed Harry's parents, but failed to kill Harry when he was just 15 months old.", "src/main/resources/image/Harry_Potter_and_the_Philosopher's_Stone_Book_Cover.jpg", new Category[]{Category.ADVENTURE}); + Book book7 = new Book("And Then There Were None","Agatha Christie",2023,true,200,4,"And Then There Were None is a mystery novel by the English writer Agatha Christie, who described it as the most difficult of her books to write.[2] It was first published in the United Kingdom by the Collins Crime Club on 6 November 1939, as Ten Little Niggers,[3] after an 1869 minstrel song that serves as a major plot element.[4][5] The US edition was released in January 1940 with the title And Then There Were None, taken from the last five words of the song.[6] Successive American reprints and adaptations use that title, though American Pocket Books paperbacks used the title Ten Little Indians between 1964 and 1986. UK editions continued to use the original title until 1985.[7]", "src/main/resources/image/And_Then_There_Were_None_First_Edition_Cover_1939.jpg", new Category[]{Category.ADVENTURE}); + Book book8 = new Book("The Hobbit","J. R. R. Tolkien",2020,true,200,3,"The Hobbit, or There and Back Again is a children's fantasy novel by English author J. R. R. Tolkien. It was published in 1937 to wide critical acclaim, being nominated for the Carnegie Medal and awarded a prize from the New York Herald Tribune for best juvenile fiction. The book is recognized as a classic in children's literature and is one of the best-selling books of all time, with over 100 million copies sold.", "src/main/resources/image/TheHobbit_FirstEdition.jpg", new Category[]{Category.ADVENTURE, Category.HORROR}); + Book book9 = new Book("She: A History of Adventure","H. Rider Haggard",2021,true,200,2,"She, subtitled A History of Adventure, is a novel by the English writer H. Rider Haggard, published in book form in 1887 following serialisation in The Graphic magazine between October 1886 and January 1887. She was extraordinarily popular upon its release and has never been out of print.", "src/main/resources/image/330px-SHE,_A_History_of_Adventure_(1st_Edition_Cover),_by_H._Rider_Haggard.jpg", new Category[]{Category.ADVENTURE}); + Book book10 = new Book("The Da Vinci Code","Dan Brown",2021,true,200,2,"The Da Vinci Code is a 2003 mystery thriller novel by Dan Brown. It is Brown's second novel to include the character Robert Langdon: the first was his 2000 novel Angels & Demons. The Da Vinci Code follows symbologist Robert Langdon and cryptologist Sophie Neveu after a murder in the Louvre Museum in Paris causes them to become involved in a battle between the Priory of Sion and Opus Dei over the possibility of Jesus Christ and Mary Magdalene having had a child together.", "src/main/resources/image/DaVinciCode.jpg", new Category[]{Category.ADVENTURE}); Library.addBook(book1); Library.addBook(book2); Library. addBook(book3); @@ -73,27 +73,27 @@ public static void main(String[] args) { Library.addBook(book8); Library.addBook(book9); Library.addBook(book10); -// Customer customer=new Customer("Ibrahem","123","111"); -// Library.addCustomer(customer); -// Borrower borrower = new Borrower("Ibrahem","111","111"); -// Library.addBorrower(borrower); -// Library.logInByUserName("Ibrahem","111"); -// -// customer.addOrder(book1.getId(),2); -// customer.addOrder(book2.getId(),2); -// customer.addOrder(book3.getId(),1); -// customer.addOrder(book5.getId(),2); -// customer.addOrder(book7.getId(),2); -// -// borrower.addTransaction(book3,2020,2022); -// borrower.addTransaction(book5,2020,2022); -// borrower.addTransaction(book9,2020,2022); + Customer customer=new Customer("Ibrahem","123","111"); + Library.addCustomer(customer); + Borrower borrower = new Borrower("Ibrahem","111","111"); + Library.addBorrower(borrower); + Library.logInByUserName("Ibrahem","111"); + + customer.addOrder(book1.getId(),2); + customer.addOrder(book2.getId(),2); + customer.addOrder(book3.getId(),1); + customer.addOrder(book5.getId(),2); + customer.addOrder(book7.getId(),2); + + borrower.addTransaction(book3,2020,2022); + borrower.addTransaction(book5,2020,2022); + borrower.addTransaction(book9,2020,2022); - books.add(book100); - Library.addBorrower(new Borrower("arsany", "123", "01277535814")); - Library.logInByUserName("arsany", "123"); + //books.add(book100); +// Library.addBorrower(new Borrower("arsany", "123", "01277535814")); +// Library.logInByUserName("arsany", "123"); launch(); diff --git a/src/main/java/com/asu/librarysystem/MyBooksController.java b/src/main/java/com/asu/librarysystem/MyBooksController.java index 0e28da4..b908a7c 100644 --- a/src/main/java/com/asu/librarysystem/MyBooksController.java +++ b/src/main/java/com/asu/librarysystem/MyBooksController.java @@ -45,15 +45,30 @@ else if(account instanceof Borrower){ public void backButton(ActionEvent event){ try { - FXMLLoader loader = new FXMLLoader(getClass().getResource("name.fxml")); - Parent root = loader.load(); - + Account account = Library.getActiveAccount(); + if (account instanceof Customer) { + Customer customer =(Customer) account; + FXMLLoader loader = new FXMLLoader(getClass().getResource("name of.fxml")); + Parent root = loader.load(); +// clsssName objName = loader.getController(); +// objName.method; + Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + Scene scene= new Scene(root); + stage.setScene(scene); + stage.show(); + } + else if(account instanceof Borrower){ + Borrower borrower =(Borrower) account; + FXMLLoader loader = new FXMLLoader(getClass().getResource("name.fxml")); + Parent root = loader.load(); // clsssName objName = loader.getController(); // objName.method; - Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); - Scene scene= new Scene(root); - stage.setScene(scene); - stage.show(); + Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + Scene scene= new Scene(root); + stage.setScene(scene); + stage.show(); + } + } catch (IOException e) { e.printStackTrace(); } @@ -130,7 +145,7 @@ else if(account instanceof Borrower){ } return foundBooks; } - public void searshBook(){ + public void searchBook(){ String word = searshText.getText(); ArrayListfoundBooks=arrayReadyToSearch(word); int colm=0; @@ -167,10 +182,10 @@ public void searshBook(){ } } public void searshBookByKey(KeyEvent event){ - searshBook(); + searchBook(); } public void searshBookByAction(ActionEvent event){ - searshBook(); + searchBook(); } } diff --git a/src/main/resources/com/asu/librarysystem/All-Books.fxml b/src/main/resources/com/asu/librarysystem/All-Books.fxml index 76b5539..53a7fdc 100644 --- a/src/main/resources/com/asu/librarysystem/All-Books.fxml +++ b/src/main/resources/com/asu/librarysystem/All-Books.fxml @@ -17,7 +17,7 @@ - + @@ -28,7 +28,7 @@ - +