}
private HSSFSheet createTestConditionSheet(String sheetName) {
// タイトルのセルを作成, 同時にカラム位置の最大値を取得
int maxColumn = 0;
HSSFSheet sheet = workbook.createSheet(sheetName);
for (ConditionSheetItem item : ConditionSheetItem.values()) {
HSSFCell cell = getCell(sheet, item.getRow(), item.getCol());
cell.setCellValue(item.getName());
cell.setCellStyle(titleStyle);
if (maxColumn < item.getCol()) {
maxColumn = item.getCol();
}
}
// テーブル名とテーブルのマッチング条件を設定
HSSFCell tableNameCell = getCell(sheet, ConditionSheetItem.TABLE_NAME
.getRow(), ConditionSheetItem.TABLE_NAME.getCol() + 1);
tableNameCell.setCellStyle(fixedValueStyle);
tableNameCell.setCellValue(tableName);
HSSFCell rowMatichingConditionCell = getCell(sheet,
ConditionSheetItem.ROW_MATCHING_CONDITION.getRow(),
ConditionSheetItem.ROW_MATCHING_CONDITION.getCol() + 1);
rowMatichingConditionCell.setCellValue(RowMatchingCondition.NONE.getJapaneseName());
// 各カラムの情報を設定
int startRow = ConditionSheetItem.NO.getRow();
int endRow = configureColumns(sheet, startRow);
// 入力規則を設定
setExplicitListConstraint(sheet,
RowMatchingCondition.getJapaneseNames(),
ConditionSheetItem.ROW_MATCHING_CONDITION.getRow(),
ConditionSheetItem.ROW_MATCHING_CONDITION.getRow(),
ConditionSheetItem.ROW_MATCHING_CONDITION.getCol() + 1,
ConditionSheetItem.ROW_MATCHING_CONDITION.getCol() + 1);
setExplicitListConstraint(sheet,
ColumnMatchingCondition.getJapaneseNames(),
startRow + 1,
endRow,
ConditionSheetItem.MATCHING_CONDITION.getCol(),
ConditionSheetItem.MATCHING_CONDITION.getCol());
setExplicitListConstraint(sheet,
NullValueCondition.getJapaneseNames(),
startRow + 1,
endRow,
ConditionSheetItem.NULL_VALUE_CONDITION.getCol(),
ConditionSheetItem.NULL_VALUE_CONDITION.getCol());
// カラム幅の調整
for (int i = 0; i <= maxColumn + 1; i++) {
sheet.autoSizeColumn(i);
}
return sheet;
}