1 | ### Eclipse Workspace Patch 1.0 |
---|
2 | #P org.sophie2.main.app.commons |
---|
3 | Index: src/main/java/org/sophie2/main/app/commons/dialogs/BookInfo.java |
---|
4 | =================================================================== |
---|
5 | --- src/main/java/org/sophie2/main/app/commons/dialogs/BookInfo.java (revision 8302) |
---|
6 | +++ src/main/java/org/sophie2/main/app/commons/dialogs/BookInfo.java (working copy) |
---|
7 | @@ -3,6 +3,7 @@ |
---|
8 | import org.sophie2.base.model.book.resource.r4.BookR4; |
---|
9 | import org.sophie2.base.model.book.resource.r4.PageR4; |
---|
10 | import org.sophie2.base.model.resources.r4.ResourceRefR4; |
---|
11 | +import org.sophie2.base.model.resources.r4.ResourceUtil; |
---|
12 | import org.sophie2.core.prolib.annot.Immutable; |
---|
13 | |
---|
14 | /** |
---|
15 | @@ -13,11 +14,6 @@ |
---|
16 | @Immutable |
---|
17 | public class BookInfo { |
---|
18 | |
---|
19 | - /** |
---|
20 | - * Book info representing the default book information state. |
---|
21 | - */ |
---|
22 | - public static final BookInfo DEFAULT_INFO = new BookInfo(); |
---|
23 | - |
---|
24 | private final String bookTitle; |
---|
25 | private final float pageWidth; |
---|
26 | private final float pageHeight; |
---|
27 | @@ -75,14 +71,16 @@ |
---|
28 | } |
---|
29 | |
---|
30 | /** |
---|
31 | - * A default constructor. |
---|
32 | + * A getter for default BookInfo with different name. |
---|
33 | + * |
---|
34 | + * @return |
---|
35 | + * Default book info. |
---|
36 | */ |
---|
37 | - private BookInfo() { |
---|
38 | - this.bookTitle = BookR4.DEFAULT_TITLE; |
---|
39 | - this.pageHeight = BookR4.DEFAULT_PAGE_SIZE.getHeight(); |
---|
40 | - this.pageWidth = BookR4.DEFAULT_PAGE_SIZE.getWidth(); |
---|
41 | - this.bgAudioResource = ResourceRefR4.NONE_REF; |
---|
42 | - this.loopBgAudio = true; |
---|
43 | + public static BookInfo getDefaultInfo() { |
---|
44 | + String title = ResourceUtil.getNextTitle(ResourceRefR4.NONE_REF, BookR4.DEFAULT_TITLE); |
---|
45 | + |
---|
46 | + return new BookInfo(title, BookR4.DEFAULT_PAGE_SIZE.getWidth(), |
---|
47 | + BookR4.DEFAULT_PAGE_SIZE.getHeight(), ResourceRefR4.NONE_REF, true); |
---|
48 | } |
---|
49 | |
---|
50 | /** |
---|
51 | Index: src/main/java/org/sophie2/main/app/commons/dialogs/BookPropertiesDialog.java |
---|
52 | =================================================================== |
---|
53 | --- src/main/java/org/sophie2/main/app/commons/dialogs/BookPropertiesDialog.java (revision 8302) |
---|
54 | +++ src/main/java/org/sophie2/main/app/commons/dialogs/BookPropertiesDialog.java (working copy) |
---|
55 | @@ -427,7 +427,7 @@ |
---|
56 | private List<String> titles = new ArrayList<String>(); |
---|
57 | |
---|
58 | /** |
---|
59 | - * Constructs an input for the book properties dialog. |
---|
60 | + * Constructs an input for the book properties dialog. |
---|
61 | * |
---|
62 | * @param book |
---|
63 | * The book whose properties the window will display, |
---|
64 | @@ -440,7 +440,7 @@ |
---|
65 | this.titles.add("NONE"); |
---|
66 | |
---|
67 | if (book == null) { |
---|
68 | - this.info = BookInfo.DEFAULT_INFO; |
---|
69 | + this.info = BookInfo.getDefaultInfo(); |
---|
70 | } else { |
---|
71 | |
---|
72 | ImmSize size = book.getPageSize(); |
---|
73 | #P org.sophie2.main.app.layout |
---|
74 | Index: src/main/java/org/sophie2/main/app/layout/right/library/LibraryTabLogic.java |
---|
75 | =================================================================== |
---|
76 | --- src/main/java/org/sophie2/main/app/layout/right/library/LibraryTabLogic.java (revision 8302) |
---|
77 | +++ src/main/java/org/sophie2/main/app/layout/right/library/LibraryTabLogic.java (working copy) |
---|
78 | @@ -469,7 +469,7 @@ |
---|
79 | // create a new book from the template |
---|
80 | |
---|
81 | BookDocView bookView = BookDocView.create(mainWindow, |
---|
82 | - BookInfo.DEFAULT_INFO); |
---|
83 | + BookInfo.getDefaultInfo()); |
---|
84 | |
---|
85 | DefaultDocView.setCurrent(bookView); |
---|
86 | |
---|
87 | #P org.sophie2.main.app.menus |
---|
88 | Index: src/test/java/org/sophie2/main/app/menus/FileMenuTest.java |
---|
89 | =================================================================== |
---|
90 | --- src/test/java/org/sophie2/main/app/menus/FileMenuTest.java (revision 8302) |
---|
91 | +++ src/test/java/org/sophie2/main/app/menus/FileMenuTest.java (working copy) |
---|
92 | @@ -73,7 +73,7 @@ |
---|
93 | NewBookItem m = getAppMainWindow().findNearestElement(null, NewBookItem.class); |
---|
94 | assertTrue(m.enabled().get()); |
---|
95 | assertEquals(0, getAppMainWindow().documents().size()); |
---|
96 | - TestingDialogManager.get().expect(BookPropertiesDialog.Input.class, BookInfo.DEFAULT_INFO); |
---|
97 | + TestingDialogManager.get().expect(BookPropertiesDialog.Input.class, BookInfo.getDefaultInfo()); |
---|
98 | m.clicked(); |
---|
99 | |
---|
100 | // expect one new book |
---|
101 | @@ -82,7 +82,7 @@ |
---|
102 | assertNotNull(getAppMainWindow().currentDocument().get()); |
---|
103 | |
---|
104 | // and another |
---|
105 | - TestingDialogManager.get().expect(BookPropertiesDialog.Input.class, BookInfo.DEFAULT_INFO); |
---|
106 | + TestingDialogManager.get().expect(BookPropertiesDialog.Input.class, BookInfo.getDefaultInfo()); |
---|
107 | m.clicked(); |
---|
108 | // expect one new book |
---|
109 | assertEquals(2, getAppMainWindow().documents().size()); |
---|
110 | #P org.sophie2.extra.func.scripting |
---|
111 | Index: src/main/java/org/sophie2/extra/func/scripting/facade/JSAppMainWindow.java |
---|
112 | =================================================================== |
---|
113 | --- src/main/java/org/sophie2/extra/func/scripting/facade/JSAppMainWindow.java (revision 8302) |
---|
114 | +++ src/main/java/org/sophie2/extra/func/scripting/facade/JSAppMainWindow.java (working copy) |
---|
115 | @@ -30,7 +30,7 @@ |
---|
116 | * @return A newly created book. |
---|
117 | */ |
---|
118 | public JSBook jsFunction_newBook() { |
---|
119 | - BookInfo info = BookInfo.DEFAULT_INFO; |
---|
120 | + BookInfo info = BookInfo.getDefaultInfo(); |
---|
121 | BookDocView newBookView = BookDocView.create(getAdaptedObject(), info); |
---|
122 | |
---|
123 | JSBook result = (JSBook) Context.getCurrentContext().newObject(getParentScope(), JSBook.CLASS_NAME); |
---|
124 | #P org.sophie2.dev |
---|
125 | Index: src/test/java/org/sophie2/dev/author/PdfImportTest.java |
---|
126 | =================================================================== |
---|
127 | --- src/test/java/org/sophie2/dev/author/PdfImportTest.java (revision 8302) |
---|
128 | +++ src/test/java/org/sophie2/dev/author/PdfImportTest.java (working copy) |
---|
129 | @@ -84,7 +84,7 @@ |
---|
130 | PdfImportTest.this.testBookFileName = "guts.pdf"; |
---|
131 | |
---|
132 | BookDocView newBook = |
---|
133 | - BookDocView.create(getAppMainWindow(), BookInfo.DEFAULT_INFO); |
---|
134 | + BookDocView.create(getAppMainWindow(), BookInfo.getDefaultInfo()); |
---|
135 | |
---|
136 | assertTrue(DefaultDocView.setCurrent(newBook)); |
---|
137 | |
---|
138 | Index: src/test/java/org/sophie2/dev/author/EmbeddedBookTest.java |
---|
139 | =================================================================== |
---|
140 | --- src/test/java/org/sophie2/dev/author/EmbeddedBookTest.java (revision 8302) |
---|
141 | +++ src/test/java/org/sophie2/dev/author/EmbeddedBookTest.java (working copy) |
---|
142 | @@ -84,7 +84,7 @@ |
---|
143 | EmbeddedBookTest.this.testBookFileName = "testBookResource.sjrb"; |
---|
144 | |
---|
145 | BookDocView newBook = |
---|
146 | - BookDocView.create(getAppMainWindow(), BookInfo.DEFAULT_INFO); |
---|
147 | + BookDocView.create(getAppMainWindow(), BookInfo.getDefaultInfo()); |
---|
148 | |
---|
149 | assertTrue(DefaultDocView.setCurrent(newBook)); |
---|
150 | |
---|