-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuinewcollection.java
More file actions
48 lines (41 loc) · 2.1 KB
/
Copy pathuinewcollection.java
File metadata and controls
48 lines (41 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
public class uinewcollection {
String currCollection = null;
List<Collections> collectionsList = new ArrayList<>();
public void saveButtonClicked() {
if(currCollection != null) {
String ID = GetIDs.returnID("Collectiondatabase.txt");
String title = titleField.getText();
String publisher = publisherField.getText();
String genre = genreField.getText();
String type = currCollection;
String itemInfo = title + "\t" + publisher + "\t" + genre + "\t" + type + "\t";
switch (currCollection) {
case "DVDs":
String isbn = isbnField.getText();
itemInfo = ID + "\t" + isbn + "\t" + itemInfo + "\n";
DVDs dvd = new DVDs(ID, title, publisher, genre, isbn, type);
collectionsList.add(dvd);
case "Books":
String isbn = isbnField.getText();
String author = authorField.getText();
itemInfo = ID + "\t" + isbn + "\t" + author + "\t" + itemInfo + "\n";
Books book = new Books(ID, title, publisher, genre, isbn, author, type);
collectionsList.add(book);
case "Journals":
String issn = issnField.getText();
String author = authorField.getText();
itemInfo = ID + "\t" + issn + "\t" + author + "\t" + itemInfo + "\n";
Journals journal = new Journals(ID, title, publisher, genre, type, issn, author);
collectionsList.add(journal);
case "Newspapers":
String issn = issnField.getText();
itemInfo = ID + "\t" + issn + "\t" + itemInfo + "\n";
Newspapers newspaper = new Newspapers(ID, title, publisher, genre, type, issn);
collectionsList.add(newspaper);
}
SaveToFile.save(employeeInfo, "Collectiondatabase.txt");
} else {
System.out.println("The collection type doesn't exist.");
}
}
}