View Javadoc

1   /*
2    * XMLCV - Gestion de CV sous forme XML
3    * 
4    * Copyright (C) 2004-2005, Damien Raude-Morvan
5    * 
6    * This file is part of XMLCV.
7    *
8    * XMLCV is free software; you can redistribute it and/or modify
9    * it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation; either version 2 of the License, or
11   * (at your option) any later version.
12   *
13   * XMLCV is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   * GNU General Public License for more details.
17   *
18   * You should have received a copy of the GNU General Public License
19   * along with XMLCV; if not, write to the Free Software
20   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21   * 
22   * Contacts :
23   * - Sébastien Mathy <smathy@tuxfamily.org>
24   * - Emmanuel Berre <eberre@tuxfamily.org>
25   * - Damien Raude-Morvan <drazzib@drazzib.com>
26   */
27  package org.xmlcv.gui.listeners;
28  
29  import javax.swing.event.DocumentEvent;
30  import javax.swing.event.DocumentListener;
31  import javax.swing.text.JTextComponent;
32  
33  /***
34   * @version $Revision: 114 $
35   * @author <a href="mailto:drazzib@drazzib.com">Damien Raude-Morvan</a>
36   */
37  public abstract class AbstractTextFieldDocumentListener implements
38  		DocumentListener {
39  
40  	private JTextComponent _field;
41  
42  	public AbstractTextFieldDocumentListener(JTextComponent p_field) {
43  		this._field = p_field;
44  	}
45  
46  	/*
47  	 * (non-Javadoc)
48  	 * 
49  	 * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
50  	 */
51  	public void changedUpdate(DocumentEvent arg0) {
52  		this.recallUpdateGlobal(arg0);
53  	}
54  
55  	/*
56  	 * (non-Javadoc)
57  	 * 
58  	 * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
59  	 */
60  	public void insertUpdate(DocumentEvent arg0) {
61  		this.recallUpdateGlobal(arg0);
62  	}
63  
64  	/*
65  	 * (non-Javadoc)
66  	 * 
67  	 * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
68  	 */
69  	public void removeUpdate(DocumentEvent arg0) {
70  		this.recallUpdateGlobal(arg0);
71  	}
72  
73  	public abstract void recallUpdateGlobal(DocumentEvent arg0);
74  
75  	public String getValue() {
76  		return this._field.getText();
77  	}
78  
79  }