
META-INF.modules.java.desktop.classes.javax.swing.undo.StateEdit Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
package javax.swing.undo;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
/**
* StateEdit is a general edit for objects that change state.
* Objects being edited must conform to the StateEditable interface.
*
* 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.
*
* A state edit is used as follows:
*
* // 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();
*
*
* Note that when a StateEdit ends, it removes redundant state from
* the Hashtables - A state Hashtable is not guaranteed to contain all
* keys/values placed into it when the state is stored!
*
* @see StateEditable
*
* @author Ray Ryan
*/
@SuppressWarnings("serial") // Same-version serialization only
public class StateEdit
extends AbstractUndoableEdit {
/**
* Obsolete RCS version identity.
*/
protected static final String RCSID = "$Id: StateEdit.java,v 1.6 1997/10/01 20:05:51 sandipc Exp $";
//
// Attributes
//
/**
* The object being edited
*/
protected StateEditable object;
/**
* The state information prior to the edit
*/
protected Hashtable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy