Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.BorderStyle


        cell.setFormat(format);
      }
    }
  }
  public static void setBorder(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0xF);
  }
View Full Code Here


  public static void setBorder(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0xF);
  }
  public static void setBorderTop(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0x4);
  }
View Full Code Here

  public static void setBorderTop(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0x4);
  }
  public static void setBorderLeft(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0x8);
  }
View Full Code Here

  public static void setBorderLeft(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0x8);
  }
  public static void setBorderBottom(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0x1);
  }
View Full Code Here

  public static void setBorderBottom(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0x1);
  }
  public static void setBorderRight(Sheet sheet,int row,int col,String color,BorderLineStyle linestyle){
    BorderStyle bs = new BorderStyleImpl(color,linestyle);
    setBorder(sheet,row,col,bs,0x2);
  }
View Full Code Here

    boolean hitBottom = false;

    if (_cell != null) {
      Format format = _cell.getFormat();
      if (format != null){
        BorderStyle bb = format.getBorderBottom();
        if (bb != null) {
          hitBottom = appendBorderStyle(sb, "bottom", bb);
        }
      }
    }
    Cell next = null;
    if (!hitBottom) {
      next = _sheet.getCell(_row + 1, _col);
      /*if(next == null){ // don't search into merge ranges
        //check is _row+1,_col in merge range
        MergedRect rect = _mmHelper.getMergeRange(_row+1, _col);
        if(rect !=null){
          next = _sheet.getCell(rect.getTop(),rect.getLeft());
        }
      }*/
      if (next != null) {
        Format format = next.getFormat();
        if (format != null){
          BorderStyle bb = format.getBorderTop();// get top border of
          if (bb != null) {
            // set next row top border as cell's bottom border;
            hitBottom = appendBorderStyle(sb, "bottom", bb);
          }
        }
      }
    }
   
    //border depends on next cell's background color
    if(!hitBottom && next !=null){
      Format format = next.getFormat();
      if (format != null){
        String bgColor = format.getFillColor();
        if (AUTO_COLOR.equals(bgColor)) {
          bgColor = null;
        }
        if (bgColor != null && !bgColor.toUpperCase().endsWith("FFFFFF")) {
          BorderStyle bb = new BorderStyleImpl(bgColor,BorderLineStyle.THIN);
          hitBottom = appendBorderStyle(sb, "bottom", bb);
        }
      }
    }
   
    //border depends on current cell's background color
    if(!hitBottom && _cell !=null){
      Format format = _cell.getFormat();
      if (format != null){
        String bgColor = format.getFillColor();
        if (AUTO_COLOR.equals(bgColor)) {
          bgColor = null;
        }
        if (bgColor != null && !bgColor.toUpperCase().endsWith("FFFFFF")) {
          BorderStyle bb = new BorderStyleImpl(bgColor,BorderLineStyle.THIN);
          hitBottom = appendBorderStyle(sb, "bottom", bb);
        }
      }
    }
   
View Full Code Here

        hitMerge = true;
        right = _sheet.getCell(_row,rect.getRight());
      }
      Format format = right.getFormat();
      if (format != null){
        BorderStyle bb = format.getBorderRight();
        if (bb != null) {
          hitRight = appendBorderStyle(sb, "right", bb);
        }
      }
    }

    Cell next = null;
    //if no border for target cell,then check is this cell in a merge range
    //if(true) then try to get next cell after this merge range
    //else get next cell of this cell
    if(!hitRight){
      int c = hitMerge?rect.getRight()+1:_col+1;
      next = _sheet.getCell(_row,c);
      //find the right cell of merge range.
      if(next!=null){
        Format format = next.getFormat();
        if (format != null){
          BorderStyle bb = format.getBorderLeft();//get left here
          if (bb != null) {
            hitRight = appendBorderStyle(sb, "right", bb);
          }
        }
      }
    }

    //border depends on next cell's background color
    if(!hitRight && next !=null){
      Format format = next.getFormat();
      if (format != null){
        String bgColor = format.getFillColor();
        if (AUTO_COLOR.equals(bgColor)) {
          bgColor = null;
        }
        if (bgColor != null && !bgColor.toUpperCase().endsWith("FFFFFF")) {
          BorderStyle bb = new BorderStyleImpl(bgColor,BorderLineStyle.THIN);
          hitRight = appendBorderStyle(sb, "right", bb);
        }
      }
    }
    //border depends on current cell's background color
    if(!hitRight && _cell !=null){
      Format format = _cell.getFormat();
      if (format != null){
        String bgColor = format.getFillColor();
        if (AUTO_COLOR.equals(bgColor)) {
          bgColor = null;
        }
        if (bgColor != null && !bgColor.toUpperCase().endsWith("FFFFFF")) {
          BorderStyle bb = new BorderStyleImpl(bgColor,BorderLineStyle.THIN);
          hitRight = appendBorderStyle(sb, "right", bb);
        }
      }
    }
   
