コード例 #1
0
 @Override
 public WorksheetCommandHistory clone() {
   WorksheetCommandHistory worksheetCommandHistory = new WorksheetCommandHistory();
   for (String worksheetId : getAllWorksheetId()) {
     worksheetCommandHistory.historyWorksheetMap.put(worksheetId, new CommandTagListMap());
   }
   for (ICommand command : getAllCommands()) {
     worksheetCommandHistory.insertCommandToHistory(command);
   }
   for (String worksheetId : getAllWorksheetId()) {
     CommandTagListMap newMap = worksheetCommandHistory.historyWorksheetMap.get(worksheetId);
     CommandTagListMap oldMap = this.historyWorksheetMap.get(worksheetId);
     if (oldMap != null && newMap != null) {
       if (oldMap.currentCommand != null) {
         newMap.currentCommand =
             new RedoCommandObject(
                 oldMap.currentCommand.getCommand(),
                 oldMap.currentCommand.getConsolidatedCommand());
       }
       if (oldMap.lastRedoCommand != null) {
         newMap.lastRedoCommand =
             new RedoCommandObject(
                 oldMap.lastRedoCommand.getCommand(),
                 oldMap.lastRedoCommand.getConsolidatedCommand());
       }
       newMap.stale = oldMap.stale;
     }
   }
   return worksheetCommandHistory;
 }
コード例 #2
0
 public void clearRedoCommand(String worksheetId) {
   if (worksheetId == null) {
     worksheetId = IMPORT_COMMANDS;
   }
   CommandTagListMap commandTagListMap = historyWorksheetMap.get(worksheetId);
   if (commandTagListMap != null) {
     commandTagListMap.lastRedoCommand = null;
   }
 }
コード例 #3
0
  public void setLastRedoCommandObject(RedoCommandObject command) {

    String worksheetId = getWorksheetId(command.getCommand());
    if (worksheetId == null) {
      worksheetId = IMPORT_COMMANDS;
    }
    CommandTagListMap commandTagListMap = historyWorksheetMap.get(worksheetId);
    if (commandTagListMap == null) {
      commandTagListMap = new CommandTagListMap();
      historyWorksheetMap.put(worksheetId, commandTagListMap);
    }
    if (commandTagListMap.lastRedoCommand == null) {
      commandTagListMap.lastRedoCommand = command;
    }
  }