44 | | A new class BookInfo is created with three value properties in order to keep the values of the book info. If a new book is created new instance of the BookInfo class is created with default values for its fields. Otherwise the new instance of the BookInfo class holds the properties of the current book. |
45 | | If a new book is created the book properties dialog appears and if the user clicks cancel the getInfo method in BookInfo class returns null and a new book is not created, if the user clicks ok, getInfo method returns an instance of the BookInfo class and a new book with the desired prperties is created. |
| 40 | == End user behaviour == |
| 41 | When a new book is created, a dialog showing a default title and page size is displayed. The user is able to edit these and accept them by clicking OK. In this case, a new book is created with the given title and page size. If Cancel is clicked, no book is created. The dialog can be displayed again by selecting the Book Properties item in the File menu or by pressing Ctrl+Shift+B from the keyboard. In this case, the title and page size of the current book are displayed and can be edited. Clicking OK now saves the changes, while clicking Cancel discards them. |
| 42 | |
| 43 | == Internal design == |
| 44 | |
| 45 | A new class BookInfo will be created in the org.sophie2.base.model.book module. It will contain three value properties, holding the values for the title, the page width and the page height. These should be set with the following default initial values: |
| 46 | * Title - "New Book" |
| 47 | * Page width - 640 |
| 48 | * Page height - 480 |
| 49 | There will be two constructors of this class. The first takes no arguments and is invoked when a new book is created. The second takes a book as an argument and sets the values of the properties to the corresponding values of the given book. It is invoked with the current book when there is such. There will be one other property as well, which will hold the current book (if there is such). |
| 50 | |
| 51 | The book properties dialog will provide a JPanel that shows the information from the BookInfo class. Based on the user input (OK/Cancel clicked) and the currentBook property of BookInfo (whether it is null or not), one of the above mentioned actions will be taken. |
| 52 | |
| 53 | An Initial test can be found here: ^Provide a link and a changeset for the updated test. |