Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Worksheet


    for (int i = 0; i < len; i++) {
      //key: sheet names, value: sheet uuid
      LinkedHashMap<String, String> sheetLabels = new LinkedHashMap<String, String>();
     
      Worksheet sheet = _book.getWorksheetAt(i);
      sheetLabels.put("id", ((SheetCtrl)sheet).getUuid());
      sheetLabels.put("name", sheet.getSheetName());
      if (sheet == _selectedSheet)
        sheetLabels.put("sel", "t");//stand for true, use for set selected tab only
       
      ary.add(sheetLabels);
    }
View Full Code Here


      }
      renderer.render("showToolbar", _showToolbar);
    }
     
    renderer.render("showFormulabar", _showFormulabar);
    Worksheet sheet = this.getSelectedSheet();
    if (sheet == null) {
      return;
    }
   
    if (_showContextMenu) {
      renderer.render("showContextMenu", _showContextMenu)
    }
   
    if (_clientCacheDisabled) //default: use client cache
      renderer.render("clientCacheDisabled", _clientCacheDisabled);
   
    if (_maxRenderedCellSize != DEFAULT_MAX_RENDERED_CELL_SIZE)
      renderer.render("maxRenderedCellSize", _maxRenderedCellSize);
   
    //Note: sheetLabels (sheet name, sheet uuid) must before showSheetTabpanel
    List<LinkedHashMap<String, String>> sheetLabels = getSheetLabels();
    if (sheetLabels != null) {
      renderer.render("sheetLabels", sheetLabels);
    }
    if (_showSheetbar)
      renderer.render("showSheetbar", _showSheetbar);
   
    //handle link to new browser tab window; default to link to new tab
    if (!getLinkToNewTab()) {
      renderer.render("_linkToNewTab", false);
    }
   
    //handle AutoFilter
    Map afmap = convertAutoFilterToJSON(sheet.getAutoFilter());
    if (afmap != null) {
      renderer.render("autoFilter", afmap);
    } else {
      renderer.render("autoFilter", (String) null);
    }
    int rowHeight = getRowheight();
    if (rowHeight != DEFAULT_ROW_HEIGHT) {
      renderer.render("rowHeight", getRowheight());
    }
    renderer.render("columnWidth", getColumnwidth());
   
    if (_hideGridlines) {
      renderer.render("displayGridlines", !_hideGridlines);
    }
    if (_protectSheet)
      renderer.render("protect", _protectSheet);
   
    renderer.render("topPanelHeight", isHidecolumnhead() ? 1 : this.getTopheadheight());
    renderer.render("leftPanelWidth", isHiderowhead() ? 1 : this.getLeftheadwidth());

    if (_cellpadding != DEFAULT_CELL_PADDING)
      renderer.render("cellPadding", _cellpadding);
   
    String sheetId = getSelectedSheetId();
    String css = getDynamicMediaURI(this, _cssVersion++, "ss_" + this.getUuid() + "_" + sheetId, "css");
    renderer.render("loadcss", new JavaScriptValue("zk.loadCSS('" + css + "', '" + this.getUuid() + "-sheet')"));
    renderer.render("scss", css);

    int maxRows = getMaxrows();
    if (maxRows != DEFAULT_MAX_ROWS) {
      renderer.render("maxRows", maxRows);
    }
    int maxCols = getMaxcolumns();
    if (maxCols != DEFAULT_MAX_COLUMNS) {
      renderer.render("maxColumns", maxCols);
    }
    int rowFreeze = getRowfreeze();
    if (rowFreeze != DEFAULT_ROW_FREEZE) {
      renderer.render("rowFreeze", rowFreeze);
    }
    int colFreeze = getColumnfreeze();
    if (colFreeze != DEFAULT_COLUMN_FREEZE) {
      renderer.render("columnFreeze", colFreeze);
    }
   
    renderer.render("sheetId", getSelectedSheetId());
    renderer.render("focusRect", getRectStr(_focusRect));
    renderer.render("selectionRect", getRectStr(_selectionRect));
    if (_highlightRect != null) {
      renderer.render("highLightRect", getRectStr(_highlightRect));
    }

    // generate customized row & column information
    HeaderPositionHelper colHelper = getColumnPositionHelper(sheet);
    HeaderPositionHelper rowHelper = getRowPositionHelper(sheet);
    renderer.render("csc", getSizeHelperStr(colHelper));
    renderer.render("csr", getSizeHelperStr(rowHelper));

    // generate merge range information

    MergeMatrixHelper mmhelper = getMergeMatrixHelper(sheet);
    Iterator iter = mmhelper.getRanges().iterator();
    StringBuffer merr = new StringBuffer();
    while (iter.hasNext()) {
      MergedRect block = (MergedRect) iter.next();
      int left = block.getLeft();
      int top = block.getTop();
      int right = block.getRight();
      int bottom = block.getBottom();
      int id = block.getId();
      merr.append(left).append(",").append(top).append(",").append(right).append(",").append(bottom).append(",").append(id);
      if (iter.hasNext()) {
        merr.append(";");
      }
    }
    renderer.render("mergeRange", merr.toString());
    /**
     * Add attr for UI renderer
     */
    final SpreadsheetCtrl spreadsheetCtrl = ((SpreadsheetCtrl) this.getExtraCtrl());
   
    int initColSize = getInitColumnSize();
    int preloadColSize = getPreloadColumnSize();
    int initRowSize = getInitRowSize();
    int preloadRowSize = getPreloadRowSize();
    renderer.render("activeRange",
      spreadsheetCtrl.getRangeAttrs(sheet, SpreadsheetCtrl.Header.BOTH, SpreadsheetCtrl.CellAttribute.ALL, 0, 0,
          initColSize , initRowSize));
   
    renderer.render("preloadRowSize", preloadColSize);
    renderer.render("preloadColumnSize", preloadRowSize);
   
    renderer.render("initRowSize", initRowSize);
    renderer.render("initColumnSize", initColSize);
   
    renderer.render("columnHeadHidden", _hideColhead);
    renderer.render("rowHeadHidden", _hideRowhead);
   
    //handle Validation, must after render("activeRange" ...)
    List<Map> dvs = convertDataValidationToJSON(sheet.getDataValidations());
    if (dvs != null) {
      renderer.render("dataValidations", dvs);
    } else {
      renderer.render("dataValidations", (String) null);
    }
