KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > form > layoutsupport > LayoutSupportContext


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 package org.netbeans.modules.form.layoutsupport;
21
22 import java.awt.Component JavaDoc;
23 import java.awt.Container JavaDoc;
24 import java.beans.PropertyChangeEvent JavaDoc;
25 import java.beans.PropertyVetoException JavaDoc;
26
27 import org.netbeans.modules.form.codestructure.*;
28
29 /**
30  * Interface providing necessary context information for LayoutSupportDelegate
31  * implementation. Its purpose is to "connect" the layout delegate with the
32  * rest of the layout support infrastructure (which implements this interface).
33  * LayoutSupportDelegate receives an instance of LayoutSupportContext as
34  * a parameter of initialize method.
35  * Besides providing information, this interface also contains two methods
36  * which should be called from the layout delegate to notify the infrastructure
37  * about changes: containerLayoutChanged and componentLayoutChanged.
38  * Note: these calls need not be handled explicitly if the layout support
39  * implementation uses FormProperty subclass for properties (instead of
40  * Node.Property only).
41  *
42  * @author Tomas Pavek
43  */

44
45 public interface LayoutSupportContext {
46
47     /** Gets the CodeStructure object to be used for reading/creating code of
48      * the container layout configuration.
49      * @return main CodeStructure object holding code data
50      */

51     public CodeStructure getCodeStructure();
52
53     /** Gets the code expression of the primary container (reference container
54      * instance in form metadata structures).
55      * @return CodeExpression of the primary container
56      */

57     public CodeExpression getContainerCodeExpression();
58
59     /** Gets the code expression of the primary container delegate.
60      * #return CodeEpression of primary container delegate.
61      */

62     public CodeExpression getContainerDelegateCodeExpression();
63
64     /** Gets the primary container. This is the reference instance used in form
65      * metadata structures.
66      * @return instance of the primary container
67      */

68     public Container JavaDoc getPrimaryContainer();
69
70     /** Gets the container delegate of the primary container.
71      * @return instance of the primary container delegate
72      */

73     public Container JavaDoc getPrimaryContainerDelegate();
74
75     /** Gets the primary component (reference instance) on given index in
76      * the primary container.
77      * @return component on given index in primary container.
78      */

79     public Component JavaDoc getPrimaryComponent(int index);
80
81     /** This method should be called by the layout delegate if some change
82      * requires to update the layout in the primary container completely
83      * (remove components, set new layout, add components again). To be used
84      * probably only in case the supported layout manager is not a bean
85      * (e.g. BoxLayout).
86      */

87     public void updatePrimaryContainer();
88
89     /** This method should be called by the layout delegate to notify about
90      * changing a property of container layout. The infrastructure then calls
91      * back the delegate's acceptContainerLayoutChange method which may
92      * throw PropertyVetoException to revert the property change.
93      */

94     public void containerLayoutChanged(PropertyChangeEvent JavaDoc evt)
95         throws PropertyVetoException JavaDoc;
96
97     /** This method should be called by the layout delegate to notify about
98      * changing a property of component layout constraint. The infrastructure
99      * then calls back the delegate's acceptComponentLayoutChange method which
100      * may throw PropertyVetoException to revert the property change.
101      */

102     public void componentLayoutChanged(int index, PropertyChangeEvent JavaDoc evt)
103         throws PropertyVetoException JavaDoc;
104 }
105
Popular Tags