Added
Link Here
|
1 |
/* |
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 |
* |
4 |
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. |
5 |
* |
6 |
* The contents of this file are subject to the terms of either the GNU |
7 |
* General Public License Version 2 only ("GPL") or the Common |
8 |
* Development and Distribution License("CDDL") (collectively, the |
9 |
* "License"). You may not use this file except in compliance with the |
10 |
* License. You can obtain a copy of the License at |
11 |
* http://www.netbeans.org/cddl-gplv2.html |
12 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the |
13 |
* specific language governing permissions and limitations under the |
14 |
* License. When distributing the software, include this License Header |
15 |
* Notice in each file and include the License file at |
16 |
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this |
17 |
* particular file as subject to the "Classpath" exception as provided |
18 |
* by Sun in the GPL Version 2 section of the License file that |
19 |
* accompanied this code. If applicable, add the following below the |
20 |
* License Header, with the fields enclosed by brackets [] replaced by |
21 |
* your own identifying information: |
22 |
* "Portions Copyrighted [year] [name of copyright owner]" |
23 |
* |
24 |
* Contributor(s): |
25 |
* |
26 |
* The Original Software is NetBeans. The Initial Deve1loper of the Original |
27 |
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
28 |
* Microsystems, Inc. All Rights Reserved. |
29 |
* |
30 |
* If you wish your version of this file to be governed by only the CDDL |
31 |
* or only the GPL Version 2, indicate your decision by adding |
32 |
* "[Contributor] elects to include this software in this distribution |
33 |
* under the [CDDL or GPL Version 2] license." If you do not indicate a |
34 |
* single choice of license, a recipient has the option to distribute |
35 |
* your version of this file under either the CDDL, the GPL Version 2 or |
36 |
* to extend the choice of license to its licensees as provided above. |
37 |
* However, if you add GPL Version 2 code and therefore, elected the GPL |
38 |
* Version 2 license, then the option applies only if the new code is |
39 |
* made subject to such option by the copyright holder. |
40 |
*/ |
41 |
|
42 |
package org.netbeans.modules.mobility.project.ui.customizer; |
43 |
|
44 |
import java.awt.Component; |
45 |
import java.awt.Font; |
46 |
import java.awt.Graphics; |
47 |
import java.awt.event.ActionEvent; |
48 |
import java.awt.event.ActionListener; |
49 |
import java.awt.event.ComponentAdapter; |
50 |
import java.awt.event.ComponentEvent; |
51 |
import java.io.File; |
52 |
import java.nio.charset.Charset; |
53 |
import java.nio.charset.CharsetDecoder; |
54 |
import java.nio.charset.CharsetEncoder; |
55 |
import java.nio.charset.IllegalCharsetNameException; |
56 |
import java.util.logging.Logger; |
57 |
import javax.swing.DefaultCellEditor; |
58 |
import javax.swing.DefaultComboBoxModel; |
59 |
import javax.swing.JLabel; |
60 |
import javax.swing.JList; |
61 |
import javax.swing.JTable; |
62 |
import javax.swing.JTextField; |
63 |
import javax.swing.ListCellRenderer; |
64 |
import javax.swing.ListSelectionModel; |
65 |
import javax.swing.UIManager; |
66 |
import javax.swing.event.ListDataEvent; |
67 |
import javax.swing.event.ListDataListener; |
68 |
import javax.swing.plaf.UIResource; |
69 |
import javax.swing.table.TableColumn; |
70 |
import javax.swing.table.TableModel; |
71 |
import org.netbeans.api.mobility.project.ui.customizer.MultiRootProjectProperties; |
72 |
import org.netbeans.modules.mobility.project.J2MEProject; |
73 |
import org.netbeans.spi.mobility.project.ui.customizer.CustomizerPanel; |
74 |
import org.openide.DialogDisplayer; |
75 |
import org.openide.NotifyDescriptor; |
76 |
import org.openide.filesystems.FileObject; |
77 |
import org.openide.filesystems.FileUtil; |
78 |
import org.openide.util.HelpCtx; |
79 |
import org.openide.util.NbBundle; |
80 |
|
81 |
/** |
82 |
* Customizer panel "Sources": source roots, level, includes/excludes. |
83 |
* @author Tomas Zezula |
84 |
*/ |
85 |
public class CustomizerSources extends javax.swing.JPanel implements HelpCtx.Provider, CustomizerPanel { |
86 |
//Copied from J2SEProject |
87 |
private String originalEncoding; |
88 |
private boolean notified; |
89 |
|
90 |
private J2MEProjectProperties uiProperties; |
91 |
|
92 |
public CustomizerSources() { |
93 |
initComponents(); |
94 |
} |
95 |
|
96 |
public void initValues(MultiRootProjectProperties props, String configuration) { |
97 |
this.uiProperties = (J2MEProjectProperties) props; |
98 |
jScrollPane1.getViewport().setBackground( sourceRoots.getBackground() ); |
99 |
jScrollPane2.getViewport().setBackground( testRoots.getBackground() ); |
100 |
|
101 |
sourceRoots.setModel( uiProperties.SOURCE_ROOTS_MODEL ); |
102 |
testRoots.setModel( uiProperties.TEST_ROOTS_MODEL ); |
103 |
sourceRoots.getTableHeader().setReorderingAllowed(false); |
104 |
testRoots.getTableHeader().setReorderingAllowed(false); |
105 |
J2MEProject project = ((J2MEProjectProperties) uiProperties).getProject(); |
106 |
|
107 |
FileObject projectFolder = project.getProjectDirectory(); |
108 |
File pf = FileUtil.toFile( projectFolder ); |
109 |
this.projectLocation.setText( pf == null ? "" : pf.getPath() ); // NOI18N |
110 |
|
111 |
|
112 |
J2MESourceRootsUi.EditMediator emSR = J2MESourceRootsUi.registerEditMediator( |
113 |
project, |
114 |
project.getSourceRoots(), |
115 |
sourceRoots, |
116 |
addSourceRoot, |
117 |
removeSourceRoot, |
118 |
upSourceRoot, |
119 |
downSourceRoot, |
120 |
new LabelCellEditor(sourceRoots, testRoots)); |
121 |
|
122 |
J2MESourceRootsUi.EditMediator emTSR = J2MESourceRootsUi.registerEditMediator( |
123 |
project, |
124 |
project.getTestSourceRoots(), |
125 |
testRoots, |
126 |
addTestRoot, |
127 |
removeTestRoot, |
128 |
upTestRoot, |
129 |
downTestRoot, |
130 |
new LabelCellEditor(sourceRoots, testRoots)); |
131 |
|
132 |
emSR.setRelatedEditMediator( emTSR ); |
133 |
emTSR.setRelatedEditMediator( emSR ); |
134 |
this.sourceLevel.setEditable(false); |
135 |
this.sourceLevel.setModel(uiProperties.JAVAC_SOURCE_MODEL); |
136 |
this.sourceLevel.setRenderer(uiProperties.JAVAC_SOURCE_RENDERER); |
137 |
uiProperties.JAVAC_SOURCE_MODEL.addListDataListener(new ListDataListener () { |
138 |
public void intervalAdded(ListDataEvent e) { |
139 |
enableSourceLevel (); |
140 |
} |
141 |
|
142 |
public void intervalRemoved(ListDataEvent e) { |
143 |
enableSourceLevel (); |
144 |
} |
145 |
|
146 |
public void contentsChanged(ListDataEvent e) { |
147 |
enableSourceLevel (); |
148 |
} |
149 |
}); |
150 |
enableSourceLevel (); |
151 |
this.originalEncoding = project.evaluator().getProperty(J2MEProjectProperties.SOURCE_ENCODING); |
152 |
if (this.originalEncoding == null) { |
153 |
this.originalEncoding = Charset.defaultCharset().name(); |
154 |
} |
155 |
|
156 |
this.encoding.setModel(new EncodingModel(this.originalEncoding)); |
157 |
this.encoding.setRenderer(new EncodingRenderer()); |
158 |
final String lafid = UIManager.getLookAndFeel().getID(); |
159 |
if (!"Aqua".equals(lafid)) { //NOI18N |
160 |
this.encoding.putClientProperty ("JComboBox.isTableCellEditor", Boolean.TRUE); //NOI18N |
161 |
this.encoding.addItemListener(new java.awt.event.ItemListener(){ |
162 |
public void itemStateChanged(java.awt.event.ItemEvent e){ |
163 |
javax.swing.JComboBox combo = (javax.swing.JComboBox)e.getSource(); |
164 |
combo.setPopupVisible(false); |
165 |
} |
166 |
}); |
167 |
} |
168 |
this.encoding.addActionListener(new ActionListener () { |
169 |
public void actionPerformed(ActionEvent arg0) { |
170 |
handleEncodingChange(); |
171 |
} |
172 |
}); |
173 |
initTableVisualProperties(sourceRoots); |
174 |
initTableVisualProperties(testRoots); |
175 |
} |
176 |
|
177 |
private class TableColumnSizeComponentAdapter extends ComponentAdapter { |
178 |
private JTable table = null; |
179 |
|
180 |
public TableColumnSizeComponentAdapter(JTable table){ |
181 |
this.table = table; |
182 |
} |
183 |
|
184 |
public void componentResized(ComponentEvent evt){ |
185 |
double pw = table.getParent().getParent().getSize().getWidth(); |
186 |
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
187 |
TableColumn column = table.getColumnModel().getColumn(0); |
188 |
column.setWidth( ((int)pw/2) - 1 ); |
189 |
column.setPreferredWidth( ((int)pw/2) - 1 ); |
190 |
column = table.getColumnModel().getColumn(1); |
191 |
column.setWidth( ((int)pw/2) - 1 ); |
192 |
column.setPreferredWidth( ((int)pw/2) - 1 ); |
193 |
} |
194 |
} |
195 |
|
196 |
private void initTableVisualProperties(JTable table) { |
197 |
|
198 |
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
199 |
table.setIntercellSpacing(new java.awt.Dimension(0, 0)); |
200 |
// set the color of the table's JViewport |
201 |
table.getParent().setBackground(table.getBackground()); |
202 |
|
203 |
//we'll get the parents width so we can use that to set the column sizes. |
204 |
double pw = table.getParent().getParent().getPreferredSize().getWidth(); |
205 |
|
206 |
//#88174 - Need horizontal scrollbar for library names |
207 |
//ugly but I didn't find a better way how to do it |
208 |
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
209 |
TableColumn column = table.getColumnModel().getColumn(0); |
210 |
column.setMinWidth(226); |
211 |
column.setWidth( ((int)pw/2) - 1 ); |
212 |
column.setPreferredWidth( ((int)pw/2) - 1 ); |
213 |
column.setMinWidth(75); |
214 |
column = table.getColumnModel().getColumn(1); |
215 |
column.setMinWidth(226); |
216 |
column.setWidth( ((int)pw/2) - 1 ); |
217 |
column.setPreferredWidth( ((int)pw/2) - 1 ); |
218 |
column.setMinWidth(75); |
219 |
this.addComponentListener(new TableColumnSizeComponentAdapter(table)); |
220 |
} |
221 |
|
222 |
private void handleEncodingChange () { |
223 |
Charset enc = (Charset) encoding.getSelectedItem(); |
224 |
String encName; |
225 |
if (enc != null) { |
226 |
encName = enc.name(); |
227 |
} |
228 |
else { |
229 |
encName = originalEncoding; |
230 |
} |
231 |
if (!notified && encName!=null && !encName.equals(originalEncoding)) { |
232 |
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( |
233 |
NbBundle.getMessage(CustomizerSources.class,"MSG_EncodingWarning"), NotifyDescriptor.WARNING_MESSAGE)); |
234 |
notified=true; |
235 |
} |
236 |
this.uiProperties.put(J2MEProjectProperties.SOURCE_ENCODING, encName); |
237 |
} |
238 |
|
239 |
public HelpCtx getHelpCtx() { |
240 |
return new HelpCtx (CustomizerSources.class); |
241 |
} |
242 |
|
243 |
private void enableSourceLevel () { |
244 |
this.sourceLevel.setEnabled(sourceLevel.getItemCount()>0); |
245 |
} |
246 |
|
247 |
|
248 |
private static class EncodingRenderer extends JLabel implements ListCellRenderer, UIResource { |
249 |
|
250 |
public EncodingRenderer() { |
251 |
setOpaque(true); |
252 |
} |
253 |
|
254 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
255 |
assert value instanceof Charset; |
256 |
setName("ComboBox.listRenderer"); // NOI18N |
257 |
setText(((Charset) value).displayName()); |
258 |
setIcon(null); |
259 |
if (isSelected) { |
260 |
setBackground(list.getSelectionBackground()); |
261 |
setForeground(list.getSelectionForeground()); |
262 |
} else { |
263 |
setBackground(list.getBackground()); |
264 |
setForeground(list.getForeground()); |
265 |
} |
266 |
return this; |
267 |
} |
268 |
|
269 |
@Override |
270 |
public String getName() { |
271 |
String name = super.getName(); |
272 |
return name == null ? "ComboBox.renderer" : name; // NOI18N |
273 |
} |
274 |
|
275 |
} |
276 |
|
277 |
private static class EncodingModel extends DefaultComboBoxModel { |
278 |
|
279 |
public EncodingModel (String originalEncoding) { |
280 |
Charset defEnc = null; |
281 |
for (Charset c : Charset.availableCharsets().values()) { |
282 |
if (c.name().equals(originalEncoding)) { |
283 |
defEnc = c; |
284 |
} |
285 |
addElement(c); |
286 |
} |
287 |
if (defEnc == null) { |
288 |
//Create artificial Charset to keep the original value |
289 |
//May happen when the project was set up on the platform |
290 |
//which supports more encodings |
291 |
try { |
292 |
defEnc = new UnknownCharset (originalEncoding); |
293 |
addElement(defEnc); |
294 |
} catch (IllegalCharsetNameException e) { |
295 |
//The source.encoding property is completely broken |
296 |
Logger.getLogger(this.getClass().getName()).info("IllegalCharsetName: " + originalEncoding); |
297 |
} |
298 |
} |
299 |
if (defEnc == null) { |
300 |
defEnc = Charset.defaultCharset(); |
301 |
} |
302 |
setSelectedItem(defEnc); |
303 |
} |
304 |
} |
305 |
|
306 |
private static class UnknownCharset extends Charset { |
307 |
|
308 |
UnknownCharset (String name) { |
309 |
super (name, new String[0]); |
310 |
} |
311 |
|
312 |
public boolean contains(Charset c) { |
313 |
throw new UnsupportedOperationException(); |
314 |
} |
315 |
|
316 |
public CharsetDecoder newDecoder() { |
317 |
throw new UnsupportedOperationException(); |
318 |
} |
319 |
|
320 |
public CharsetEncoder newEncoder() { |
321 |
throw new UnsupportedOperationException(); |
322 |
} |
323 |
} |
324 |
|
325 |
private static class ResizableRowHeightTable extends JTable { |
326 |
|
327 |
private boolean needResize = true; |
328 |
|
329 |
@Override |
330 |
public void setFont(Font font) { |
331 |
needResize = true; |
332 |
super.setFont(font); |
333 |
} |
334 |
|
335 |
@Override |
336 |
public void paint(Graphics g) { |
337 |
if(needResize) { |
338 |
this.setRowHeight(g.getFontMetrics(this.getFont()).getHeight()); |
339 |
needResize = false; |
340 |
} |
341 |
super.paint(g); |
342 |
} |
343 |
|
344 |
} |
345 |
|
346 |
private static class LabelCellEditor extends DefaultCellEditor { |
347 |
|
348 |
private JTable sourceRoots; |
349 |
private JTable testRoots; |
350 |
|
351 |
public LabelCellEditor(JTable sourceRoots, JTable testRoots) { |
352 |
super(new JTextField()); |
353 |
this.sourceRoots = sourceRoots; |
354 |
this.testRoots = testRoots; |
355 |
} |
356 |
|
357 |
@Override |
358 |
public boolean stopCellEditing() { |
359 |
JTextField field = (JTextField) getComponent(); |
360 |
String text = field.getText(); |
361 |
boolean validCell = true; |
362 |
TableModel model = sourceRoots.getModel(); |
363 |
int rowCount = model.getRowCount(); |
364 |
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { |
365 |
String value = (String) model.getValueAt(rowIndex, 1); |
366 |
if (text.equals(value)) { |
367 |
validCell = false; |
368 |
} |
369 |
} |
370 |
model = testRoots.getModel(); |
371 |
rowCount = model.getRowCount(); |
372 |
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { |
373 |
String value = (String) model.getValueAt(rowIndex, 1); |
374 |
if (text.equals(value)) { |
375 |
validCell = false; |
376 |
} |
377 |
} |
378 |
|
379 |
return validCell == false ? validCell : super.stopCellEditing(); |
380 |
} |
381 |
|
382 |
} |
383 |
|
384 |
/** This method is called from within the constructor to |
385 |
* initialize the form. |
386 |
* WARNING: Do NOT modify this code. The content of this method is |
387 |
* always regenerated by the Form Editor. |
388 |
*/ |
389 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
390 |
private void initComponents() { |
391 |
java.awt.GridBagConstraints gridBagConstraints; |
392 |
|
393 |
jLabel1 = new javax.swing.JLabel(); |
394 |
projectLocation = new javax.swing.JTextField(); |
395 |
sourceRootsPanel = new javax.swing.JPanel(); |
396 |
jLabel2 = new javax.swing.JLabel(); |
397 |
jScrollPane1 = new javax.swing.JScrollPane(); |
398 |
sourceRoots = new ResizableRowHeightTable(); |
399 |
addSourceRoot = new javax.swing.JButton(); |
400 |
removeSourceRoot = new javax.swing.JButton(); |
401 |
upSourceRoot = new javax.swing.JButton(); |
402 |
downSourceRoot = new javax.swing.JButton(); |
403 |
testRootsPanel = new javax.swing.JPanel(); |
404 |
jLabel3 = new javax.swing.JLabel(); |
405 |
jScrollPane2 = new javax.swing.JScrollPane(); |
406 |
testRoots = new ResizableRowHeightTable(); |
407 |
addTestRoot = new javax.swing.JButton(); |
408 |
removeTestRoot = new javax.swing.JButton(); |
409 |
upTestRoot = new javax.swing.JButton(); |
410 |
downTestRoot = new javax.swing.JButton(); |
411 |
jPanel1 = new javax.swing.JPanel(); |
412 |
jLabel4 = new javax.swing.JLabel(); |
413 |
sourceLevel = new javax.swing.JComboBox(); |
414 |
jLabel5 = new javax.swing.JLabel(); |
415 |
encoding = new javax.swing.JComboBox(); |
416 |
jPanel2 = new javax.swing.JPanel(); |
417 |
|
418 |
setLayout(new java.awt.GridBagLayout()); |
419 |
|
420 |
jLabel1.setLabelFor(projectLocation); |
421 |
jLabel1.setText(org.openide.util.NbBundle.getBundle(CustomizerSources.class).getString("CTL_ProjectFolder")); // NOI18N |
422 |
add(jLabel1, new java.awt.GridBagConstraints()); |
423 |
|
424 |
projectLocation.setEditable(false); |
425 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
426 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
427 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
428 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
429 |
gridBagConstraints.weightx = 1.0; |
430 |
add(projectLocation, gridBagConstraints); |
431 |
projectLocation.getAccessibleContext().setAccessibleDescription("null"); |
432 |
|
433 |
sourceRootsPanel.setLayout(new java.awt.GridBagLayout()); |
434 |
|
435 |
jLabel2.setLabelFor(sourceRoots); |
436 |
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/mobility/project/ui/customizer/Bundle"); // NOI18N |
437 |
jLabel2.setText(bundle.getString("CTL_SourceRoots")); // NOI18N |
438 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
439 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
440 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
441 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
442 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0); |
443 |
sourceRootsPanel.add(jLabel2, gridBagConstraints); |
444 |
|
445 |
jScrollPane1.setPreferredSize(new java.awt.Dimension(450, 150)); |
446 |
|
447 |
sourceRoots.setModel(new javax.swing.table.DefaultTableModel( |
448 |
new Object [][] { |
449 |
{null, null}, |
450 |
{null, null}, |
451 |
{null, null}, |
452 |
{null, null} |
453 |
}, |
454 |
new String [] { |
455 |
"Package Folder", "Label" |
456 |
} |
457 |
) { |
458 |
Class[] types = new Class [] { |
459 |
java.lang.Object.class, java.lang.String.class |
460 |
}; |
461 |
boolean[] canEdit = new boolean [] { |
462 |
false, false |
463 |
}; |
464 |
|
465 |
public Class getColumnClass(int columnIndex) { |
466 |
return types [columnIndex]; |
467 |
} |
468 |
|
469 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
470 |
return canEdit [columnIndex]; |
471 |
} |
472 |
}); |
473 |
jScrollPane1.setViewportView(sourceRoots); |
474 |
sourceRoots.getAccessibleContext().setAccessibleDescription("null"); |
475 |
|
476 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
477 |
gridBagConstraints.gridx = 0; |
478 |
gridBagConstraints.gridy = 1; |
479 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
480 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
481 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
482 |
gridBagConstraints.weightx = 1.0; |
483 |
gridBagConstraints.weighty = 0.5; |
484 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
485 |
sourceRootsPanel.add(jScrollPane1, gridBagConstraints); |
486 |
|
487 |
addSourceRoot.setText(bundle.getString("CTL_AddSourceRoot")); // NOI18N |
488 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
489 |
gridBagConstraints.gridx = 1; |
490 |
gridBagConstraints.gridy = 1; |
491 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
492 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
493 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
494 |
sourceRootsPanel.add(addSourceRoot, gridBagConstraints); |
495 |
addSourceRoot.getAccessibleContext().setAccessibleDescription("null"); |
496 |
|
497 |
removeSourceRoot.setText(bundle.getString("CTL_RemoveSourceRoot")); // NOI18N |
498 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
499 |
gridBagConstraints.gridx = 1; |
500 |
gridBagConstraints.gridy = 2; |
501 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
502 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
503 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
504 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); |
505 |
sourceRootsPanel.add(removeSourceRoot, gridBagConstraints); |
506 |
removeSourceRoot.getAccessibleContext().setAccessibleDescription("null"); |
507 |
|
508 |
upSourceRoot.setText(bundle.getString("CTL_UpSourceRoot")); // NOI18N |
509 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
510 |
gridBagConstraints.gridx = 1; |
511 |
gridBagConstraints.gridy = 3; |
512 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
513 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
514 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
515 |
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); |
516 |
sourceRootsPanel.add(upSourceRoot, gridBagConstraints); |
517 |
upSourceRoot.getAccessibleContext().setAccessibleDescription("null"); |
518 |
|
519 |
downSourceRoot.setText(bundle.getString("CTL_DownSourceRoot")); // NOI18N |
520 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
521 |
gridBagConstraints.gridx = 1; |
522 |
gridBagConstraints.gridy = 4; |
523 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
524 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
525 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
526 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); |
527 |
sourceRootsPanel.add(downSourceRoot, gridBagConstraints); |
528 |
downSourceRoot.getAccessibleContext().setAccessibleDescription("null"); |
529 |
|
530 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
531 |
gridBagConstraints.gridx = 0; |
532 |
gridBagConstraints.gridy = 1; |
533 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
534 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
535 |
gridBagConstraints.weightx = 1.0; |
536 |
gridBagConstraints.weighty = 0.45; |
537 |
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); |
538 |
add(sourceRootsPanel, gridBagConstraints); |
539 |
|
540 |
testRootsPanel.setLayout(new java.awt.GridBagLayout()); |
541 |
|
542 |
jLabel3.setLabelFor(testRoots); |
543 |
jLabel3.setText(bundle.getString("CTL_TestRoots")); // NOI18N |
544 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
545 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
546 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
547 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
548 |
gridBagConstraints.weightx = 1.0; |
549 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0); |
550 |
testRootsPanel.add(jLabel3, gridBagConstraints); |
551 |
|
552 |
jScrollPane2.setPreferredSize(new java.awt.Dimension(450, 150)); |
553 |
|
554 |
testRoots.setModel(new javax.swing.table.DefaultTableModel( |
555 |
new Object [][] { |
556 |
{null, null}, |
557 |
{null, null}, |
558 |
{null, null}, |
559 |
{null, null} |
560 |
}, |
561 |
new String [] { |
562 |
"Package Folder", "Label" |
563 |
} |
564 |
) { |
565 |
Class[] types = new Class [] { |
566 |
java.lang.Object.class, java.lang.String.class |
567 |
}; |
568 |
boolean[] canEdit = new boolean [] { |
569 |
false, false |
570 |
}; |
571 |
|
572 |
public Class getColumnClass(int columnIndex) { |
573 |
return types [columnIndex]; |
574 |
} |
575 |
|
576 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
577 |
return canEdit [columnIndex]; |
578 |
} |
579 |
}); |
580 |
jScrollPane2.setViewportView(testRoots); |
581 |
testRoots.getAccessibleContext().setAccessibleDescription("null"); |
582 |
|
583 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
584 |
gridBagConstraints.gridx = 0; |
585 |
gridBagConstraints.gridy = 1; |
586 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
587 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
588 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
589 |
gridBagConstraints.weightx = 1.0; |
590 |
gridBagConstraints.weighty = 0.5; |
591 |
testRootsPanel.add(jScrollPane2, gridBagConstraints); |
592 |
|
593 |
addTestRoot.setText(bundle.getString("CTL_AddTestRoot")); // NOI18N |
594 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
595 |
gridBagConstraints.gridx = 1; |
596 |
gridBagConstraints.gridy = 1; |
597 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
598 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
599 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
600 |
gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 0); |
601 |
testRootsPanel.add(addTestRoot, gridBagConstraints); |
602 |
addTestRoot.getAccessibleContext().setAccessibleDescription("null"); |
603 |
|
604 |
removeTestRoot.setText(bundle.getString("CTL_RemoveTestRoot")); // NOI18N |
605 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
606 |
gridBagConstraints.gridx = 1; |
607 |
gridBagConstraints.gridy = 2; |
608 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
609 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
610 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
611 |
gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0); |
612 |
testRootsPanel.add(removeTestRoot, gridBagConstraints); |
613 |
removeTestRoot.getAccessibleContext().setAccessibleDescription("null"); |
614 |
|
615 |
upTestRoot.setText(bundle.getString("CTL_UpTestRoot")); // NOI18N |
616 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
617 |
gridBagConstraints.gridx = 1; |
618 |
gridBagConstraints.gridy = 3; |
619 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
620 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
621 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
622 |
gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 0); |
623 |
testRootsPanel.add(upTestRoot, gridBagConstraints); |
624 |
upTestRoot.getAccessibleContext().setAccessibleDescription("null"); |
625 |
|
626 |
downTestRoot.setText(bundle.getString("CTL_DownTestRoot")); // NOI18N |
627 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
628 |
gridBagConstraints.gridx = 1; |
629 |
gridBagConstraints.gridy = 4; |
630 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
631 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
632 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
633 |
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); |
634 |
testRootsPanel.add(downTestRoot, gridBagConstraints); |
635 |
downTestRoot.getAccessibleContext().setAccessibleDescription("null"); |
636 |
|
637 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
638 |
gridBagConstraints.gridx = 0; |
639 |
gridBagConstraints.gridy = 2; |
640 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
641 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
642 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
643 |
gridBagConstraints.weightx = 1.0; |
644 |
gridBagConstraints.weighty = 0.45; |
645 |
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); |
646 |
add(testRootsPanel, gridBagConstraints); |
647 |
|
648 |
jPanel1.setLayout(new java.awt.GridBagLayout()); |
649 |
|
650 |
jLabel4.setLabelFor(sourceLevel); |
651 |
org.openide.awt.Mnemonics.setLocalizedText(jLabel4, bundle.getString("TXT_SourceLevel")); // NOI18N |
652 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
653 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
654 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
655 |
jPanel1.add(jLabel4, gridBagConstraints); |
656 |
|
657 |
sourceLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1.4", "1.5" })); |
658 |
sourceLevel.setMinimumSize(this.sourceLevel.getPreferredSize()); |
659 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
660 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
661 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
662 |
gridBagConstraints.weightx = 1.0; |
663 |
jPanel1.add(sourceLevel, gridBagConstraints); |
664 |
sourceLevel.getAccessibleContext().setAccessibleName("null"); |
665 |
sourceLevel.getAccessibleContext().setAccessibleDescription("null"); |
666 |
|
667 |
jLabel5.setLabelFor(encoding); |
668 |
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(CustomizerSources.class, "TXT_Encoding")); // NOI18N |
669 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
670 |
gridBagConstraints.gridx = 0; |
671 |
gridBagConstraints.gridy = 1; |
672 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
673 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
674 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
675 |
gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 12); |
676 |
jPanel1.add(jLabel5, gridBagConstraints); |
677 |
jLabel5.getAccessibleContext().setAccessibleDescription("null"); |
678 |
|
679 |
encoding.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); |
680 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
681 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
682 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
683 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
684 |
gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); |
685 |
jPanel1.add(encoding, gridBagConstraints); |
686 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
687 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
688 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
689 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
690 |
gridBagConstraints.weightx = 1.0; |
691 |
jPanel1.add(jPanel2, gridBagConstraints); |
692 |
|
693 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
694 |
gridBagConstraints.gridx = 0; |
695 |
gridBagConstraints.gridy = 3; |
696 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
697 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
698 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
699 |
gridBagConstraints.weightx = 1.0; |
700 |
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); |
701 |
add(jPanel1, gridBagConstraints); |
702 |
}// </editor-fold>//GEN-END:initComponents |
703 |
|
704 |
|
705 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
706 |
private javax.swing.JButton addSourceRoot; |
707 |
private javax.swing.JButton addTestRoot; |
708 |
private javax.swing.JButton downSourceRoot; |
709 |
private javax.swing.JButton downTestRoot; |
710 |
private javax.swing.JComboBox encoding; |
711 |
private javax.swing.JLabel jLabel1; |
712 |
private javax.swing.JLabel jLabel2; |
713 |
private javax.swing.JLabel jLabel3; |
714 |
private javax.swing.JLabel jLabel4; |
715 |
private javax.swing.JLabel jLabel5; |
716 |
private javax.swing.JPanel jPanel1; |
717 |
private javax.swing.JPanel jPanel2; |
718 |
private javax.swing.JScrollPane jScrollPane1; |
719 |
private javax.swing.JScrollPane jScrollPane2; |
720 |
private javax.swing.JTextField projectLocation; |
721 |
private javax.swing.JButton removeSourceRoot; |
722 |
private javax.swing.JButton removeTestRoot; |
723 |
private javax.swing.JComboBox sourceLevel; |
724 |
private javax.swing.JTable sourceRoots; |
725 |
private javax.swing.JPanel sourceRootsPanel; |
726 |
private javax.swing.JTable testRoots; |
727 |
private javax.swing.JPanel testRootsPanel; |
728 |
private javax.swing.JButton upSourceRoot; |
729 |
private javax.swing.JButton upTestRoot; |
730 |
// End of variables declaration//GEN-END:variables |
731 |
|
732 |
} |