Package org.zkoss.zss.engine

Examples of org.zkoss.zss.engine.Ref


    return ref.getLeftCol();
  }

  @Override
  public int getLastColumn() {
    final Ref ref = getRefs().iterator().next();
    return ref.getRightCol();
  }
View Full Code Here


    return ref.getRightCol();
  }

  @Override
  public int getLastRow() {
    final Ref ref = getRefs().iterator().next();
    return ref.getBottomRow();
  }
View Full Code Here

  }

  @Override
  public Object getValue() {
    synchronized (_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null) {
          return getValue0(cell);
        }
      }
View Full Code Here

  @Override
  public void setValue(Object value) {
    //ZSS-78: Implementation of RangeImpl#setValue() is not correct
    synchronized (_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        Set<Ref>[] refs = null;
        if (value instanceof FormulaError) {
          refs = setValue(Byte.valueOf(((FormulaError)value).getCode()));
        } else if (value instanceof Byte) {
View Full Code Here

        }
        final RefAddr refAddr = new RefAddr(ntop, nleft, nbottom, nright);
        if (refMap.containsKey(refAddr)) { //same area there, next
          continue;
        }
        final Ref newRef = (nleft == nright && ntop == nbottom) ?
          new CellRefImpl(ntop, nleft, refSheet) :
          new AreaRefImpl(ntop, nleft, nbottom, nright, refSheet);
        nrefs.add(newRef);
        refMap.put(refAddr, newRef);
      }
View Full Code Here

  }
 
  @Override
  public Range getCurrentRegion() {
    synchronized (_sheet) {
      final Ref ref = getRefs().iterator().next();
      final int row = ref.getTopRow();
      final int col = ref.getLeftCol();
      CellRangeAddress cra = getCurrentRegion(_sheet, row, col);
      return cra == null ?
          new RangeImpl(row, col, _sheet, _sheet) :
          new RangeImpl(cra.getFirstRow(), cra.getFirstColumn(), cra.getLastRow(), cra.getLastColumn(), _sheet, _sheet);
    }
View Full Code Here

      } else {
        //The logic to decide the actual affected range to implement autofilter:
        //If it's a multi cell range, it's the range intersect with largest range of the sheet.
        //If it's a single cell range, it has to be extend to a continuous range by looking up the near 8 cells of the single cell.
        affectedArea = new CellRangeAddress(getRow(), getLastRow(), getColumn(), getLastColumn());
        final Ref ref = getRefs().iterator().next();
        //ZSS-199
        if (ref.isWholeRow()) {
          //extend to a continuous range from the top row
          CellRangeAddress maxRange = getRowCurrentRegion(_sheet, ref.getTopRow(), ref.getBottomRow());
          if (maxRange == null) {
            throw new RuntimeException(ALL_BLANK_MSG);
          }
          affectedArea = maxRange;
        } else if (BookHelper.isOneCell(_sheet, affectedArea)) { //only one cell selected(include merged one), try to look the max range surround by blank cells
View Full Code Here

      final DrawingManager dm = ((SheetCtrl)_sheet).getDrawingManager();
      final XSSFChartX chartX = (XSSFChartX) dm.addChartX(_sheet, anchor, data, type, grouping, pos);
      final RangeImpl rng = (RangeImpl) Ranges.range(_sheet, anchor.getRow1(), anchor.getCol1(), anchor.getRow2(), anchor.getCol2());
      final Collection<Ref> refs = rng.getRefs();
      if (refs != null && !refs.isEmpty()) {
        final Ref ref = refs.iterator().next();
        BookHelper.notifyChartAdd(ref, chartX);
      }
      return chartX.getChart();
    }
  }
View Full Code Here

      DrawingManager dm = ((SheetCtrl)_sheet).getDrawingManager();
      final Picture picture = dm.addPicture(_sheet, anchor, image, format);
      final RangeImpl rng = (RangeImpl) Ranges.range(_sheet, anchor.getRow1(), anchor.getCol1(), anchor.getRow2(), anchor.getCol2());
      final Collection<Ref> refs = rng.getRefs();
      if (refs != null && !refs.isEmpty()) {
        final Ref ref = refs.iterator().next();
        BookHelper.notifyPictureAdd(ref, picture);
      }
      return picture;
    }
  }
View Full Code Here

      ClientAnchor anchor = picture.getPreferredSize();
      final RangeImpl rng = (RangeImpl) Ranges.range(_sheet, anchor.getRow1(), anchor.getCol1(), anchor.getRow2(), anchor.getCol2());
      final Collection<Ref> refs = rng.getRefs();
      dm.deletePicture(_sheet, picture); //must after getPreferredSize() or anchor is gone!
      if (refs != null && !refs.isEmpty()) {
        final Ref ref = refs.iterator().next();
        BookHelper.notifyPictureDelete(ref, picture);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.Ref

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.