KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > usertasks > EditTaskPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.tasklist.usertasks;
21
22 import java.awt.BorderLayout JavaDoc;
23 import java.awt.Dimension JavaDoc;
24 import java.awt.Toolkit JavaDoc;
25 import java.net.MalformedURLException JavaDoc;
26 import java.net.URL JavaDoc;
27 import java.text.DateFormat JavaDoc;
28 import java.text.SimpleDateFormat JavaDoc;
29 import java.util.Calendar JavaDoc;
30 import java.util.Date JavaDoc;
31 import java.util.logging.Level JavaDoc;
32
33 import javax.swing.ComboBoxModel JavaDoc;
34 import javax.swing.DefaultComboBoxModel JavaDoc;
35 import javax.swing.DefaultListModel JavaDoc;
36 import javax.swing.InputVerifier JavaDoc;
37 import javax.swing.JComponent JavaDoc;
38 import javax.swing.JPanel JavaDoc;
39 import javax.swing.ListCellRenderer JavaDoc;
40 import javax.swing.border.EmptyBorder JavaDoc;
41 import javax.swing.text.JTextComponent JavaDoc;
42 import org.netbeans.api.javahelp.Help;
43
44 import org.netbeans.modules.tasklist.usertasks.dependencies.DependenciesPanel;
45 import org.netbeans.modules.tasklist.usertasks.model.Duration;
46 import org.netbeans.modules.tasklist.usertasks.options.Settings;
47 import org.netbeans.modules.tasklist.usertasks.renderers.PriorityListCellRenderer;
48 import org.netbeans.modules.tasklist.usertasks.util.UTUtils;
49 import org.openide.awt.Mnemonics;
50 import org.openide.util.HelpCtx;
51 import org.openide.util.Lookup;
52 import org.openide.util.NbBundle;
53 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
54 import org.netbeans.modules.tasklist.usertasks.util.DurationFormat;
55
56 /**
57  * Panel used to enter/edit a user task.
58  * Please read comment at the beginning of initA11y before editing
59  * this file using the form builder.
60  *
61  * @author Tor Norbye
62  * @author tl
63  */

