| 61 |
61 |
|
| 62 |
62 |
@Override
|
| 63 |
63 |
public void startSpreadSheet(SpreadSheetEvent spreadSheetEvent){
|
| 64 |
|
String sourceDirectoryPath = spreadSheetEvent.getSpreadSheet().getSourceDirectory().getPath();
|
| 65 |
|
String textAreaDirectoryPath = spreadSheetEvent.getSpreadSheet().getSourceDirectory().getPath()+
|
|
64 |
String sourceDirectoryPath = spreadSheetEvent.getSpreadSheet().getSourceDirectory().getRelativePath();
|
|
65 |
String textAreaDirectoryPath = spreadSheetEvent.getSpreadSheet().getSourceDirectory().getRelativePath()+
|
| 66 |
66 |
File.separator + AppConstants.RESULT_DIRNAME + File.separator + "TEXTAREA";
|
| 67 |
67 |
FormMaster formMaster = spreadSheetEvent.getFormMaster();
|
| 68 |
68 |
this.textAreaColumnArray = new TextAreaColumn[formMaster.getNumColumns()];
|
| ... | ... | |
| 85 |
85 |
if(defaultFormArea.isTextArea()){
|
| 86 |
86 |
TextAreaColumn textAreaColumn = createTextAreaColumn(
|
| 87 |
87 |
sourceDirectoryPath, numRows, defaultFormArea);
|
| 88 |
|
this.textAreaColumnArray[defaultFormArea.getColumnIndex()] = textAreaColumn;
|
|
88 |
this.textAreaColumnArray[defaultFormArea.getQuestionIndex()] = textAreaColumn;
|
| 89 |
89 |
}
|
| 90 |
90 |
}
|
| 91 |
91 |
}
|
| 92 |
92 |
|
| 93 |
93 |
private TextAreaColumn createTextAreaColumn(String sourceDirectoryPath,
|
| 94 |
94 |
int numRows, FormArea defaultFormArea) {
|
| 95 |
|
int columnIndex = defaultFormArea.getColumnIndex();
|
|
95 |
int columnIndex = defaultFormArea.getQuestionIndex();
|
| 96 |
96 |
//int numRowRangePages = (int) Math.ceil(1.0 * numRows / TextAreaHTMLWriter.NUM_IMAGES_PAR_PAGE);
|
| 97 |
97 |
|
| 98 |
98 |
TextAreaColumnMetadata textAreaColumnMetadata = new TextAreaColumnMetadata(defaultFormArea,
|
| ... | ... | |
| 113 |
113 |
List<FormArea> formAreaList = entry.getValue();
|
| 114 |
114 |
FormArea defaultFormArea = formAreaList.get(0);
|
| 115 |
115 |
if(defaultFormArea.isTextArea()){
|
| 116 |
|
createAndAddNewTextAreaRowGroup(defaultFormArea.getColumnIndex(),
|
|
116 |
createAndAddNewTextAreaRowGroup(defaultFormArea.getQuestionIndex(),
|
| 117 |
117 |
rowIndexBase,
|
| 118 |
118 |
rowGroupSourceDirectory);
|
| 119 |
119 |
}
|
| ... | ... | |
| 154 |
154 |
}
|
| 155 |
155 |
|
| 156 |
156 |
private void createAndAddNewTextAreaRowRange(FormArea defaultFormArea, int numRowsInThisRowGroup, int numRowsInThisSpreadSheet) {
|
| 157 |
|
TextAreaColumn textAreaColumn = this.textAreaColumnArray[defaultFormArea.getColumnIndex()];
|
|
157 |
TextAreaColumn textAreaColumn = this.textAreaColumnArray[defaultFormArea.getQuestionIndex()];
|
| 158 |
158 |
TextAreaRowGroup textAreaRowGroup = textAreaColumn.getLastTextAreaRowGroup();
|
| 159 |
159 |
int rowIndexBase = textAreaColumn.getLastTextAreaRowGroup().getRowIndexBaseOfThisRowGroup();
|
| 160 |
160 |
int nextRowRangeIndex = textAreaColumn.getLastTextAreaRowGroup().getTextAreaRowRangeSize();
|
| ... | ... | |
| 178 |
178 |
return;
|
| 179 |
179 |
}
|
| 180 |
180 |
SourceDirectory rowGroupSourceDirectory = questionEvent.getRowEvent().getRowGroupEvent().getSourceDirectory();
|
| 181 |
|
String rowGroupSourceDirectoryPath = rowGroupSourceDirectory.getPath();
|
| 182 |
|
int columnIndex = questionEvent.getDefaultFormArea().getColumnIndex();
|
|
181 |
String rowGroupSourceDirectoryPath = rowGroupSourceDirectory.getRelativePath();
|
|
182 |
int columnIndex = questionEvent.getDefaultFormArea().getQuestionIndex();
|
| 183 |
183 |
|
| 184 |
184 |
String key = columnIndex + "-" + rowIndex;
|
| 185 |
185 |
String value = this.textAreaHTMLWriter.textAreaValueMap.get(key);
|
| ... | ... | |
| 199 |
199 |
SourceDirectory rowGroupSourceDirectory = rowGroupEvent.getSourceDirectory();
|
| 200 |
200 |
SourceDirectory spreadSheetSourceDirectory = rowGroupEvent.getSpreadSheetEvent().getSourceDirectoryEvent().getSourceDirectory();
|
| 201 |
201 |
FormArea formArea = questionItemEvent.getFormArea();
|
| 202 |
|
if(spreadSheetSourceDirectory.getPath().equals(rowGroupSourceDirectory.getPath()) &&
|
|
202 |
if(spreadSheetSourceDirectory.getRelativePath().equals(rowGroupSourceDirectory.getRelativePath()) &&
|
| 203 |
203 |
questionItemEvent.getItemIndex() == 0 && formArea.isTextArea()){
|
| 204 |
204 |
TextAreaImageWriter.exportTextAreaImageFile(questionItemEvent);
|
| 205 |
205 |
}
|
| ... | ... | |
| 222 |
222 |
// write textAreaDirectoryIndex
|
| 223 |
223 |
// RESULT/TEXTAREA/index.html
|
| 224 |
224 |
TextAreaHTMLWriter textAreaHTMLWriter = new TextAreaHTMLWriter(sourceDirectory, textAreaDirectoryFile, skinName);
|
| 225 |
|
textAreaHTMLWriter.writeTextAreaIndexFile(formMaster, sourceDirectory.getPath());
|
|
225 |
textAreaHTMLWriter.writeTextAreaIndexFile(formMaster, sourceDirectory.getRelativePath());
|
| 226 |
226 |
|
| 227 |
227 |
for (Map.Entry<String, ArrayList<FormArea>> entry : sourceDirectoryEvent.getFormMaster()
|
| 228 |
228 |
.getFormAreaListEntrySet()) {
|
| 229 |
229 |
List<FormArea> formAreaList = entry.getValue();
|
| 230 |
230 |
FormArea defaultFormArea = formAreaList.get(0);
|
| 231 |
231 |
if (defaultFormArea.isTextArea()) {
|
| 232 |
|
int columnIndex = defaultFormArea.getColumnIndex();
|
|
232 |
int columnIndex = defaultFormArea.getQuestionIndex();
|
| 233 |
233 |
File textAreaColumnDirectoryFile = new File(textAreaDirectoryFile, Integer.toString(columnIndex));
|
| 234 |
234 |
if(! textAreaColumnDirectoryFile.exists()){
|
| 235 |
235 |
// make textAreaColumnDirectory
|
| ... | ... | |
| 243 |
243 |
// RESULT/TEXTAREA/${colIndex}/index.html
|
| 244 |
244 |
// FIXME!: when source and row is different
|
| 245 |
245 |
|
| 246 |
|
textAreaHTMLWriter.writeTextAreaColumnIndexFile(formMaster, textAreaColumn, sourceDirectory.getPath());
|
|
246 |
textAreaHTMLWriter.writeTextAreaColumnIndexFile(formMaster, textAreaColumn, sourceDirectory.getRelativePath());
|
| 247 |
247 |
|
| 248 |
248 |
for(TextAreaRowGroup textAreaRowGroup:textAreaColumn.getTextAreaRowGroupList()){
|
| 249 |
249 |
for(TextAreaRowRange textAreaRowRange:textAreaRowGroup.getTextAreaRowRangeList()){
|
| ... | ... | |
| 255 |
255 |
textAreaColumn,
|
| 256 |
256 |
textAreaRowGroup,
|
| 257 |
257 |
textAreaRowRange,
|
| 258 |
|
textAreaRowGroup.getSourceDirectory().getPath());
|
|
258 |
textAreaRowGroup.getSourceDirectory().getRelativePath());
|
| 259 |
259 |
}
|
| 260 |
260 |
}
|
| 261 |
261 |
}
|
| 262 |
262 |
}
|
| 263 |
263 |
FormMaster master = (FormMaster) sourceDirectory.getPageMaster();
|
| 264 |
|
textAreaHTMLWriter.writeTextAreaIndexFile(master, sourceDirectory.getPath());
|
|
264 |
textAreaHTMLWriter.writeTextAreaIndexFile(master, sourceDirectory.getRelativePath());
|
| 265 |
265 |
}catch(TemplateException ex){
|
| 266 |
266 |
ex.printStackTrace();
|
| 267 |
267 |
}catch(IOException ex){
|