Statistics
| Revision:

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

History | View | Annotate | Download (4.01 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;
25

    
26
import javax.swing.JTextArea;
27
import javax.swing.text.Document;
28

    
29
import org.gvsig.gui.beans.editabletextcomponent.event.UndoRedoEditListener;
30

    
31
/**
32
 * <p>Text area with options to edit its text easily.</p>
33
 * 
34
 * @see JTextArea
35
 * 
36
 * @version 03/01/2008
37
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
38
 */
39
public class JEditableTextArea extends JTextArea implements IEditableText {
40
        private static final long serialVersionUID = -8094155271679157582L;
41

    
42
        // REFERENCE TO THE TEXT EDITOR DECORATOR
43
        private EditableTextDecorator editableTextDecorator;
44
        // END REFERENCE TO THE TEXT EDITOR DECORATOR
45
        
46
        /**
47
         * @see JEditableTextArea#JEditableTextArea()
48
         */
49
        public JEditableTextArea() {
50
                super();
51
                
52
                initialize();
53
        }
54

    
55
        /**
56
         * @see JEditableTextArea#JEditableTextArea(Document, String, int, int)
57
         */
58
        public JEditableTextArea(Document doc, String text, int rows, int columns) {
59
                super(doc, text, rows, columns);
60
                
61
                initialize();
62
        }
63

    
64
        /**
65
         * @see JEditableTextArea#JEditableTextArea(Document)
66
         */
67
        public JEditableTextArea(Document doc) {
68
                super(doc);
69
                
70
                initialize();
71
        }
72

    
73
        /**
74
         * @see JEditableTextArea#JEditableTextArea(int, int)
75
         */
76
        public JEditableTextArea(int rows, int columns) {
77
                super(rows, columns);
78
                
79
                initialize();
80
        }
81

    
82
        /**
83
         * @see JEditableTextArea#JEditableTextArea(String, int, int)
84
         */
85
        public JEditableTextArea(String text, int rows, int columns) {
86
                super(text, rows, columns);
87
                
88
                initialize();
89
        }
90

    
91
        /**
92
         * @see JEditableTextArea#JEditableTextArea(String)
93
         */
94
        public JEditableTextArea(String text) {
95
                super(text);
96
                
97
                initialize();
98
        }
99

    
100
        /**
101
         * <p>Fits this component to be ready to be used.</p>
102
         */
103
        protected void initialize() {
104
                editableTextDecorator = new EditableTextDecorator(this);
105
        }
106

    
107
        /*
108
         * (non-Javadoc)
109
         * @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#getUndoRedoLimitActions()
110
         */
111
        public int getUndoRedoLimitActions() {
112
                return editableTextDecorator.getUndoRedoLimitActions();
113
        }
114

    
115
        /*
116
         * (non-Javadoc)
117
         * @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#setUndoRedoLimitActions(int)
118
         */
119
        public void setUndoRedoLimitActions(int limit) {
120
                editableTextDecorator.setUndoRedoLimitActions(limit);
121
        }
122

    
123
        /*
124
         * (non-Javadoc)
125
         * @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#addUndoRedoEditListener(org.gvsig.gui.beans.editabletextcomponent.event.UndoRedoEditListener)
126
         */
127
        public void addUndoRedoEditListener(UndoRedoEditListener listener) {
128
                editableTextDecorator.addUndoRedoEditListener(listener);
129
        }
130

    
131
        /*
132
         * (non-Javadoc)
133
         * @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#getUndoRedoEditListeners()
134
         */
135
        public UndoRedoEditListener[] getUndoRedoEditListeners() {
136
                return editableTextDecorator.getUndoRedoEditListeners();
137
        }
138

    
139
        /*
140
         * (non-Javadoc)
141
         * @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#removeUndoRedoEditListener(org.gvsig.gui.beans.editabletextcomponent.event.UndoRedoEditListener)
142
         */
143
        public void removeUndoRedoEditListener(UndoRedoEditListener listener) {
144
                editableTextDecorator.removeUndoRedoEditListener(listener);
145
        }
146
}