コード例 #1
0
  @Override
  public boolean process(UserActionContext ctx) {
    try {
      Book book = ctx.getBook();
      save(book);
      Clients.showNotification("saved " + book.getBookName(), "info", null, null, 2000, true);

    } catch (Exception e) {
      e.printStackTrace();
    }
    return true;
  }
コード例 #2
0
 /* (non-Javadoc)
  * @see org.zkoss.zss.ui.sys.ua.impl.AbstractHandler#processAction(org.zkoss.zss.ui.UserActionContext)
  */
 @Override
 protected boolean processAction(UserActionContext ctx) {
   Sheet sheet = ctx.getSheet();
   AreaRef selection = ctx.getSelection();
   CellSelectionType type = ctx.getSelectionType();
   Range range = Ranges.range(sheet, selection);
   if (range.isProtected()) {
     showProtectMessage();
     return true;
   }
   // zss-623, extends to row,column area
   switch (type) {
     case ROW:
       range = range.toRowRange();
       break;
     case COLUMN:
       range = range.toColumnRange();
       break;
     case ALL:
       // we don't allow to set whole sheet style, use column range instead
       range = range.toColumnRange();
   }
   selection =
       new AreaRef(range.getRow(), range.getColumn(), range.getLastRow(), range.getLastColumn());
   UndoableActionManager uam = ctx.getSpreadsheet().getUndoableActionManager();
   uam.doAction(
       new CellStyleAction(
           Labels.getLabel("zss.undo.cellStyle"),
           sheet,
           selection.getRow(),
           selection.getColumn(),
           selection.getLastRow(),
           selection.getLastColumn(),
           CellOperationUtil.getVerticalAligmentApplier(_type)));
   return true;
 }