Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Range


    assertEquals("1,234,567", rng.getText().toString()); //1,234,567
  }
  @Test
  public void test123456dot89() {
    Worksheet sheet1 = _workbook.getWorksheet("Sheet1");
    Range rng = Ranges.range(sheet1, "A1");
    rng.setEditText("1234567.89");
    assertEquals("1,234,567.89", rng.getText().toString()); //1,234,567.89
  }
View Full Code Here


   
    workbenchContext.addEventListener(Consts.ON_SHEET_INSERT_FORMULA, new EventListener() {
      public void onEvent(Event event) throws Exception {
        String formula = (String)event.getData();
        Rect rect = spreadsheet.getSelection();
        Range rng = Ranges.range(spreadsheet.getSelectedSheet(), rect.getTop(), rect.getLeft());
        rng.setEditText(formula);
      }
    });
    workbenchContext.getWorkbookCtrl().addBookEventListener(new EventListener() {
      public void onEvent(Event event) throws Exception {
        String evtName = event.getName();
View Full Code Here

      //TODO: show error message
    }
  }
 
  public void onClick$deleteSheet() {
    Range rng = Ranges.range(getDesktopWorkbenchContext().getWorkbookCtrl().getSelectedSheet());
    rng.deleteSheet();
   
/*    int newIdx = getDesktopWorkbenchContext().getWorkbookCtrl().deleteSheet();
    if (newIdx >= 0) {
      tabbox.setSelectedIndex(newIdx);
      redraw();
View Full Code Here

  @Test
  public void testNamedRange() {
    Worksheet sheet1 = _workbook.getWorksheet("Sheet1");
   
    Range rngA1 = Ranges.range(sheet1, "RangeA1");
    assertEquals("Sheet1", rngA1.getSheet().getSheetName());
    assertEquals(0, rngA1.getColumn());
    assertEquals(0, rngA1.getRow());
   
    Range rngB1 = Ranges.range(sheet1, "RangeB1");
    assertEquals("Sheet1", rngB1.getSheet().getSheetName());
    assertEquals(1, rngB1.getColumn());
    assertEquals(0, rngB1.getRow());
   
    Range rngA2B3 = Ranges.range(sheet1, "RangeA2_B3");
    assertEquals("Sheet1", rngA2B3.getSheet().getSheetName());
    assertEquals(0, rngA2B3.getColumn());
    assertEquals(1, rngA2B3.getRow());
    assertEquals(1, rngA2B3.getLastColumn());
    assertEquals(2, rngA2B3.getLastRow());
  }
View Full Code Here

    if (clipboard != null) {
      final Worksheet srcSheet = clipboard.sourceSheet;
      final Rect srcRect = clipboard.sourceRect;
      final Rect dst = ss.getSelection();
     
      Range rng = Utils.pasteSpecial(srcSheet,
          srcRect,
          ss.getSelectedSheet(),
          dst.getTop(),
          dst.getLeft(),
          dst.getBottom(),
          dst.getRight(),
          getPasteType(pasteSelector.getSelectedItem().getValue().toString()),
          getPasteOperation(operationSelector.getSelectedItem().getValue().toString()),
          skipBlanks.isChecked(), transpose.isChecked());
     
     
      if (clipboard.type == Clipboard.Type.CUT) {
        Ranges
        .range(srcSheet, srcRect.getTop(), srcRect.getLeft(), srcRect.getBottom(), srcRect.getRight())
        .clearContents();
       
        final CellStyle defaultStyle = clipboard.book.createCellStyle();
        Ranges
        .range(srcSheet, srcRect.getTop(), srcRect.getLeft(),srcRect.getBottom(), srcRect.getRight())
        .setStyle(defaultStyle);
       
        ss.getActionHandler().clearClipboard();
        ss.setHighlight(null);
      }
     
      if (rng != null) {
        ss.setSelection(new Rect(rng.getColumn(), rng.getRow(),
            rng.getLastColumn(), rng.getLastRow()))
      }
    }
   
    _pasteSpecialDialog.fireOnClose(null);
  }
View Full Code Here

   * Delete current selection area and shift cells below the selection area up
   * @param Worksheet the current sheet
   * @param rect the selection rectangle
   */
  public static void shiftCellUp(Worksheet sheet, Rect rect) {
    final Range rng = Ranges.range(sheet, rect.getTop(), rect.getLeft(), rect.getBottom(), rect.getRight());
    rng.delete(Range.SHIFT_UP);
  }
View Full Code Here

   * Insert a new cell and shift cells right
   * @param Worksheet the current sheet
   * @param rect the selection rectangle
   */
  public static void shiftCellRight(Worksheet sheet, Rect rect) {
    final Range rng = Ranges.range(sheet, rect.getTop(), rect.getLeft(), rect.getBottom(), rect.getRight());
    rng.insert(Range.SHIFT_RIGHT, Range.FORMAT_RIGHTBELOW);
  }
View Full Code Here

   * Insert a new cell and shift original cells down
   * @param Worksheet the current sheet
   * @param rect the selection rectangle
   */
  public static void shiftCellDown(Worksheet sheet, Rect rect) {
    final Range rng = Ranges.range(sheet, rect.getTop(), rect.getLeft(), rect.getBottom(), rect.getRight());
    rng.insert(Range.SHIFT_DOWN, Range.FORMAT_LEFTABOVE);
  }
View Full Code Here

   * Delete current cell and shift cells up beside it.
   * @param Worksheet the current sheet
   * @param rect the selection rectangle
   */
  public static void shiftCellLeft(Worksheet sheet, Rect rect) {
    final Range rng = Ranges.range(sheet, rect.getTop(), rect.getLeft(), rect.getBottom(), rect.getRight());
    rng.delete(Range.SHIFT_LEFT);
  }
View Full Code Here

  public void setRowFreeze(int rowfreeze) {
    spreadsheet.setRowfreeze(rowfreeze);
  }

  public void insertFormula(int rowIdx, int colIdx, String formula) {
    Range rng = Ranges.range(spreadsheet.getSelectedSheet(), rowIdx, colIdx);
    //Note. can not catch evaluate exception here
    rng.setEditText(formula);
  }
View Full Code Here

TOP

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

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.