KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > multiview > ui > BoxPanel


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 package org.netbeans.modules.xml.multiview.ui;
20
21 import javax.swing.*;
22 import java.awt.*;
23
24 /**
25  * @author pfiala
26  */

27 public class BoxPanel extends SectionNodeInnerPanel {
28
29     /**
30      * Creates new form BoxPanel
31      *
32      * @param sectionNodeView
33      */

34     public BoxPanel(SectionNodeView sectionNodeView) {
35         super(sectionNodeView);
36         initComponents();
37     }
38
39     /**
40      * This method is called from within the constructor to
41      * initialize the form.
42      * WARNING: Do NOT modify this code. The content of this method is
43      * always regenerated by the Form Editor.
44      */

45     private void initComponents() {//GEN-BEGIN:initComponents
46

47         setLayout(new javax.swing.BoxLayout JavaDoc(this, javax.swing.BoxLayout.Y_AXIS));
48
49     }//GEN-END:initComponents
50

51
52     // Variables declaration - do not modify//GEN-BEGIN:variables
53
// End of variables declaration//GEN-END:variables
54

55     public JComponent getErrorComponent(String JavaDoc errorId) {
56         final Component[] components = getComponents();
57         for (int i = 0; i < components.length; i++) {
58             final Component component = components[i];
59             if (component instanceof SectionInnerPanel) {
60                 SectionInnerPanel panel = (SectionInnerPanel) component;
61                 final JComponent errorComponent = panel.getErrorComponent(errorId);
62                 if (errorComponent != null) {
63                     return errorComponent;
64                 }
65             }
66         }
67         return null;
68     }
69
70     public void setValue(JComponent source, Object JavaDoc value) {
71
72     }
73
74     public void linkButtonPressed(Object JavaDoc ddBean, String JavaDoc ddProperty) {
75         final Component[] components = getComponents();
76         for (int i = 0; i < components.length; i++) {
77             final Component component = components[i];
78             if (component instanceof SectionInnerPanel) {
79                 SectionInnerPanel panel = (SectionInnerPanel) component;
80                 panel.linkButtonPressed(ddBean, ddProperty);
81             }
82         }
83     }
84
85     public void setComponents(Component[] components) {
86         for (int i = 0; i < components.length; i++) {
87             Component component = components[i];
88             if (i >= getComponentCount() || component != getComponent(i)) {
89                 add(component, i);
90             }
91         }
92         int n = components.length;
93         while (getComponentCount() > n) {
94             remove(n);
95         }
96     }
97     /** This will be called after model is changed from this panel
98      */

99     protected void signalUIChange() {
100     }
101 }
102
Popular Tags