Examples of CellFormat


Examples of com.projity.graphic.configuration.CellFormat

public class ResourceCellStyle extends DefaultCellStyle {
  public ResourceCellStyle(){
   
  }
  public CellFormat getCellFormat(Object object) {
    CellFormat format=super.getCellFormat(object);
    GraphicNode node=(GraphicNode)object;
    Object impl=node.getNode().getImpl();
    if (impl instanceof ResourceImpl) {
      if (((ResourceImpl)impl).getAssignments().size()>0) // make assigned resources have a special color
        format.setBackground("PALE_GREEN");
    }

    return format;
  }
View Full Code Here

Examples of com.projity.graphic.configuration.CellFormat

*/
public class CellUtility {
  public static void setAppearance(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column, JComponent component){
    CommonSpreadSheetModel model = (CommonSpreadSheetModel) table.getModel();
    GraphicNode node = model.getNode(row);
    CellFormat cellFormat=model.getCellProperties(node);
    if (isSelected){
      component.setForeground(/*table.getSelectionForeground()*/Color.WHITE);
      component.setBackground(/*Color.BLACK*/GraphicManager.getInstance().getLafManager().getSelectedBackgroundColor());
    }else{

      Color foreground=cellFormat.getForegroundObject();
      component.setForeground((foreground==null)?table.getForeground():foreground);
      Color background=cellFormat.getBackgroundObject();
      component.setBackground((background==null)?table.getBackground():background);
    }
    //component.setFont(table.getFont());
    if (hasFocus){
      component.setBorder( /*UIManager.getBorder("Table.focusCellHighlightBorder")*/new LineBorder(Color.BLACK) );
      if (table.isCellEditable(row, column)) {
        Color foreground=cellFormat.getForegroundObject();
        component.setForeground((foreground==null)?UIManager.getColor("Table.focusCellForeground"):foreground );
        Color background=cellFormat.getBackgroundObject();
        component.setBackground((background==null)?(Environment.isMac()?Colors.NOT_TOO_DARK_GRAY:UIManager.getColor("Table.focusCellBackground")):background );
      }
    }else{
      component.setBorder(new EmptyBorder(1, 1, 1, 1));
//      if (!model.isRowEditable(row))
View Full Code Here

Examples of com.projity.graphic.configuration.CellFormat

    return component;
  }

  public static Component getComponent(Object value, GraphicNode node, SpreadSheetParams params){
    NameCellComponent component = getUninitializedComponent(false);
    CellFormat format=params.getFieldArray().getCellStyle().getCellFormat(node);
    component.getTextComponent().setBorder(null);
    component.setOffline(true);
    CellUtility.setAppearance(format,component);
    String valueS=value == null? " " : value.toString();//to avoid void textComponents with no height
    if (valueS.length()==0) valueS=" ";
    component.setText(valueS);
    int level=params.getCache().getLevel(node);
    component.setLevel((node.isVoid())?(level+1):level,true);
    component.setLazy(node.isLazyParent());
    component.setFetched(node.isFetched());
    if (format.isCompositeIcon()) {
      component.setCollapsed(node.isCollapsed());
    } else {
      component.setLeaf(node.isVoid());
    }
    FontManager.setComponentFont(format,component);
View Full Code Here

Examples of jxl.format.CellFormat

        bw.newLine();
        bw.write("    <name><![CDATA["+s.getName()+"]]></name>");
        bw.newLine();
     
        Cell[] row = null;
        CellFormat format = null;
        Font font = null;
     
        for (int i = 0 ; i < s.getRows() ; i++)
        {
          bw.write("    <row number=\"" + i + "\">");
          bw.newLine();
          row = s.getRow(i);

          for (int j = 0 ; j < row.length; j++)
          {
            // Remember that empty cells can contain format information
            if ((row[j].getType() != CellType.EMPTY) ||
                (row[j].getCellFormat() != null))
            {
              format = row[j].getCellFormat();
              bw.write("      <col number=\"" + j + "\">");
              bw.newLine();
              bw.write("        <data>");
              bw.write("<![CDATA["+row[j].getContents()+"]]>");
              bw.write("</data>");
              bw.newLine();    

              if (row[j].getCellFormat() != null)
              {
                bw.write("        <format wrap=\"" + format.getWrap() + "\"");
                bw.newLine();
                bw.write("                align=\"" +
                         format.getAlignment().getDescription() + "\"");
                bw.newLine();
                bw.write("                valign=\"" +
                         format.getVerticalAlignment().getDescription() + "\"");
                bw.newLine();
                bw.write("                orientation=\"" +
                         format.getOrientation().getDescription() + "\"");
                bw.write(">");
                bw.newLine();

                // The font information
                font = format.getFont();
                bw.write("          <font name=\"" + font.getName() + "\"");
                bw.newLine();
                bw.write("                point_size=\"" +
                         font.getPointSize() + "\"");
                bw.newLine();
                bw.write("                bold_weight=\"" +
                         font.getBoldWeight() + "\"");
                bw.newLine();
                bw.write("                italic=\"" + font.isItalic() + "\"");
                bw.newLine();
                bw.write("                underline=\"" +
                         font.getUnderlineStyle().getDescription() + "\"");
                bw.newLine();
                bw.write("                colour=\"" +
                         font.getColour().getDescription() + "\"");
                bw.newLine();
                bw.write("                script=\"" +
                         font.getScriptStyle().getDescription() + "\"");
                bw.write(" />");
                bw.newLine();


                // The cell background information
                if (format.getBackgroundColour() != Colour.DEFAULT_BACKGROUND ||
                    format.getPattern()          != Pattern.NONE)
                {
                  bw.write("          <background colour=\"" +
                           format.getBackgroundColour().getDescription() + "\"");
                  bw.newLine();
                  bw.write("                      pattern=\"" +
                           format.getPattern().getDescription() + "\"");
                  bw.write(" />");
                  bw.newLine();
                }


                // The cell border, if it has one
                if (format.getBorder(Border.TOP  != BorderLineStyle.NONE ||
                    format.getBorder(Border.BOTTOM) != BorderLineStyle.NONE ||
                    format.getBorder(Border.LEFT)   != BorderLineStyle.NONE ||
                    format.getBorder(Border.RIGHT!= BorderLineStyle.NONE)
                {
                 
                  bw.write("          <border top=\"" +
                           format.getBorder(Border.TOP).getDescription() + "\"");
                  bw.newLine();
                  bw.write("                  bottom=\"" +
                           format.getBorder(Border.BOTTOM).getDescription() +
                           "\"");
                  bw.newLine();
                  bw.write("                  left=\"" +
                           format.getBorder(Border.LEFT).getDescription() + "\"");
                  bw.newLine();
                  bw.write("                  right=\"" +
                           format.getBorder(Border.RIGHT).getDescription() + "\"");
                  bw.write(" />");
                  bw.newLine();
                }

                // The cell number/date format
                if (!format.getFormat().getFormatString().equals(""))
                {
                  bw.write("          <format_string string=\"");
                  bw.write(format.getFormat().getFormatString());
                  bw.write("\" />");
                  bw.newLine();
                }

                bw.write("        </format>");
View Full Code Here

Examples of jxl.format.CellFormat

    logger.info("Modifying...");

    WritableSheet sheet = w.getSheet("modified");
   
    WritableCell cell = null;
    CellFormat cf = null;
    Label l = null;
    WritableCellFeatures wcf = null;

    // Change the format of cell B4 to be emboldened
    cell = sheet.getWritableCell(1,3);
View Full Code Here

Examples of jxl.format.CellFormat

  /*
   * Import cell Format
   */
  private FormatImpl importCellStyle(jxl.Cell cell, int row, int col){
    FormatImpl zkFormat = new FormatImpl();
    CellFormat format = cell.getCellFormat();
    zkFormat.setFormatCodes(format.getFormat().getFormatString());
   
    /* text align */
    zkFormat.setTextVAlign(ExcelFormatHelper.getTextVAlign(format.getVerticalAlignment()));
    zkFormat.setTextHAlign(ExcelFormatHelper.getTextHAlign(format.getAlignment()));
   
    /* text indent */
    zkFormat.setTextIndent(format.getIndentation());
   
    /* Text Orient */
    //TODO System.out.println("TODO: Orein: "+format.getOrientation().getDescription());
    /* Text Angle*/
    zkFormat.setTextAngle(format.getOrientation().getValue());
   
    /* Text Control*/
    zkFormat.setTextWrap(format.getWrap());
    zkFormat.setTextShrinkToFit(format.isShrinkToFit());
    
    /* Text Direction*/
    //TODO
   
    jxl.format.Font font = format.getFont();
   
    /* font type */
    zkFormat.setFontType(font.getName());
   
    /* font style bold, italic */
    zkFormat.setFontStyle(ExcelFormatHelper.getFontStyle(font));
   
    /* font size */
    zkFormat.setFontSize(font.getPointSize());
   
    /* font underline */
    zkFormat.setFontUnderline(ExcelFormatHelper.getFontUnlineStyle(font.getUnderlineStyle()));
 
    /* font color*/
    zkFormat.setFontColor(ExcelFormatHelper.jxlColourToHex(font.getColour()));
   
    /* font strikethrough */
    zkFormat.setFontStrikethrough(font.isStruckout());
   
    /* font superscript*/
    zkFormat.setFontSuperscript(ExcelFormatHelper.isSuperscript(font.getScriptStyle()));
   
    /* font superscript*/
    zkFormat.setFontSubscript(ExcelFormatHelper.isSubscript(font.getScriptStyle()));
   
    /* Border */
    if(format.hasBorders()){
      zkFormat.setBorderBottom(
          ExcelFormatHelper.getBorderStyle(
              format.getBorderColour(Border.BOTTOM),
              format.getBorderLine(Border.BOTTOM)));
      //System.out.println(format.getBorderColour(Border.BOTTOM).getDescription());
      zkFormat.setBorderLeft(
          ExcelFormatHelper.getBorderStyle(
              format.getBorderColour(Border.LEFT),
              format.getBorderLine(Border.LEFT)));
     
      zkFormat.setBorderRight(
          ExcelFormatHelper.getBorderStyle(
              format.getBorderColour(Border.RIGHT),
              format.getBorderLine(Border.RIGHT)));
     
      zkFormat.setBorderTop(
          ExcelFormatHelper.getBorderStyle(
              format.getBorderColour(Border.TOP),
              format.getBorderLine(Border.TOP)));
    }
   
    /* Fill color hexidecimal #RRGGBB format (NONE means no color) */
    zkFormat.setFillColor(ExcelFormatHelper.jxlColourToHex(format.getBackgroundColour()));
   
    /* Pattern */
    //TODO pattern color
    zkFormat.setPatternStyle(ExcelFormatHelper.getPatternStyle(format.getPattern()));
   
    /* isLocked */
    zkFormat.setLocked(format.isLocked());
   
    /* isHidden */
    zkFormat.setHidden(cell.isHidden());
   
   
 
View Full Code Here

Examples of jxl.format.CellFormat

    return zkFormat;
  }
 
  /* import DateTimeCell format*/
  private FormatImpl importDateTimeCelFormat(FormatImpl zkFormat, jxl.DateCell cell , int row, int col){
    CellFormat cf = cell.getCellFormat();
    zkFormat.setFormatCodes(cf.getFormat().getFormatString());
    return zkFormat;
  }
View Full Code Here

Examples of jxl.format.CellFormat

    }
  }

  private void styleCell( String _styleName, WritableWorkbook _xwb, WritableSheet _xs, WritableCell _xc )
  {
    final CellFormat style = getCellStyle( _styleName );
    if (null != style) {
      _xc.setCellFormat( style );
    }
  }
View Full Code Here

Examples of org.apache.poi.ss.format.CellFormat

                    if (cell != null) {
                        style = cell.getCellStyle();
                        attrs = tagStyle(cell, style);
                        //Set the value that is rendered for the cell
                        //also applies the format
                        CellFormat cf = CellFormat.getInstance(
                                style.getDataFormatString());
                        CellFormatResult result = cf.apply(cell);
                        content = result.text;
                        if (content.equals(""))
                            content = "&nbsp;";
                    }
                }
View Full Code Here

Examples of org.apache.poi.ss.format.CellFormat

                    if (cell != null) {
                        style = cell.getCellStyle();
                        attrs = tagStyle(cell, style);
                        //Set the value that is rendered for the cell
                        //also applies the format
                        CellFormat cf = CellFormat.getInstance(
                                style.getDataFormatString());
                        CellFormatResult result = cf.apply(cell);
                        content = result.text;
                        if (content.equals(""))
                            content = "&nbsp;";
                    }
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.