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-2007 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.visualweb.dataconnectivity.ui;
043:
044: import javax.swing.JPanel;
045: import org.openide.util.NbBundle;
046:
047: /**
048: * Broken/missing datasource alert panel.
049: *
050: * PLEASE NOTE! This is just a temporary solution. BrokenReferencesSupport from
051: * the java project support currently does not allow to plug in a check for missing
052: * datasources. Once BrokenReferencesSupport will support it, this class should be
053: * removed.
054: */
055: public class MissingConnectionsAlertPanel extends JPanel {
056:
057: public MissingConnectionsAlertPanel() {
058: initComponents();
059: notAgain.setSelected(!DatasourceUISettings.getDefault()
060: .isShowAgainBrokenDatasourceAlert());
061: }
062:
063: /** This method is called from within the constructor to
064: * initialize the form.
065: * WARNING: Do NOT modify this code. The content of this method is
066: * always regenerated by the Form Editor.
067: */
068: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
069: private void initComponents() {
070: java.awt.GridBagConstraints gridBagConstraints;
071:
072: notAgain = new javax.swing.JCheckBox();
073: message = new javax.swing.JLabel();
074:
075: setLayout(new java.awt.GridBagLayout());
076:
077: org.openide.awt.Mnemonics.setLocalizedText(notAgain,
078: org.openide.util.NbBundle.getMessage(
079: MissingConnectionsAlertPanel.class,
080: "MSG_Broken_Datasources_Again")); // NOI18N
081: notAgain.setMargin(new java.awt.Insets(0, 0, 0, 0));
082: notAgain.addActionListener(new java.awt.event.ActionListener() {
083: public void actionPerformed(java.awt.event.ActionEvent evt) {
084: notAgainActionPerformed(evt);
085: }
086: });
087: gridBagConstraints = new java.awt.GridBagConstraints();
088: gridBagConstraints.gridx = 0;
089: gridBagConstraints.gridy = 1;
090: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
091: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
092: gridBagConstraints.insets = new java.awt.Insets(6, 11, 0, 0);
093: add(notAgain, gridBagConstraints);
094: notAgain.getAccessibleContext().setAccessibleName(
095: org.openide.util.NbBundle.getMessage(
096: MissingConnectionsAlertPanel.class,
097: "ACSN_UpdateDatasourcesAlertPanel_notAgain")); // NOI18N
098: notAgain.getAccessibleContext().setAccessibleDescription(
099: org.openide.util.NbBundle.getMessage(
100: MissingConnectionsAlertPanel.class,
101: "ACSD_UpdateDatasourcesAlertPanel_notAgain")); // NOI18N
102:
103: org.openide.awt.Mnemonics.setLocalizedText(message,
104: org.openide.util.NbBundle.getMessage(
105: MissingConnectionsAlertPanel.class,
106: "MSG_Update_DatasourcesAlertPanel")); // NOI18N
107: gridBagConstraints = new java.awt.GridBagConstraints();
108: gridBagConstraints.gridx = 0;
109: gridBagConstraints.gridy = 0;
110: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
111: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
112: gridBagConstraints.weightx = 1.0;
113: gridBagConstraints.weighty = 1.0;
114: gridBagConstraints.insets = new java.awt.Insets(11, 11, 0, 0);
115: add(message, gridBagConstraints);
116: message.getAccessibleContext().setAccessibleName(
117: NbBundle.getMessage(MissingConnectionsAlertPanel.class,
118: "ACSN_UpdateDatasourcesAlertPanel")); // NOI18N
119: message.getAccessibleContext().setAccessibleDescription(
120: org.openide.util.NbBundle.getMessage(
121: MissingConnectionsAlertPanel.class,
122: "ACSD_UpdateDatasourcesAlertPanel")); // NOI18N
123:
124: getAccessibleContext().setAccessibleName(
125: org.openide.util.NbBundle.getMessage(
126: MissingConnectionsAlertPanel.class,
127: "ACSN_UpdateDatasourcesAlertPanel")); // NOI18N
128: getAccessibleContext().setAccessibleDescription(
129: org.openide.util.NbBundle.getMessage(
130: MissingConnectionsAlertPanel.class,
131: "ACSD_UpdateDatasourcesAlertPanel")); // NOI18N
132: }// </editor-fold>//GEN-END:initComponents
133:
134: private void notAgainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_notAgainActionPerformed
135: DatasourceUISettings.getDefault()
136: .setShowAgainBrokenDatasourceAlert(
137: !notAgain.isSelected());
138: }//GEN-LAST:event_notAgainActionPerformed
139:
140: // Variables declaration - do not modify//GEN-BEGIN:variables
141: private javax.swing.JLabel message;
142: private javax.swing.JCheckBox notAgain;
143: // End of variables declaration//GEN-END:variables
144:
145: }
|