Package org.zkoss.zss.engine.impl

Examples of org.zkoss.zss.engine.impl.ChangeInfo


        }
        switch(shift) {
        default:
        case SHIFT_DEFAULT:
          if (ref.isWholeRow()) {
            final ChangeInfo info = BookHelper.deleteRows(sheet, ref.getTopRow(), ref.getRowCount());
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_DELETE, SSDataEvent.MOVE_V);
          } else if (ref.isWholeColumn()) {
            final ChangeInfo info = BookHelper.deleteColumns(sheet, ref.getLeftCol(), ref.getColumnCount());
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_DELETE, SSDataEvent.MOVE_H);
          }
          break;
        case SHIFT_LEFT:
          if (ref.isWholeRow() || ref.isWholeColumn()) {
            delete(SHIFT_DEFAULT);
          } else {
            final ChangeInfo info = BookHelper.deleteRange(sheet, ref.getTopRow(), ref.getLeftCol(), ref.getBottomRow(), ref.getRightCol(), true);
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_DELETE, SSDataEvent.MOVE_H);
          }
          break;
        case SHIFT_UP:
          if (ref.isWholeRow() || ref.isWholeColumn()) {
            delete(SHIFT_DEFAULT);
          } else {
            final ChangeInfo info = BookHelper.deleteRange(sheet, ref.getTopRow(), ref.getLeftCol(), ref.getBottomRow(), ref.getRightCol(), false);
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_DELETE, SSDataEvent.MOVE_V);
          }
          break;
        }
      }
View Full Code Here


        }
        switch(shift) {
        default:
        case SHIFT_DEFAULT:
          if (ref.isWholeRow()) {
            final ChangeInfo info = BookHelper.insertRows(sheet, ref.getTopRow(), ref.getRowCount(), copyOrigin);
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_INSERT, SSDataEvent.MOVE_V);
          } else if (ref.isWholeColumn()) {
            final ChangeInfo info = BookHelper.insertColumns(sheet, ref.getLeftCol(), ref.getColumnCount(), copyOrigin);
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_INSERT, SSDataEvent.MOVE_H);
          }
          break;
        case SHIFT_RIGHT:
          if (ref.isWholeRow() || ref.isWholeColumn()) {
            insert(SHIFT_DEFAULT, copyOrigin);
          } else {
            final ChangeInfo info = BookHelper.insertRange(sheet, ref.getTopRow(), ref.getLeftCol(), ref.getBottomRow(), ref.getRightCol(), true, copyOrigin);
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_INSERT, SSDataEvent.MOVE_H);
          }
          break;
        case SHIFT_DOWN:
          if (ref.isWholeRow() || ref.isWholeColumn()) {
            insert(SHIFT_DEFAULT, copyOrigin);
          } else {
            final ChangeInfo info = BookHelper.insertRange(sheet, ref.getTopRow(), ref.getLeftCol(), ref.getBottomRow(), ref.getRightCol(), false, copyOrigin);
            notifyMergeChange(refBook, info, ref, SSDataEvent.ON_RANGE_INSERT, SSDataEvent.MOVE_V);
          }
          break;
        }
      }
View Full Code Here

        final int lCol = ref.getLeftCol();
        final int bRow = ref.getBottomRow();
        final int rCol = ref.getRightCol();
        final Worksheet sheet = BookHelper.getSheet(_sheet, ref.getOwnerSheet());
        final RefBook refBook = ref.getOwnerSheet().getOwnerBook();
        ChangeInfo info = BookHelper.sort(sheet, tRow, lCol, bRow, rCol,
                  key1, desc1, key2, type, desc2, key3, desc3, header,
                  orderCustom, matchCase, sortByRows, sortMethod, dataOption1, dataOption2, dataOption3);
        if (info == null) {
          info = new ChangeInfo(new HashSet<Ref>(0), new HashSet<Ref>(), new ArrayList<MergeChange>(0));
        }
        info.getAffected().add(ref);
        notifyMergeChange(refBook, info, ref, SSDataEvent.ON_CONTENTS_CHANGE, SSDataEvent.MOVE_NO);
      }
    }
  }
View Full Code Here

      int srcColCount = ref1.getColumnCount();
      final Ref dstRef = ((RangeImpl)dstRange).getRefs().iterator().next();
      final Set<Ref> toEval = new HashSet<Ref>();
      final Set<Ref> affected = new HashSet<Ref>();
      final List<MergeChange> mergeChanges = new ArrayList<MergeChange>();
      final ChangeInfo info = new ChangeInfo(toEval, affected, mergeChanges);
      Ref pasteRef = null;
      if (_refs.size() > 1) { //multiple src references
        final SortedMap<Integer, Ref> srcRefs = new TreeMap<Integer, Ref>();
        boolean sameRow = false;
        boolean sameCol = false;
View Full Code Here

        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final int bRow = ref.getBottomRow();
        final int rCol = ref.getRightCol();
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
        final ChangeInfo info = BookHelper.merge(sheet, tRow, lCol, bRow, rCol, across);
        notifyMergeChange(refBook, info, ref, SSDataEvent.ON_CONTENTS_CHANGE, SSDataEvent.MOVE_NO);
      }
    }
  }
