Example usage for org.apache.poi.ss.usermodel IndexedColors ORANGE

List of usage examples for org.apache.poi.ss.usermodel IndexedColors ORANGE

Introduction

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

Prototype

IndexedColors ORANGE

To view the source code for org.apache.poi.ss.usermodel IndexedColors ORANGE.

Click Source Link

Usage

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.SummaryReportGenerator.java

License:Apache License

private CellStyle getHeaderOrangeStyle(Workbook p_workbook) {
    if (headerOrangeStyle == null) {
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.ORANGE.getIndex());

        headerOrangeStyle = cs;/*w ww.ja  va  2 s.  c o m*/
    }
    return headerOrangeStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.SummaryReportGenerator.java

License:Apache License

private CellStyle getFloatSumStyle(Workbook p_workbook) {
    if (floatSumStyle == null) {
        DataFormat formatDouble = p_workbook.createDataFormat();
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
        cs.setDataFormat(formatDouble.getFormat(DOUBLE_FORMAT));

        floatSumStyle = cs;//from  w  ww .ja  v  a 2s . c om
    }
    return floatSumStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.SummaryReportGenerator.java

License:Apache License

private CellStyle getMoneySumStyle(Workbook p_workbook) {
    if (moneySumStyle == null) {
        DataFormat moneyFormat = p_workbook.createDataFormat();
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setDataFormat(moneyFormat.getFormat(moneyFormatString));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.ORANGE.getIndex());

        moneySumStyle = cs;/*from   w w w. j a v a  2  s. c  o m*/
    }
    return moneySumStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.SummaryReportGenerator.java

License:Apache License

private CellStyle getPercentSumStyle(Workbook p_workbook) {
    if (percentSumStyle == null) {
        DataFormat percentFormat = p_workbook.createDataFormat();

        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setDataFormat(percentFormat.getFormat(PERCENT_FORMAT));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.ORANGE.getIndex());

        percentSumStyle = cs;/* ww  w . ja v  a  2s .  c o  m*/
    }
    return percentSumStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.JobAttributeReportHelper.java

License:Apache License

private CellStyle getHeaderStyle(Boolean isSuper) throws Exception {
    if (isSuper && headerStyleSuper != null) {
        return headerStyleSuper;
    }/*from  w ww . java2 s  .c o  m*/

    if (!isSuper && headerStyle != null) {
        return headerStyle;
    }

    Font font = workbook.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    if (isSuper) {
        font.setColor(IndexedColors.ORANGE.getIndex());
    } else {
        font.setColor(IndexedColors.BLACK.getIndex());
    }
    font.setUnderline(Font.U_NONE);
    font.setFontName("Arial");
    font.setFontHeightInPoints((short) 9);

    CellStyle cs = workbook.createCellStyle();
    cs.setFont(font);
    cs.setWrapText(true);
    cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
    cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    cs.setBorderTop(CellStyle.BORDER_THIN);
    cs.setBorderRight(CellStyle.BORDER_THIN);
    cs.setBorderBottom(CellStyle.BORDER_THIN);
    cs.setBorderLeft(CellStyle.BORDER_THIN);

    if (isSuper) {
        headerStyleSuper = cs;
        return headerStyleSuper;
    } else {
        headerStyle = cs;
        return headerStyle;
    }
}

From source file:com.netxforge.netxstudio.server.logic.reporting.ResourceReportingEngine.java

License:Open Source License

private CellStyle createAmberBorderStyle() {
    CellStyle style = this.getWorkBook().createCellStyle();
    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setBottomBorderColor(IndexedColors.ORANGE.getIndex());
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setLeftBorderColor(IndexedColors.ORANGE.getIndex());
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setRightBorderColor(IndexedColors.ORANGE.getIndex());
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setTopBorderColor(IndexedColors.ORANGE.getIndex());
    return style;
}

From source file:com.netxforge.netxstudio.server.logic.reporting.RFSServiceDashboardReportingLogic.java

License:Open Source License

/**
 * Write each Node per NodeType column, starting
 *//* w  ww  . ja  v a 2s . c om*/
@Override
protected void writeContent(Sheet sheet, Service service, Node node, int row, int column) {

    // Write the NODE.ID box.
    int newRow = NODE_ROW + (row * NODE_HEIGHT);
    int nodeColumn = NODE_COLUMN + (column * NODE_WIDTH);

    sheet.setColumnWidth(nodeColumn, 10 * 256);

    CellStyle nodeStyle = this.getWorkBook().createCellStyle();
    nodeStyle.setBorderTop(CellStyle.BORDER_MEDIUM);
    nodeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);
    nodeStyle.setBorderLeft(CellStyle.BORDER_MEDIUM);
    nodeStyle.setBorderRight(CellStyle.BORDER_MEDIUM);
    nodeStyle.setAlignment(CellStyle.ALIGN_CENTER);
    nodeStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

    {
        Row cellRow = sheet.getRow(newRow);
        if (cellRow == null) {
            cellRow = sheet.createRow(newRow);
        }
        Cell c1 = cellRow.createCell(nodeColumn);
        c1.setCellValue(node.getNodeID());
        c1.setCellStyle(nodeStyle);
    }
    {
        Row cellRow = sheet.getRow(newRow + 1);
        if (cellRow == null) {
            cellRow = sheet.createRow(newRow + 1);
        }
        Cell c1 = cellRow.createCell(nodeColumn);
        c1.setCellStyle(nodeStyle);
    }
    {
        Row cellRow = sheet.getRow(newRow + 2);
        if (cellRow == null) {
            cellRow = sheet.createRow(newRow + 2);
        }
        Cell c1 = cellRow.createCell(nodeColumn);
        c1.setCellStyle(nodeStyle);
    }

    sheet.addMergedRegion(new CellRangeAddress(newRow, newRow + NODE_HEIGHT - 2, nodeColumn, nodeColumn));

    // In between column.
    sheet.setColumnWidth(nodeColumn + 1, 2 * 256);

    // Write the RAG

    CellStyle ragStyle = this.getWorkBook().createCellStyle();

    ragStyle.setBorderTop(CellStyle.BORDER_THIN);
    ragStyle.setBorderBottom(CellStyle.BORDER_THIN);
    ragStyle.setBorderLeft(CellStyle.BORDER_THIN);
    ragStyle.setBorderRight(CellStyle.BORDER_THIN);
    ragStyle.setAlignment(CellStyle.ALIGN_CENTER);
    ragStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    ragStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);

    int ragColumn = nodeColumn + 2;
    sheet.setColumnWidth(ragColumn, 2 * 256);

    IMonitoringSummary summary = monStateModel.summary(new NullProgressMonitor(), node,
            new IComputationContext[] { new ObjectContext<Service>(service),
                    new ObjectContext<DateTimeRange>(getPeriod()) });
    if (summary == null) {
        return;
    }
    int[] rag = summary.rag();
    {
        Row cellRow = sheet.getRow(newRow);
        if (cellRow == null) {
            cellRow = sheet.createRow(newRow);
        }
        Cell c1 = cellRow.createCell(ragColumn);

        c1.setCellValue("R");

        CellStyle rStyle = this.getWorkBook().createCellStyle();
        rStyle.cloneStyleFrom(ragStyle);
        rStyle.setFillForegroundColor(IndexedColors.RED.getIndex());
        c1.setCellStyle(rStyle);

        if (rag != null) {
            c1.setCellValue(rag[0]);
        }
    }
    {
        Row cellRow = sheet.getRow(newRow + 1);
        if (cellRow == null) {
            cellRow = sheet.createRow(newRow + 1);
        }
        Cell c1 = cellRow.createCell(ragColumn);

        c1.setCellValue("A");

        CellStyle aStyle = this.getWorkBook().createCellStyle();
        aStyle.cloneStyleFrom(ragStyle);
        aStyle.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
        c1.setCellStyle(aStyle);

        if (rag != null) {
            c1.setCellValue(rag[1]);
        }
    }
    {
        Row cellRow = sheet.getRow(newRow + 2);
        if (cellRow == null) {
            cellRow = sheet.createRow(newRow + 2);
        }
        Cell c1 = cellRow.createCell(ragColumn);
        c1.setCellValue("G");
        CellStyle gStyle = this.getWorkBook().createCellStyle();
        gStyle.cloneStyleFrom(ragStyle);
        gStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());
        c1.setCellStyle(gStyle);

        if (rag != null) {
            c1.setCellValue(rag[2]);
        }

    }
    // Clean our adapted summary.
    node.eAdapters().remove(summary);

}

