KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > form > FormDesignValue


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20
21 package org.netbeans.modules.form;
22
23 /**
24  * FormDesignValue interface gives a way how to use special property
25  * values that holds some additional or design specific information.
26  * Objects implementing FormDesignValue are specially supported by
27  * properties (@see FormProperty) in the form editor. An instance of
28  * FormDesignValue can be set as a property value - but it is not set to
29  * the real object (target bean) directly - some "design value" is derived
30  * from it first. Method getDesignValue() is defined for this purpose.
31  * The value returned from getDesignValue() is used on the real instance
32  * of the bean during design-time, while the object implementing
33  * FormDesignValue will be used for persistence and for code generation.
34  *
35  * Various property editors may provide values implementing FormDesignValue.
36  * For example, an internationalization string editor can work with
37  * values holding the key of internationalized string and returning the
38  * content of the key (from a Bundle.properties file) as the "design value"
39  * (from getDesignValue() method). Such an editor can be used then on any
40  * property of type String.
41  *
42  * @author Ian Formanek
43  */

44 public interface FormDesignValue extends java.io.Serializable JavaDoc {
45
46     /** A special value indicating (when returned from getDesignValue())
47      * that no real value is available during design-time for this object.
48      * @see #getDesignValue
49      */

50     public static final Object JavaDoc IGNORED_VALUE = new Object JavaDoc();
51
52     static final long serialVersionUID =5993614134339828170L;
53
54     /** Provides a value which should be used during design-time
55      * as the real value of a property on the bean instance.
56      * E.g. the ResourceBundle String would provide the real value
57      * of the String from the resource bundle, so that the design-time
58      * representation reflects the real code being generated.
59      * @return the real property value to be used during design-time
60      */

61     public Object JavaDoc getDesignValue();
62
63     /** Returns description of the design value. Can be useful when
64      * the real value for design-time is not provided.
65      */

66     public String JavaDoc getDescription();
67
68     /**
69      * Returns a new FormDesignValue instance which should, as appropriate,
70      * correspond to the target form property.
71      *
72      * @param targetFormProperty the FormProperty the copied value will be set to
73      * @return the new FormDesignValue instance or null if it's impossible to copy
74      * the particular subtype; may also return the represented real value
75      */

76     public Object JavaDoc copy(FormProperty targetFormProperty);
77     
78     //
79
// In the future, some methods for handling persistence
80
// will be probably added here.
81
//
82

83 // /** Extended version of FormDesignValue which supports listening on
84
// * changes of the design value. */
85
// public interface Listener extends FormDesignValue {
86
// static final long serialVersionUID =7127443991708952900L;
87
//
88
// /** Attaches specified listener to the design value.
89
// * The change event is fired whenever the design value (accessible
90
// * via getDesignValue() method call) changes.
91
// * @param listener the change listener to add
92
// */
93
// public void addChangeListener(javax.swing.event.ChangeListener listener);
94
//
95
// /** Deattaches specified listener from the design value.
96
// * @param listener the change listener to remove
97
// */
98
// public void removeChangeListener(javax.swing.event.ChangeListener listener);
99
// }
100
}
101
Popular Tags