01: /*
02: * Copyright (C) 2005 Jeff Tassin
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.jeta.swingbuilder.gui.properties.editors;
20:
21: import java.awt.BorderLayout;
22: import java.awt.Component;
23:
24: import javax.swing.JPanel;
25: import javax.swing.JTextField;
26:
27: import com.jeta.swingbuilder.gui.properties.JETAPropertyEditor;
28:
29: public class UnknownEditor extends JETAPropertyEditor {
30: private JPanel m_panel;
31: private JTextField m_field = new JTextField();
32:
33: public UnknownEditor() {
34: m_panel = new JPanel();
35: m_panel.setLayout(new BorderLayout());
36: m_field.setEnabled(false);
37: m_panel.add(m_field, BorderLayout.CENTER);
38: m_panel.setBackground(javax.swing.UIManager
39: .getColor("Table.background"));
40: m_field.setBorder(javax.swing.BorderFactory.createEmptyBorder(
41: 2, 2, 3, 2));
42: }
43:
44: public Component getCustomEditor() {
45: return m_panel;
46: }
47:
48: /**
49: * @return true if this editor supports custom editing inline in the
50: * property table. Property types such as the Java primitives and
51: * Strings support inline editing.
52: */
53: public boolean supportsInlineEditing() {
54: return true;
55: }
56:
57: public void setValue(Object value) {
58: super .setValue(value);
59: if (value != null) {
60: m_field.setText(value.toString());
61: } else {
62: m_field.setText("");
63: }
64: }
65:
66: }
|