Resolver#getDefaultSheet、 Resolver#setDefaultSheet の名前を~Default~から~Current~に変更
Resolver#isFullyQualifiedName、Resolver#getSheetNameFromFullyQualifiedNameのアクセスレベルをデフォルトからpublicに変更
@@ -167,8 +167,8 @@ | ||
167 | 167 | Sheet sheet = new Sheet(sheetName, this); |
168 | 168 | this._sheets.put(sheetName, sheet); |
169 | 169 | // リゾルバのデフォルトシートに登録が無い場合、このシートをデフォルトシートにする |
170 | - if (this._resolver.getDefaultSheet() == null) { | |
171 | - this._resolver.setDefaultSheet(sheet); | |
170 | + if (this._resolver.getCurrentSheet() == null) { | |
171 | + this._resolver.setCurrentSheet(sheet); | |
172 | 172 | } |
173 | 173 | return sheet; |
174 | 174 | } |
@@ -214,9 +214,9 @@ | ||
214 | 214 | // シートを削除する |
215 | 215 | if (this._sheets.containsKey((sheetName))) { |
216 | 216 | this._sheets.remove(sheetName); |
217 | - if (_resolver.getDefaultSheet().getName().equals(sheetName)) { | |
217 | + if (_resolver.getCurrentSheet().getName().equals(sheetName)) { | |
218 | 218 | // 削除したシートがデフォルトシートだった場合、デフォルトシートをnullにする |
219 | - _resolver.setDefaultSheet(null); | |
219 | + _resolver.setCurrentSheet(null); | |
220 | 220 | } |
221 | 221 | } else { |
222 | 222 | throw new ReferenceNotFoundException("no such sheet " + sheetName); |
@@ -74,7 +74,7 @@ | ||
74 | 74 | public ConcurrentBookWrapper (Book book) { |
75 | 75 | _book = book; |
76 | 76 | // Bookオブジェクトにシートが1つも作成されていない場合、シートを作成する |
77 | - if (_book.getResolver().getDefaultSheet() == null) { | |
77 | + if (_book.getResolver().getCurrentSheet() == null) { | |
78 | 78 | _book.addSheet(DEFAULT_SHEET_NAME); |
79 | 79 | } |
80 | 80 |
@@ -256,7 +256,7 @@ | ||
256 | 256 | try { |
257 | 257 | sheetName = resolver.getSheetNameFromFullyQualifiedName(cellName); |
258 | 258 | } catch (Exception e) { |
259 | - sheetName = resolver.getDefaultSheet().getName(); | |
259 | + sheetName = resolver.getCurrentSheet().getName(); | |
260 | 260 | } |
261 | 261 | addSheet(sheetName); |
262 | 262 | _book.getSheet(sheetName).addCell(cellName); |
@@ -1,17 +1,17 @@ | ||
1 | 1 | /** |
2 | 2 | * JPicosheet: Spreadsheet engine for Java Applications |
3 | 3 | * Copyright (C) 2011 yusuke nishikawa |
4 | - * | |
4 | + * | |
5 | 5 | * This library is free software; you can redistribute it and/or |
6 | 6 | * modify it under the terms of the GNU Lesser General Public |
7 | 7 | * License as published by the Free Software Foundation; either |
8 | 8 | * version 2.1 of the License, or (at your option) any later version. |
9 | - * | |
9 | + * | |
10 | 10 | * This library is distributed in the hope that it will be useful, |
11 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | 13 | * Lesser General Public License for more details. |
14 | - * | |
14 | + * | |
15 | 15 | * You should have received a copy of the GNU Lesser General Public |
16 | 16 | * License along with this library; if not, write to the Free Software |
17 | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -38,9 +38,9 @@ | ||
38 | 38 | */ |
39 | 39 | private Book _book; |
40 | 40 | /** |
41 | - * このブックのデフォルトシート参照 | |
41 | + * このブックのカレントシート参照 | |
42 | 42 | */ |
43 | - private Sheet _defaultSheet; | |
43 | + private Sheet _currentSheet; | |
44 | 44 | |
45 | 45 | /** |
46 | 46 | * あるセルまたはグループを参照しているほかのセルの集合を保持するMap |
@@ -62,19 +62,19 @@ | ||
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | - * このブックの、デフォルトのシートオブジェクトをセットします | |
66 | - * @param defaultSheet デフォルトで選択するシートオブジェクト | |
65 | + * このブックで既定で使用するシートオブジェクトを指定します | |
66 | + * @param currentSheet 選択するシートオブジェクト | |
67 | 67 | */ |
68 | - public void setDefaultSheet(Sheet defaultSheet) { | |
69 | - this._defaultSheet = defaultSheet; | |
68 | + public void setCurrentSheet(Sheet currentSheet) { | |
69 | + this._currentSheet = currentSheet; | |
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | - * このブックの、デフォルトのシートオブジェクトを返します | |
74 | - * @return デフォルトで選択するシートオブジェクト | |
73 | + * このブックで現在選択されているシートオブジェクトを返します | |
74 | + * @return 選択されているシートオブジェクト | |
75 | 75 | */ |
76 | - public Sheet getDefaultSheet() { | |
77 | - return this._defaultSheet; | |
76 | + public Sheet getCurrentSheet() { | |
77 | + return this._currentSheet; | |
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -96,7 +96,7 @@ | ||
96 | 96 | * @param name セル名 |
97 | 97 | * @return セル名が完全修飾名の場合true、そうでない場合false |
98 | 98 | */ |
99 | - boolean isFullyQualifiedName(String name) { | |
99 | + public boolean isFullyQualifiedName(String name) { | |
100 | 100 | if (name.contains("!")) { |
101 | 101 | return true; |
102 | 102 | } else { |
@@ -109,7 +109,7 @@ | ||
109 | 109 | * @param fullyQualifiedName 完全修飾名 |
110 | 110 | * @return シート名 |
111 | 111 | */ |
112 | - String getSheetNameFromFullyQualifiedName(String fullyQualifiedName) { | |
112 | + public String getSheetNameFromFullyQualifiedName(String fullyQualifiedName) { | |
113 | 113 | if (isFullyQualifiedName(fullyQualifiedName)) { |
114 | 114 | return fullyQualifiedName.substring(0, fullyQualifiedName.indexOf("!")); |
115 | 115 | } else { |
@@ -120,7 +120,7 @@ | ||
120 | 120 | /** |
121 | 121 | * 指定したセル名のセルが存在するかどうか確認します。<br> |
122 | 122 | * シート名!セル名 の形式で指定した場合で、指定したシートが存在しない場合、ReferenceNotFoundExceptionがスローされます。 |
123 | - * @param cellName セル名。シート名!セル名 の形式でも指定できる。シート名を指定しない場合デフォルトシートから探す。 | |
123 | + * @param cellName セル名。シート名!セル名 の形式でも指定できる。シート名を指定しない場合カレントシートから探す。 | |
124 | 124 | * @return 指定したセルが存在する場合true、そうでない場合false |
125 | 125 | */ |
126 | 126 | public boolean cellExists(String cellName) { |
@@ -130,7 +130,7 @@ | ||
130 | 130 | return this._book.getSheet(sheetCell[0]).cellExists(cellName); |
131 | 131 | } |
132 | 132 | // そうでない場合、セル名 の形式である |
133 | - return this._defaultSheet.cellExists(cellName); | |
133 | + return this._currentSheet.cellExists(cellName); | |
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -146,7 +146,7 @@ | ||
146 | 146 | return this._book.getSheet(sheetCell[0]).getCell(sheetCell[1]); |
147 | 147 | } |
148 | 148 | // そうでない場合、セル名 の形式である |
149 | - return this._defaultSheet.getCell(cellName); | |
149 | + return this._currentSheet.getCell(cellName); | |
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -164,7 +164,7 @@ | ||
164 | 164 | targetSheet = this._book.getSheet(sheetGroup[0]); |
165 | 165 | targetGroup = sheetGroup[1]; |
166 | 166 | } else { |
167 | - targetSheet = this._defaultSheet; | |
167 | + targetSheet = this._currentSheet; | |
168 | 168 | targetGroup = groupName; |
169 | 169 | } |
170 | 170 | // シートに含まれるグループからCellを得る |
@@ -186,7 +186,7 @@ | ||
186 | 186 | targetSheet = this._book.getSheet(sheetTable[0]); |
187 | 187 | targetTable = sheetTable[1]; |
188 | 188 | } else { |
189 | - targetSheet = this._defaultSheet; | |
189 | + targetSheet = this._currentSheet; | |
190 | 190 | targetTable = tableName; |
191 | 191 | } |
192 | 192 | // シートに含まれるテーブルからCellを得る |
@@ -285,7 +285,7 @@ | ||
285 | 285 | /** |
286 | 286 | * 指定したグループ名のグループが存在するかどうか確認します。 |
287 | 287 | * シート名!グループ名 の形式で指定した場合で、指定したシートが存在しない場合、ReferenceNotFoundExceptionがスローされます |
288 | - * @param groupName グループ名。シート名!グループ名 の形式でも指定できる。シート名を指定しない場合デフォルトシートから探す。 | |
288 | + * @param groupName グループ名。シート名!グループ名 の形式でも指定できる。シート名を指定しない場合カレントシートから探す。 | |
289 | 289 | * @return 指定したグループが存在する場合true、そうでない場合false |
290 | 290 | */ |
291 | 291 | public boolean groupExists(String groupName) { |
@@ -295,7 +295,7 @@ | ||
295 | 295 | return this._book.getSheet(sheetCell[0]).groupExists(groupName); |
296 | 296 | } |
297 | 297 | // そうでない場合、グループ名 の形式である |
298 | - return this._defaultSheet.groupExists(groupName); | |
298 | + return this._currentSheet.groupExists(groupName); | |
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -312,7 +312,7 @@ | ||
312 | 312 | return this._book.getSheet(sheetGroup[0]).getGroup(sheetGroup[1]); |
313 | 313 | } |
314 | 314 | // そうでない場合、グループ名 の形式である |
315 | - return this._defaultSheet.getGroup(groupName); | |
315 | + return this._currentSheet.getGroup(groupName); | |
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -362,7 +362,7 @@ | ||
362 | 362 | /** |
363 | 363 | * 指定したテーブル名のテーブルが存在するかどうか確認します。<br> |
364 | 364 | * シート名!テーブル名 の形式で指定した場合で、指定したシートが存在しない場合、ReferenceNotFoundExceptionがスローされます |
365 | - * @param tableName テーブル名。シート名!テーブル名 の形式でも指定できる。シート名を指定しない場合デフォルトシートから探す。 | |
365 | + * @param tableName テーブル名。シート名!テーブル名 の形式でも指定できる。シート名を指定しない場合カレントシートから探す。 | |
366 | 366 | * @return 指定したテーブルが存在する場合true、そうでない場合false |
367 | 367 | */ |
368 | 368 | public boolean tableExists(String tableName) { |
@@ -372,7 +372,7 @@ | ||
372 | 372 | return this._book.getSheet(sheetCell[0]).tableExists(tableName); |
373 | 373 | } |
374 | 374 | // そうでない場合、テーブル名 の形式である |
375 | - return this._defaultSheet.tableExists(tableName); | |
375 | + return this._currentSheet.tableExists(tableName); | |
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -388,7 +388,7 @@ | ||
388 | 388 | return this._book.getSheet(sheetTable[0]).getTable(sheetTable[1]); |
389 | 389 | } |
390 | 390 | // そうでない場合、テーブル名 の形式である |
391 | - return this._defaultSheet.getTable(tableName); | |
391 | + return this._currentSheet.getTable(tableName); | |
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -133,7 +133,7 @@ | ||
133 | 133 | |
134 | 134 | @Override |
135 | 135 | protected Cell createCell(String cellName) { |
136 | - return _book.getResolver().getDefaultSheet().addCell(cellName); | |
136 | + return _book.getResolver().getCurrentSheet().addCell(cellName); | |
137 | 137 | } |
138 | 138 | |
139 | 139 | }.process(br); |
@@ -173,7 +173,7 @@ | ||
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - _book.getResolver().getDefaultSheet().addTable(tableName, rowSize, colSize); | |
176 | + _book.getResolver().getCurrentSheet().addTable(tableName, rowSize, colSize); | |
177 | 177 | |
178 | 178 | new CellCreator("endtable") { |
179 | 179 |
@@ -862,7 +862,7 @@ | ||
862 | 862 | */ |
863 | 863 | public void testNonDefaultSheetCalc() { |
864 | 864 | Sheet anotherSheet = book.addSheet("anotherSheet"); |
865 | - book.getResolver().setDefaultSheet(sheet); | |
865 | + book.getResolver().setCurrentSheet(sheet); | |
866 | 866 | |
867 | 867 | anotherSheet.addCell("another1").setNumberValue("123"); |
868 | 868 | anotherSheet.addCell("another2").setFormula("another1 * 10"); |