Package jxl.format

Examples of jxl.format.Colour


        && borderStyle[BOTTOM] == BorderLineStyle.NONE
        && borderStyle[RIGHT] == BorderLineStyle.NONE
        )
      {
        BorderLineStyle style = getBorderLineStyle(pen);
        Colour colour = getWorkbookColour(pen.getLineColor());

        borderStyle[TOP] = style;
        borderStyle[LEFT] = style;
        borderStyle[BOTTOM] = style;
        borderStyle[RIGHT] = style;
View Full Code Here


  protected void initCustomPalette()
  {
    //mark "fixed" colours as always used
    for (int i = 0; i < FIXED_COLOURS.length; i++)
    {
      Colour colour = FIXED_COLOURS[i];
      setColourUsed(colour);
    }
  }
View Full Code Here

    sheet.removeColumn(col);
  }

  protected void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
  {
    Colour forecolor = BLACK;
    if (gridCell.getForecolor() != null)
    {
      forecolor = getWorkbookColour(gridCell.getForecolor());
    }

    Pattern mode = backgroundMode;
    Colour backcolor = WHITE;
   
    if (!isIgnoreCellBackground && gridCell.getCellBackcolor() != null)
    {
      mode = Pattern.SOLID;
      backcolor = getWorkbookColour(gridCell.getCellBackcolor(), true);
View Full Code Here

  protected void exportLine(JRPrintLine line, JRExporterGridCell gridCell, int col, int row) throws JRException
  {
    addMergeRegion(gridCell, col, row);

    Colour forecolor2 = getWorkbookColour(line.getLinePen().getLineColor());
    WritableFont cellFont2 = getLoadedFont(getDefaultFont(), forecolor2.getValue(), getLocale());
   
    Colour backcolor = WHITE;
    Pattern mode = this.backgroundMode;

    if (!isIgnoreCellBackground && gridCell.getCellBackcolor() != null)
    {
      mode = Pattern.SOLID;
View Full Code Here

  protected void exportRectangle(JRPrintGraphicElement element, JRExporterGridCell gridCell, int col, int row) throws JRException
  {
    addMergeRegion(gridCell, col, row);

    Colour backcolor = WHITE;
    Pattern mode = this.backgroundMode;

    if (!isIgnoreCellBackground && gridCell.getCellBackcolor() != null)
    {
      mode = Pattern.SOLID;
      backcolor = getWorkbookColour(gridCell.getCellBackcolor(), true);
    }

    Colour forecolor = getWorkbookColour(element.getLinePen().getLineColor());
    WritableFont cellFont2 = getLoadedFont(getDefaultFont(), forecolor.getValue(), getLocale());
    WritableCellFormat cellStyle2 =
      getLoadedCellStyle(
        mode,
        backcolor,
        cellFont2,
View Full Code Here

    JRStyledText styledText = getStyledText(text);

    if (styledText != null)
    {
      Colour forecolor = getWorkbookColour(text.getForecolor());
      WritableFont cellFont = this.getLoadedFont(text, forecolor.getValue(), getTextLocale(text));

      TextAlignHolder alignment = getTextAlignHolder(text);
      int horizontalAlignment = getHorizontalAlignment(alignment);
      int verticalAlignment = getVerticalAlignment(alignment);
      int rotation = getRotation(alignment);

      Pattern mode = this.backgroundMode;
      Colour backcolor = WHITE;

      if (!isIgnoreCellBackground && gridCell.getCellBackcolor() != null)
      {
        mode = Pattern.SOLID;
        backcolor = getWorkbookColour(gridCell.getCellBackcolor(), true);
View Full Code Here

          break;
        }
      }

      Pattern mode = this.backgroundMode;
      Colour background = WHITE;

      if (!isIgnoreCellBackground && gridCell.getCellBackcolor() != null)
      {
        mode = Pattern.SOLID;
        background = getWorkbookColour(gridCell.getCellBackcolor(), true);
      }

      if (element.getModeValue() == ModeEnum.OPAQUE)
      {
        background = getWorkbookColour(element.getBackcolor(), true);
      }

      Colour forecolor = getWorkbookColour(element.getLineBox().getPen().getLineColor());

      WritableFont cellFont2 = this.getLoadedFont(getDefaultFont(), forecolor.getValue(), getLocale());

      WritableCellFormat cellStyle2 =
        getLoadedCellStyle(
          mode,
          background,
View Full Code Here

    return getWorkbookColour(awtColor);
  }

  protected Colour getWorkbookColour(Color awtColor)
  {
    Colour colour;
    if (createCustomPalette)
    {
      colour = (Colour) workbookColours.get(awtColor);
      if (colour == null)
      {
View Full Code Here

  protected Colour determineWorkbookColour(Color awtColor)
  {
    //nearest match
    int minDist = 999;
    Colour minColour = null;

    //nearest match among the available (not used) colours
    int minDistAvailable = 999;
    Colour minColourAvailable = null;

    Colour[] colors = Colour.getAllColours();
    for (int i = 0; i < colors.length; i++)
    {
      Colour colour = colors[i];
      RGB customRGB = (RGB) usedColours.get(colour);

      RGB rgb = customRGB == null ? colour.getDefaultRGB() : customRGB;
      int dist = rgbDistance(awtColor, rgb);
      if (dist < minDist)
      {
        minDist = dist;
        minColour = colour;
      }

      if (dist == 0)//exact match
      {
        break;
      }

      if (customRGB == null)//the colour is not used
      {
        if (dist < minDistAvailable)
        {
          minDistAvailable = dist;
          minColourAvailable = colour;
        }
      }
    }

    Colour workbookColour;
    if (minDist == 0)//exact match found
    {
      if (!usedColours.containsKey(minColour))
      {
        //if the colour is not marked as used, mark it
View Full Code Here

    return workbookColour;
  }

  protected static Colour getNearestColour(Color awtColor)
  {
    Colour color = (Colour) colorsCache.get(awtColor);

    if (color == null)
    {
      Colour[] colors = Colour.getAllColours();
      if ((colors != null) && (colors.length > 0))
      {
        int minDiff = 999;

        for (int i = 0; i < colors.length; i++)
        {
          Colour crtColor = colors[i];
          int diff = rgbDistance(awtColor, crtColor.getDefaultRGB());

          if (diff < minDiff)
          {
            minDiff = diff;
            color = crtColor;
View Full Code Here

TOP

Related Classes of jxl.format.Colour

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.