64 public class EditTaskPanel extends JPanel JavaDoc {
65
66     private static final long serialVersionUID = 1;
67
68     private static String JavaDoc[] PERCENTS = {
69         "0%", "5%", "10%", "15%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", // NOI18N
70
"55%", "60%", "65%", "70%", "75%", "80%", "85%", "90%", "95%", "100%" // NOI18N
71
};
72     
73     /**
74      * Parses values with % sign
75      *
76      * @param text text to parse
77      * @return parsed value
78      */

79     private static int parsePercents(String JavaDoc text) throws NumberFormatException JavaDoc {
80         text = text.trim();
81         if (text.endsWith("%")) // NOI18N
82
text = text.substring(0, text.length() - 1);
83         int n = Integer.parseInt(text);
84         if (n < 0 || n > 100)
85             throw new NumberFormatException JavaDoc("Wrong range"); // NOI18N
86
return n;
87     }
88     
89     /**
90      * InputVerifier for the combobox with percents
91      */

92     private static class PercentsInputVerifier extends InputVerifier JavaDoc {
93         public boolean verify(javax.swing.JComponent JavaDoc input) {
94             String JavaDoc p = ((JTextComponent JavaDoc) input).getText();
95             try {
96                 parsePercents(p);
97                 return true;
98             } catch (NumberFormatException JavaDoc e) {
99                 return false;
100             }
101         }
102     }
103     
104     /**
105      * InputVerifier for a JTextField with an integer
106      */

107     private static class IntTextFieldInputVerifier extends InputVerifier JavaDoc {
108         public boolean verify(javax.swing.JComponent JavaDoc input) {
109             String JavaDoc p = ((JTextComponent JavaDoc) input).getText();
110             try {
111                 Integer.parseInt(p);
112                 return true;
113             } catch (NumberFormatException JavaDoc e) {
114                 return false;
115             }
116         }
117     }
118     
119     private static boolean appendDefault = Settings.getDefault().getAppend();
120     
121     private SimpleDateFormat JavaDoc format;
122     private ComboBoxModel JavaDoc prioritiesModel =
123         new DefaultComboBoxModel JavaDoc(new Integer JavaDoc[] {
124             new Integer JavaDoc(UserTask.HIGH),
125             new Integer JavaDoc(UserTask.MEDIUM_HIGH),
126             new Integer JavaDoc(UserTask.MEDIUM),
127             new Integer JavaDoc(UserTask.MEDIUM_LOW),
128             new Integer JavaDoc(UserTask.LOW),
129         });
130     private ListCellRenderer JavaDoc priorityRenderer = new PriorityListCellRenderer();
131     private DependenciesPanel dp;
132     
133     /**
134      * Creates new form.
135      *
136      * @param editing true = no append/prepend options
137      */

138     public EditTaskPanel(boolean editing) {
139         initComponents();
140         initA11y();
141         priorityComboBox.setSelectedIndex(2);
142         
143         format = new SimpleDateFormat JavaDoc();
144         
145         if (editing) {
146             addLabel.setVisible(false);
147             beginningToggle.setVisible(false);
148             endToggle.setVisible(false);
149             jLinkButtonAddToSource.setVisible(false);
150             jCheckBoxTopLevel.setVisible(false);
151         } else {
152             boolean append = appendDefault;
153             if (append) {
154                 endToggle.setSelected(true);
155             } else {
156                 beginningToggle.setSelected(true);
157             }
158         }
159         
160         jComboBoxProgress.setModel(new DefaultComboBoxModel JavaDoc(PERCENTS));
161         ((JComponent JavaDoc) jComboBoxProgress.getEditor().getEditorComponent()).
162             setInputVerifier(new EditTaskPanel.PercentsInputVerifier());
163         
164         dp = new DependenciesPanel();
165         dp.setBorder(new EmptyBorder JavaDoc(11, 11, 12, 12));
166         jPanelDependencies.add(dp, BorderLayout.CENTER);
167         
168         Dimension JavaDoc d = jDateChooserDue.getPreferredSize();
169         d.width = 120;
170         jDateChooserDue.setPreferredSize(d);
171         jDateChooserStart.setPreferredSize(d);
172         
173         d = jComboBoxProgress.getPreferredSize();
174         d.width = 50;
175         jComboBoxProgress.setPreferredSize(d);
176     }
177     
178     public void addNotify() {
179         super.addNotify();
180         descriptionTextField.requestFocus();
181     }
182     
183     /**
184      * Transfers the focus into the summary text field
185      */

186     public void focusSummary() {
187         jTabbedPane.setSelectedIndex(0);
188         descriptionTextField.requestFocus();
189     }
190     
191     /**
192      * Fills the panel with the values of a user task
193      *
194      * @param item a user task
195      */

196     public void fillPanel(UserTask item) {
197         if (item.getSummary() != null) {
198             descriptionTextField.setText(item.getSummary());
199         }
200         priorityComboBox.setSelectedItem(new Integer JavaDoc(item.getPriority()));
201         
202         URL JavaDoc url = item.getUrl();
203         if (url != null) {
204             fileTextField.setText(url.toExternalForm());
205             if (fileTextField.getText().length() > 0)
206                 fileTextField.setCaretPosition(fileTextField.getText().length()-1);
207             fileCheckBox.setSelected(true);
208             lineTextField.setText(Integer.toString(item.getLineNumber() + 1));
209         } else {
210             fileCheckBox.setSelected(false);
211         }
212         detailsTextArea.setText(item.getDetails());
213         setDueDate(item.getDueDate());
214         setStart(item.getStart());
215
216         // Initialize the Categories list
217
String JavaDoc[] categories = item.getList().getCategories();
218         if (categories.length > 0) {
219             DefaultComboBoxModel JavaDoc model = new DefaultComboBoxModel JavaDoc(categories);
220             categoryCombo.setModel(model);
221         }
222         categoryCombo.setSelectedItem(item.getCategory());
223         
224         jComboBoxProgress.setSelectedItem(item.getPercentComplete() + "%"); // NOI18N
225
jCheckBoxCompute.setSelected(item.isValuesComputed());
226         jCheckBoxComputeActionPerformed(null);
227         
228         durationPanelEffort.setDuration(item.getEffort());
229         
230         DateFormat JavaDoc df = DateFormat.getDateTimeInstance(
231             DateFormat.LONG, DateFormat.LONG);
232         jLabelCreated.setText(df.format(new Date JavaDoc(item.getCreatedDate())));
233         jLabelLastEdited.setText(df.format(new Date JavaDoc(item.getLastEditedDate())));
234         
235         durationPanelSpent.setDuration(item.getSpentTime());
236
237         dp.fillPanel(item);
238         
239         String JavaDoc[] owners = item.getList().getOwners();
240         if (owners.length > 0) {
241             DefaultComboBoxModel JavaDoc model = new DefaultComboBoxModel JavaDoc(owners);
242             jComboBoxOwner.setModel(model);
243         }
244         jComboBoxOwner.setSelectedItem(item.getOwner());
245
246         if (item.getCompletedDate() != 0)
247             jLabelCompleted.setText(df.format(new Date JavaDoc(item.getCompletedDate())));
248         else
249             jLabelCompleted.setText(""); // NOI18N
250

251         DurationFormat durf = new DurationFormat(DurationFormat.Type.LONG);
252         DefaultListModel JavaDoc dlm = new DefaultListModel JavaDoc();
253         for (int i = 0; i < item.getWorkPeriods().size(); i++) {
254             UserTask.WorkPeriod wp = (UserTask.WorkPeriod)
255                 item.getWorkPeriods().get(i);
256             dlm.addElement(
257                 df.format(new Date JavaDoc(wp.getStart())) + ", " + // NOI18N
258
durf.format(new Duration(wp.getDuration(),
259                     Settings.getDefault().getMinutesPerDay(),
260                     Settings.getDefault().getDaysPerWeek(), true
261                 ))
262             );
263         }
264         jListWorkPeriods.setModel(dlm);
265         
266         jLabelSpentTimeToday.setText(
267                 durf.format(
268                 new Duration(item.getSpentTimeToday(),
269                 Settings.getDefault().getMinutesPerDay(),
270                 Settings.getDefault().getDaysPerWeek(), true)));
271     }
272     
273     /**
274      * Fills an object with the values from this panel
275      *
276      * @param task a user object
277      */

278     public void fillObject(UserTask task) {
279         task.setSummary(descriptionTextField.getText().trim());
280         task.setDetails(detailsTextArea.getText().trim());
281         if (categoryCombo.getSelectedItem() == null)
282             task.setCategory(""); // NOI18N
283
else
284             task.setCategory(categoryCombo.getSelectedItem().toString().trim());
285         int p = ((Integer JavaDoc) priorityComboBox.getSelectedItem()).intValue();
286         task.setPriority(p);
287         if (fileCheckBox.isSelected()) {
288             try {
289                 URL JavaDoc url = new URL JavaDoc(fileTextField.getText().trim());
290                 task.setUrl(url);
291                 try {
292                     int lineno = Integer.parseInt(lineTextField.getText());
293                     if (lineno > 0)
294                         task.setLineNumber(lineno - 1);
295                     else
296                         ; // TODO: validation
297
} catch (NumberFormatException JavaDoc e) {
298                     // TODO validation
299
UTUtils.LOGGER.log(Level.INFO, "", e);
300                 }
301             } catch (MalformedURLException JavaDoc e) {
302                 // TODO: validation
303
UTUtils.LOGGER.log(Level.INFO, "", e);
304             }
305         } else {
306             task.setLine(null);
307         }
308         
309         task.setDueDate(getDueDate());
310         task.setStart(getStart());
311
312         task.setValuesComputed(jCheckBoxCompute.isSelected());
313         if (!task.isValuesComputed()) {
314             task.setPercentComplete(
315                 parsePercents((String JavaDoc) jComboBoxProgress.getSelectedItem()));
316             task.setEffort(durationPanelEffort.getDuration());
317         }
318
319         boolean valuesComputed = jCheckBoxCompute.isSelected();
320         int spentTime = durationPanelSpent.getDuration();
321         if (spentTime != task.getSpentTime() ||
322             valuesComputed != task.isValuesComputed()) {
323             boolean started = task.isStarted();
324             if (started)
325                 task.stop();
326             task.setValuesComputed(valuesComputed);
327             if (!task.isValuesComputed()) {
328                 task.setSpentTime(spentTime);
329             }
330             if (started && !valuesComputed)
331                 task.start();
332         }
333
334         dp.fillObject();
335         
336         if (jComboBoxOwner.getSelectedItem() == null)
337             task.setOwner(""); // NOI18N
338
else
339             task.setOwner(jComboBoxOwner.getSelectedItem().toString().trim());
340     }
341     
342     /**
343      * Returns the value of the due date
344      *
345      * @return due date
346      */

347     private Date JavaDoc getDueDate() {
348         Date JavaDoc ret = jDateChooserDue.getDate();
349         if (ret != null) {
350             Calendar JavaDoc c = Calendar.getInstance();
351             c.setTime(ret);
352             c.set(Calendar.HOUR_OF_DAY, 0);
353             c.set(Calendar.MINUTE, 0);
354             c.set(Calendar.SECOND, 0);
355             c.set(Calendar.MILLISECOND, 0);
356             ret = c.getTime();
357         }
358         return ret;
359     }
360     
361     /**
362      * Returns the value of the start date
363      *
364      * @return start date
365      */

366     private long getStart() {
367         long ret;
368         if (jDateChooserStart.getDate() != null) {
369             ret = jDateChooserStart.getDate().getTime();
370             Calendar JavaDoc c = Calendar.getInstance();
371             c.setTimeInMillis(ret);
372             c.set(Calendar.HOUR_OF_DAY, 0);
373             c.set(Calendar.MINUTE, 0);
374             c.set(Calendar.SECOND, 0);
375             c.set(Calendar.MILLISECOND, 0);
376             ret = c.getTimeInMillis();
377         } else {
378             ret = -1;
379         }
380         return ret;
381     }
382
383     /**
384      * Returns "append/prepend" option.
385      *
386      * @return true = the task should be appended
387      */

388     public boolean getAppend() {
389         appendDefault = endToggle.isSelected();
390         return appendDefault;
391     }
392     
393     /**
394      * Set the due date field
395      *
396      * @param d the due date
397      */

398     private void setDueDate(Date JavaDoc d) {
399         jDateChooserDue.setDate(d);
400     }
401     
402     /**
403      * Set the start date field
404      *
405      * @param d the date
406      */

407     private void setStart(long d) {
408         if (d != -1) {
409             jDateChooserStart.setDate(new Date JavaDoc(d));
410         } else {
411             jDateChooserStart.setDate(null);
412         }
413     }
414     
415     /**
416      * Changes associated file position in the dialog
417      *
418      * @param n line number
419      */

420     public void setLineNumber(int n) {
421         lineTextField.setText(Integer.toString(n + 1));
422     }
423
424     /**
425      * Sets new URL.
426      *
427      * @param URL an URL or null
428      */

429     public void setUrl(URL JavaDoc url) {
430         if (url != null)
431             fileTextField.setText(url.toExternalForm());
432         else
433             fileTextField.setText(""); // NOI18N
434
}
435     
436     public void setAssociatedFilePos(boolean set) {
437         fileCheckBox.setSelected(set);
438     }
439     
440     /**
441      * Should the task be added at the topmost level
442      *
443      * @return true = yes
444      */

445     public boolean isTopLevel() {
446         return jCheckBoxTopLevel.isSelected();
447     }
448     
449     /**
450      * Sets the flag for "add at the topmost level".
451      *
452      * @param b true = topmost level
453      */

454     public void setTopLevel(boolean b) {
455         jCheckBoxTopLevel.setSelected(b);
456     }
457     
458     /** This method is called from within the constructor to
459      * initialize the form.
460      * WARNING: Do NOT modify this code. The content of this method is
461      * always regenerated by the Form Editor.
462      */

463     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
464
private void initComponents() {
465
466         addButtonGroup = new javax.swing.ButtonGroup JavaDoc();
467         effortButtonGroup = new javax.swing.ButtonGroup JavaDoc();
468         buttonGroupProgress = new javax.swing.ButtonGroup JavaDoc();
469         buttonGroupSpent = new javax.swing.ButtonGroup JavaDoc();
470         jTabbedPane = new javax.swing.JTabbedPane JavaDoc();
471         jPanelGeneral = new javax.swing.JPanel JavaDoc();
472         descLabel = new javax.swing.JLabel JavaDoc();
473         categoryCombo = new javax.swing.JComboBox JavaDoc();
474         detailsScrollPane = new javax.swing.JScrollPane JavaDoc();
475         detailsTextArea = new javax.swing.JTextArea JavaDoc();
476         addLabel = new javax.swing.JLabel JavaDoc();
477         beginningToggle = new javax.swing.JRadioButton JavaDoc();
478         detailsLabel = new javax.swing.JLabel JavaDoc();
479         endToggle = new javax.swing.JRadioButton JavaDoc();
480         descriptionTextField = new javax.swing.JTextField JavaDoc();
481         priorityComboBox = new javax.swing.JComboBox JavaDoc();
482         fileCheckBox = new javax.swing.JCheckBox JavaDoc();
483         categoryLabel = new javax.swing.JLabel JavaDoc();
484         prioLabel = new javax.swing.JLabel JavaDoc();
485         jLabel1 = new javax.swing.JLabel JavaDoc();
486         jComboBoxOwner = new javax.swing.JComboBox JavaDoc();
487         jLinkButtonAddToSource = new org.netbeans.modules.tasklist.usertasks.util.JLinkButton();
488         jCheckBoxTopLevel = new javax.swing.JCheckBox JavaDoc();
489         lineLabel = new javax.swing.JLabel JavaDoc();
490         lineTextField = new javax.swing.JTextField JavaDoc();
491         fileTextField = new javax.swing.JTextField JavaDoc();
492         jPanel3 = new javax.swing.JPanel JavaDoc();
493         jCheckBoxCompute = new javax.swing.JCheckBox JavaDoc();
494         jLabel8 = new javax.swing.JLabel JavaDoc();
495         jLabel9 = new javax.swing.JLabel JavaDoc();
496         durationPanelSpent = new org.netbeans.modules.tasklist.usertasks.DurationPanel();
497         jLabel10 = new javax.swing.JLabel JavaDoc();
498         jComboBoxProgress = new javax.swing.JComboBox JavaDoc();
499         jLabel11 = new javax.swing.JLabel JavaDoc();
500         durationPanelEffort = new org.netbeans.modules.tasklist.usertasks.DurationPanel();
501         jDateChooserDue = new com.toedter.calendar.JDateChooser();
502         jDateChooserStart = new com.toedter.calendar.JDateChooser();
503         jLabel7 = new javax.swing.JLabel JavaDoc();
504         jLabel4 = new javax.swing.JLabel JavaDoc();
505         jPanel4 = new javax.swing.JPanel JavaDoc();
506         jLabel6 = new javax.swing.JLabel JavaDoc();
507         jLabel5 = new javax.swing.JLabel JavaDoc();
508         jLabel2 = new javax.swing.JLabel JavaDoc();
509         jLabelLastEdited = new javax.swing.JLabel JavaDoc();
510         jLabelCompleted = new javax.swing.JLabel JavaDoc();
511         jLabelCreated = new javax.swing.JLabel JavaDoc();
512         jPanelDependencies = new javax.swing.JPanel JavaDoc();
513         jPanel1 = new javax.swing.JPanel JavaDoc();
514         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
515         jListWorkPeriods = new javax.swing.JList JavaDoc();
516         jLabel12 = new javax.swing.JLabel JavaDoc();
517         jLabelSpentTimeToday = new javax.swing.JLabel JavaDoc();
518         jLabel3 = new javax.swing.JLabel JavaDoc();
519
520         setPreferredSize(new java.awt.Dimension JavaDoc(400, 300));
521         setLayout(new java.awt.BorderLayout JavaDoc());
522
523         jPanelGeneral.setBorder(javax.swing.BorderFactory.createEmptyBorder(11, 11, 12, 12));
524
525         descLabel.setLabelFor(descriptionTextField);
526         /*
527         org.openide.awt.Mnemonics.setLocalizedText(descLabel, NbBundle.getMessage(EditTaskPanel.class, "Brief_Description")); // NOI18N); // NOI18N
528     */

529
530     categoryCombo.setEditable(true);
531
532     detailsTextArea.setLineWrap(true);
533     detailsTextArea.setRows(5);
534     detailsTextArea.setWrapStyleWord(true);
535     detailsScrollPane.setViewportView(detailsTextArea);
536
537     org.openide.awt.Mnemonics.setLocalizedText(addLabel, NbBundle.getMessage(EditTaskPanel.class, "AddTo")); // NOI18N(); // NOI18N
538

539     addButtonGroup.add(beginningToggle);
540     /*
541     org.openide.awt.Mnemonics.setLocalizedText(beginningToggle, NbBundle.getMessage(EditTaskPanel.class, "BeginningList")); // NOI18N(); // NOI18N
542     */

543
544     detailsLabel.setLabelFor(detailsTextArea);
545     /*
546     org.openide.awt.Mnemonics.setLocalizedText(detailsLabel, NbBundle.getMessage(EditTaskPanel.class, "DetailsLabel")); // NOI18N); // NOI18N
547     */

548
549     addButtonGroup.add(endToggle);
550     /*
551     org.openide.awt.Mnemonics.setLocalizedText(endToggle, NbBundle.getMessage(EditTaskPanel.class, "EndList")); // NOI18N(); // NOI18N
552     */

553
554     priorityComboBox.setModel(prioritiesModel);
555     priorityComboBox.setRenderer(priorityRenderer);
556     priorityComboBox.addActionListener(new java.awt.event.ActionListener JavaDoc() {
557         public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
558             priorityComboBoxActionPerformed(evt);
559         }
560     });
561
562     /*
563     org.openide.awt.Mnemonics.setLocalizedText(fileCheckBox, NbBundle.getMessage(EditTaskPanel.class, "AssociatedFile")); // NOI18N); // NOI18N
564     */

565     fileCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
566     fileCheckBox.addItemListener(new java.awt.event.ItemListener JavaDoc() {
567         public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
568             fileCheckBoxItemStateChanged(evt);
569         }
570     });
571
572     categoryLabel.setLabelFor(categoryCombo);
573     /*
574     org.openide.awt.Mnemonics.setLocalizedText(categoryLabel, NbBundle.getMessage(EditTaskPanel.class, "CategoryLabel")); // NOI18N); // NOI18N
575     */

