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.mobility.project.ui.customizer;
043:
044: import javax.swing.JPanel;
045: import org.netbeans.api.mobility.project.ui.customizer.ProjectProperties;
046: import org.netbeans.modules.mobility.project.DefaultPropertiesDescriptor;
047: import org.netbeans.spi.mobility.project.ui.customizer.CustomizerPanel;
048: import org.netbeans.spi.mobility.project.ui.customizer.support.VisualPropertySupport;
049: import org.netbeans.spi.mobility.project.ui.customizer.VisualPropertyGroup;
050: import org.openide.util.NbBundle;
051:
052: /** Customizer for general project attributes.
053: *
054: * @author phrebejk, Adam Sotona
055: */
056: public class CustomizerJar extends JPanel implements CustomizerPanel,
057: VisualPropertyGroup {
058:
059: private static final String[] PROPERTY_GROUP = new String[] {
060: DefaultPropertiesDescriptor.DIST_JAR,
061: DefaultPropertiesDescriptor.DIST_JAD,
062: DefaultPropertiesDescriptor.JAR_COMPRESS };
063:
064: private VisualPropertySupport vps;
065:
066: /** Creates new form CustomizerCompile */
067: public CustomizerJar() {
068: initComponents();
069: initAccessibility();
070: }
071:
072: public void initValues(ProjectProperties props, String configuration) {
073: vps = VisualPropertySupport.getDefault(props);
074: vps.register(defaultCheck, configuration, this );
075: }
076:
077: public String[] getGroupPropertyNames() {
078: return PROPERTY_GROUP;
079: }
080:
081: public void initGroupValues(final boolean useDefault) {
082: vps.register(jarField, DefaultPropertiesDescriptor.DIST_JAR,
083: useDefault);
084: vps.register(jadField, DefaultPropertiesDescriptor.DIST_JAD,
085: useDefault);
086: vps.register(jCheckBoxCommpress,
087: DefaultPropertiesDescriptor.JAR_COMPRESS, useDefault);
088: jadLabel.setEnabled(!useDefault);
089: jarLabel.setEnabled(!useDefault);
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: defaultCheck = new javax.swing.JCheckBox();
102: jadLabel = new javax.swing.JLabel();
103: jadField = new javax.swing.JTextField();
104: jarLabel = new javax.swing.JLabel();
105: jarField = new javax.swing.JTextField();
106: jCheckBoxCommpress = new javax.swing.JCheckBox();
107:
108: setLayout(new java.awt.GridBagLayout());
109:
110: org.openide.awt.Mnemonics.setLocalizedText(defaultCheck,
111: NbBundle.getMessage(CustomizerJar.class,
112: "LBL_Use_Default")); // NOI18N
113: defaultCheck.setMargin(new java.awt.Insets(0, 0, 0, 2));
114: gridBagConstraints = new java.awt.GridBagConstraints();
115: gridBagConstraints.gridx = 0;
116: gridBagConstraints.gridy = 0;
117: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
118: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
119: gridBagConstraints.weightx = 1.0;
120: add(defaultCheck, gridBagConstraints);
121: defaultCheck.getAccessibleContext().setAccessibleDescription(
122: NbBundle.getMessage(CustomizerJar.class,
123: "ACSD_CustJar_UseDefault")); // NOI18N
124:
125: jadLabel.setLabelFor(jadField);
126: org.openide.awt.Mnemonics
127: .setLocalizedText(jadLabel, NbBundle.getMessage(
128: CustomizerJar.class, "LBL_CustJar_JADName")); // NOI18N
129: gridBagConstraints = new java.awt.GridBagConstraints();
130: gridBagConstraints.gridx = 0;
131: gridBagConstraints.gridy = 1;
132: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
133: gridBagConstraints.insets = new java.awt.Insets(11, 0, 0, 6);
134: add(jadLabel, gridBagConstraints);
135: gridBagConstraints = new java.awt.GridBagConstraints();
136: gridBagConstraints.gridx = 1;
137: gridBagConstraints.gridy = 1;
138: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
139: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
140: gridBagConstraints.weightx = 1.0;
141: gridBagConstraints.insets = new java.awt.Insets(11, 0, 0, 0);
142: add(jadField, gridBagConstraints);
143: jadField.getAccessibleContext().setAccessibleDescription(
144: NbBundle.getMessage(CustomizerJar.class,
145: "ACSD_CustJar_JadName")); // NOI18N
146:
147: jarLabel.setLabelFor(jarField);
148: org.openide.awt.Mnemonics
149: .setLocalizedText(jarLabel, NbBundle.getMessage(
150: CustomizerJar.class, "LBL_CustJar_JARName")); // NOI18N
151: gridBagConstraints = new java.awt.GridBagConstraints();
152: gridBagConstraints.gridx = 0;
153: gridBagConstraints.gridy = 2;
154: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
155: gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 6);
156: add(jarLabel, gridBagConstraints);
157: gridBagConstraints = new java.awt.GridBagConstraints();
158: gridBagConstraints.gridx = 1;
159: gridBagConstraints.gridy = 2;
160: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
161: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
162: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
163: gridBagConstraints.weightx = 1.0;
164: gridBagConstraints.insets = new java.awt.Insets(11, 0, 0, 0);
165: add(jarField, gridBagConstraints);
166: jarField.getAccessibleContext().setAccessibleDescription(
167: NbBundle.getMessage(CustomizerJar.class,
168: "ACSD_CustJar_JarName")); // NOI18N
169:
170: org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxCommpress,
171: NbBundle.getMessage(CustomizerJar.class,
172: "LBL_CustJar_Compress")); // NOI18N
173: gridBagConstraints = new java.awt.GridBagConstraints();
174: gridBagConstraints.gridx = 0;
175: gridBagConstraints.gridy = 3;
176: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
177: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
178: gridBagConstraints.weightx = 1.0;
179: gridBagConstraints.weighty = 1.0;
180: gridBagConstraints.insets = new java.awt.Insets(11, 0, 0, 0);
181: add(jCheckBoxCommpress, gridBagConstraints);
182: jCheckBoxCommpress.getAccessibleContext()
183: .setAccessibleDescription(
184: NbBundle.getMessage(CustomizerJar.class,
185: "ACSD_CustJar_Compress")); // NOI18N
186: }// </editor-fold>//GEN-END:initComponents
187:
188: private void initAccessibility() {
189: getAccessibleContext()
190: .setAccessibleName(
191: NbBundle.getMessage(CustomizerJar.class,
192: "ACSN_CustJar"));
193: getAccessibleContext()
194: .setAccessibleDescription(
195: NbBundle.getMessage(CustomizerJar.class,
196: "ACSD_CustJar"));
197: }
198:
199: // Variables declaration - do not modify//GEN-BEGIN:variables
200: private javax.swing.JCheckBox defaultCheck;
201: private javax.swing.JCheckBox jCheckBoxCommpress;
202: private javax.swing.JTextField jadField;
203: private javax.swing.JLabel jadLabel;
204: private javax.swing.JTextField jarField;
205: private javax.swing.JLabel jarLabel;
206: // End of variables declaration//GEN-END:variables
207:
208: // Private methods for classpath data manipulation -------------------------
209:
210: }
|