Package org.zkoss.zss.ui

Examples of org.zkoss.zss.ui.Rect


    String val = Labels.getLabel(key);
    return val != null ? val : "";
  }

  private static int getSpreadsheetIndexOffset (Spreadsheet spreadsheet, int index, boolean sortAlgorithm) {
    Rect rect = spreadsheet.getSelection();
    int baseIdx = sortAlgorithm == SORT_TOP_TO_BOTTOM ? rect.getLeft() : rect.getTop();
    int idx = index - baseIdx + 1;
    return idx >= 0 ? idx : -1;
  }
View Full Code Here


    }
    return -1;
  }
 
  public static Rect getSpreadsheetMaxSelection(Spreadsheet spreadsheet) {
    Rect selection = spreadsheet.getSelection();// selection is cloned
    if (selection.getBottom() >= spreadsheet.getMaxrows())
      selection.setBottom(spreadsheet.getMaxrows() - 1);
    if (selection.getRight() >= spreadsheet.getMaxcolumns())
      selection.setRight(spreadsheet.getMaxcolumns() - 1);
    return selection;
  }
View Full Code Here

   * @param title
   * @param sortAlgorithm
   * @return
   */
  private static int getSpreadsheetIndexBy (Spreadsheet spreadsheet, String title, boolean sortAlgorithm) {
    Rect rect = spreadsheet.getSelection();
    if (sortAlgorithm == SORT_TOP_TO_BOTTOM) {
      for (int i = rect.getLeft(); i <= rect.getRight(); i++) {
        String t = spreadsheet.getColumntitle(i);
        if (Objects.equals(title, t))
          return i;
      }
    } else {
      for (int i = rect.getTop(); i <= rect.getBottom(); i++) {
        String t = spreadsheet.getRowtitle(i);
        if (Objects.equals(title, t))
          return i;
      }
    }
View Full Code Here

    });
  }
 
  public void onOpen$_insertFormulaDialog(ForwardEvent evt) {
   
    Rect selection = (Rect) evt.getOrigin().getData();
   
    _insertFormulaDialog.setMode(Window.MODAL);
    searchTextbox.setText(null);
    initFunctionListbox();
    searchTextbox.focus();
   
    rowIdx = selection.getTop();
    colIdx = selection.getLeft();
  }
View Full Code Here

     * Returns true indicate spreadsheet index column/row is number
     * @return
     */
    private boolean isAllCellNumberType(int idx) {
      Worksheet sheet = ss.getSelectedSheet();
      Rect rect = ss.getSelection();
      int top = sortOrientation ? idx : rect.getTop();
      int left = sortOrientation ? rect.getLeft() : idx;
      int bottom = sortOrientation ? idx : rect.getBottom();
      int right = sortOrientation ? rect.getRight() : idx;

      for (int row = top; row <= bottom; row++) {
        for (int col = left; col <= right; col++) {
          Cell c = Utils.getCell(sheet, row, col);
          if (c != null) {
View Full Code Here

      Listbox rcw_rangeList = (Listbox) Path
          .getComponent("//p1/rangeChooseWin/rcw_rangeList");

      Listitem st = rcw_rangeList.getSelectedItem();
      Name range;
      Rect rect;
      if (st != null) {
        String rangeName = st.getLabel();
        range = book.getName(rangeName);
        CellRangeAddress cra = CellRangeAddress.valueOf(range.getRefersToFormula());
        rect = new Rect(cra.getFirstColumn(), cra.getFirstRow(),
            cra.getLastColumn(), cra.getLastRow());
        spreadsheet.setSelection(rect);
      }

      Window rangeChooseWin = (Window) Path
View Full Code Here

        return;
      }
     
      Listitem st = rangeList.getSelectedItem();
      Name range;
      Rect rect;
      if (st != null) {
        String rangeName = st.getLabel();
        range = book.getName(rangeName);
        CellRangeAddress cra = CellRangeAddress.valueOf(range.getRefersToFormula());
        rect = new Rect(cra.getFirstColumn(), cra.getFirstRow(),
            cra.getLastColumn(), cra.getLastRow());
        spreadsheet.setHighlight(rect);
      }

    } catch (Exception e) {
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 {
View Full Code Here

     if (savePermission) {
       spreadsheet.setActionDisabled(false, Action.SAVE_BOOK);
     }
   
    Worksheet seldSheet = spreadsheet.getSelectedSheet();
    Rect seld =  spreadsheet.getSelection();
    int row = seld.getTop();
    int col = seld.getLeft();
    Cell cell = Utils.getCell(seldSheet, row, col);
    if (cell != null) {
      getCellStyleContext().doTargetChange(new SSRectCellStyle(cell, spreadsheet));
    }
  }
View Full Code Here

    }
    Radio seld = range.getSelectedItem();
    if (seld == allSheet) {
      exporter.export(book, outputStream);
    } else if (seld == currSelection){
      Rect rect = selection;
      String area = ss.getColumntitle(rect.getLeft()) + ss.getRowtitle(rect.getTop()) + ":" +
        ss.getColumntitle(rect.getRight()) + ss.getRowtitle(rect.getBottom());
      exporter.exportSelection(ss.getSelectedSheet(), new AreaReference(area), outputStream);
    } else
      exporter.export(ss.getSelectedSheet(), outputStream);
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.ui.Rect

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.