/** * Clears the history array. */ public void resetHistory() { history.clear(); currentCommandIndex = -1; fireHistoryReset(new HistoryBrowserEvent(new Object())); }
/** * Clears the history array. */ public void resetHistory() { history.clear(); currentCommandIndex = -1; fireHistoryReset(new HistoryBrowserEvent(new Object())); }
currentCommandIndex--; fireExecutePerformed(new HistoryBrowserEvent(new CommandNamesInfo( command.getName(), getLastUndoableCommandName(), getLastRedoableCommandName())));
currentCommandIndex--; fireExecutePerformed(new HistoryBrowserEvent(new CommandNamesInfo( command.getName(), getLastUndoableCommandName(), getLastRedoableCommandName())));
/** * Undoes the last executed or 'redone' command. */ public void undo() { // If history is empty, or the current command index is out of bounds if (history.isEmpty() || currentCommandIndex < 0) { return; } // Gets the command and performs undo UndoableCommand command = (UndoableCommand) history .get(currentCommandIndex); if (commandController != null) { commandController.undo(command); } else { state = UNDOING; command.undo(); state = IDLE; } // Updates the current command index currentCommandIndex--; fireUndoPerformed(new HistoryBrowserEvent(new CommandNamesInfo(command .getName(), getLastUndoableCommandName(), getLastRedoableCommandName()))); }
/** * Redoes the last 'undone' command. */ public void redo() { // If history is empty, or the current command index is out of bounds if (history.isEmpty() || currentCommandIndex == history.size() - 1) { return; } // Increases the current command index and redoes the command UndoableCommand command = (UndoableCommand) history .get(++currentCommandIndex); if (commandController != null) { commandController.redo(command); } else { state = REDOING; command.redo(); state = IDLE; } fireRedoPerformed(new HistoryBrowserEvent(new CommandNamesInfo(command .getName(), getLastUndoableCommandName(), getLastRedoableCommandName()))); }
/** * Undoes the last executed or 'redone' command. */ public void undo() { // If history is empty, or the current command index is out of bounds if (history.isEmpty() || currentCommandIndex < 0) { return; } // Gets the command and performs undo UndoableCommand command = (UndoableCommand) history .get(currentCommandIndex); if (commandController != null) { commandController.undo(command); } else { state = UNDOING; command.undo(); state = IDLE; } // Updates the current command index currentCommandIndex--; fireUndoPerformed(new HistoryBrowserEvent(new CommandNamesInfo(command .getName(), getLastUndoableCommandName(), getLastRedoableCommandName()))); }
/** * Redoes the last 'undone' command. */ public void redo() { // If history is empty, or the current command index is out of bounds if (history.isEmpty() || currentCommandIndex == history.size() - 1) { return; } // Increases the current command index and redoes the command UndoableCommand command = (UndoableCommand) history .get(++currentCommandIndex); if (commandController != null) { commandController.redo(command); } else { state = REDOING; command.redo(); state = IDLE; } fireRedoPerformed(new HistoryBrowserEvent(new CommandNamesInfo(command .getName(), getLastUndoableCommandName(), getLastRedoableCommandName()))); }
/** * Adds and executes the current compound command to history browser. */ public void performCurrentCompoundCommand() { if (getCurrentCompoundCommand().getCommandNumber() > 0) { historyBrowser.addCommand(getCurrentCompoundCommand()); // Fire the 'compoundEditPerformed' event historyBrowser.fireCompoundEditPerformed (new HistoryBrowserEvent(currentCompoundCommand)); // Reset the current compound command currentCompoundCommand = null; } }
/** * Adds and executes the current compound command to history browser. */ public void performCurrentCompoundCommand() { if (getCurrentCompoundCommand().getCommandNumber() > 0) { historyBrowser.addCommand(getCurrentCompoundCommand()); // Fire the 'compoundEditPerformed' event historyBrowser.fireCompoundEditPerformed (new HistoryBrowserEvent(currentCompoundCommand)); // Reset the current compound command currentCompoundCommand = null; } }
/** * Adds the given command to current compound command. * * @param cmd * The command to add */ public void addToCurrentCompoundCommand(AbstractUndoableCommand cmd) { getCurrentCompoundCommand().addCommand(cmd); // Fire the 'doCompoundEdit' event historyBrowser.fireDoCompoundEdit (new HistoryBrowserEvent(getCurrentCompoundCommand())); }
/** * Adds the given command to current compound command. * * @param cmd * The command to add */ public void addToCurrentCompoundCommand(AbstractUndoableCommand cmd) { getCurrentCompoundCommand().addCommand(cmd); // Fire the 'doCompoundEdit' event historyBrowser.fireDoCompoundEdit (new HistoryBrowserEvent(getCurrentCompoundCommand())); }