576
577     prioLabel.setLabelFor(priorityComboBox);
578     /*
579     org.openide.awt.Mnemonics.setLocalizedText(prioLabel, NbBundle.getMessage(EditTaskPanel.class, "PriorityLabel")); // NOI18N); // NOI18N
580     */

581
582     org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getBundle(EditTaskPanel.class).getString("OwnerLabel")); // NOI18N
583

584     jComboBoxOwner.setEditable(true);
585
586     org.openide.awt.Mnemonics.setLocalizedText(jLinkButtonAddToSource, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "AddToSource")); // NOI18N
587
jLinkButtonAddToSource.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
588     jLinkButtonAddToSource.addActionListener(new java.awt.event.ActionListener JavaDoc() {
589         public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
590             jLinkButtonAddToSourceActionPerformed(evt);
591         }
592     });
593
594     org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxTopLevel, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "TopLevel")); // NOI18N
595
jCheckBoxTopLevel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
596     jCheckBoxTopLevel.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
597
598     lineLabel.setLabelFor(lineTextField);
599     /*
600     org.openide.awt.Mnemonics.setLocalizedText(lineLabel, NbBundle.getMessage(EditTaskPanel.class, "LineLabel")); // NOI18N); // NOI18N
601     */

602
603     lineTextField.setEditable(false);
604     lineTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
605
606     fileTextField.setColumns(100);
607     fileTextField.setEditable(false);
608
609     org.jdesktop.layout.GroupLayout jPanelGeneralLayout = new org.jdesktop.layout.GroupLayout(jPanelGeneral);
610     jPanelGeneral.setLayout(jPanelGeneralLayout);
611     jPanelGeneralLayout.setHorizontalGroup(
612         jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
613         .add(jPanelGeneralLayout.createSequentialGroup()
614             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
615                 .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelGeneralLayout.createSequentialGroup()
616                     .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
617                         .add(jPanelGeneralLayout.createSequentialGroup()
618                             .add(fileCheckBox)
619                             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
620                             .add(fileTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE)
621                             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
622                             .add(lineLabel)
623                             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
624                             .add(lineTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 82, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
625                         .add(jPanelGeneralLayout.createSequentialGroup()
626                             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
627                                 .add(detailsLabel)
628                                 .add(jLabel1)
629                                 .add(descLabel)
630                                 .add(prioLabel)
631                                 .add(categoryLabel))
632                             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
633                             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
634                                 .add(priorityComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 137, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
635                                 .add(categoryCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
636                                 .add(jComboBoxOwner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
637                                 .add(descriptionTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 699, Short.MAX_VALUE)
638                                 .add(detailsScrollPane))))
639                     .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
640                 .add(jPanelGeneralLayout.createSequentialGroup()
641                     .add(addLabel)
642                     .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
643                     .add(beginningToggle)
644                     .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
645                     .add(endToggle)
646                     .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
647                     .add(jCheckBoxTopLevel))
648                 .add(jLinkButtonAddToSource, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
649             .addContainerGap())
650     );
651
652     jPanelGeneralLayout.linkSize(new java.awt.Component JavaDoc[] {categoryCombo, jComboBoxOwner, priorityComboBox}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
653
654     jPanelGeneralLayout.setVerticalGroup(
655         jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
656         .add(jPanelGeneralLayout.createSequentialGroup()
657             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
658                 .add(descLabel)
659                 .add(descriptionTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
660             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
661             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
662                 .add(detailsLabel)
663                 .add(detailsScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE))
664             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
665             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
666                 .add(prioLabel)
667                 .add(priorityComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
668             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
669             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
670                 .add(categoryLabel)
671                 .add(categoryCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
672             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
673             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
674                 .add(jLabel1)
675                 .add(jComboBoxOwner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
676             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
677             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
678                 .add(fileCheckBox)
679                 .add(lineLabel)
680                 .add(lineTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
681                 .add(fileTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
682             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
683             .add(jLinkButtonAddToSource, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
684             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
685             .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
686                 .add(addLabel)
687                 .add(beginningToggle)
688                 .add(endToggle)
689                 .add(jCheckBoxTopLevel)))
690     );
691
692     jTabbedPane.addTab(org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "General"), jPanelGeneral); // NOI18N
693

694     jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 11, 12, 12));
695
696     jCheckBoxCompute.setSelected(true);
697     org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxCompute, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "ComputeAll")); // NOI18N
698
jCheckBoxCompute.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
699     jCheckBoxCompute.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
700     jCheckBoxCompute.addActionListener(new java.awt.event.ActionListener JavaDoc() {
701         public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
702             jCheckBoxComputeActionPerformed(evt);
703         }
704     });
705
706     jLabel8.setLabelFor(jCheckBoxCompute);
707     org.openide.awt.Mnemonics.setLocalizedText(jLabel8, "<html>Effort and spent time will be computed as a sum of the subtask values. Progress will be computed as a weighted sum of the subtask values.</html>");
708
709     jLabel9.setLabelFor(durationPanelEffort);
710     org.openide.awt.Mnemonics.setLocalizedText(jLabel9, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "Effort_")); // NOI18N
711

712     durationPanelSpent.setEnabled(false);
713
714     jLabel10.setLabelFor(durationPanelSpent);
715     org.openide.awt.Mnemonics.setLocalizedText(jLabel10, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "SpentTime_")); // NOI18N
716

717     jComboBoxProgress.setEditable(true);
718     jComboBoxProgress.setEnabled(false);
719     jComboBoxProgress.setInputVerifier(new PercentsInputVerifier());
720
721     jLabel11.setLabelFor(jComboBoxProgress);
722     org.openide.awt.Mnemonics.setLocalizedText(jLabel11, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "Progress_")); // NOI18N
723

