/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* <P>StateEdit is a general edit for objects that change state.
* Objects being edited must conform to the StateEditable interface.</P>
*
* <P>This edit class works by asking an object to store it's state in
* Hashtables before and after editing occurs. Upon undo or redo the
* object is told to restore it's state from these Hashtables.</P>
*
* A state edit is used as follows:
* <PRE>
* // Create the edit during the "before" state of the object
* StateEdit newEdit = new StateEdit(myObject);
* // Modify the object
* myObject.someStateModifyingMethod();
* // "end" the edit when you are done modifying the object
* newEdit.end();
* </PRE>
*
* <P><EM>Note that when a StateEdit ends, it removes redundant state from
* the Hashtables - A state Hashtable is not guaranteed to contain all
*
* @see StateEditable
*
* @author Ray Ryan
*/
public class StateEdit
extends AbstractUndoableEdit {
protected static final String RCSID = "$Id: StateEdit.java,v 1.6 1997/10/01 20:05:51 sandipc Exp $";
//
// Attributes
//
/**
* The object being edited
*/
/**
* The state information prior to the edit
*/
/**
* The state information after the edit
*/
/**
*/
//
// Constructors
//
/**
* Create and return a new StateEdit.
*
* @param anObject The object to watch for changing state
*
* @see StateEdit
*/
super();
}
/**
* Create and return a new StateEdit with a presentation name.
*
* @param anObject The object to watch for changing state
* @param name The presentation name to be used for this edit
*
* @see StateEdit
*/
super();
}
this.undoRedoName = name;
}
//
// Operation
//
/**
* Gets the post-edit state of the StateEditable object and
* ends the edit.
*/
public void end() {
this.removeRedundantState();
}
/**
* Tells the edited object to apply the state prior to the edit
*/
public void undo() {
super.undo();
}
/**
* Tells the edited object to apply the state after the edit
*/
public void redo() {
super.redo();
}
/**
* Gets the presentation name for this edit
*/
return this.undoRedoName;
}
//
// Internal support
//
/**
*/
protected void removeRedundantState() {
// Locate redundant state
while (myKeys.hasMoreElements()) {
}
}
// Remove redundant state
}
}
} // End of class StateEdit