01: /*
02: * SalomeTMF is a Test Management Framework
03: * Copyright (C) 2005 France Telecom R&D
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *
19: * @author Mikael MARCHE, Fayçal SOUGRATI, Vincent PAUTRET
20: *
21: * Contact: mikael.marche@rd.francetelecom.com
22: */
23:
24: package org.objectweb.salome_tmf.ihm.models;
25:
26: import java.awt.Component;
27:
28: import javax.swing.AbstractCellEditor;
29: import javax.swing.JComponent;
30: import javax.swing.JTable;
31: import javax.swing.JTextField;
32: import javax.swing.table.TableCellEditor;
33:
34: /**
35: * @author teaml039
36: */
37: public class DataSetCellEditor extends AbstractCellEditor implements
38: TableCellEditor {
39:
40: /**
41: * Composant prenant en compte la modification de la cellule
42: */
43: JComponent component = new JTextField();
44:
45: /**
46: * M?thode appel?e lorsque l'utilisateur ?dite la cellule
47: */
48: public Component getTableCellEditorComponent(JTable table,
49: Object value, boolean isSelected, int rowIndex,
50: int vColIndex) {
51:
52: // Configure le composant avec la valeur sp?cifi?e
53: ((JTextField) component).setText((String) value);
54:
55: // Retourne le composant
56: return component;
57: }
58:
59: /**
60: * M?thode appel?e lorsque l'?dition est termin?e.
61: * @return la nouvelle valeur entr?e dans la cellule
62: */
63: public Object getCellEditorValue() {
64: return ((JTextField) component).getText();
65: }
66:
67: }
|