KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsitconf > ui > ErrorTopComponent


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

19
20 package org.netbeans.modules.websvc.wsitconf.ui;
21
22 import org.openide.util.NbBundle;
23 import org.openide.windows.TopComponent;
24
25 import java.awt.*;
26
27 /**
28  * @author Martin Grebac
29  */

30 public class ErrorTopComponent extends TopComponent {
31
32     static final long serialVersionUID=6021472310161712674L;
33     private boolean initialized = false;
34     
35     private String JavaDoc error = "";
36     
37     public ErrorTopComponent(String JavaDoc error) {
38         this.error = error;
39         setLayout(new BorderLayout());
40     }
41
42     @Override JavaDoc
43     protected String JavaDoc preferredID(){
44         return "WSITTopComponent"; //NOI18N
45
}
46     
47     /**
48      * #38900 - lazy addition of GUI components
49      */

50     private void doInitialize() {
51         initAccessibility();
52         add(new ErrorJPanel(error));
53         setFocusable(true);
54     }
55
56     @Override JavaDoc
57     public int getPersistenceType() {
58         return TopComponent.PERSISTENCE_ALWAYS;
59     }
60     
61     private void initAccessibility(){
62         getAccessibleContext().setAccessibleDescription(
63                 NbBundle.getMessage(ErrorTopComponent.class, "ACS_Tab_DESC")); // NOI18N
64
}
65     
66     /**
67      * #38900 - lazy addition of GUI components
68      */

69     @Override JavaDoc
70     public void addNotify() {
71         if (!initialized) {
72             initialized = true;
73             doInitialize();
74         }
75         super.addNotify();
76     }
77     
78     /**
79      * Called when <code>TopComponent</code> is about to be shown.
80      * Shown here means the component is selected or resides in it own cell
81      * in container in its <code>Mode</code>. The container is visible and not minimized.
82      * <p><em>Note:</em> component
83      * is considered to be shown, even its container window
84      * is overlapped by another window.</p>
85      * @since 2.18
86      *
87      * #38900 - lazy addition of GUI components
88      *
89      */

90     @Override JavaDoc
91     protected void componentShowing() {
92         if (!initialized) {
93             initialized = true;
94             doInitialize();
95         }
96         super.componentShowing();
97     }
98     
99 }
100
101
Popular Tags