Lines 44-163
Link Here
|
44 |
|
44 |
|
45 |
package org.netbeans.modules.apisupport.project.ui.wizard.winsys; |
45 |
package org.netbeans.modules.apisupport.project.ui.wizard.winsys; |
46 |
|
46 |
|
47 |
import java.io.File; |
47 |
import java.awt.EventQueue; |
48 |
import javax.swing.JFileChooser; |
48 |
import java.io.IOException; |
49 |
import javax.swing.JTextField; |
49 |
import java.util.concurrent.atomic.AtomicReference; |
50 |
import javax.swing.event.DocumentEvent; |
50 |
import javax.swing.JComponent; |
51 |
import javax.swing.event.DocumentListener; |
51 |
import javax.swing.JLabel; |
52 |
import org.netbeans.api.project.ProjectUtils; |
52 |
import org.netbeans.api.progress.ProgressHandle; |
53 |
import org.netbeans.modules.apisupport.project.api.UIUtil; |
53 |
import org.netbeans.api.progress.ProgressHandleFactory; |
54 |
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator; |
54 |
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator; |
55 |
import org.openide.WizardDescriptor; |
55 |
import org.openide.WizardDescriptor; |
|
|
56 |
import org.openide.explorer.ExplorerManager; |
57 |
import org.openide.explorer.view.CheckableNode; |
58 |
import org.openide.explorer.view.OutlineView; |
59 |
import org.openide.filesystems.FileObject; |
60 |
import org.openide.filesystems.FileSystem; |
61 |
import org.openide.nodes.AbstractNode; |
62 |
import org.openide.nodes.Children; |
63 |
import org.openide.nodes.Node; |
64 |
import org.openide.util.Exceptions; |
56 |
import org.openide.util.HelpCtx; |
65 |
import org.openide.util.HelpCtx; |
57 |
import org.openide.util.NbBundle; |
66 |
import org.openide.util.NbBundle; |
58 |
import org.openide.util.Utilities; |
67 |
import org.openide.util.Task; |
|
|
68 |
import org.openide.util.TaskListener; |
59 |
|
69 |
|
60 |
/** |
70 |
/** |
61 |
* the second panel in topcomponent wizard. |
71 |
* Shows progress of launching first, then let's user pickup changed modes. |
62 |
* |
72 |
* |
63 |
* @author Milos Kleint |
73 |
* @author Jaroslav Tulach |
64 |
*/ |
74 |
*/ |
65 |
final class NameAndLocationPanel extends BasicWizardIterator.Panel { |
75 |
final class LayoutLaunchingPanel extends BasicWizardIterator.Panel |
|
|
76 |
implements TaskListener, Runnable, ExplorerManager.Provider { |
77 |
private AtomicReference<FileObject> userDir = new AtomicReference<FileObject>(); |
78 |
private NewTCIterator.DataModel data; |
79 |
private Task task; |
80 |
private ProgressHandle handle; |
81 |
private ExplorerManager em; |
82 |
private final OutlineView outlineView; |
66 |
|
83 |
|
67 |
private NewTCIterator.DataModel data; |
84 |
@NbBundle.Messages({ |
68 |
|
85 |
"CTL_FoundModes=Found modes", |
69 |
/** Creates new NameAndLocationPanel */ |
86 |
"LBL_LayoutingWizardTitle=Define Your Modes" |
70 |
public NameAndLocationPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) { |
87 |
}) |
|
|
88 |
public LayoutLaunchingPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) { |
71 |
super(setting); |
89 |
super(setting); |
72 |
this.data = data; |
90 |
this.data = data; |
|
|
91 |
Node root = new AbstractNode(new Children.Array()); |
92 |
this.em = new ExplorerManager(); |
93 |
this.em.setRootContext(root); |
73 |
initComponents(); |
94 |
initComponents(); |
74 |
initAccessibility(); |
95 |
initAccessibility(); |
75 |
putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle")); |
96 |
putClientProperty("NewFileWizard_Title", Bundle.LBL_LayoutingWizardTitle()); // NOI18N |
76 |
|
97 |
outlineView = new OutlineView(Bundle.CTL_FoundModes()); |
77 |
DocumentListener dListener = new UIUtil.DocumentAdapter() { |
98 |
outlineView.getOutline().setRootVisible(false); |
78 |
public void insertUpdate(DocumentEvent e) { |
99 |
tree.add(outlineView); |
79 |
if (checkValidity()) { |
100 |
outlineView.setDefaultActionAllowed(false); |
80 |
updateData(); |
101 |
outlineView.setVisible(false); |
81 |
} |
102 |
tree.setMinimumSize(outlineView.getPreferredSize()); |
|
|
103 |
} |
104 |
|
105 |
@Override |
106 |
protected void storeToDataModel() { |
107 |
for (Node n : getExplorerManager().getRootContext().getChildren().getNodes()) { |
108 |
ModeNode mn = (ModeNode)n; |
109 |
if (mn.isSelected()) { |
110 |
data.defineMode(mn.getName(), mn.text); |
82 |
} |
111 |
} |
83 |
}; |
|
|
84 |
txtPrefix.getDocument().addDocumentListener(dListener); |
85 |
txtIcon.getDocument().addDocumentListener(dListener); |
86 |
|
87 |
if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) { |
88 |
JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent(); |
89 |
txt.getDocument().addDocumentListener(dListener); |
90 |
} |
112 |
} |
91 |
} |
113 |
} |
92 |
|
114 |
|
93 |
protected void storeToDataModel() { |
115 |
@NbBundle.Messages({ |
94 |
updateData(); |
116 |
"MSG_LaunchingApplication=Launching your application" |
|
|
117 |
}) |
118 |
@Override |
119 |
protected void readFromDataModel() { |
120 |
checkValidity(); |
121 |
if (task == null) { |
122 |
try { |
123 |
task = DesignSupport.invokeDesignMode(data.getProject(), userDir, false, !data.isIgnorePreviousRun()); |
124 |
} catch (IOException ex) { |
125 |
Exceptions.printStackTrace(ex); |
126 |
} |
127 |
handle = ProgressHandleFactory.createHandle(Bundle.MSG_LaunchingApplication()); |
128 |
JComponent pc = ProgressHandleFactory.createProgressComponent(handle); |
129 |
JLabel ml = ProgressHandleFactory.createMainLabelComponent(handle); |
130 |
|
131 |
progress.add(ml); |
132 |
progress.add(pc); |
133 |
|
134 |
handle.start(); |
135 |
markInvalid(); |
136 |
try { |
137 |
DesignSupport.existingModes(data); |
138 |
} catch (IOException ex) { |
139 |
Exceptions.printStackTrace(ex); |
140 |
} |
141 |
} |
142 |
task.addTaskListener(this); |
95 |
} |
143 |
} |
96 |
|
144 |
|
97 |
private void updateData() { |
145 |
@Override |
98 |
data.setPackageName(comPackageName.getEditor().getItem().toString()); |
146 |
@NbBundle.Messages({ |
99 |
String icon = txtIcon.getText().trim(); |
147 |
"LBL_DesignLayout=Design Window Layout" |
100 |
data.setIcon(icon.length() == 0 ? (String)null : icon); |
148 |
}) |
101 |
data.setName(txtPrefix.getText().trim()); |
|
|
102 |
NewTCIterator.generateFileChanges(data); |
103 |
createdFilesValue.setText(UIUtil.generateTextAreaContent( |
104 |
data.getCreatedModifiedFiles().getCreatedPaths())); |
105 |
modifiedFilesValue.setText(UIUtil.generateTextAreaContent( |
106 |
data.getCreatedModifiedFiles().getModifiedPaths())); |
107 |
//#68294 check if the paths for newly created files are valid or not.. |
108 |
String[] invalid = data.getCreatedModifiedFiles().getInvalidPaths(); |
109 |
if (invalid.length > 0) { |
110 |
setError(NbBundle.getMessage(NameAndLocationPanel.class, "ERR_ToBeCreateFileExists", invalid[0])); |
111 |
} |
112 |
|
113 |
} |
114 |
|
115 |
protected void readFromDataModel() { |
116 |
txtPrefix.setText(data.getName()); |
117 |
txtIcon.setText(data.getIcon()); |
118 |
if (data.getPackageName() != null) { |
119 |
comPackageName.setSelectedItem(data.getPackageName()); |
120 |
} |
121 |
checkValidity(); |
122 |
} |
123 |
|
124 |
protected String getPanelName() { |
149 |
protected String getPanelName() { |
125 |
return getMessage("LBL_NameLocation_Title"); |
150 |
return Bundle.LBL_DesignLayout(); |
126 |
} |
151 |
} |
127 |
|
152 |
|
128 |
private boolean checkValidity() { |
153 |
private boolean checkValidity() { |
129 |
if (txtPrefix.getText().trim().length() == 0) { |
154 |
int cnt = 0; |
130 |
setInfo(getMessage("ERR_Name_Prefix_Empty"), false); |
155 |
for (Node node : getExplorerManager().getRootContext().getChildren().getNodes()) { |
|
|
156 |
if (node instanceof ModeNode) { |
157 |
ModeNode mn = (ModeNode)node; |
158 |
if (mn.isSelected()) { |
159 |
cnt++; |
160 |
} |
161 |
} |
162 |
} |
163 |
if (cnt == 0 || !outlineView.isVisible()) { |
164 |
markInvalid(); |
131 |
return false; |
165 |
return false; |
132 |
} |
166 |
} |
133 |
if (!Utilities.isJavaIdentifier(txtPrefix.getText().trim())) { |
|
|
134 |
setError(getMessage("ERR_Name_Prefix_Invalid")); |
135 |
return false; |
136 |
} |
137 |
String path = txtIcon.getText().trim(); |
138 |
if (path.length() != 0) { |
139 |
File fil = new File(path); |
140 |
if (!fil.exists()) { |
141 |
setError(NbBundle.getMessage(getClass(), "ERR_Icon_Invalid")); |
142 |
return false; |
143 |
} |
144 |
} |
145 |
String packageName = comPackageName.getEditor().getItem().toString().trim(); |
146 |
if (packageName.length() == 0 || !UIUtil.isValidPackageName(packageName)) { |
147 |
setError(NbBundle.getMessage(getClass(), "ERR_Package_Invalid")); |
148 |
return false; |
149 |
} |
150 |
|
151 |
markValid(); |
167 |
markValid(); |
152 |
return true; |
168 |
return true; |
153 |
} |
169 |
} |
154 |
|
170 |
|
|
|
171 |
@Override |
155 |
protected HelpCtx getHelp() { |
172 |
protected HelpCtx getHelp() { |
156 |
return new HelpCtx(NameAndLocationPanel.class); |
173 |
return new HelpCtx(LayoutLaunchingPanel.class); |
157 |
} |
|
|
158 |
|
159 |
private static String getMessage(String key) { |
160 |
return NbBundle.getMessage(NameAndLocationPanel.class, key); |
161 |
} |
174 |
} |
162 |
|
175 |
|
163 |
/** This method is called from within the constructor to |
176 |
/** This method is called from within the constructor to |
Lines 165-370
Link Here
|
165 |
* WARNING: Do NOT modify this code. The content of this method is |
178 |
* WARNING: Do NOT modify this code. The content of this method is |
166 |
* always regenerated by the Form Editor. |
179 |
* always regenerated by the Form Editor. |
167 |
*/ |
180 |
*/ |
168 |
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents |
181 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
169 |
private void initComponents() { |
182 |
private void initComponents() { |
170 |
java.awt.GridBagConstraints gridBagConstraints; |
183 |
java.awt.GridBagConstraints gridBagConstraints; |
171 |
|
184 |
|
172 |
lblPrefix = new javax.swing.JLabel(); |
185 |
progress = new javax.swing.JPanel(); |
173 |
txtPrefix = new javax.swing.JTextField(); |
186 |
tree = new javax.swing.JPanel(); |
174 |
lblIcon = new javax.swing.JLabel(); |
|
|
175 |
txtIcon = new javax.swing.JTextField(); |
176 |
btnIcon = new javax.swing.JButton(); |
177 |
lblProjectName = new javax.swing.JLabel(); |
178 |
txtProjectName = new JTextField(ProjectUtils.getInformation(this.data.getProject()).getDisplayName()); |
179 |
lblPackageName = new javax.swing.JLabel(); |
180 |
comPackageName = UIUtil.createPackageComboBox(data.getSourceRootGroup()); |
181 |
createdFiles = new javax.swing.JLabel(); |
182 |
modifiedFiles = new javax.swing.JLabel(); |
183 |
filler = new javax.swing.JLabel(); |
184 |
createdFilesValue = new javax.swing.JTextArea(); |
185 |
modifiedFilesValue = new javax.swing.JTextArea(); |
186 |
|
187 |
|
187 |
setLayout(new java.awt.GridBagLayout()); |
188 |
setLayout(new java.awt.GridBagLayout()); |
188 |
|
|
|
189 |
lblPrefix.setLabelFor(txtPrefix); |
190 |
org.openide.awt.Mnemonics.setLocalizedText(lblPrefix, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Prefix")); |
191 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
189 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
192 |
gridBagConstraints.gridx = 0; |
190 |
gridBagConstraints.gridx = 0; |
193 |
gridBagConstraints.gridy = 0; |
191 |
gridBagConstraints.gridy = 0; |
|
|
192 |
gridBagConstraints.gridwidth = 4; |
193 |
gridBagConstraints.gridheight = 3; |
194 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
194 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
195 |
gridBagConstraints.insets = new java.awt.Insets(1, 0, 6, 12); |
195 |
add(progress, gridBagConstraints); |
196 |
add(lblPrefix, gridBagConstraints); |
|
|
197 |
|
198 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
199 |
gridBagConstraints.gridx = 1; |
200 |
gridBagConstraints.gridy = 0; |
201 |
gridBagConstraints.gridwidth = 2; |
202 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
203 |
gridBagConstraints.weightx = 1.0; |
204 |
gridBagConstraints.insets = new java.awt.Insets(1, 0, 6, 0); |
205 |
add(txtPrefix, gridBagConstraints); |
206 |
|
207 |
lblIcon.setLabelFor(txtIcon); |
208 |
org.openide.awt.Mnemonics.setLocalizedText(lblIcon, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Icon")); |
209 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
210 |
gridBagConstraints.gridx = 0; |
211 |
gridBagConstraints.gridy = 1; |
212 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
213 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
214 |
add(lblIcon, gridBagConstraints); |
215 |
|
216 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
217 |
gridBagConstraints.gridx = 1; |
218 |
gridBagConstraints.gridy = 1; |
219 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
220 |
gridBagConstraints.weightx = 1.0; |
221 |
add(txtIcon, gridBagConstraints); |
222 |
|
223 |
org.openide.awt.Mnemonics.setLocalizedText(btnIcon, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Icon_Browse")); |
224 |
btnIcon.addActionListener(new java.awt.event.ActionListener() { |
225 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
226 |
btnIconActionPerformed(evt); |
227 |
} |
228 |
}); |
229 |
|
230 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
231 |
gridBagConstraints.gridx = 2; |
232 |
gridBagConstraints.gridy = 1; |
233 |
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); |
234 |
add(btnIcon, gridBagConstraints); |
235 |
|
236 |
lblProjectName.setLabelFor(txtProjectName); |
237 |
org.openide.awt.Mnemonics.setLocalizedText(lblProjectName, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_ProjectName")); |
238 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
239 |
gridBagConstraints.gridx = 0; |
240 |
gridBagConstraints.gridy = 2; |
241 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
242 |
gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 12); |
243 |
add(lblProjectName, gridBagConstraints); |
244 |
|
245 |
txtProjectName.setEditable(false); |
246 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
247 |
gridBagConstraints.gridx = 1; |
248 |
gridBagConstraints.gridy = 2; |
249 |
gridBagConstraints.gridwidth = 2; |
250 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
251 |
gridBagConstraints.weightx = 1.0; |
252 |
gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 0); |
253 |
add(txtProjectName, gridBagConstraints); |
254 |
|
255 |
lblPackageName.setLabelFor(comPackageName); |
256 |
org.openide.awt.Mnemonics.setLocalizedText(lblPackageName, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_PackageName")); |
257 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
196 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
258 |
gridBagConstraints.gridx = 0; |
197 |
gridBagConstraints.gridx = 0; |
259 |
gridBagConstraints.gridy = 3; |
198 |
gridBagConstraints.gridy = 3; |
260 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
199 |
gridBagConstraints.gridwidth = 4; |
261 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
200 |
gridBagConstraints.gridheight = 11; |
262 |
add(lblPackageName, gridBagConstraints); |
201 |
add(tree, gridBagConstraints); |
|
|
202 |
}// </editor-fold>//GEN-END:initComponents |
203 |
|
204 |
@NbBundle.Messages({ |
205 |
"ACS_DesignPanel=Design Window Layout" |
206 |
}) |
207 |
private void initAccessibility() { |
208 |
this.getAccessibleContext().setAccessibleDescription(Bundle.ACS_DesignPanel()); |
209 |
} |
210 |
|
211 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
212 |
private javax.swing.JPanel progress; |
213 |
private javax.swing.JPanel tree; |
214 |
// End of variables declaration//GEN-END:variables |
263 |
|
215 |
|
264 |
comPackageName.setEditable(true); |
216 |
@Override |
265 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
217 |
@NbBundle.Messages({ |
266 |
gridBagConstraints.gridx = 1; |
218 |
"LBL_NoModesFound=No layout definition found", |
267 |
gridBagConstraints.gridy = 3; |
219 |
"MSG_NoModesFound=Is everything OK? Did your application compile and run?" |
268 |
gridBagConstraints.gridwidth = 2; |
220 |
}) |
269 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
221 |
public void taskFinished(Task task) { |
270 |
gridBagConstraints.weightx = 1.0; |
222 |
handle.finish(); |
271 |
add(comPackageName, gridBagConstraints); |
223 |
FileObject modeDir = userDir.get().getFileObject("config/Windows2Local/Modes"); |
|
|
224 |
boolean one = false; |
225 |
final Children ch = getExplorerManager().getRootContext().getChildren(); |
226 |
if (modeDir != null) { |
227 |
try { |
228 |
FileSystem layer = DesignSupport.findLayer(data.getProject()); |
229 |
if (layer == null) { |
230 |
throw new IOException("Cannot find layer in " + data.getProject()); // NOI18N |
231 |
} |
232 |
for (FileObject m : modeDir.getChildren()) { |
233 |
if (m.isData() && "wsmode".equals(m.getExt())) { |
234 |
ModeNode mn = new ModeNode(m, data); |
235 |
ch.add(new Node[] { mn }); |
236 |
one = true; |
237 |
} |
238 |
} |
239 |
} catch (IOException ex) { |
240 |
Exceptions.printStackTrace(ex); |
241 |
} |
242 |
} |
243 |
if (!one) { |
244 |
AbstractNode empty = new AbstractNode(Children.LEAF); |
245 |
empty.setName("empty"); // NOI18N |
246 |
empty.setDisplayName(Bundle.LBL_NoModesFound()); |
247 |
empty.setShortDescription(Bundle.MSG_NoModesFound()); |
248 |
ch.add(new Node[] { empty }); |
249 |
markInvalid(); |
250 |
} else { |
251 |
markValid(); |
252 |
} |
253 |
|
254 |
EventQueue.invokeLater(this); |
255 |
} |
256 |
@Override |
257 |
public void run() { |
258 |
progress.setVisible(false); |
259 |
outlineView.setVisible(true); |
260 |
progress.invalidate(); |
261 |
outlineView.invalidate(); |
262 |
validateTree(); |
263 |
} |
272 |
|
264 |
|
273 |
createdFiles.setLabelFor(createdFilesValue); |
265 |
@Override |
274 |
org.openide.awt.Mnemonics.setLocalizedText(createdFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_CreatedFiles")); |
266 |
public ExplorerManager getExplorerManager() { |
275 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
267 |
return em; |
276 |
gridBagConstraints.gridx = 0; |
268 |
} |
277 |
gridBagConstraints.gridy = 4; |
|
|
278 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
279 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
280 |
gridBagConstraints.insets = new java.awt.Insets(36, 0, 6, 12); |
281 |
add(createdFiles, gridBagConstraints); |
282 |
|
269 |
|
283 |
modifiedFiles.setLabelFor(modifiedFilesValue); |
270 |
private class ModeNode extends AbstractNode |
284 |
org.openide.awt.Mnemonics.setLocalizedText(modifiedFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_ModifiedFiles")); |
271 |
implements CheckableNode { |
285 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
272 |
private final FileObject mode; |
286 |
gridBagConstraints.gridx = 0; |
273 |
private final String text; |
287 |
gridBagConstraints.gridy = 5; |
274 |
private boolean selected; |
288 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
|
289 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
290 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
291 |
add(modifiedFiles, gridBagConstraints); |
292 |
|
275 |
|
293 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
276 |
public ModeNode(FileObject mode, NewTCIterator.DataModel data) throws IOException { |
294 |
gridBagConstraints.gridx = 0; |
277 |
super(Children.LEAF); |
295 |
gridBagConstraints.gridy = 6; |
278 |
this.mode = mode; |
296 |
gridBagConstraints.gridwidth = 3; |
279 |
this.text = DesignSupport.readMode(mode); |
297 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
280 |
this.selected = !data.isExistingMode(mode.getName()); |
298 |
gridBagConstraints.weightx = 1.0; |
281 |
|
299 |
gridBagConstraints.weighty = 1.0; |
282 |
setName(mode.getName()); |
300 |
add(filler, gridBagConstraints); |
283 |
} |
301 |
|
284 |
|
302 |
createdFilesValue.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background")); |
285 |
@Override |
303 |
createdFilesValue.setColumns(20); |
286 |
public boolean isCheckable() { |
304 |
createdFilesValue.setEditable(false); |
287 |
return true; |
305 |
createdFilesValue.setRows(5); |
288 |
} |
306 |
createdFilesValue.setBorder(null); |
|
|
307 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
308 |
gridBagConstraints.gridx = 1; |
309 |
gridBagConstraints.gridy = 4; |
310 |
gridBagConstraints.gridwidth = 2; |
311 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
312 |
gridBagConstraints.weightx = 1.0; |
313 |
gridBagConstraints.insets = new java.awt.Insets(36, 0, 6, 0); |
314 |
add(createdFilesValue, gridBagConstraints); |
315 |
|
289 |
|
316 |
modifiedFilesValue.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background")); |
290 |
@Override |
317 |
modifiedFilesValue.setColumns(20); |
291 |
public boolean isCheckEnabled() { |
318 |
modifiedFilesValue.setEditable(false); |
292 |
return true; |
319 |
modifiedFilesValue.setRows(5); |
293 |
} |
320 |
modifiedFilesValue.setToolTipText("modifiedFilesValue"); |
|
|
321 |
modifiedFilesValue.setBorder(null); |
322 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
323 |
gridBagConstraints.gridx = 1; |
324 |
gridBagConstraints.gridy = 5; |
325 |
gridBagConstraints.gridwidth = 2; |
326 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
327 |
gridBagConstraints.weightx = 1.0; |
328 |
add(modifiedFilesValue, gridBagConstraints); |
329 |
|
294 |
|
330 |
} |
295 |
@Override |
331 |
// </editor-fold>//GEN-END:initComponents |
296 |
public Boolean isSelected() { |
332 |
|
297 |
return selected; |
333 |
private void initAccessibility() { |
298 |
} |
334 |
this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_NameAndLocationPanel")); |
299 |
|
335 |
comPackageName.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_PackageName")); |
300 |
@Override |
336 |
txtIcon.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_Icon")); |
301 |
public void setSelected(Boolean selected) { |
337 |
txtPrefix.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_Prefix")); |
302 |
this.selected = Boolean.TRUE.equals(selected); |
338 |
btnIcon.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_IconButton")); |
303 |
checkValidity(); |
339 |
txtProjectName.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ProjectName")); |
304 |
} |
340 |
createdFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_CreatedFilesValue")); |
|
|
341 |
modifiedFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ModifiedFilesValue")); |
342 |
} |
305 |
} |
343 |
|
306 |
|
344 |
private void btnIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIconActionPerformed |
|
|
345 |
JFileChooser chooser = UIUtil.getIconFileChooser(txtIcon.getText()); |
346 |
int ret = chooser.showDialog(this, getMessage("LBL_Select")); // NOI18N |
347 |
if (ret == JFileChooser.APPROVE_OPTION) { |
348 |
File file = chooser.getSelectedFile(); |
349 |
txtIcon.setText(file.getAbsolutePath()); |
350 |
} |
351 |
}//GEN-LAST:event_btnIconActionPerformed |
352 |
|
353 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
354 |
private javax.swing.JButton btnIcon; |
355 |
private javax.swing.JComboBox comPackageName; |
356 |
private javax.swing.JLabel createdFiles; |
357 |
private javax.swing.JTextArea createdFilesValue; |
358 |
private javax.swing.JLabel filler; |
359 |
private javax.swing.JLabel lblIcon; |
360 |
private javax.swing.JLabel lblPackageName; |
361 |
private javax.swing.JLabel lblPrefix; |
362 |
private javax.swing.JLabel lblProjectName; |
363 |
private javax.swing.JLabel modifiedFiles; |
364 |
private javax.swing.JTextArea modifiedFilesValue; |
365 |
private javax.swing.JTextField txtIcon; |
366 |
private javax.swing.JTextField txtPrefix; |
367 |
private javax.swing.JTextField txtProjectName; |
368 |
// End of variables declaration//GEN-END:variables |
369 |
|
370 |
} |
307 |
} |