KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > ElementOrTypeTableCellEditor


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * ElementOrTypeTableCellEditor.java
22  *
23  * Created on August 30, 2006, 5:27 PM
24  *
25  * To change this template, choose Tools | Template Manager
26  * and open the template in the editor.
27  */

28
29 package org.netbeans.modules.xml.wsdl.ui.view;
30
31 import java.awt.Component JavaDoc;
32 import java.util.Map JavaDoc;
33
34 import javax.swing.AbstractCellEditor JavaDoc;
35 import javax.swing.DefaultCellEditor JavaDoc;
36 import javax.swing.JTable JavaDoc;
37 import javax.swing.JTextField JavaDoc;
38 import javax.swing.table.TableCellEditor JavaDoc;
39
40 import org.netbeans.api.project.Project;
41 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
42
43 /**
44  *
45  * @author radval
46  */

47 class ElementOrTypeTableCellEditor extends AbstractCellEditor JavaDoc
48                                                 implements TableCellEditor JavaDoc {
49         
50         private ElementOrTypeChooserEditorPanel mPanel;
51         private DefaultCellEditor JavaDoc mEditor = new DefaultCellEditor JavaDoc(new JTextField JavaDoc());
52         
53         public ElementOrTypeTableCellEditor(JTable JavaDoc partsTable, Map JavaDoc<String JavaDoc, String JavaDoc> namespaceToPrefixMap, Project project, WSDLModel model) {
54             mPanel = new ElementOrTypeChooserEditorPanel(partsTable, namespaceToPrefixMap, project, model);
55             
56         }
57         
58         public Component JavaDoc getTableCellEditorComponent(JTable JavaDoc table,
59                                                      Object JavaDoc value,
60                                                       boolean isSelected,
61                                                       int row,
62                                                       int column) {
63             if(column == 1) {
64                 mPanel.getJTextField().setText(value.toString());
65                 
66                  return mPanel;
67             }
68             
69             return mEditor.getTableCellEditorComponent(table, value, isSelected, row, column);
70         }
71
72         public Object JavaDoc getCellEditorValue() {
73             return mPanel.getJTextField().getText();
74         }
75         
76
77     }
78
Popular Tags