All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nakedobjects.plugins.dnd.viewer.undo.UndoStack Maven / Gradle / Ivy

The newest version!
package org.nakedobjects.plugins.dnd.viewer.undo;

import java.util.Vector;


public class UndoStack {
    
    private final Vector commands = new Vector();

    public void add(final Command command) {
        commands.addElement(command);
        command.execute();
    }

    public void undoLastCommand() {
        final Command lastCommand = commands.lastElement();
        lastCommand.undo();
        commands.removeElement(lastCommand);
    }

    public String descriptionOfUndo() {
        final Command lastCommand = commands.lastElement();
        return lastCommand.getDescription();
    }

    public boolean isEmpty() {
        return commands.isEmpty();
    }

    public String getNameOfUndo() {
        final Command lastCommand = commands.lastElement();
        return lastCommand.getName();
    }
}
// Copyright (c) Naked Objects Group Ltd.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy