Package org.zkoss.zss.ui

Examples of org.zkoss.zss.ui.Rect


    }
    Radio seld = range.getSelectedItem();
    if (seld == allSheet) {
      exporter.export(book, outputStream);
    } else if (seld == currSelection){
      Rect rect = ss.getSelection();
      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


   
    Clipboard clipboard = ss.getActionHandler().getClipboard();
   
    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

   * <p> Sort target is row if sort direction is from left to right
   */
  private void setAvailableSortTarget (List<String> list) {
    list.clear();
    list.add(new String(""));
    Rect rect = ss.getSelection();
    if (sortOrientation == SORT_TOP_TO_BOTTOM) {
      for (int i = rect.getLeft(); i <= rect.getRight(); i++)
        list.add(new String("Column " + ss.getColumntitle(i)));
    } else {
      for (int i = rect.getTop(); i <= rect.getBottom(); i++)
        list.add(new String("Row " + ss.getRowtitle(i)));
    }
    sortIndexModel.clear();
    sortIndexModel.addAll(list);
  }
View Full Code Here

    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

   * @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

     * 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

    }
    return data;
  }
 
  private ChartData fillXYData(XYData data) {
    final Rect selection = spreadsheet.getSelection();
    final Worksheet sheet = spreadsheet.getSelectedSheet();
   
    Rect rect = getChartDataRange(selection, sheet);
    int colIdx = rect.getLeft();
    int rowIdx = rect.getTop();
   
    ChartDataSource<Number> horValues = null;
    ArrayList<ChartTextSource> titles = new ArrayList<ChartTextSource>();
    ArrayList<ChartDataSource<Number>> values = new ArrayList<ChartDataSource<Number>>();
   
View Full Code Here

    }
    if (rowIdx == -1) { //can not find number cell, use last cell as chart's value
      rowIdx = selection.getBottom();
      colIdx = selection.getRight();
    }
    return new Rect(colIdx, rowIdx, selection.getRight(), selection.getBottom());
  }
View Full Code Here

    }
    return new Rect(colIdx, rowIdx, selection.getRight(), selection.getBottom());
  }
 
  private CategoryData fillCategoryData(CategoryData data) {
    final Rect selection = spreadsheet.getSelection();
    final Worksheet sheet = spreadsheet.getSelectedSheet();
   
    Rect rect = getChartDataRange(selection, sheet);
    int colIdx = rect.getLeft();
    int rowIdx = rect.getTop();
   
    ChartDataSource<String> cats = null;
    ArrayList<ChartTextSource> titles = new ArrayList<ChartTextSource>();
    ArrayList<ChartDataSource<Number>> vals = new ArrayList<ChartDataSource<Number>>();
   
View Full Code Here

  public void insertColumnLeft() {
    if (spreadsheet.getSelection() == null)
      return;
   
    Rect rect = spreadsheet.getSelection();
    CellHelper.shiftEntireColumnRight(spreadsheet.getSelectedSheet(),
        rect.getLeft(), rect.getRight());
  }
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.