Example usage for org.apache.poi.ss.usermodel BorderStyle DASH_DOT_DOT

List of usage examples for org.apache.poi.ss.usermodel BorderStyle DASH_DOT_DOT

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel BorderStyle DASH_DOT_DOT.

Prototype

BorderStyle DASH_DOT_DOT

To view the source code for org.apache.poi.ss.usermodel BorderStyle DASH_DOT_DOT.

Click Source Link

Document

dash-dot-dot border

Usage

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.ExcelCellStyleBuilderTest.java

License:Open Source License

@Test
public void testXlsx_BackgroundStyle() {
    when(workbook.createCellStyle()).thenReturn(xlsxStyle);
    ExcelCellStyleBuilder builder = new ExcelCellStyleBuilder(workbook);

    CellBackground bg = getBackground();
    HSSFCellStyleProducer.HSSFCellStyleKey styleKey = getXlsxKey();

    builder.withBackgroundStyle(bg, styleKey);

    verify(xlsxStyle, times(1)).setBorderBottom(eq(BorderStyle.DASH_DOT));
    verify(xlsxStyle, times(1)).setBorderColor(eq(XSSFCellBorder.BorderSide.BOTTOM), notNull(XSSFColor.class));
    verify(xlsxStyle, times(1)).setBorderTop(eq(BorderStyle.DOTTED));
    verify(xlsxStyle, times(1)).setBorderColor(eq(XSSFCellBorder.BorderSide.TOP), notNull(XSSFColor.class));
    verify(xlsxStyle, times(1)).setBorderLeft(eq(BorderStyle.DASH_DOT_DOT));
    verify(xlsxStyle, times(1)).setBorderColor(eq(XSSFCellBorder.BorderSide.LEFT), notNull(XSSFColor.class));
    verify(xlsxStyle, times(1)).setBorderRight(eq(BorderStyle.DASHED));
    verify(xlsxStyle, times(1)).setBorderColor(eq(XSSFCellBorder.BorderSide.RIGHT), notNull(XSSFColor.class));
    verify(xlsxStyle, times(1)).setFillForegroundColor(notNull(XSSFColor.class));
    verify(xlsxStyle, times(1)).setFillPattern(eq(FillPatternType.SOLID_FOREGROUND));
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.ExcelCellStyleBuilderTest.java

License:Open Source License

private HSSFCellStyleProducer.HSSFCellStyleKey getXlsxKey() {
    when(styleKey.getBorderStrokeBottom()).thenReturn(BorderStyle.DASH_DOT);
    when(styleKey.getExtendedColorBottom()).thenReturn(Color.BLACK);
    when(styleKey.getBorderStrokeTop()).thenReturn(BorderStyle.DOTTED);
    when(styleKey.getExtendedColorTop()).thenReturn(Color.BLACK);
    when(styleKey.getBorderStrokeLeft()).thenReturn(BorderStyle.DASH_DOT_DOT);
    when(styleKey.getExtendedColorLeft()).thenReturn(Color.BLACK);
    when(styleKey.getBorderStrokeLeft()).thenReturn(BorderStyle.DASH_DOT_DOT);
    when(styleKey.getBorderStrokeRight()).thenReturn(BorderStyle.DASHED);
    when(styleKey.getExtendedColorRight()).thenReturn(Color.BLACK);
    when(styleKey.getExtendedColor()).thenReturn(Color.BLACK);

    return styleKey;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.HSSFCellStyleProducer.java

License:Open Source License

/**
 * Tries to translate the given stroke width into one of the predefined excel border styles.
 *
 * @param widthRaw the AWT-Stroke-Width.
 * @return the translated excel border width.
 *///from w w w  .j ava  2 s .  c  om
protected static org.apache.poi.ss.usermodel.BorderStyle translateStroke(
        final org.pentaho.reporting.engine.classic.core.style.BorderStyle borderStyle, final long widthRaw) {
    final double width = StrictGeomUtility.toExternalValue(widthRaw);

    if (org.pentaho.reporting.engine.classic.core.style.BorderStyle.NONE.equals(borderStyle)) {
        return BorderStyle.NONE;
    } else if (org.pentaho.reporting.engine.classic.core.style.BorderStyle.DASHED.equals(borderStyle)) {
        return width <= 1.5 ? BorderStyle.DASHED : BorderStyle.MEDIUM_DASHED;
    } else if (org.pentaho.reporting.engine.classic.core.style.BorderStyle.DOT_DOT_DASH.equals(borderStyle)) {
        return width <= 1.5 ? BorderStyle.DASH_DOT_DOT : BorderStyle.MEDIUM_DASH_DOT_DOT;
    } else if (org.pentaho.reporting.engine.classic.core.style.BorderStyle.DOT_DASH.equals(borderStyle)) {
        return width <= 1.5 ? BorderStyle.DASH_DOT : BorderStyle.MEDIUM_DASH_DOT;
    } else if (org.pentaho.reporting.engine.classic.core.style.BorderStyle.DOTTED.equals(borderStyle)) {
        return BorderStyle.DOTTED;
    } else if (org.pentaho.reporting.engine.classic.core.style.BorderStyle.DOUBLE.equals(borderStyle)) {
        return BorderStyle.DOUBLE;
    } else if (width == 0) {
        return BorderStyle.NONE;
    } else if (width <= 0.5) {
        return BorderStyle.HAIR;
    } else if (width <= 1) {
        return BorderStyle.THIN;
    } else if (width <= 1.5) {
        return BorderStyle.MEDIUM;
    } else {
        return BorderStyle.THICK;
    }
}

From source file:org.sysmodb.xml.XMLStyleGenerator.java

License:BSD License

private static Map<BorderStyle, String> createBorderMap() {
    Map<BorderStyle, String> result = new HashMap<BorderStyle, String>();
    result.put(BorderStyle.DASHED, "dashed 1pt");
    result.put(BorderStyle.DASH_DOT, "dashed 1pt");
    result.put(BorderStyle.DASH_DOT_DOT, "dashed 1pt");
    result.put(BorderStyle.DOTTED, "dotted 1pt");
    result.put(BorderStyle.DOUBLE, "double 3pt");
    result.put(BorderStyle.HAIR, "solid 1pt");
    result.put(BorderStyle.MEDIUM, "2pt solid");
    result.put(BorderStyle.MEDIUM_DASHED, "2pt dashed");
    result.put(BorderStyle.MEDIUM_DASH_DOT, "2pt dashed");
    result.put(BorderStyle.MEDIUM_DASH_DOT_DOT, "2pt dashed");
    result.put(BorderStyle.NONE, "none");
    result.put(BorderStyle.SLANTED_DASH_DOT, "dashed 2pt");
    result.put(BorderStyle.THICK, "solid 3pt");
    result.put(BorderStyle.THIN, "dashed 1pt");

    return Collections.unmodifiableMap(result);
}