View Full Code Here

    _selectionRect.setBottom(row);
  }

  private String getSheetDefaultRules() {

    Worksheet sheet = getSelectedSheet();

    HeaderPositionHelper colHelper = this.getColumnPositionHelper(sheet);
    HeaderPositionHelper rowHelper = this.getRowPositionHelper(sheet);
    MergeMatrixHelper mmhelper = this.getMergeMatrixHelper(sheet);

    boolean hiderow = isHiderowhead();
    boolean hidecol = isHidecolumnhead();
    boolean showgrid = sheet.isDisplayGridlines();

    int th = hidecol ? 1 : this.getTopheadheight();
    int lw = hiderow ? 1 : this.getLeftheadwidth();
    int cp = this._cellpadding;//
    int rh = this.getRowheight();
View Full Code Here

  private void doInvalidate() {
    //TODO: reset here ?
//    _loadedRect.set(-1, -1, -1, -1);
   
    Worksheet sheet = getSelectedSheet();

    clearHeaderSizeHelper(true, true);
    // remove this, beacuse invalidate will cause client side rebuild,
    // i must reinitial size helper since there are maybe some customized is
    // from client.
View Full Code Here

    iconMap.put(ErrorStyle.WARNING, Messagebox.EXCLAMATION);
  }
  //return true if a valid input; false otherwise and show Error Alert if required
  public boolean validate(Worksheet sheet, final int row, final int col, final String txt,
    final EventListener callback) {
    final Worksheet ssheet = this.getSelectedSheet();
    if (ssheet == null || !ssheet.equals(sheet)) { //skip no sheet case
      return true;
    }
    if (_inCallback) { //skip validation check
      return true;
    }
View Full Code Here

    private String nextFocusColor() {
      return FOCUS_COLORS[_colorIndex++ % FOCUS_COLORS.length];
    }
    private void onFriendFocusMove(SSDataEvent event) {
      final Ref rng = event.getRef();
      Worksheet sheet = getSheet(rng);
      if (sheet == null) {//ZSS-209: book may removed
        return;
      }
      if (sheet.equals(_selectedSheet)) { //same sheet
        final Focus focus = (Focus) event.getPayload(); //other's spreadsheet's focus
        final String id = focus.id;
        if (!id.equals(_focus.id)) {
          final Focus ofocus = _focuses.get(id);
          moveEditorFocus(id, focus.name, ofocus != null ? ofocus.color : nextFocusColor(), focus.row, focus.col);
View Full Code Here

        }
      }
    }
    private void onFriendFocusDelete(SSDataEvent event) {
      final Ref rng = event.getRef();
      Worksheet sheet = BookHelper.getSheet(_book, rng.getOwnerSheet());
      if (sheet == null) {//ZSS-209: book may removed
        return;
      }
      if (sheet.equals(_selectedSheet)) { //same sheet
        final Focus focus = (Focus) event.getPayload(); //other's spreadsheet's focus
        removeEditorFocus(focus.id);
      }
    }
View Full Code Here

        removeEditorFocus(focus.id);
      }
    }
    private void onChartAdd(SSDataEvent event) {
      final Ref rng = event.getRef();
      final Worksheet sheet = getSheet(rng);
      final Object payload = event.getPayload();
      addChartWidget(sheet, (ZssChartX) payload);
    }
View Full Code Here

      final Object payload = event.getPayload();
      addChartWidget(sheet, (ZssChartX) payload);
    }
    private void onChartDelete(SSDataEvent event) {
      final Ref rng = event.getRef();
      final Worksheet sheet = getSheet(rng);
      final Object payload = event.getPayload();
      deleteChartWidget(sheet, (Chart) payload);
    }
View Full Code Here

      final Object payload = event.getPayload();
      deleteChartWidget(sheet, (Chart) payload);
    }
    private void onChartUpdate(SSDataEvent event) {
      final Ref rng = event.getRef();
      final Worksheet sheet = getSheet(rng);
      final Object payload = event.getPayload();
      updateChartWidget(sheet, (Chart) payload);
    }
View Full Code Here

TOP

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

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.