KickJava   Java API By Example, From Geeks To Geeks.

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


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.*;
23 import java.beans.*;
24 import org.openide.nodes.Node;
25 import org.netbeans.modules.form.*;
26
27 /**
28  * Meta component representing a LayoutManager instance as a JavaBean.
29  *
30  * @author Tomas Pavek
31  */

32
33 class MetaLayout extends RADComponent {
34
35     private AbstractLayoutSupport abstLayoutDelegate;
36
37     public MetaLayout(AbstractLayoutSupport layoutDelegate,
38                       LayoutManager lmInstance,
39                       boolean defaultInstance)
40     {
41         super();
42
43         abstLayoutDelegate = layoutDelegate;
44
45         initialize(((LayoutSupportManager)abstLayoutDelegate.getLayoutContext())
46                          .getMetaContainer().getFormModel());
47
48         if (defaultInstance)
49             setBeanInstance(lmInstance);
50         else
51             setInstance(lmInstance);
52     }
53
54     protected void createCodeExpression() {
55         // code expression is handled by the layout support class
56
}
57
58     protected void createPropertySets(java.util.List JavaDoc propSets) {
59         super.createPropertySets(propSets);
60
61         // RADComponent provides also Code Generation properties for which
62
// we have no use here (yet) - so we remove them now
63
for (int i=0, n=propSets.size(); i < n; i++) {
64             Node.PropertySet propSet = (Node.PropertySet)propSets.get(i);
65             if (!"properties".equals(propSet.getName()) // NOI18N
66
&& !"properties2".equals(propSet.getName())) { // NOI18N
67
propSets.remove(i);
68                 i--; n--;
69             }
70         }
71     }
72
73     protected PropertyChangeListener createPropertyListener() {
74         // cannot reuse RADComponent.PropertyListener, because this is not
75
// a regular RADComponent (properties have a special meaning)
76
return null;
77     }
78 }
79
Popular Tags