Package org.zkoss.zss.app.zul.ctrl

Examples of org.zkoss.zss.app.zul.ctrl.DesktopWorkbenchContext


    getDesktopWorkbenchContext().getWorkbenchCtrl().openOpenFileDialog();
  }
 
  public void onClick$saveFile() {
    //TODO: refactor duplicate save logic
    DesktopWorkbenchContext workbench = getDesktopWorkbenchContext();
    if (workbench.getWorkbookCtrl().hasFileExtentionName()) {
      workbench.getWorkbookCtrl().save();
      workbench.fireWorkbookSaved();
    } else
      workbench.getWorkbenchCtrl().openSaveFileDialog();
  }
View Full Code Here


    throw new UiException("save is not implement yet");
  }
 
  public void onClick$saveFileAndClose() {
    //TODO: refactor duplicate save logic
    DesktopWorkbenchContext workbench = getDesktopWorkbenchContext();
    if (workbench.getWorkbookCtrl().hasFileExtentionName()) {
      workbench.getWorkbookCtrl().save();
      workbench.getWorkbookCtrl().close();
      workbench.fireWorkbookSaved();
      workbench.fireWorkbookChanged();
    } else
      workbench.getWorkbenchCtrl().openSaveFileDialog();
  }
View Full Code Here

    } else
      workbench.getWorkbenchCtrl().openSaveFileDialog();
  }
 
  public void onClick$deleteFile() {
    DesktopWorkbenchContext workbench = getDesktopWorkbenchContext();
    if(!workbench.getWorkbookCtrl().hasFileExtentionName()) {
      workbench.getWorkbookCtrl().close();
      workbench.fireWorkbookChanged();
      return;
    }
   
    WorkspaceContext.getInstance(Executions.getCurrent().getDesktop()).
      delete(workbench.getWorkbookCtrl().getSrc());
    workbench.getWorkbookCtrl().close();
    workbench.fireWorkbookChanged();
  }
