Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / editabletextcomponent / event / UndoRedoEditEvent.java @ 40561

History | View | Annotate | Download (2.82 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.gui.beans.editabletextcomponent.event;
25

    
26

    
27
/**
28
 * <p>An event indicating the kind of operation occurred: undo or redo.</p>
29
 * 
30
 * @version 12/02/2008
31
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
32
 */
33
public class UndoRedoEditEvent extends java.util.EventObject {
34
        public static final short UNDO = 0;
35
        public static final short REDO = 1;
36

    
37
        protected transient short myType;
38
        protected transient String myOldText;
39
        protected transient String myNewText;
40
        
41
    /**
42
     * Constructs an UndoableEditEvent object.
43
     *
44
     * @param source  the Object that originated the event
45
     *                (typically <code>this</code>)
46
     * @param type    type of operation done <i>(undo or redo)</i>
47
     * @param oldText text before the operation
48
     * @param newText text after the operation
49
     */
50
    public UndoRedoEditEvent(Object source, short type, String oldText, String newText) {
51
            super(source);
52
            myType = type;
53
            myOldText = oldText;
54
            myNewText = newText;
55
    }
56
    
57
    /**
58
     * Returns the edit operation identifier value.
59
     *
60
     * @return the UndoableEdit object encapsulating the edit
61
     */
62
    public short getType() {
63
            return myType;
64
    }
65
    
66
    /**
67
     * Returns the previous text.
68
     *
69
     * @return the previous text
70
     */
71
    public String getOldText() {
72
            return myOldText;
73
    }
74
    
75
    /**
76
     * Returns the new text.
77
     *
78
     * @return the new text
79
     */
80
    public String getNewText() {
81
            return myNewText;
82
    }
83

    
84
    /**
85
     * Returns a <code>String</code> representation of this <code>UndoRedoEditEvent</code>.
86
     *
87
     * @return a <code>String</code> representation of this <code>UndoRedoEditEvent</code>
88
     */
89
    public String toString() {
90
        return getClass().getName() + "[source=" + source +
91
        ",myType=" + myType +
92
            ",myOldText=" + myOldText +
93
            ",myNewText=" + myNewText +
94
        "]" ;
95
    }
96
}