724     durationPanelEffort.setEnabled(false);
725
726     jLabel7.setLabelFor(jDateChooserStart);
727     org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "LBL_Start")); // NOI18N
728

729     jLabel4.setLabelFor(jDateChooserDue);
730     org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "DueDateCb")); // NOI18N
731

732     org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "LastEditedLabel")); // NOI18N); // NOI18N
733

734     org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "CreatedLabel")); // NOI18N); // NOI18N
735

736     org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getBundle(EditTaskPanel.class).getString("Completed")); // NOI18N
737

738     org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
739     jPanel4.setLayout(jPanel4Layout);
740     jPanel4Layout.setHorizontalGroup(
741         jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
742         .add(jPanel4Layout.createSequentialGroup()
743             .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
744                 .add(jLabel6)
745                 .add(jLabel2)
746                 .add(jLabel5))
747             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
748             .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
749                 .add(jLabelLastEdited, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
750                 .add(jLabelCompleted, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
751                 .add(jLabelCreated))
752             .addContainerGap())
753     );
754     jPanel4Layout.setVerticalGroup(
755         jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
756         .add(jPanel4Layout.createSequentialGroup()
757             .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
758                 .add(jLabel5)
759                 .add(jLabelCreated))
760             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
761             .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
762                 .add(jLabel6)
763                 .add(jLabelLastEdited))
764             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
765             .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
766                 .add(jLabel2)
767                 .add(jLabelCompleted)))
768     );
769
770     org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
771     jPanel3.setLayout(jPanel3Layout);
772     jPanel3Layout.setHorizontalGroup(
773         jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
774         .add(jLabel8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 772, Short.MAX_VALUE)
775         .add(jPanel3Layout.createSequentialGroup()
776             .addContainerGap()
777             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
778                 .add(jLabel10)
779                 .add(jLabel11)
780                 .add(jLabel9))
781             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
782             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
783                 .add(durationPanelEffort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
784                 .add(durationPanelSpent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
785                 .add(jComboBoxProgress, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
786             .add(350, 350, 350))
787         .add(jPanel3Layout.createSequentialGroup()
788             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
789                 .add(jLabel7)
790                 .add(jLabel4))
791             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
792             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
793                 .add(jDateChooserDue, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
794                 .add(jDateChooserStart, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE))
795             .addContainerGap(580, Short.MAX_VALUE))
796         .add(jPanel3Layout.createSequentialGroup()
797             .add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
798             .addContainerGap())
799         .add(jPanel3Layout.createSequentialGroup()
800             .add(jCheckBoxCompute)
801             .addContainerGap())
802     );
803     jPanel3Layout.setVerticalGroup(
804         jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
805         .add(jPanel3Layout.createSequentialGroup()
806             .addContainerGap()
807             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
808                 .add(jLabel7)
809                 .add(jDateChooserStart, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
810             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
811             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
812                 .add(jLabel4)
813                 .add(jDateChooserDue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
814             .add(20, 20, 20)
815             .add(jCheckBoxCompute)
816             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
817             .add(jLabel8)
818             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
819             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
820                 .add(jLabel9)
821                 .add(durationPanelEffort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
822             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
823             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
824                 .add(jLabel11)
825                 .add(jComboBoxProgress, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
826             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
827             .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
828                 .add(jLabel10)
829                 .add(durationPanelSpent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
830             .add(30, 30, 30)
831             .add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
832             .addContainerGap(187, Short.MAX_VALUE))
833     );
834
835     jTabbedPane.addTab(org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "TimeRelated"), jPanel3); // NOI18N
836

837     jPanelDependencies.setLayout(new java.awt.BorderLayout JavaDoc());
838     jTabbedPane.addTab(org.openide.util.NbBundle.getBundle(EditTaskPanel.class).getString("LBL_DependenciesTab"), jPanelDependencies); // NOI18N
839

840     jScrollPane1.setViewportView(jListWorkPeriods);
841
842     jLabel12.setLabelFor(jListWorkPeriods);
843     org.openide.awt.Mnemonics.setLocalizedText(jLabel12, org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "HistoryOfSpentTimes")); // NOI18N
844

845     jLabel3.setText(org.openide.util.NbBundle.getBundle(EditTaskPanel.class).getString("SpentTimeToday")); // NOI18N
846

847     org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
848     jPanel1.setLayout(jPanel1Layout);
849     jPanel1Layout.setHorizontalGroup(
850         jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
851         .add(jPanel1Layout.createSequentialGroup()
852             .addContainerGap()
853             .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
854                 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 771, Short.MAX_VALUE)
855                 .add(jPanel1Layout.createSequentialGroup()
856                     .add(jLabel3)
857                     .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
858                     .add(jLabelSpentTimeToday, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 656, Short.MAX_VALUE))
859                 .add(jLabel12))
860             .addContainerGap())
861     );
862     jPanel1Layout.setVerticalGroup(
863         jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
864         .add(jPanel1Layout.createSequentialGroup()
865             .addContainerGap()
866             .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
867                 .add(jLabelSpentTimeToday, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE)
868                 .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
869             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
870             .add(jLabel12)
871             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
872             .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE)
873             .addContainerGap())
874     );
875
876     jTabbedPane.addTab(org.openide.util.NbBundle.getMessage(EditTaskPanel.class, "WorkPeriods"), jPanel1); // NOI18N
877

878     add(jTabbedPane, java.awt.BorderLayout.CENTER);
879     }// </editor-fold>//GEN-END:initComponents
880

