@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; }
public void setStale(String worksheetId, boolean stale) { if (worksheetId == null) { worksheetId = IMPORT_COMMANDS; } CommandTagListMap commandTagListMap = historyWorksheetMap.get(worksheetId); if (commandTagListMap != null) { commandTagListMap.stale = stale; } }