Package org.apache.metamodel.data

Examples of org.apache.metamodel.data.Style$Color


          cell.setCellValue((Date) value);
        } else {
          cell.setCellValue(value.toString());
        }

        Style style = styles[i];
        if (style != null && !Style.NO_STYLE.equals(style)) {
          LazyRef<Font> font = new LazyRef<Font>() {
            @Override
            protected Font fetch() {
              return getUpdateCallback().createFont();
            }

          };
          if (style.isBold()) {
            font.get().setBoldweight(Font.BOLDWEIGHT_BOLD);
          }
          if (style.isItalic()) {
            font.get().setItalic(true);
          }
          if (style.isUnderline()) {
            font.get().setUnderline(Font.U_SINGLE);
          }
          if (style.getFontSize() != null) {
            Integer fontSize = style.getFontSize();
            SizeUnit sizeUnit = style.getFontSizeUnit();
            if (sizeUnit == SizeUnit.PERCENT) {
              fontSize = convertFontPercentageToPt(fontSize);
            }
            font.get().setFontHeightInPoints(fontSize.shortValue());
          }
          Color foregroundColor = style.getForegroundColor();
          if (foregroundColor != null) {
            short index = getUpdateCallback().getColorIndex(
                foregroundColor);
            font.get().setColor(index);
          }
          if (font.isFetched()) {
            cellStyle.get().setFont(font.get());
          }
          if (style.getAlignment() != null) {
            cellStyle.get().setAlignment(
                getAlignment(style.getAlignment()));
          }

          final Color backgroundColor = style.getBackgroundColor();
          if (backgroundColor != null) {
            cellStyle.get().setFillPattern(
                CellStyle.SOLID_FOREGROUND);
            cellStyle.get().setFillForegroundColor(
                getUpdateCallback().getColorIndex(
View Full Code Here


        final Table table = dc.getDefaultSchema().getTables()[0];
        final Column nameColumn = table.getColumnByName("name");
        dc.executeUpdate(new UpdateScript() {
            @Override
            public void run(UpdateCallback cb) {
                Style clownStyle = new StyleBuilder().bold().foreground(255, 0, 0).background(0, 0, 255).create();

                Style thirtyStyle = new StyleBuilder().italic().underline().centerAligned().foreground(10, 10, 200)
                        .create();

                cb.insertInto(table).value("id", 1000).value(nameColumn, "pennywise the [clown]", clownStyle)
                        .value("gender", "male").value("age", 30, thirtyStyle).execute();
            }
View Full Code Here

        if (row != null) {
            for (int i = 0; i < size; i++) {
                final int columnNumber = header.getSelectItem(i).getColumn().getColumnNumber();
                final Cell cell = row.getCell(columnNumber);
                final String value = ExcelUtils.getCellValue(workbook, cell);
                final Style style = ExcelUtils.getCellStyle(workbook, cell);
                values[i] = value;
                styles[i] = style;
            }
        }
View Full Code Here

        final boolean[] explicitNulls = getExplicitNulls();

        for (int i = 0; i < columns.length; i++) {
            Object value = values[i];
            Column column = columns[i];
            Style style = styles[i];
            if (value == null) {
                if (explicitNulls[i]) {
                    insertBuilder = insertBuilder.value(column, value, style);
                }
            } else {
View Full Code Here

            assertEquals(comparedValues[j], values[j]);
          }

          // compare styles
          for (int j = 0; j < comparedValues.length; j++) {
            Style style1 = comparedRow.getStyle(j);
            Style style2 = row.getStyle(j);
            assertEquals("Diff in style on row: " + row
                + " (value index = " + j + ")\nStyle 1: "
                + style1 + "\nStyle 2: " + style2 + ". ",
                style1, style2);
          }
View Full Code Here

                final Object physicalValue = converter.toPhysicalValue(value);
                logger.debug("Converted virtual value {} to {}", value, physicalValue);
                if (value == null && physicalValue == null && !rowBuilder.isSet(column)) {
                    logger.debug("Omitting implicit null value for column: {}", column);
                } else {
                    final Style style = row.getStyle(indexInRow);
                    rowBuilder.value(column, physicalValue, style);
                }
            }
        }
        return rowBuilder;
View Full Code Here

        final boolean[] explicitNulls = getExplicitNulls();

        for (int i = 0; i < columns.length; i++) {
            Object value = values[i];
            Column column = columns[i];
            Style style = styles[i];
            if (value == null) {
                if (explicitNulls[i]) {
                    updateBuilder = updateBuilder.value(column, value, style);
                }
            } else {
View Full Code Here

        final Table table = dc.getDefaultSchema().getTables()[0];
        final Column nameColumn = table.getColumnByName("name");
        dc.executeUpdate(new UpdateScript() {
            @Override
            public void run(UpdateCallback cb) {
                Style clownStyle = new StyleBuilder().bold().foreground(255, 0, 0).background(0, 0, 255).create();

                Style thirtyStyle = new StyleBuilder().italic().underline().centerAligned().foreground(10, 10, 200).create();

                cb.insertInto(table).value("id", 1000).value(nameColumn, "pennywise the [clown]", clownStyle)
                        .value("gender", "male").value("age", 30, thirtyStyle).execute();
            }
        });
View Full Code Here

TOP

Related Classes of org.apache.metamodel.data.Style$Color

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.