View Full Code Here

        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final int bRow = ref.getBottomRow();
        final int rCol = ref.getRightCol();
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
        final ChangeInfo info = BookHelper.unMerge(sheet, tRow, lCol, bRow, rCol);
        notifyMergeChange(refBook, info, ref, SSDataEvent.ON_CONTENTS_CHANGE, SSDataEvent.MOVE_NO);
      }
    }
  }
View Full Code Here

          for (int cr = colRepeat; cr > 0; --cr) {
            for (int srcCol = lCol; srcCol <= rCol; ++srcCol, ++dstCol) {
              final Cell cell = BookHelper.getCell(srcSheet, srcRow, srcCol);
              if (cell != null) {
                if (!skipBlanks || cell.getCellType() != Cell.CELL_TYPE_BLANK) {
                  final ChangeInfo changeInfo0 = BookHelper.copyCell(cell, dstSheet, dstRow, dstCol, pasteType, pasteOp, transpose);
                  BookHelper.assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
                }
              } else if (!skipBlanks) {
                final Set<Ref>[] refs = BookHelper.removeCell(dstSheet, dstRow, dstCol);
                BookHelper.assignRefs(toEval, affected, refs);
              }
            }
          }
        }
      }
    } else { //row -> column, column -> row
      int dstCol = dstRef.getLeftCol();
      for(int rr = rowRepeat; rr > 0; --rr) {
        for(int srcRow = tRow; srcRow <= bRow; ++srcRow, ++dstCol) {
          int dstRow = dstRef.getTopRow();
          for (int cr = colRepeat; cr > 0; --cr) {
            for (int srcCol = lCol; srcCol <= rCol; ++srcCol, ++dstRow) {
              final Cell cell = BookHelper.getCell(srcSheet, srcRow, srcCol);
              if (cell != null) {
                if (!skipBlanks || cell.getCellType() != Cell.CELL_TYPE_BLANK) {
                  final ChangeInfo changeInfo0 = BookHelper.copyCell(cell, dstSheet, dstRow, dstCol, pasteType, pasteOp, transpose);
                  BookHelper.assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
                }
              } else if (!skipBlanks) {
                final Set<Ref>[] refs = BookHelper.removeCell(dstSheet, dstRow, dstCol);
                BookHelper.assignRefs(toEval, affected, refs);
View Full Code Here

        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final int bRow = ref.getBottomRow();
        final int rCol = ref.getRightCol();
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
        final ChangeInfo info = BookHelper.moveRange(sheet, tRow, lCol, bRow, rCol, nRow, nCol);
        notifyMergeChange(refBook, info, ref, SSDataEvent.ON_CONTENTS_CHANGE, SSDataEvent.MOVE_NO);
      }
    }
  }
View Full Code Here

    all.add(new AreaRefImpl(tRow, lCol, bRow, rCol, BookHelper.getRefSheet(book, sheet)));
    BookHelper.reevaluateAndNotify(book, last, all);
  }
 
  private void fillRef(Ref srcRef, Ref dstRef, int fillType) {
    final ChangeInfo info = BookHelper.fill(_sheet, srcRef, dstRef, fillType);
    notifyMergeChange(dstRef.getOwnerSheet().getOwnerBook(), info, dstRef, SSDataEvent.ON_CONTENTS_CHANGE, SSDataEvent.MOVE_NO);
  }
View Full Code Here

    assertEquals(12, valueC13.getNumberValue(), 0.0000000000000001);
    assertEquals(Cell.CELL_TYPE_NUMERIC, valueC13.getCellType());
    testToFormulaString(cellC13, "B12");
   
    //Sort A1:C12
    ChangeInfo info = BookHelper.sort(sheet1, 0, 0, 11, 2, ((RangeImpl)Utils.getRange(sheet1, 0, 0)).getRefs().iterator().next(), false,
        null, 0, false, null, false, BookHelper.SORT_HEADER_NO, 0, false, false, 0,
        BookHelper.SORT_NORMAL_DEFAULT, BookHelper.SORT_NORMAL_DEFAULT, BookHelper.SORT_NORMAL_DEFAULT);
    Set<Ref> last = info.getToEval();
    Set<Ref> all = info.getAffected();
    _evaluator.notifySetFormula(cellC13);

    assertEquals(1, row1.getCell(0).getNumericCellValue(), 0.0000000000000001); //A1: 1
    assertEquals(2, row2.getCell(0).getNumericCellValue(), 0.0000000000000001)//A2: 2
    assertEquals(3, row3.getCell(0).getNumericCellValue(), 0.0000000000000001); //A3: 3
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.impl.ChangeInfo

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.