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

org.arakhne.afc.ui.undo.UndoManager Maven / Gradle / Ivy

There is a newer version: 13.0
Show newest version
/* 
 * $Id: org/arakhne/afc/ui/undo/UndoManager.java v12.0 2015-04-09 01:26:18$
 * 
 * Copyright (C) 2013 Stephane GALLAND.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * This program is free software; you can redistribute it and/or modify
 */
package org.arakhne.afc.ui.undo ;


/** Manager of undoable actions.
 *
 * @author Stéphane GALLAND
 * @version 12.0 2015-04-09 01:26:18
 * @mavengroupid org.arakhne.afc.ui
 * @mavenartifactid base
 */
public interface UndoManager {

	/** Add listener on the changes in the undo list.
	 * 
	 * @param l
	 */
	public void addUndoListener(UndoListener l);
	
	/** Remove listener on the changes in the undo list.
	 * 
	 * @param l
	 */
	public void removeUndoListener(UndoListener l);

	/**
     * Undoes the appropriate actions.
     * @see #canUndo()
     */
    public void undo();

    /**
     * Returns true if actions may be undone.
     * 
     * @return true if there are actions to be undone.
     */
    public boolean canUndo();

    /**
     * Redoes the appropriate actions.
     * @see #canRedo()
     */
    public void redo();

    /**
     * Returns true if actions may be redone.
     * 
     * @return true if there are actions to be redone.
     */
    public boolean canRedo();

    /**
     * Returns a description of the undoable form of this edit.
     *
     * @return a description of the undoable form of this edit
     */
    public String getUndoPresentationName();
    /**
     * Returns a description of the redoable form of this edit.
     * 
     * @return a description of the redoable form of this edit
     */
    public String getRedoPresentationName();

    /**
     * Adds an Undoable to this
     * UndoManager, if it's possible.  This removes all
     * edits from the index of the next edit to the end of the edits
     * list.  If end has been invoked the edit is not added
     * and false is returned.  If end hasn't
     * been invoked this returns true.
     *
     * @param action is the action to be added
     * @return true if action can be incorporated into this
     *              edit
     */
    public boolean add(Undoable action);

    /**
     * Sets the maximum number of action this UndoManager
     * holds. A value less than 0 indicates the number of edits is not
     * limited.
     *
     * @param l the new limit
     */
    public void setLimit(int l);

    /**
     * Replies the maximum number of action this UndoManager
     * holds. A value less than 0 indicates the number of edits is not
     * limited.
     *
     * @return the limit.
     */
    public int getLimit();

    /**
     * Empties the undo manager sending each edit a die message
     * in the process.
     *
     * @see Undoable#die()
     */
    public void discardAll();
    	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy