001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.dbschema.jdbcimpl.wizard;
043:
044: import java.awt.BorderLayout;
045: import java.awt.Dialog;
046: import java.awt.Dimension;
047: import javax.swing.JComponent;
048: import javax.swing.JDialog;
049: import org.openide.DialogDescriptor;
050: import org.openide.DialogDisplayer;
051: import org.openide.util.NbBundle;
052:
053: /**
054: *
055: * @author Martin Adamek, Andrei Badea
056: */
057: public class ProgressPanel extends javax.swing.JPanel {
058:
059: private Dialog dialog;
060:
061: /** Creates new form ProgressPanel */
062: public ProgressPanel() {
063: initComponents();
064: }
065:
066: public void open(JComponent progressComponent) {
067: holder.add(progressComponent, BorderLayout.CENTER);
068: DialogDescriptor dd = new DialogDescriptor(this , NbBundle
069: .getMessage(ProgressPanel.class, "MSG_PleaseWait"),
070: true, new Object[0], DialogDescriptor.NO_OPTION,
071: DialogDescriptor.DEFAULT_ALIGN, null, null);
072: dialog = DialogDisplayer.getDefault().createDialog(dd);
073: if (dialog instanceof JDialog) {
074: ((JDialog) dialog)
075: .setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
076: }
077: dialog.setResizable(false);
078: dialog.setVisible(true);
079: }
080:
081: public void close() {
082: if (dialog != null) {
083: dialog.setVisible(false);
084: dialog.dispose();
085: }
086: }
087:
088: public void setText(String text) {
089: info.setText(text);
090: }
091:
092: /** This method is called from within the constructor to
093: * initialize the form.
094: * WARNING: Do NOT modify this code. The content of this method is
095: * always regenerated by the Form Editor.
096: */
097: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
098: private void initComponents() {
099: java.awt.GridBagConstraints gridBagConstraints;
100:
101: info = new javax.swing.JLabel();
102: holder = new javax.swing.JPanel();
103:
104: setLayout(new java.awt.GridBagLayout());
105:
106: info.setText(" ");
107: gridBagConstraints = new java.awt.GridBagConstraints();
108: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
109: gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 11);
110: add(info, gridBagConstraints);
111:
112: holder.setLayout(new java.awt.BorderLayout());
113:
114: gridBagConstraints = new java.awt.GridBagConstraints();
115: gridBagConstraints.gridx = 0;
116: gridBagConstraints.gridy = 1;
117: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
118: gridBagConstraints.weightx = 1.0;
119: gridBagConstraints.weighty = 1.0;
120: gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 11);
121: add(holder, gridBagConstraints);
122:
123: }// </editor-fold>//GEN-END:initComponents
124:
125: // Variables declaration - do not modify//GEN-BEGIN:variables
126: private javax.swing.JPanel holder;
127: private javax.swing.JLabel info;
128:
129: // End of variables declaration//GEN-END:variables
130:
131: public Dimension getPreferredSize() {
132: Dimension orig = super .getPreferredSize();
133: return new Dimension(500, orig.height);
134: }
135:
136: }
|