881     private void jCheckBoxComputeActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jCheckBoxComputeActionPerformed
882
boolean b = jCheckBoxCompute.isSelected();
883         durationPanelEffort.setEnabled(!b);
884         jComboBoxProgress.setEnabled(!b);
885         durationPanelSpent.setEnabled(!b);
886     }//GEN-LAST:event_jCheckBoxComputeActionPerformed
887

888     private void jLinkButtonAddToSourceActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jLinkButtonAddToSourceActionPerformed
889
HelpCtx help = new HelpCtx(
890                 "org.netbeans.modules.tasklist.usertasks.AddTask"); // NOI18N
891

892         Help h = (Help) Lookup.getDefault().lookup(Help.class);
893
894         if (h != null) {
895             h.showHelp(help);
896             return;
897         } else {
898             // Did not work.
899
Toolkit.getDefaultToolkit().beep();
900         }
901     }//GEN-LAST:event_jLinkButtonAddToSourceActionPerformed
902

903     private void priorityComboBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_priorityComboBoxActionPerformed
904
// I don't know why JComboBox does not use my renderer to draw
905
// selected value
906
int sel = priorityComboBox.getSelectedIndex();
907         priorityComboBox.setForeground(PriorityListCellRenderer.COLORS[sel]);
908     }//GEN-LAST:event_priorityComboBoxActionPerformed
909

