1 /* -------------------------------------------------------------------
2 * Java source file for the class EditorSupport
3 *
4 * Copyright (c), 2002, Masahiro Takatsuka.
5 * All Rights Researved.
6 *
7 * Original Author: Masahiro Takatsuka (masa@jbeans.net)
8 * $Author: takatsukam $
9 *
10 * $Date: 2003/07/25 04:51:45 $
11 *
12 * $Id: EditorSupport.java,v 1.1.1.1 2003/07/25 04:51:45 takatsukam Exp $
13 *
14 * Reference: Document no:
15 * ___ ___
16 *
17 * To Do:
18 * ___
19 *
20 ------------------------------------------------------------------- */
21
22 /* --------------------------- Package ---------------------------- */
23 package net.jbeans.bean.property.editor;
24
25 /* ------------------ Import classes (packages) ------------------- *//package-summary/html">color="#329900"> ------------------ Import classes (packages) ------------------- *//package-summary.html">color="#329900">/* ------------------ Import classes (packages) ------------------- *//package-summary.html">color="#329900"> ------------------ Import classes (packages) ------------------- */
26 import java.awt.*;
27 import java.beans.*;
28 import javax.swing.*;
29
30 /*====================================================================
31 Implementation of class EditorSupport
32 ====================================================================*/
33 /***
34 * Base class of all property editors.
35 *
36 * @version $Revision: 1.1.1.1 $
37 * @author Masahiro Takatsuka (masa@jbeans.net)
38 * @see PropertyEditorSupport
39 */
40
41 public class EditorSupport extends PropertyEditorSupport {
42 /***
43 * Component which holds the editor. Subclasses are responsible for
44 * instantiating this panel.
45 */
46 private JPanel panel;
47
48 protected static final Dimension MEDIUM_DIMENSION = new Dimension(120,20);
49 protected static final Dimension SMALL_DIMENSION = new Dimension(50,20);
50
51 /***
52 * Returns the panel responsible for rendering the PropertyEditor.
53 */
54 public Component getCustomEditor() {
55 return this.panel;
56 }
57
58 public final boolean supportsCustomEditor() {
59 return true;
60 }
61
62 // layout stuff
63 protected final void setAlignment(JComponent c){
64 c.setAlignmentX(Component.CENTER_ALIGNMENT);
65 c.setAlignmentY(Component.CENTER_ALIGNMENT);
66 }
67
68 /***
69 * For property editors that must be initialized with values from
70 * the property descriptor.
71 */
72 public void init(PropertyDescriptor descriptor) {
73 }
74
75 protected void setPanel(JPanel panel) {
76 this.panel = panel;
77 }
78
79 protected JPanel getPanel() {
80 return this.panel;
81 }
82 }
This page was automatically generated by Maven