⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zcmdgroup.java

📁 用Java写的报表.功能如下: 0.内建网络打印,网络预览功能! 1.文件操作。包括url 指定的文件。 2.全功能打印支持。包括打印预览。 3.Undo 和 redo。 4.合并单元格。 5.Cel
💻 JAVA
字号:
/*
 * Copyright 2002 EZCell , Inc. All rights reserved.
 * Version  1.0.
 * Author   W.John
 */
package ezcell;

import java.util.Hashtable;
import java.util.Vector;
import javax.swing.undo.AbstractUndoableEdit;


/**
 * DOCUMENT ME!
 *
 * @version 1.00
 * @author W.John
 */
class ZCmdGroup extends AbstractUndoableEdit implements ZCommand {
    Vector cmdList = new Vector();
    int selectionMode = SELECT_010;
    Hashtable table;
    ZSheet sheet;
    ZRect cells;

    ZCmdGroup(ZSheet sheet, ZRect cells, int selectionMode) {
        this.sheet = sheet;
        this.cells = cells;
        this.selectionMode = selectionMode;

        if (ZCmdFormat.getAutoUndo()) {
            ZCmdFormat.undoManager.addCommand(this);
        }
    }
    public void setRect(ZRect rect){ cells = rect;}

    /**
    *
    * @return
    */
    public ZRect getCells() {
        return cells;
    }

    /**
    *
    * @return
    */
    public int getSelectMode() {
        return selectionMode;
    }

    /**
    *
    * @return
    */
    public ZSheet getSheet() {
        return sheet;
    }

    /**
    * put your documentation comment here
    * @param cmd
    */
    public void add(AbstractUndoableEdit cmd) {
        cmdList.add(cmd);
    }

    /**
    *
    * @param key
    *
    * @return
    */
    public Object get(String key) {
        if (table != null) {
            return table.get(key);
        }

        return null;
    }

    /**
    *
    * @param key
    * @param value
    */
    public void put(String key, Object value) {
        if (table == null) {
            table = new Hashtable();
        }

        table.put(key, value);
    }

    /**
    * put your documentation comment here
    */
    public void redo() {
        super.redo() ;
        try {
            for (int i = 0; i < cmdList.size(); i++) {
                AbstractUndoableEdit cmd = (AbstractUndoableEdit) cmdList.elementAt(i);
                cmd.redo();
            }
        } catch (Exception e) {
        }

        ;
    }

    /**
     */
    public void undo() {
       super.undo() ;
        try {
            for (int i = cmdList.size() - 1; i >= 0; i--) {
                AbstractUndoableEdit cmd = (AbstractUndoableEdit) cmdList.elementAt(i);
                cmd.undo();
            }
        } catch (Exception e) {
        }

        ;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -