Skip to content

Commit

Permalink
Show helper box only in the header cells of all sample and measuremen…
Browse files Browse the repository at this point in the history
…t excel templates (#978)

* Remove helperbox from all cells except cells in header row

* Remove unnecessary semi colon
  • Loading branch information
Steffengreiner authored Jan 15, 2025
1 parent 411491f commit 65507d8
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,6 @@ public byte[] getContent() {
DEFAULT_GENERATED_ROW_COUNT - 1,
sequencingReadTypeArea);

for (NGSMeasurementEditColumn column : NGSMeasurementEditColumn.values()) {
column.getFillHelp().ifPresent(
helper -> XLSXTemplateHelper.addInputHelper(sheet,
column.columnIndex(),
startIndex,
column.columnIndex(),
DEFAULT_GENERATED_ROW_COUNT - 1,
helper.exampleValue(),
helper.description())
);
}

setAutoWidth(sheet);
workbook.setActiveSheet(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,6 @@ public byte[] getContent() {
DEFAULT_GENERATED_ROW_COUNT - 1,
sequencingReadTypeArea);

for (NGSMeasurementRegisterColumn column : NGSMeasurementRegisterColumn.values()) {
column.getFillHelp().ifPresent(
helper -> XLSXTemplateHelper.addInputHelper(sheet,
column.columnIndex(),
startIndex,
column.columnIndex(),
DEFAULT_GENERATED_ROW_COUNT - 1,
helper.exampleValue(),
helper.description()));
}

// add property information order of columns matters!!
for (NGSMeasurementRegisterColumn column : Arrays.stream(
NGSMeasurementRegisterColumn.values())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public byte[] getContent() {
}

try (Workbook workbook = new XSSFWorkbook();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {

CellStyle readOnlyHeaderStyle = XLSXTemplateHelper.createReadOnlyHeaderCellStyle(workbook);
CellStyle boldStyle = createBoldCellStyle(workbook);
Expand Down Expand Up @@ -193,18 +193,6 @@ public byte[] getContent() {
DEFAULT_GENERATED_ROW_COUNT - 1,
digestionMethodArea);

for (ProteomicsMeasurementEditColumn column : ProteomicsMeasurementEditColumn.values()) {
column.getFillHelp().ifPresent(
helper -> XLSXTemplateHelper.addInputHelper(sheet,
column.columnIndex(),
startIndex,
column.columnIndex(),
DEFAULT_GENERATED_ROW_COUNT - 1,
helper.exampleValue(),
helper.description())
);
}

setAutoWidth(sheet);
workbook.setActiveSheet(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void setAutoWidth(Sheet sheet) {
@Override
public byte[] getContent() {
try (Workbook workbook = new XSSFWorkbook();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {

CellStyle readOnlyHeaderStyle = XLSXTemplateHelper.createReadOnlyHeaderCellStyle(workbook);
CellStyle boldStyle = createBoldCellStyle(workbook);
Expand Down Expand Up @@ -135,18 +135,6 @@ public byte[] getContent() {
DEFAULT_GENERATED_ROW_COUNT - 1,
digestionMethodArea);

for (ProteomicsMeasurementRegisterColumn column : ProteomicsMeasurementRegisterColumn.values()) {
column.getFillHelp().ifPresent(
helper -> XLSXTemplateHelper.addInputHelper(sheet,
column.columnIndex(),
startIndex,
column.columnIndex(),
DEFAULT_GENERATED_ROW_COUNT - 1,
helper.exampleValue(),
helper.description())
);
}

setAutoWidth(sheet);

workbook.setActiveSheet(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,6 @@ public static XSSFWorkbook createRegistrationTemplate(List<String> conditions,
MAX_ROW_INDEX_TO,
specimenOptions);

for (var column : RegisterColumn.values()) {
column.getFillHelp().ifPresent(
helper -> XLSXTemplateHelper.addInputHelper(sheet,
column.columnIndex(),
startIndex,
column.columnIndex(),
MAX_ROW_INDEX_TO,
helper.exampleValue(),
helper.description())
);
}

setColumnAutoWidth(sheet, 0, RegisterColumn.maxColumnIndex());
// Auto width ignores cell validation values (e.g. a list of valid entries). So we need
// to set them explicit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,6 @@ public static XSSFWorkbook createUpdateTemplate(List<Sample> samples, List<Strin
MAX_ROW_INDEX_TO,
specimenOptions);

for (var column : EditColumn.values()) {
column.getFillHelp().ifPresent(
helper -> XLSXTemplateHelper.addInputHelper(sheet,
column.columnIndex(),
startIndex,
column.columnIndex(),
MAX_ROW_INDEX_TO,
helper.exampleValue(),
helper.description())
);
}

setColumnAutoWidth(sheet, 0, EditColumn.maxColumnIndex());
workbook.setActiveSheet(0);
lockSheet(hiddenSheet);
Expand Down

0 comments on commit 65507d8

Please sign in to comment.