From source file:com.rarediscovery.services.logic.WorkPad.java

protected CellStyle applySelectedStyle() {
    Font font = workbook.createFont();
    if (bold) {//ww  w  . j ava2s. co m
        font.setBold(true);
    } else {
        font.setBold(false);
    }

    CellStyle style = workbook.createCellStyle();
    style.setFont(font);

    if (alignRight) {
        style.setAlignment(CellStyle.ALIGN_RIGHT);
    } else {
        style.setAlignment(CellStyle.ALIGN_LEFT);
    }

    if (backgroundColor) {
        style.setFillBackgroundColor(IndexedColors.ORANGE.getIndex());
        style.setFillPattern(CellStyle.BIG_SPOTS);
    } else {
        style.setFillBackgroundColor(IndexedColors.WHITE.getIndex());
    }

    return style;
}

From source file:FormatConvert.tab2excel.java

public void tab2excel() throws FileNotFoundException, IOException {
    Workbook wb = new XSSFWorkbook();
    Sheet sheet1 = wb.createSheet("input");

    CellStyle style = wb.createCellStyle();
    style.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);

    int rowIndex = 0;
    BufferedReader br = null;//from   w  ww.ja v  a  2  s. c  om
    try {
        br = new BufferedReader(new FileReader(new File(input)));
        String[] str;
        while (br.ready()) {
            str = br.readLine().split(seperator);

            Row row = sheet1.createRow(rowIndex);
            for (int i = 0; i < str.length; i++) {
                row.createCell(i).setCellValue(str[i]);
            }
            rowIndex++;
        }
        br.close();
    } catch (FileNotFoundException ex) {
        System.out.println(input + " is not found! please check your filepath ");
    } catch (IOException ex) {
        System.out.println("IO error");
    }

    FileOutputStream fileOut = new FileOutputStream(output + ".xlsx");
    wb.write(fileOut);
    fileOut.close();
    System.out.println("Convert finished. The output file is named as " + output + ".xlsx");
}

From source file:FormatStatics.HeaderFormats.java

private static short InterpretColor(String color) {
    switch (color) {
    case "blue":
        return IndexedColors.BLUE.getIndex();
    case "red":
        return IndexedColors.RED.getIndex();
    case "green":
        return IndexedColors.GREEN.getIndex();
    case "teal":
        return IndexedColors.TEAL.getIndex();
    case "orange":
        return IndexedColors.ORANGE.getIndex();
    default://  w w w  .  jav  a  2  s .  c om
        return IndexedColors.WHITE.getIndex();
    }
}