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.upgrade;
043:
044: import java.awt.Dialog;
045: import java.util.ArrayList;
046: import java.util.List;
047: import java.util.ResourceBundle;
048: import javax.swing.JPanel;
049: import javax.swing.event.ChangeListener;
050: import org.openide.util.NbBundle;
051:
052: /**
053: * @author Jiri Rechtacek
054: */
055: final class AutoUpgradePanel extends JPanel {
056:
057: String source;
058:
059: /** Creates new form UpgradePanel */
060: public AutoUpgradePanel(String directory) {
061: this .source = directory;
062: initComponents();
063: initAccessibility();
064: }
065:
066: /** Remove a listener to changes of the panel's validity.
067: * @param l the listener to remove
068: */
069: void removeChangeListener(ChangeListener l) {
070: changeListeners.remove(l);
071: }
072:
073: /** Add a listener to changes of the panel's validity.
074: * @param l the listener to add
075: * @see #isValid
076: */
077: void addChangeListener(ChangeListener l) {
078: if (!changeListeners.contains(l)) {
079: changeListeners.add(l);
080: }
081: }
082:
083: private void initAccessibility() {
084: this .getAccessibleContext().setAccessibleDescription(
085: bundle.getString("MSG_Confirmation")); // NOI18N
086: }
087:
088: /** This method is called from within the constructor to
089: * initialize the form.
090: * WARNING: Do NOT modify this code. The content of this method is
091: * always regenerated by the Form Editor.
092: */
093: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
094: private void initComponents() {
095:
096: txtVersions = new javax.swing.JTextArea();
097:
098: setName(bundle.getString("LBL_UpgradePanel_Name")); // NOI18N
099: setLayout(new java.awt.BorderLayout());
100:
101: txtVersions.setBackground(getBackground());
102: txtVersions.setColumns(50);
103: txtVersions.setEditable(false);
104: txtVersions.setFont(new java.awt.Font("Dialog", 0, 12));
105: txtVersions.setLineWrap(true);
106: txtVersions.setRows(3);
107: txtVersions.setText(NbBundle.getMessage(AutoUpgradePanel.class,
108: "MSG_Confirmation", source)); // NOI18N
109: txtVersions.setWrapStyleWord(true);
110: txtVersions.setFocusable(false);
111: txtVersions.setMinimumSize(new java.awt.Dimension(100, 50));
112: add(txtVersions, java.awt.BorderLayout.CENTER);
113: }// </editor-fold>//GEN-END:initComponents
114:
115: // Variables declaration - do not modify//GEN-BEGIN:variables
116: private javax.swing.JTextArea txtVersions;
117: // End of variables declaration//GEN-END:variables
118:
119: private static final ResourceBundle bundle = NbBundle
120: .getBundle(AutoUpgradePanel.class);
121: private List<ChangeListener> changeListeners = new ArrayList<ChangeListener>(
122: 1);
123:
124: }
|