Bug 60187 - RegionUtil should use new enum style classes
Summary: RegionUtil should use new enum style classes
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 3.15-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Blocks: 59836
  Show dependency tree
Reported: 2016-09-29 12:39 UTC by Guillaume Camus
Modified: 2016-09-30 07:02 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Camus 2016-09-29 12:39:21 UTC
RegionUtil has to change some methods to switch old int/short value to new enums classes (like BorderStyle, HorizontalAlignment, FillPatternType...)

Actually, with version 3.15, we have some output lines like :
BorderStyle short usage

I use RegionUtil with merged zones, to put some border, with the following code :
protected static void addMergedRegion(Sheet sheet, int iRowMin, int iRowMax, int iColMin, int iColMax) {
    CellRangeAddress cellZone = new CellRangeAddress(iRowMin, iRowMax, iColMin, iColMax);

    Cell cell = sheet.getRow(iRowMin).getCell(iColMin);
    if (cell != null) {
        RegionUtil.setBorderBottom(cell.getCellStyle().getBorderBottomEnum().getCode(), cellZone, sheet);
        RegionUtil.setBorderTop(cell.getCellStyle().getBorderTopEnum().getCode(), cellZone, sheet);
        RegionUtil.setBorderLeft(cell.getCellStyle().getBorderLeftEnum().getCode(), cellZone, sheet);
        RegionUtil.setBorderRight(cell.getCellStyle().getBorderRightEnum().getCode(), cellZone, sheet);

        RegionUtil.setBottomBorderColor(cell.getCellStyle().getBottomBorderColor(), cellZone, sheet);
        RegionUtil.setTopBorderColor(cell.getCellStyle().getTopBorderColor(), cellZone, sheet);
        RegionUtil.setLeftBorderColor(cell.getCellStyle().getLeftBorderColor(), cellZone, sheet);
        RegionUtil.setRightBorderColor(cell.getCellStyle().getRightBorderColor(), cellZone, sheet);

Maybe, there is a new way to do the same thing, but I don't find it.

I have submitted a question here :
Comment 1 Javen O'Neal 2016-09-30 06:46:43 UTC
Added in r1762856.

I believe only BorderStyle applies to setBorderLeft|Right|Top|Bottom. Fill pattern and text alignment in a cell is currently not handled by RegionUtil.setBorderLeft|Right|Top|Bottom.

See bug 58787 for some potential future changes to work with multi-cell regions.
Comment 2 Javen O'Neal 2016-09-30 07:02:53 UTC
And r1762859 so that the new methods don't log a BorderStyle short usage warning in the POI logger.