View Full Code Here

  protected DesktopWorkbenchContext getDesktopWorkbenchContext() {
    return Zssapp.getDesktopWorkbenchContext(this);
  }
 
  public void onCreate() {
        final DesktopWorkbenchContext workbenchCtrl = getDesktopWorkbenchContext();
        getDesktopWorkbenchContext().addEventListener(Consts.ON_WORKBOOK_CHANGED, new EventListener() {
            public void onEvent(Event event) throws Exception {
                boolean isOpen = workbenchCtrl.getWorkbookCtrl().hasBook();
                boolean savePermission = FileHelper.hasSavePermission();
               
          if (isOpen) {
            boolean isPE = WebApps.getFeature("pe");
            deleteFile.setDisabled(false);
View Full Code Here

  protected DesktopWorkbenchContext getDesktopWorkbenchContext() {
    return Zssapp.getDesktopWorkbenchContext(this);
  }

  public void onCreate() {
    final DesktopWorkbenchContext workbenchCtrl = getDesktopWorkbenchContext();
    getDesktopWorkbenchContext().addEventListener(Consts.ON_WORKBOOK_CHANGED, new EventListener() {
      public void onEvent(Event event) throws Exception {
        setDisabled(!workbenchCtrl.getWorkbookCtrl().hasBook());
      }
    });
  }
View Full Code Here

  protected DesktopCellStyleContext getDesktopCellStyleContext() {
    return Zssapp.getDesktopCellStyleContext(this);
  }

  public void onCreate() {
    final DesktopWorkbenchContext workbenchCtrl = getDesktopWorkbenchContext();
    workbenchCtrl.addEventListener(Consts.ON_WORKBOOK_CHANGED, new EventListener() {
      public void onEvent(Event event) throws Exception {
        setDisabled(!workbenchCtrl.getWorkbookCtrl().hasBook());
      }
    });
    if (WebApps.getFeature("pe"))
      backgroundColorMenu.setContent("#color=#FFFFFF");
    else {
View Full Code Here

   
    //Note. setSrcName will set spreadsheet's src name, but not the book name
    // if setSrc will init a book, then setSrcName only change the src name,
    // if setSrc again with the first same book, the book will register two listener
    //spreadsheet.setSrcName("Untitled");
    final DesktopWorkbenchContext workbenchContext = getDesktopWorkbenchContext();
    workbenchContext.doTargetChange(new SSWorkbookCtrl(spreadsheet));
    workbenchContext.setWorkbenchCtrl(this);
   
//    if (!FileHelper.hasSavePermission())
//      saveBtn.setVisible(false);
    workbenchContext.addEventListener(Consts.ON_WORKBOOK_SAVED,  new EventListener() {
      public void onEvent(Event event) throws Exception {
        if (!FileHelper.hasSavePermission())
          return;
       
        spreadsheet.setActionDisabled(true, Action.SAVE_BOOK);
      }
    });

    workbenchContext.addEventListener(Consts.ON_WORKBOOK_CHANGED, new EventListener() {
      public void onEvent(Event event) throws Exception {
        boolean isOpen = spreadsheet.getBook() != null;
//        toolbarMask.setVisible(!isOpen);
//        closeBtn.setVisible(isOpen);
       
        spreadsheet.setActionDisabled(true, Action.SAVE_BOOK);

//        gridlinesCheckbox.setChecked(isOpen && spreadsheet.getSelectedSheet().isDisplayGridlines());
//        protectSheet.setChecked(isOpen && spreadsheet.getSelectedSheet().getProtect());
//        protectSheet.setDisabled(!isOpen);
       
        //TODO: provide clip board interface, to allow save cut, copy, high light info
        //use set setHighlight null can cancel selection, but need to re-store selection when select same sheet again
        spreadsheet.setHighlight(null);
       
        if (isOpen) {
          getCellStyleContext().doTargetChange(
              new SSRectCellStyle(Utils.getOrCreateCell(spreadsheet.getSelectedSheet(), 0, 0), spreadsheet));
//          syncAutoFilterStatus();
        }
      }
    });

    workbenchContext.addEventListener(Consts.ON_SHEET_CONTENTS_CHANGED,  new EventListener(){
      public void onEvent(Event event) throws Exception {
        doContentChanged();
      }}
    );
   
    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();
        if (evtName == SSDataEvent.ON_CONTENTS_CHANGE) {
          doContentChanged();
        }
View Full Code Here

      getCellStyleContext().doTargetChange(new SSRectCellStyle(cell, spreadsheet));
    }
  }
 
  public void saveBook() {
    DesktopWorkbenchContext workbench = getDesktopWorkbenchContext();
    if (workbench.getWorkbookCtrl().hasFileExtentionName()) {
      workbench.getWorkbookCtrl().save();
      workbench.fireWorkbookSaved();
    } else
      workbench.getWorkbenchCtrl().openSaveFileDialog();
  }
View Full Code Here

    String sheetName = sheetNameTB.getText();
    if (sheetName == null || sheetName == "") {
      Messagebox.show("invalid sheet name");
      return;
    }
    DesktopWorkbenchContext bookContent = Zssapp.getDesktopWorkbenchContext(self);
    bookContent.getWorkbookCtrl().renameSelectedSheet(sheetName);
    bookContent.fireRefresh();
   
    _renameSheetDialog.fireOnClose(null);
  }
View Full Code Here

    }

    @Override
    public void doSaveBook() {
      if (FileHelper.hasSavePermission() && spreadsheet.getBook() != null) {
        DesktopWorkbenchContext workbench = getDesktopWorkbenchContext();
        if (workbench.getWorkbookCtrl().hasFileExtentionName()) {
          workbench.getWorkbookCtrl().save();
          workbench.fireWorkbookSaved();
        } else
          workbench.getWorkbenchCtrl().openSaveFileDialog()
      }
    }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.app.zul.ctrl.DesktopWorkbenchContext

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.