910     /** Initialize accessibility settings on the panel */
911     private void initA11y() {
912         /*
913           I couldn't figure out how to use Mnemonics.setLocalizedText
914           to set labels and checkboxes with a mnemonic using the
915           form builder, so the closest I got was to use "/*" and "* /
916           as code pre-init/post-init blocks, such that I don't actually
917           execute the bundle lookup code - and then call it explicitly
918           below. (I wanted to keep the text on the components so that
919           I can see them when visually editing the GUI.
920         */

921
922         Mnemonics.setLocalizedText(descLabel, NbBundle.getMessage(
923                  EditTaskPanel.class, "Brief_Description")); // NOI18N
924
Mnemonics.setLocalizedText(detailsLabel, NbBundle.getMessage(
925                     EditTaskPanel.class, "DetailsLabel")); // NOI18N
926
Mnemonics.setLocalizedText(prioLabel, NbBundle.getMessage(
927                  EditTaskPanel.class, "PriorityLabel")); // NOI18N
928
Mnemonics.setLocalizedText(fileCheckBox, NbBundle.getMessage(
929                  EditTaskPanel.class, "AssociatedFile")); // NOI18N
930
Mnemonics.setLocalizedText(categoryLabel, NbBundle.getMessage(
931                      EditTaskPanel.class, "CategoryLabel")); // NOI18N
932
Mnemonics.setLocalizedText(lineLabel, NbBundle.getMessage(
933                  EditTaskPanel.class, "LineLabel")); // NOI18N
934
Mnemonics.setLocalizedText(addLabel, NbBundle.getMessage(
935                 EditTaskPanel.class, "AddTo")); // NOI18N
936
Mnemonics.setLocalizedText(beginningToggle, NbBundle.getMessage(
937                        EditTaskPanel.class, "BeginningList")); // NOI18N
938
Mnemonics.setLocalizedText(endToggle, NbBundle.getMessage(
939                  EditTaskPanel.class, "EndList")); // NOI18N
940
Mnemonics.setLocalizedText(jLinkButtonAddToSource, NbBundle.getMessage(
941                        EditTaskPanel.class, "AddToSource")); // NOI18N
942

943         this.getAccessibleContext().setAccessibleDescription(
944                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_NewTask")); // NOI18N
945
descriptionTextField.getAccessibleContext().setAccessibleDescription(
946                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_Brief_Description")); // NOI18N
947
detailsTextArea.getAccessibleContext().setAccessibleDescription(
948                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_Details")); // NOI18N
949
priorityComboBox.getAccessibleContext().setAccessibleDescription(
950                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_Priority")); // NOI18N
951
categoryCombo.getAccessibleContext().setAccessibleDescription(
952                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_Category")); // NOI18N
953
fileTextField.getAccessibleContext().setAccessibleDescription(
954                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_File")); // NOI18N
955
jDateChooserDue.getAccessibleContext().setAccessibleDescription(
956                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_DueCb")); // NOI18N
957

958         // We're using a checkbox to "label" the textfield - of course JCheckBox
959
// doesn't have a setLabelFor (since it is itself an input component)
960
// so we have to label the associated component ourselves
961
fileTextField.getAccessibleContext().setAccessibleName(fileCheckBox.getText());
962
963         lineTextField.getAccessibleContext().setAccessibleDescription(
964                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_Line")); // NOI18N
965
jDateChooserDue.getAccessibleContext().setAccessibleDescription(
966                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_Due")); // NOI18N
967
fileCheckBox.getAccessibleContext().setAccessibleDescription(
968                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_FileCb")); // NOI18N
969
beginningToggle.getAccessibleContext().setAccessibleDescription(
970                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_Beginning")); // NOI18N
971
endToggle.getAccessibleContext().setAccessibleDescription(
972                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_End")); // NOI18N
973
jLinkButtonAddToSource.getAccessibleContext().setAccessibleDescription(
974                 NbBundle.getMessage(EditTaskPanel.class, "ACSD_AddSource")); // NOI18N
975

976         // Gotta set accessible name - no more that I've set label for?
977
// gotta set accessible description "everywhere" ?
978
}
979
980     private void fileCheckBoxItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_fileCheckBoxItemStateChanged
981
boolean s = fileCheckBox.isSelected();
982         fileTextField.setEditable(s);
983         lineTextField.setEditable(s);
984     }//GEN-LAST:event_fileCheckBoxItemStateChanged
985

986     // <editor-fold defaultstate="collapsed" desc=" Generated Code: Variables declarations ">
987
// Variables declaration - do not modify//GEN-BEGIN:variables
988
private javax.swing.ButtonGroup JavaDoc addButtonGroup;
989     private javax.swing.JLabel JavaDoc addLabel;
990     private javax.swing.JRadioButton JavaDoc beginningToggle;
991     private javax.swing.ButtonGroup JavaDoc buttonGroupProgress;
992     private javax.swing.ButtonGroup JavaDoc buttonGroupSpent;
993     private javax.swing.JComboBox JavaDoc categoryCombo;
994     private javax.swing.JLabel JavaDoc categoryLabel;
995     private javax.swing.JLabel JavaDoc descLabel;
996     private javax.swing.JTextField JavaDoc descriptionTextField;
997     private javax.swing.JLabel JavaDoc detailsLabel;
998     private javax.swing.JScrollPane JavaDoc detailsScrollPane;
999     private javax.swing.JTextArea JavaDoc detailsTextArea;
1000    private org.netbeans.modules.tasklist.usertasks.DurationPanel durationPanelEffort;
1001    private org.netbeans.modules.tasklist.usertasks.DurationPanel durationPanelSpent;
1002    private javax.swing.ButtonGroup JavaDoc effortButtonGroup;
1003    private javax.swing.JRadioButton JavaDoc endToggle;
1004    private javax.swing.JCheckBox JavaDoc fileCheckBox;
1005    private javax.swing.JTextField JavaDoc fileTextField;
1006    private javax.swing.JCheckBox JavaDoc jCheckBoxCompute;
1007    private javax.swing.JCheckBox JavaDoc jCheckBoxTopLevel;
1008    private javax.swing.JComboBox JavaDoc jComboBoxOwner;
1009    private javax.swing.JComboBox JavaDoc jComboBoxProgress;
1010    private com.toedter.calendar.JDateChooser jDateChooserDue;
1011    private com.toedter.calendar.JDateChooser jDateChooserStart;
1012    private javax.swing.JLabel JavaDoc jLabel1;
1013    private javax.swing.JLabel JavaDoc jLabel10;
1014    private javax.swing.JLabel JavaDoc jLabel11;
1015    private javax.swing.JLabel JavaDoc jLabel12;
1016    private javax.swing.JLabel JavaDoc jLabel2;
1017    private javax.swing.JLabel JavaDoc jLabel3;
1018    private javax.swing.JLabel JavaDoc jLabel4;
1019    private javax.swing.JLabel JavaDoc jLabel5;
1020    private javax.swing.JLabel JavaDoc jLabel6;
1021    private javax.swing.JLabel JavaDoc jLabel7;
1022    private javax.swing.JLabel JavaDoc jLabel8;
1023    private javax.swing.JLabel JavaDoc jLabel9;
1024    private javax.swing.JLabel JavaDoc jLabelCompleted;
1025    private javax.swing.JLabel JavaDoc jLabelCreated;
1026    private javax.swing.JLabel JavaDoc jLabelLastEdited;
1027    private javax.swing.JLabel JavaDoc jLabelSpentTimeToday;
1028    private org.netbeans.modules.tasklist.usertasks.util.JLinkButton jLinkButtonAddToSource;
1029    private javax.swing.JList JavaDoc jListWorkPeriods;
1030    private javax.swing.JPanel JavaDoc jPanel1;
1031    private javax.swing.JPanel JavaDoc jPanel3;
1032    private javax.swing.JPanel JavaDoc jPanel4;
1033    private javax.swing.JPanel JavaDoc jPanelDependencies;
1034    private javax.swing.JPanel JavaDoc jPanelGeneral;
1035    private javax.swing.JScrollPane JavaDoc jScrollPane1;
1036    private javax.swing.JTabbedPane JavaDoc jTabbedPane;
1037    private javax.swing.JLabel JavaDoc lineLabel;
1038    private javax.swing.JTextField JavaDoc lineTextField;
1039    private javax.swing.JLabel JavaDoc prioLabel;
1040    private javax.swing.JComboBox JavaDoc priorityComboBox;
1041    // End of variables declaration//GEN-END:variables
1042
// </editor-fold>
1043
}
1044
Popular Tags