Version 15 (modified by diana, 16 years ago) (diff) |
---|
Analysis
Overview
This task is about providing a book properties dialog. It should display the book title and page size. This dialog appears when a new book is created and when the book properties item is selected from the file menu.
Task requirements
- Provide a modal dialog with cancel/ok buttons that displays the following properties which should be editable:
- Title
- Page width
- Page height
- The book properties dialog should be displayed when a new book is created.
- If the user clicks the cancel button no book is created.
- Otherwise a book with the specified properties is created.
- These properties can be changed when the dialog is displayed.
- The keyboard shortcut for opening this dialog should be Ctrl+Shift+B.
Task result
The result should be source code.
Implementation idea
A new BookInfo class should be created with the following properties:
- BookTitle
- PageWidth
- PageHeight
This is required because the dialog should be displayed before the new book is created.
Related
How to demo
- Display the book properties dialog.
- Change the title and page size and show they are updated.
Design
When a new book is created the dialog is displayed with default values for its fields. If the user clicks ok a new book is created with the valued of the fields in the BookPropertiesDialog. Otherwise no book is created. If you display the dialog when the book is already opened it should display the information about it and allow editing it.
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. 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.
Implementation
Done according to the design. The page width and height are set differently because they are in one property. (changeset [2913])
Testing
Comments
(Write comments for this or later revisions here.)