View Full Code Here

   
    //1. copy format to all merged cells from the cell
    //2. set contents to null
    //3. check border consistency
    //4. clear interior border of the merged cells
    BorderStyle lstyle = fmt.getBorderLeft();
    BorderStyle tstyle = fmt.getBorderTop();
   
    BorderLineStyle lline = lstyle.getBorderLineStyle();
    BorderLineStyle tline = tstyle.getBorderLineStyle();
    BorderLineStyle rline = null;
    BorderLineStyle bline = null;
    String lcolor = lstyle.getBorderColor();
    String tcolor = tstyle.getBorderColor();
    String rcolor = null;
    String bcolor = null;
    boolean lequal = true;
    boolean tequal = true;
    boolean requal = true;
    boolean bequal = true;
   
    for (int row = top; row <= bottom; ++row) {
      for (int col = left; col <= right; ++col) {
        if (row == top && col == left) { //skip the first cell
          continue;
        }
        final CellImpl x = (CellImpl) _matrix.getCellIndex(row, col).getCell();
        x.mySetValue(null, false); //set content to null, but don't fire event
       
        FormatImpl xfmt;
        try {
          xfmt = (FormatImpl) fmt.clone();
        } catch (CloneNotSupportedException e) {
          throw ModelException.Aide.wrap(e);
        }
        final FormatImpl ofmt = getFormatOrCreate(x);
        //check top border
        if (row == top) {
          if (tequal) {
            final BorderStyle tborder = ofmt.getBorderTop();
            final BorderLineStyle tl  = tborder.getBorderLineStyle();
            final String tc = tborder.getBorderColor();
            if (tline != tl) {
              tequal = false;
            }
            if (!tcolor.equals(tc)) {
              tequal = false;
            }
            if (tequal) {
              xfmt.setBorderTop(tborder);
            }
          }
        } else {
          xfmt.setBorderTop(null);
        }
        //check bottom border
        if (row == bottom) {
          if (bequal) {
            final BorderStyle bborder = ofmt.getBorderBottom();
            final BorderLineStyle bl  = bborder.getBorderLineStyle();
            final String bc = bborder.getBorderColor();
            if (bline == null) {
              bline = bl;
            } else if (bline != bl) {
              bequal = false;
            }
            if (bcolor == null) {
              bcolor = bc;
            } else if (!bcolor.equals(bc)) {
              bequal = false;
            }
            if (bequal) {
              xfmt.setBorderBottom(bborder);
            }
          }
        } else {
          xfmt.setBorderBottom(null);
        }
        //check left border
        if (col == left) {
          if (lequal) {
            final BorderStyle lborder = ofmt.getBorderLeft();
            final BorderLineStyle ll  = lborder.getBorderLineStyle();
            final String lc = lborder.getBorderColor();
            if (lline != ll) {
              lequal = false;
            }
            if (!lcolor.equals(lc)) {
              lequal = false;
            }
            if (lequal) {
              xfmt.setBorderLeft(lborder);
            }
          }
        } else {
          xfmt.setBorderLeft(null);
        }
        //check right border
        if (col == right) {
          if (requal) {
            final BorderStyle rborder = ofmt.getBorderRight();
            final BorderLineStyle rl  = rborder.getBorderLineStyle();
            final String rc = rborder.getBorderColor();
            if (rline == null) {
              rline = rl;
            } else if (rline != rl) {
              requal = false;
            }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.model.BorderStyle

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.