1 /*
2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package java.beans;
27 
28 /**
29  * <p>
30  * This interface is intended to be implemented by, or delegated from, instances
31  * of java.beans.beancontext.BeanContext, in order to propagate to its nested hierarchy
32  * of java.beans.beancontext.BeanContextChild instances, the current "designTime" property.
33  * <p>
34  * The JavaBeans&trade; specification defines the notion of design time as is a
35  * mode in which JavaBeans instances should function during their composition
36  * and customization in a interactive design, composition or construction tool,
37  * as opposed to runtime when the JavaBean is part of an applet, application,
38  * or other live Java executable abstraction.
39  *
40  * @author Laurence P. G. Cable
41  * @since 1.2
42  *
43  * @see java.beans.beancontext.BeanContext
44  * @see java.beans.beancontext.BeanContextChild
45  * @see java.beans.beancontext.BeanContextMembershipListener
46  * @see java.beans.PropertyChangeEvent
47  */
48 
49 public interface DesignMode {
50 
51     /**
52      * The standard value of the propertyName as fired from a BeanContext or
53      * other source of PropertyChangeEvents.
54      */
55 
56     static String PROPERTYNAME = "designTime";
57 
58     /**
59      * Sets the "value" of the "designTime" property.
60      * <p>
61      * If the implementing object is an instance of java.beans.beancontext.BeanContext,
62      * or a subinterface thereof, then that BeanContext should fire a
63      * PropertyChangeEvent, to its registered BeanContextMembershipListeners, with
64      * parameters:
65      * <ul>
66      *    <li>{@code propertyName} - {@code java.beans.DesignMode.PROPERTYNAME}
67      *    <li>{@code oldValue} - previous value of "designTime"
68      *    <li>{@code newValue} - current value of "designTime"
69      * </ul>
70      * Note it is illegal for a BeanContextChild to invoke this method
71      * associated with a BeanContext that it is nested within.
72      *
73      * @param designTime  the current "value" of the "designTime" property
74      * @see java.beans.beancontext.BeanContext
75      * @see java.beans.beancontext.BeanContextMembershipListener
76      * @see java.beans.PropertyChangeEvent
77      */
78 
setDesignTime(boolean designTime)79     void setDesignTime(boolean designTime);
80 
81     /**
82      * A value of true denotes that JavaBeans should behave in design time
83      * mode, a value of false denotes runtime behavior.
84      *
85      * @return the current "value" of the "designTime" property.
86      */
87 
isDesignTime()88     boolean isDesignTime();
89 }
90