001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: package org.netbeans.modules.bpel.project.ui.customizer;
021:
022: import java.awt.event.ItemEvent;
023: import java.io.File;
024:
025: import javax.swing.JPanel;
026:
027: import org.netbeans.modules.bpel.project.ProjectConstants;
028:
029: import org.openide.filesystems.FileObject;
030: import org.openide.filesystems.FileUtil;
031: import org.openide.util.NbBundle;
032: import org.openide.util.HelpCtx;
033: import org.netbeans.modules.compapp.projects.base.ui.customizer.IcanproProjectProperties;
034:
035: /** Customizer for general project attributes.
036: *
037: * @author phrebejk
038: */
039: public class CustomizerGeneral extends JPanel implements
040: IcanproCustomizer.Panel, HelpCtx.Provider {
041:
042: private IcanproProjectProperties webProperties;
043: private VisualPropertySupport vps;
044: private boolean bValidation = true;
045:
046: /** Creates new form CustomizerCompile */
047: public CustomizerGeneral(IcanproProjectProperties webProperties) {
048: initComponents();
049: this .getAccessibleContext().setAccessibleDescription(
050: NbBundle.getMessage(CustomizerGeneral.class,
051: "ACS_CustomizeGeneral_A11YDesc")); //NOI18N
052:
053: this .webProperties = webProperties;
054: vps = new VisualPropertySupport(webProperties);
055:
056: Object validationObject = webProperties
057: .get(ProjectConstants.VALIDATION_FLAG);
058:
059: // BpelProjectHelper.getInstance().getProjectProperty(IcanproProjectProperties.VALIDATION_FLAG);
060: if (validationObject != null) {
061: boolean validation = ((Boolean) validationObject)
062: .booleanValue();
063: if (validation) {
064: jCheckBox1.setSelected(true);
065: } else {
066: jCheckBox1.setSelected(false);
067: }
068:
069: } else {
070: jCheckBox1.setSelected(false);
071: }
072:
073: }
074:
075: public void initValues() {
076: FileObject projectFolder = webProperties.getProject()
077: .getProjectDirectory();
078: File pf = FileUtil.toFile(projectFolder);
079: jTextFieldProjectFolder.setText(pf == null ? "" : pf.getPath()); // NOI18N
080:
081: vps.register(jTextFieldProjectType,
082: IcanproProjectProperties.JBI_SE_TYPE);
083: }
084:
085: /** Help context where to find more about the paste type action.
086: * @return the help context for this action
087: */
088: public HelpCtx getHelpCtx() {
089: return new HelpCtx(CustomizerGeneral.class);
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: jLabelProjectName = new javax.swing.JLabel();
100: jTextFieldProjectFolder = new javax.swing.JTextField();
101: jLabelProjectType = new javax.swing.JLabel();
102: jTextFieldProjectType = new javax.swing.JTextField();
103: jLabelAssemblyUnit = new javax.swing.JLabel();
104: jLabelAssemblyUnitAlias = new javax.swing.JLabel();
105: jTextFieldAssemblyUnitAlias = new javax.swing.JTextField();
106: jLabelAssemblyUnitDescription = new javax.swing.JLabel();
107: jTextFieldAssemblyUnitDescription = new javax.swing.JTextField();
108: jLabelApplicationSubAssembly = new javax.swing.JLabel();
109: jLabelApplicationSubAssemblyAlias = new javax.swing.JLabel();
110: jTextFieldApplicationSubAssemblyAlias = new javax.swing.JTextField();
111: jTextFieldApplicationSubAssemblyDescription = new javax.swing.JTextField();
112: jLabelApplicationSubAssemblyDescription = new javax.swing.JLabel();
113: jCheckBox1 = new javax.swing.JCheckBox();
114:
115: setBorder(javax.swing.BorderFactory.createEtchedBorder());
116: jLabelProjectName.setLabelFor(jTextFieldProjectFolder);
117: org.openide.awt.Mnemonics.setLocalizedText(jLabelProjectName,
118: org.openide.util.NbBundle.getMessage(
119: CustomizerGeneral.class,
120: "LBL_CustomizeGeneral_ProjectFolder_JLabel")); // NOI18N
121: jLabelProjectName
122: .setToolTipText(org.openide.util.NbBundle
123: .getMessage(CustomizerGeneral.class,
124: "CustomizerGeneral.jLabelProjectName.toolTipText")); // NOI18N
125:
126: jTextFieldProjectFolder.setEditable(false);
127: jTextFieldProjectFolder
128: .getAccessibleContext()
129: .setAccessibleDescription(
130: org.openide.util.NbBundle
131: .getMessage(CustomizerGeneral.class,
132: "ACS_CustomizeGeneral_ProjectFolder_A11YDesc")); // NOI18N
133:
134: jLabelProjectType.setLabelFor(jTextFieldProjectType);
135: org.openide.awt.Mnemonics.setLocalizedText(jLabelProjectType,
136: org.openide.util.NbBundle.getMessage(
137: CustomizerGeneral.class,
138: "LBL_CustomizeGeneral_ProjectType_JLabel")); // NOI18N
139: jLabelProjectType
140: .setToolTipText(org.openide.util.NbBundle
141: .getMessage(CustomizerGeneral.class,
142: "CustomizerGeneral.jLabelProjectType.toolTipText")); // NOI18N
143:
144: jLabelAssemblyUnit.setLabelFor(jLabelAssemblyUnit);
145: org.openide.awt.Mnemonics.setLocalizedText(jLabelAssemblyUnit,
146: org.openide.util.NbBundle.getMessage(
147: CustomizerGeneral.class,
148: "LBL_CustomizeGeneral_AssemblyUnit_JLabel")); // NOI18N
149: jLabelAssemblyUnit
150: .setToolTipText(org.openide.util.NbBundle
151: .getMessage(CustomizerGeneral.class,
152: "CustomizerGeneral.jLabelAssemblyUnit.toolTipText")); // NOI18N
153:
154: jLabelAssemblyUnitAlias
155: .setLabelFor(jTextFieldAssemblyUnitAlias);
156: org.openide.awt.Mnemonics
157: .setLocalizedText(
158: jLabelAssemblyUnitAlias,
159: org.openide.util.NbBundle
160: .getMessage(CustomizerGeneral.class,
161: "LBL_CustomizeGeneral_AssemblyUnitAlias_JLabel")); // NOI18N
162: jLabelAssemblyUnitAlias
163: .setToolTipText(org.openide.util.NbBundle
164: .getMessage(CustomizerGeneral.class,
165: "CustomizerGeneral.jLabelAssemblyUnitAlias.toolTipText")); // NOI18N
166:
167: jLabelAssemblyUnitDescription
168: .setLabelFor(jTextFieldAssemblyUnitDescription);
169: org.openide.awt.Mnemonics
170: .setLocalizedText(
171: jLabelAssemblyUnitDescription,
172: org.openide.util.NbBundle
173: .getMessage(CustomizerGeneral.class,
174: "LBL_CustomizeGeneral_AssemblyUnitDescription_JLabel")); // NOI18N
175: jLabelAssemblyUnitDescription
176: .setToolTipText(org.openide.util.NbBundle
177: .getMessage(CustomizerGeneral.class,
178: "CustomizerGeneral.jLabelAssemblyUnitDescription.toolTipText")); // NOI18N
179:
180: jLabelApplicationSubAssembly.setLabelFor(jLabelAssemblyUnit);
181: org.openide.awt.Mnemonics
182: .setLocalizedText(
183: jLabelApplicationSubAssembly,
184: org.openide.util.NbBundle
185: .getMessage(CustomizerGeneral.class,
186: "LBL_CustomizeGeneral_ApplicationSubAssembly_JLabel")); // NOI18N
187: jLabelApplicationSubAssembly
188: .setToolTipText(org.openide.util.NbBundle
189: .getMessage(CustomizerGeneral.class,
190: "CustomizerGeneral.jLabelApplicationSubAssembly.toolTipText")); // NOI18N
191:
192: jLabelApplicationSubAssemblyAlias
193: .setLabelFor(jTextFieldApplicationSubAssemblyAlias);
194: org.openide.awt.Mnemonics
195: .setLocalizedText(
196: jLabelApplicationSubAssemblyAlias,
197: org.openide.util.NbBundle
198: .getMessage(CustomizerGeneral.class,
199: "LBL_CustomizeGeneral_ApplicationSubAssemblyAlias_JLabel")); // NOI18N
200: jLabelApplicationSubAssemblyAlias
201: .setToolTipText(org.openide.util.NbBundle
202: .getMessage(CustomizerGeneral.class,
203: "CustomizerGeneral.jLabelApplicationSubAssemblyAlias.toolTipText")); // NOI18N
204:
205: jLabelApplicationSubAssemblyDescription
206: .setLabelFor(jTextFieldApplicationSubAssemblyDescription);
207: org.openide.awt.Mnemonics
208: .setLocalizedText(
209: jLabelApplicationSubAssemblyDescription,
210: org.openide.util.NbBundle
211: .getMessage(CustomizerGeneral.class,
212: "LBL_CustomizeGeneral_ApplicationSubAssemblyDescription_JLabel")); // NOI18N
213: jLabelApplicationSubAssemblyDescription
214: .setToolTipText(org.openide.util.NbBundle
215: .getMessage(CustomizerGeneral.class,
216: "CustomizerGeneral.jLabelApplicationSubAssemblyDescription.toolTipText")); // NOI18N
217:
218: org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1,
219: org.openide.util.NbBundle.getMessage(
220: CustomizerGeneral.class,
221: "CustomizerGeneral.jCheckBox1.text")); // NOI18N
222: jCheckBox1.setToolTipText(org.openide.util.NbBundle.getMessage(
223: CustomizerGeneral.class,
224: "CustomizerGeneral.jCheckBox1.toolTipText")); // NOI18N
225: jCheckBox1.setBorder(javax.swing.BorderFactory
226: .createEmptyBorder(0, 0, 0, 0));
227: jCheckBox1.setMargin(new java.awt.Insets(0, 0, 0, 0));
228: jCheckBox1.addItemListener(new java.awt.event.ItemListener() {
229: public void itemStateChanged(java.awt.event.ItemEvent evt) {
230: validationHandler(evt);
231: }
232: });
233:
234: jCheckBox1
235: .getAccessibleContext()
236: .setAccessibleName(
237: org.openide.util.NbBundle
238: .getMessage(CustomizerGeneral.class,
239: "CustomizerGeneral.jCheckBox1.AccessibleContext.accessibleName")); // NOI18N
240:
241: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
242: this );
243: this .setLayout(layout);
244: layout
245: .setHorizontalGroup(layout
246: .createParallelGroup(
247: org.jdesktop.layout.GroupLayout.LEADING)
248: .add(
249: layout
250: .createSequentialGroup()
251: .add(
252: layout
253: .createParallelGroup(
254: org.jdesktop.layout.GroupLayout.LEADING)
255: .add(
256: layout
257: .createSequentialGroup()
258: .addContainerGap()
259: .add(
260: jLabelApplicationSubAssembly))
261: .add(
262: layout
263: .createSequentialGroup()
264: .addContainerGap()
265: .add(
266: jLabelAssemblyUnit))
267: .add(
268: layout
269: .createSequentialGroup()
270: .add(
271: layout
272: .createParallelGroup(
273: org.jdesktop.layout.GroupLayout.LEADING)
274: .add(
275: layout
276: .createSequentialGroup()
277: .addContainerGap()
278: .add(
279: jLabelProjectName))
280: .add(
281: layout
282: .createSequentialGroup()
283: .add(
284: 36,
285: 36,
286: 36)
287: .add(
288: layout
289: .createParallelGroup(
290: org.jdesktop.layout.GroupLayout.LEADING)
291: .add(
292: jLabelAssemblyUnitAlias)
293: .add(
294: jLabelAssemblyUnitDescription)))
295: .add(
296: layout
297: .createSequentialGroup()
298: .add(
299: 36,
300: 36,
301: 36)
302: .add(
303: layout
304: .createParallelGroup(
305: org.jdesktop.layout.GroupLayout.LEADING)
306: .add(
307: jLabelApplicationSubAssemblyAlias)
308: .add(
309: layout
310: .createSequentialGroup()
311: .addPreferredGap(
312: org.jdesktop.layout.LayoutStyle.RELATED)
313: .add(
314: jLabelApplicationSubAssemblyDescription))))
315: .add(
316: layout
317: .createSequentialGroup()
318: .addContainerGap()
319: .add(
320: jLabelProjectType)))
321: .addPreferredGap(
322: org.jdesktop.layout.LayoutStyle.RELATED)
323: .add(
324: layout
325: .createParallelGroup(
326: org.jdesktop.layout.GroupLayout.LEADING)
327: .add(
328: jTextFieldProjectFolder,
329: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
330: 73,
331: Short.MAX_VALUE)
332: .add(
333: jTextFieldProjectType,
334: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
335: 73,
336: Short.MAX_VALUE)
337: .add(
338: org.jdesktop.layout.GroupLayout.TRAILING,
339: layout
340: .createSequentialGroup()
341: .add(
342: layout
343: .createParallelGroup(
344: org.jdesktop.layout.GroupLayout.TRAILING)
345: .add(
346: org.jdesktop.layout.GroupLayout.LEADING,
347: jTextFieldAssemblyUnitDescription,
348: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
349: 73,
350: Short.MAX_VALUE)
351: .add(
352: jTextFieldAssemblyUnitAlias,
353: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
354: 73,
355: Short.MAX_VALUE))
356: .addPreferredGap(
357: org.jdesktop.layout.LayoutStyle.RELATED))
358: .add(
359: org.jdesktop.layout.GroupLayout.TRAILING,
360: layout
361: .createSequentialGroup()
362: .add(
363: layout
364: .createParallelGroup(
365: org.jdesktop.layout.GroupLayout.TRAILING)
366: .add(
367: org.jdesktop.layout.GroupLayout.LEADING,
368: jTextFieldApplicationSubAssemblyDescription,
369: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
370: 73,
371: Short.MAX_VALUE)
372: .add(
373: jTextFieldApplicationSubAssemblyAlias,
374: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
375: 73,
376: Short.MAX_VALUE))
377: .addPreferredGap(
378: org.jdesktop.layout.LayoutStyle.RELATED))))
379: .add(
380: layout
381: .createSequentialGroup()
382: .addContainerGap()
383: .add(
384: jCheckBox1)))
385: .addContainerGap()));
386:
387: layout.linkSize(
388: new java.awt.Component[] {
389: jLabelApplicationSubAssemblyAlias,
390: jLabelApplicationSubAssemblyDescription,
391: jLabelAssemblyUnitAlias,
392: jLabelAssemblyUnitDescription },
393: org.jdesktop.layout.GroupLayout.HORIZONTAL);
394:
395: layout.linkSize(new java.awt.Component[] { jLabelProjectName,
396: jLabelProjectType },
397: org.jdesktop.layout.GroupLayout.HORIZONTAL);
398:
399: layout
400: .setVerticalGroup(layout
401: .createParallelGroup(
402: org.jdesktop.layout.GroupLayout.LEADING)
403: .add(
404: layout
405: .createSequentialGroup()
406: .add(14, 14, 14)
407: .add(
408: layout
409: .createParallelGroup(
410: org.jdesktop.layout.GroupLayout.BASELINE)
411: .add(
412: jLabelProjectName)
413: .add(
414: jTextFieldProjectFolder,
415: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
416: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
417: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
418: .add(17, 17, 17)
419: .add(
420: layout
421: .createParallelGroup(
422: org.jdesktop.layout.GroupLayout.BASELINE)
423: .add(
424: jLabelProjectType)
425: .add(
426: jTextFieldProjectType,
427: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
428: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
429: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
430: .add(11, 11, 11)
431: .add(
432: layout
433: .createParallelGroup(
434: org.jdesktop.layout.GroupLayout.TRAILING)
435: .add(
436: layout
437: .createSequentialGroup()
438: .add(
439: jLabelAssemblyUnit)
440: .addPreferredGap(
441: org.jdesktop.layout.LayoutStyle.RELATED)
442: .add(
443: jLabelAssemblyUnitAlias))
444: .add(
445: jTextFieldAssemblyUnitAlias,
446: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
447: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
448: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
449: .addPreferredGap(
450: org.jdesktop.layout.LayoutStyle.RELATED)
451: .add(
452: layout
453: .createParallelGroup(
454: org.jdesktop.layout.GroupLayout.BASELINE)
455: .add(
456: jLabelAssemblyUnitDescription)
457: .add(
458: jTextFieldAssemblyUnitDescription,
459: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
460: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
461: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
462: .add(11, 11, 11)
463: .add(
464: jLabelApplicationSubAssembly)
465: .addPreferredGap(
466: org.jdesktop.layout.LayoutStyle.RELATED)
467: .add(
468: layout
469: .createParallelGroup(
470: org.jdesktop.layout.GroupLayout.BASELINE)
471: .add(
472: jLabelApplicationSubAssemblyAlias)
473: .add(
474: jTextFieldApplicationSubAssemblyAlias,
475: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
476: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
477: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
478: .addPreferredGap(
479: org.jdesktop.layout.LayoutStyle.RELATED)
480: .add(
481: layout
482: .createParallelGroup(
483: org.jdesktop.layout.GroupLayout.BASELINE)
484: .add(
485: jLabelApplicationSubAssemblyDescription)
486: .add(
487: jTextFieldApplicationSubAssemblyDescription,
488: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
489: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
490: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
491: .addPreferredGap(
492: org.jdesktop.layout.LayoutStyle.RELATED)
493: .add(jCheckBox1)
494: .addContainerGap(27,
495: Short.MAX_VALUE)));
496: }// </editor-fold>//GEN-END:initComponents
497:
498: private void validationHandler(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_validationHandler
499: webProperties.put(ProjectConstants.VALIDATION_FLAG, evt
500: .getStateChange() == ItemEvent.SELECTED);
501: }//GEN-LAST:event_validationHandler
502:
503: // Variables declaration - do not modify//GEN-BEGIN:variables
504: private javax.swing.JCheckBox jCheckBox1;
505: private javax.swing.JLabel jLabelApplicationSubAssembly;
506: private javax.swing.JLabel jLabelApplicationSubAssemblyAlias;
507: private javax.swing.JLabel jLabelApplicationSubAssemblyDescription;
508: private javax.swing.JLabel jLabelAssemblyUnit;
509: private javax.swing.JLabel jLabelAssemblyUnitAlias;
510: private javax.swing.JLabel jLabelAssemblyUnitDescription;
511: private javax.swing.JLabel jLabelProjectName;
512: private javax.swing.JLabel jLabelProjectType;
513: private javax.swing.JTextField jTextFieldApplicationSubAssemblyAlias;
514: private javax.swing.JTextField jTextFieldApplicationSubAssemblyDescription;
515: private javax.swing.JTextField jTextFieldAssemblyUnitAlias;
516: private javax.swing.JTextField jTextFieldAssemblyUnitDescription;
517: private javax.swing.JTextField jTextFieldProjectFolder;
518: private javax.swing.JTextField jTextFieldProjectType;
519: // End of variables declaration//GEN-END:variables
520: }
|