svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / editabletextcomponent / JEditableTextField.java @ 40561
History | View | Annotate | Download (3.74 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.JTextField; |
27 |
import javax.swing.text.Document; |
28 |
|
29 |
import org.gvsig.gui.beans.editabletextcomponent.event.UndoRedoEditListener; |
30 |
|
31 |
/**
|
32 |
* <p>Text field with options to edit its text easily.</p>
|
33 |
*
|
34 |
* @see JTextField
|
35 |
*
|
36 |
* @version 03/01/2008
|
37 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
38 |
*/
|
39 |
public class JEditableTextField extends JTextField implements IEditableText { |
40 |
private static final long serialVersionUID = 5504131442718795532L; |
41 |
|
42 |
// REFERENCE TO THE TEXT EDITOR DECORATOR
|
43 |
private EditableTextDecorator editableTextDecorator;
|
44 |
// END REFERENCE TO THE TEXT EDITOR DECORATOR
|
45 |
|
46 |
/**
|
47 |
* @see JTextField#JTextField()
|
48 |
*/
|
49 |
public JEditableTextField() {
|
50 |
super();
|
51 |
|
52 |
initialize(); |
53 |
} |
54 |
|
55 |
/**
|
56 |
* @see JTextField#JTextField(Document, String, int)
|
57 |
*/
|
58 |
public JEditableTextField(Document doc, String text, int columns) { |
59 |
super(doc, text, columns);
|
60 |
|
61 |
initialize(); |
62 |
} |
63 |
|
64 |
/**
|
65 |
* @see JTextField#JTextField(int)
|
66 |
*/
|
67 |
public JEditableTextField(int columns) { |
68 |
super(columns);
|
69 |
|
70 |
initialize(); |
71 |
} |
72 |
|
73 |
/**
|
74 |
* @see JTextField#JTextField(String, int)
|
75 |
*/
|
76 |
public JEditableTextField(String text, int columns) { |
77 |
super(text, columns);
|
78 |
|
79 |
initialize(); |
80 |
} |
81 |
|
82 |
/**
|
83 |
* @see JTextField#JTextField(String)
|
84 |
*/
|
85 |
public JEditableTextField(String text) { |
86 |
super(text);
|
87 |
|
88 |
initialize(); |
89 |
} |
90 |
|
91 |
/**
|
92 |
* <p>Fits this component to be ready to be used.</p>
|
93 |
*/
|
94 |
protected void initialize() { |
95 |
editableTextDecorator = new EditableTextDecorator(this); |
96 |
} |
97 |
|
98 |
/*
|
99 |
* (non-Javadoc)
|
100 |
* @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#getUndoRedoLimitActions()
|
101 |
*/
|
102 |
public int getUndoRedoLimitActions() { |
103 |
return editableTextDecorator.getUndoRedoLimitActions();
|
104 |
} |
105 |
|
106 |
/*
|
107 |
* (non-Javadoc)
|
108 |
* @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#setUndoRedoLimitActions(int)
|
109 |
*/
|
110 |
public void setUndoRedoLimitActions(int limit) { |
111 |
editableTextDecorator.setUndoRedoLimitActions(limit); |
112 |
} |
113 |
|
114 |
/*
|
115 |
* (non-Javadoc)
|
116 |
* @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#addUndoRedoEditListener(org.gvsig.gui.beans.editabletextcomponent.event.UndoRedoEditListener)
|
117 |
*/
|
118 |
public void addUndoRedoEditListener(UndoRedoEditListener listener) { |
119 |
editableTextDecorator.addUndoRedoEditListener(listener); |
120 |
} |
121 |
|
122 |
/*
|
123 |
* (non-Javadoc)
|
124 |
* @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#getUndoRedoEditListeners()
|
125 |
*/
|
126 |
public UndoRedoEditListener[] getUndoRedoEditListeners() { |
127 |
return editableTextDecorator.getUndoRedoEditListeners();
|
128 |
} |
129 |
|
130 |
/*
|
131 |
* (non-Javadoc)
|
132 |
* @see org.gvsig.gui.beans.editabletextcomponent.IEditableText#removeUndoRedoEditListener(org.gvsig.gui.beans.editabletextcomponent.event.UndoRedoEditListener)
|
133 |
*/
|
134 |
public void removeUndoRedoEditListener(UndoRedoEditListener listener) { |
135 |
editableTextDecorator.removeUndoRedoEditListener(listener); |
136 |
} |
137 |
} |