Source Code Cross Referenced for TodoView.java in  » Project-Management » borg » net » sf » borg » ui » calendar » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Project Management » borg » net.sf.borg.ui.calendar 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         This file is part of BORG.
0003:
0004:         BORG is free software; you can redistribute it and/or modify
0005:         it under the terms of the GNU General Public License as published by
0006:         the Free Software Foundation; either version 2 of the License, or
0007:         (at your option) any later version.
0008:
0009:         BORG is distributed in the hope that it will be useful,
0010:         but WITHOUT ANY WARRANTY; without even the implied warranty of
0011:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012:         GNU General Public License for more details.
0013:
0014:         You should have received a copy of the GNU General Public License
0015:         along with BORG; if not, write to the Free Software
0016:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0017:
0018:         Copyright 2003 by Mike Berger
0019:         */
0020:
0021:        package net.sf.borg.ui.calendar;
0022:
0023:        import java.awt.BorderLayout;
0024:        import java.awt.Color;
0025:        import java.awt.Component;
0026:        import java.awt.Dimension;
0027:        import java.awt.FlowLayout;
0028:        import java.awt.Graphics;
0029:        import java.awt.Graphics2D;
0030:        import java.awt.GridBagConstraints;
0031:        import java.awt.GridBagLayout;
0032:        import java.awt.GridLayout;
0033:        import java.awt.Insets;
0034:        import java.awt.event.ActionListener;
0035:        import java.text.DateFormat;
0036:        import java.util.ArrayList;
0037:        import java.util.Calendar;
0038:        import java.util.Collection;
0039:        import java.util.Date;
0040:        import java.util.GregorianCalendar;
0041:        import java.util.Iterator;
0042:        import java.util.List;
0043:        import java.util.Vector;
0044:
0045:        import javax.swing.ButtonGroup;
0046:        import javax.swing.DefaultListSelectionModel;
0047:        import javax.swing.Icon;
0048:        import javax.swing.ImageIcon;
0049:        import javax.swing.JButton;
0050:        import javax.swing.JComboBox;
0051:        import javax.swing.JLabel;
0052:        import javax.swing.JMenu;
0053:        import javax.swing.JMenuBar;
0054:        import javax.swing.JMenuItem;
0055:        import javax.swing.JPanel;
0056:        import javax.swing.JTable;
0057:        import javax.swing.JToggleButton;
0058:        import javax.swing.ListSelectionModel;
0059:        import javax.swing.border.EmptyBorder;
0060:        import javax.swing.event.TableModelEvent;
0061:        import javax.swing.table.DefaultTableCellRenderer;
0062:
0063:        import net.sf.borg.common.Errmsg;
0064:        import net.sf.borg.common.PrefName;
0065:        import net.sf.borg.common.Prefs;
0066:        import net.sf.borg.common.Resource;
0067:        import net.sf.borg.model.AppointmentModel;
0068:        import net.sf.borg.model.CategoryModel;
0069:        import net.sf.borg.model.Repeat;
0070:        import net.sf.borg.model.TaskModel;
0071:        import net.sf.borg.model.beans.Appointment;
0072:        import net.sf.borg.model.beans.Project;
0073:        import net.sf.borg.model.beans.Subtask;
0074:        import net.sf.borg.model.beans.Task;
0075:        import net.sf.borg.ui.CategoryChooser;
0076:        import net.sf.borg.ui.DockableView;
0077:        import net.sf.borg.ui.MultiView;
0078:        import net.sf.borg.ui.ResourceHelper;
0079:        import net.sf.borg.ui.task.TaskView;
0080:        import net.sf.borg.ui.util.PopupMenuHelper;
0081:        import net.sf.borg.ui.util.StripedTable;
0082:        import net.sf.borg.ui.util.TablePrinter;
0083:        import net.sf.borg.ui.util.TableSorter;
0084:
0085:        import com.toedter.calendar.JDateChooser;
0086:
0087:        /**
0088:         * 
0089:         * @author MBERGER
0090:         */
0091:
0092:        // the tdgui displays a list of the current todo items and allows the
0093:        // suer to mark them as done
0094:        public class TodoView extends DockableView implements  Prefs.Listener {
0095:
0096:            static private class ToggleButtonIcon implements  Icon {
0097:                private Color color = Color.BLACK;
0098:
0099:                private final int h = 10;
0100:
0101:                private final int w = 30;
0102:
0103:                public ToggleButtonIcon(Color col) {
0104:                    color = col;
0105:                }
0106:
0107:                public int getIconHeight() {
0108:                    return h;
0109:                }
0110:
0111:                public int getIconWidth() {
0112:                    return w;
0113:                }
0114:
0115:                public void paintIcon(Component c, Graphics g, int x, int y) {
0116:                    Graphics2D g2 = (Graphics2D) g;
0117:                    g2.setColor(Color.BLACK);
0118:                    g2.drawRect(x, y, w, h);
0119:                    g2.setColor(color);
0120:                    g2.fillRect(x, y, w, h);
0121:                }
0122:            }
0123:
0124:            class TodayRenderer extends DefaultTableCellRenderer {
0125:                public Component getTableCellRendererComponent(JTable table,
0126:                        Object value, boolean isSelected, boolean hasFocus,
0127:                        int row, int column) {
0128:
0129:                    super .getTableCellRendererComponent(table, value,
0130:                            isSelected, hasFocus, row, column);
0131:
0132:                    // it works but not consider current locale
0133:                    // SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
0134:                    DateFormat sdf = DateFormat.getDateInstance();
0135:
0136:                    JLabel jl = new JLabel(getText());
0137:                    jl.setOpaque(true);
0138:                    if (isSelected) {
0139:                        jl.setForeground(Color.BLACK);
0140:                        jl.setBackground(Color.ORANGE);
0141:                    } else {
0142:                        String color = table.getModel().getValueAt(row, 3)
0143:                                .toString();
0144:                        if (color.equals("red")) {
0145:                            jl.setForeground(new Color((new Integer(Prefs
0146:                                    .getPref(PrefName.UCS_RED))).intValue()));
0147:                        } else if (color.equals("blue")) {
0148:                            jl.setForeground(new Color((new Integer(Prefs
0149:                                    .getPref(PrefName.UCS_BLUE))).intValue()));
0150:                        } else if (color.equals("green")) {
0151:                            jl.setForeground(new Color((new Integer(Prefs
0152:                                    .getPref(PrefName.UCS_GREEN))).intValue()));
0153:                        } else if (color.equals("black")) {
0154:                            jl.setForeground(new Color((new Integer(Prefs
0155:                                    .getPref(PrefName.UCS_BLACK))).intValue()));
0156:                        } else if (color.equals("white")) {
0157:                            jl.setForeground(new Color((new Integer(Prefs
0158:                                    .getPref(PrefName.UCS_WHITE))).intValue()));
0159:                        } else if (color.equals("navy")) {
0160:                            jl.setForeground(new Color((new Integer(Prefs
0161:                                    .getPref(PrefName.UCS_NAVY))).intValue()));
0162:                        } else if (color.equals("brick")) {
0163:                            jl.setForeground(new Color((new Integer(Prefs
0164:                                    .getPref(PrefName.UCS_BRICK))).intValue()));
0165:                        } else if (color.equals("purple")) {
0166:                            jl
0167:                                    .setForeground(new Color((new Integer(Prefs
0168:                                            .getPref(PrefName.UCS_PURPLE)))
0169:                                            .intValue()));
0170:                        } else if (color.equals("pink") && column > 1) {
0171:                            jl.setForeground(new Color((new Integer(Prefs
0172:                                    .getPref(PrefName.UCS_TODAY))).intValue()));
0173:                        } else {
0174:                            jl.setForeground(Color.BLACK);
0175:                        }
0176:                        // jl.setForeground( Color.BLACK );
0177:                        if (table
0178:                                .getModel()
0179:                                .getValueAt(row, 1)
0180:                                .equals(
0181:                                        Resource
0182:                                                .getResourceString("======_Today_======"))) {
0183:                            // jl.setBackground( new Color(16751001) );
0184:                            jl.setBackground(new Color((new Integer(Prefs
0185:                                    .getPref(PrefName.UCS_TODAY))).intValue()));
0186:                        } else {
0187:                            if (((Date) (table.getModel().getValueAt(row, 0)))
0188:                                    .getTime() > (new Date()).getTime()) {
0189:                                // jl.setBackground( new Color(192,192,192) );
0190:                                jl.setBackground(new Color((new Integer(Prefs
0191:                                        .getPref(PrefName.UCS_DEFAULT)))
0192:                                        .intValue()));
0193:                            } else {
0194:                                // jl.setBackground( new Color(216,216,216) );
0195:                                jl.setBackground(new Color((new Integer(Prefs
0196:                                        .getPref(PrefName.UCS_WEEKDAY)))
0197:                                        .intValue()));
0198:                            }
0199:                            // jl.setBackground( new Color(216,216,216) );
0200:                        }
0201:                    }
0202:                    if (column == 0) {
0203:                        jl.setText(sdf.format(value));
0204:                        // jl.setText( value.toString() );
0205:                    } else if (column == 1) {
0206:                        jl.setToolTipText(jl.getText());
0207:                    }
0208:                    jl.setBorder(new EmptyBorder(2, 2, 2, 2));
0209:                    return jl;
0210:                    // return this;
0211:                }
0212:            }
0213:
0214:            private static TodoView singleton = null;
0215:
0216:            public static TodoView getReference() {
0217:                if (singleton == null || !singleton.isDisplayable())
0218:                    singleton = new TodoView();
0219:                return (singleton);
0220:            }
0221:
0222:            // Variables declaration - do not modify//GEN-BEGIN:variables
0223:            private javax.swing.JButton addtodo;
0224:
0225:            private ActionListener alChangeDate = new java.awt.event.ActionListener() {
0226:                public void actionPerformed(java.awt.event.ActionEvent evt) {
0227:                    AppointmentListView.onChangeDate(TodoView.this ,
0228:                            getSelectedItems(true));
0229:                }
0230:            };
0231:
0232:            private ActionListener alDoneDelete = new java.awt.event.ActionListener() {
0233:                public void actionPerformed(java.awt.event.ActionEvent evt) {
0234:                    onDoneDelete(evt);
0235:                }
0236:            };
0237:
0238:            private ActionListener alDoneNoDelete = new java.awt.event.ActionListener() {
0239:                public void actionPerformed(java.awt.event.ActionEvent evt) {
0240:                    onDoneNoDelete(evt);
0241:                }
0242:            };
0243:
0244:            private ActionListener alMoveToFollowingDay = new java.awt.event.ActionListener() {
0245:                public void actionPerformed(java.awt.event.ActionEvent evt) {
0246:                    AppointmentListView.onMoveToFollowingDay(TodoView.this ,
0247:                            getSelectedItems(true));
0248:                }
0249:            };
0250:
0251:            private JPanel buttonPanel = null;
0252:
0253:            private JComboBox cat_cb;
0254:
0255:            private JMenuItem catmenuitem = null;
0256:
0257:            private JButton doneButton = null;
0258:
0259:            private JButton doneDelButton = null;
0260:
0261:            private javax.swing.JLabel jLabel1;
0262:
0263:            private javax.swing.JLabel jLabel2;
0264:
0265:            private javax.swing.JPanel jPanel1;
0266:
0267:            private javax.swing.JScrollPane jScrollPane1;
0268:
0269:            private JToggleButton jtbBlack;
0270:
0271:            private JToggleButton jtbBlue;
0272:
0273:            private JToggleButton jtbGreen;
0274:
0275:            private JToggleButton jtbRed;
0276:
0277:            private JToggleButton jtbWhite;
0278:
0279:            private javax.swing.JMenuBar menuBar;
0280:
0281:            private javax.swing.JMenuItem printList;
0282:
0283:            private Vector tds_; // list of rows currently displayed in todo list
0284:
0285:            private JDateChooser tododate_cb;
0286:
0287:            private StripedTable todoTable;
0288:
0289:            private javax.swing.JTextField todotext;
0290:
0291:            private TodoView() {
0292:
0293:                super ();
0294:                Prefs.addListener(this );
0295:                addModel(AppointmentModel.getReference());
0296:                addModel(TaskModel.getReference());
0297:
0298:                // init the gui components
0299:                initComponents();
0300:
0301:                // the todos will be displayed in a sorted table with 2 columns -
0302:                // data and todo text
0303:                todoTable.setModel(new TableSorter(new String[] {
0304:                        Resource.getPlainResourceString("Date"),
0305:                        Resource.getPlainResourceString("To_Do"),
0306:                        Resource.getPlainResourceString("Category"),
0307:                        Resource.getPlainResourceString("Color"), "key" },
0308:                        new Class[] { Date.class, java.lang.String.class,
0309:                                java.lang.String.class, java.lang.String.class,
0310:                                java.lang.Integer.class }));
0311:
0312:                todoTable.getColumnModel().getColumn(0).setPreferredWidth(140);
0313:                todoTable.getColumnModel().getColumn(1).setPreferredWidth(400);
0314:                todoTable.getColumnModel().getColumn(2).setPreferredWidth(120);
0315:
0316:                todoTable.setPreferredScrollableViewportSize(new Dimension(660,
0317:                        400));
0318:
0319:                // set more pretty renderer
0320:                if (Prefs.getPref(PrefName.UCS_ONTODO).equals("true")) {
0321:                    todoTable.setDefaultRenderer(Object.class,
0322:                            new TodayRenderer());
0323:                    todoTable.setDefaultRenderer(Date.class,
0324:                            new TodayRenderer());
0325:                }
0326:
0327:                todoTable.removeColumn(todoTable.getColumnModel().getColumn(3));
0328:                todoTable.removeColumn(todoTable.getColumnModel().getColumn(3));
0329:
0330:                refresh();
0331:
0332:            }
0333:
0334:            public PrefName getFrameSizePref() {
0335:                return PrefName.TODOVIEWSIZE;
0336:            }
0337:
0338:            public String getFrameTitle() {
0339:                return Resource.getPlainResourceString("To_Do_List");
0340:            }
0341:
0342:            public JMenuBar getMenuForFrame() {
0343:                JMenuItem exitMenuItem;
0344:                JMenu fileMenu;
0345:                JMenuItem jMenuItem1;
0346:                JMenuItem jMenuItem2;
0347:                JMenuItem jMenuItem3;
0348:                JMenuItem jMenuItem4;
0349:
0350:                menuBar = new JMenuBar();
0351:                fileMenu = new JMenu();
0352:                jMenuItem1 = new JMenuItem();
0353:                jMenuItem2 = new JMenuItem();
0354:                jMenuItem3 = new JMenuItem();
0355:                jMenuItem4 = new JMenuItem();
0356:                printList = new JMenuItem();
0357:                exitMenuItem = new JMenuItem();
0358:
0359:                ResourceHelper.setText(fileMenu, "Action");
0360:                ResourceHelper.setText(jMenuItem1, "Done_(No_Delete)");
0361:
0362:                jMenuItem1.addActionListener(alDoneNoDelete);
0363:
0364:                fileMenu.add(jMenuItem1);
0365:
0366:                ResourceHelper.setText(jMenuItem2, "Done_(Delete)");
0367:
0368:                jMenuItem1.addActionListener(alDoneDelete);
0369:
0370:                fileMenu.add(jMenuItem2);
0371:
0372:                ResourceHelper.setText(jMenuItem3, "Move_To_Following_Day");
0373:
0374:                jMenuItem3.addActionListener(alMoveToFollowingDay);
0375:
0376:                fileMenu.add(jMenuItem3);
0377:
0378:                ResourceHelper.setText(jMenuItem4, "changedate");
0379:
0380:                jMenuItem4.addActionListener(alChangeDate);
0381:
0382:                fileMenu.add(jMenuItem4);
0383:
0384:                ResourceHelper.setText(printList, "Print_List");
0385:                printList
0386:                        .addActionListener(new java.awt.event.ActionListener() {
0387:                            public void actionPerformed(
0388:                                    java.awt.event.ActionEvent evt) {
0389:                                printListActionPerformed(evt);
0390:                            }
0391:                        });
0392:
0393:                fileMenu.add(printList);
0394:
0395:                ResourceHelper.setText(exitMenuItem, "Exit");
0396:                exitMenuItem
0397:                        .addActionListener(new java.awt.event.ActionListener() {
0398:                            public void actionPerformed(
0399:                                    java.awt.event.ActionEvent evt) {
0400:                                exitMenuItemActionPerformed(evt);
0401:                            }
0402:                        });
0403:                fileMenu.add(getCatmenuitem());
0404:                fileMenu.add(exitMenuItem);
0405:                exitMenuItem.setIcon(new ImageIcon(getClass().getResource(
0406:                        "/resource/Stop16.gif")));
0407:                printList.setIcon(new ImageIcon(getClass().getResource(
0408:                        "/resource/Print16.gif")));
0409:                jMenuItem4.setIcon(new ImageIcon(getClass().getResource(
0410:                        "/resource/Edit16.gif")));
0411:                jMenuItem3.setIcon(new ImageIcon(getClass().getResource(
0412:                        "/resource/Forward16.gif")));
0413:                jMenuItem2.setIcon(new ImageIcon(getClass().getResource(
0414:                        "/resource/Delete16.gif")));
0415:                jMenuItem1.setIcon(new ImageIcon(getClass().getResource(
0416:                        "/resource/Properties16.gif")));
0417:
0418:                menuBar.add(fileMenu);
0419:
0420:                return menuBar;
0421:            }
0422:
0423:            public void prefsChanged() {
0424:                refresh();
0425:
0426:            }
0427:
0428:            // refresh the todo list if the data model changes
0429:            public void refresh() {
0430:                AppointmentModel calmod_ = AppointmentModel.getReference();
0431:
0432:                // get the to list from the data model
0433:                tds_ = calmod_.get_todos();
0434:
0435:                // init the table to empty
0436:                TableSorter tm = (TableSorter) todoTable.getModel();
0437:                tm.addMouseListenerToHeaderInTable(todoTable);
0438:                tm.setRowCount(0);
0439:
0440:                // add a tabel row to mark the current date - it will sort
0441:                // to the right spot by date
0442:                GregorianCalendar gc = new GregorianCalendar();
0443:                gc.set(Calendar.HOUR_OF_DAY, 23);
0444:                gc.set(Calendar.MINUTE, 59);
0445:
0446:                Date d = gc.getTime();
0447:
0448:                Object[] tod = new Object[5];
0449:                tod[0] = d;
0450:                tod[1] = Resource.getResourceString("======_Today_======");
0451:                tod[2] = "Today is";
0452:                tod[3] = "pink";
0453:                tod[4] = null;
0454:
0455:                tm.addRow(tod);
0456:                tm.tableChanged(new TableModelEvent(tm));
0457:
0458:                // add the todo appointment rows to the table
0459:                for (int i = 0; i < tds_.size(); i++) {
0460:                    Appointment r = (Appointment) tds_.elementAt(i);
0461:
0462:                    try {
0463:                        // get appt text
0464:                        String tx = r.getText();
0465:
0466:                        // date is the next todo field if present, otherwise
0467:                        // the due date
0468:                        Date nt = r.getNextTodo();
0469:                        if (nt == null) {
0470:                            nt = r.getDate();
0471:                        }
0472:
0473:                        // add the table row
0474:                        Object[] ro = new Object[5];
0475:                        ro[0] = nt;
0476:                        ro[1] = tx;
0477:                        ro[2] = r.getCategory();
0478:                        if (r.getColor() == null)
0479:                            ro[3] = "black";
0480:                        else
0481:                            ro[3] = r.getColor();
0482:
0483:                        ro[4] = new Integer(r.getKey());
0484:                        tm.addRow(ro);
0485:                        tm.tableChanged(new TableModelEvent(tm));
0486:                    } catch (Exception e) {
0487:                        Errmsg.errmsg(e);
0488:                        return;
0489:                    }
0490:
0491:                }
0492:
0493:                // add the tasks to the list
0494:                // add open tasks with due dates are considered as todos
0495:                String show_abb = Prefs.getPref(PrefName.TASK_SHOW_ABBREV);
0496:                if (Prefs.getBoolPref(PrefName.CAL_SHOW_TASKS)) {
0497:
0498:                    try {
0499:                        Collection pjs = TaskModel.getReference().getProjects();
0500:                        Iterator it = pjs.iterator();
0501:                        while (it.hasNext()) {
0502:
0503:                            Project pj = (Project) it.next();
0504:                            if (pj.getDueDate() == null)
0505:                                continue;
0506:                            if (pj.getStatus().equals(
0507:                                    Resource.getPlainResourceString("CLOSED")))
0508:                                continue;
0509:
0510:                            if (!CategoryModel.getReference().isShown(
0511:                                    pj.getCategory()))
0512:                                continue;
0513:
0514:                            // build a string for the table - BT<task number> +
0515:                            // description
0516:                            String abb = "";
0517:
0518:                            if (show_abb.equals("true"))
0519:                                abb = "PR" + pj.getId().toString() + " ";
0520:                            String btstring = abb + pj.getDescription();
0521:
0522:                            Object[] ro = new Object[5];
0523:                            ro[0] = pj.getDueDate();
0524:                            ro[1] = btstring;
0525:                            ro[2] = pj.getCategory();
0526:                            ro[3] = "navy";
0527:                            ro[4] = null;
0528:
0529:                            tm.addRow(ro);
0530:                            tds_.add(pj);
0531:                            tm.tableChanged(new TableModelEvent(tm));
0532:                        }
0533:                    } catch (Exception e) {
0534:                        Errmsg.errmsg(e);
0535:                        return;
0536:                    }
0537:
0538:                    Vector mrs = TaskModel.getReference().get_tasks();
0539:                    for (int i = 0; i < mrs.size(); i++) {
0540:
0541:                        Task mr = (Task) mrs.elementAt(i);
0542:                        if (mr.getDueDate() == null)
0543:                            continue;
0544:
0545:                        try {
0546:
0547:                            // build a string for the table - BT<task number> +
0548:                            // description
0549:                            String abb = "";
0550:
0551:                            if (show_abb.equals("true"))
0552:                                abb = "BT" + mr.getTaskNumber().toString()
0553:                                        + " ";
0554:                            String btstring = abb + mr.getDescription();
0555:
0556:                            Object[] ro = new Object[5];
0557:                            ro[0] = mr.getDueDate();
0558:                            ro[1] = btstring;
0559:                            ro[2] = mr.getCategory();
0560:                            ro[3] = "navy";
0561:                            ro[4] = null;
0562:
0563:                            tm.addRow(ro);
0564:                            tds_.add(mr);
0565:                            tm.tableChanged(new TableModelEvent(tm));
0566:                        } catch (Exception e) {
0567:                            Errmsg.errmsg(e);
0568:                            return;
0569:                        }
0570:
0571:                    }
0572:                }
0573:                if (Prefs.getBoolPref(PrefName.CAL_SHOW_SUBTASKS)) {
0574:                    try {
0575:                        Collection sts = TaskModel.getReference().getSubTasks();
0576:                        Iterator it = sts.iterator();
0577:                        while (it.hasNext()) {
0578:
0579:                            Subtask st = (Subtask) it.next();
0580:
0581:                            if (st.getDueDate() == null)
0582:                                continue;
0583:                            if (st.getCloseDate() != null)
0584:                                continue;
0585:
0586:                            // build a string for the table - BT<task number> +
0587:                            // description
0588:                            String abb = "";
0589:
0590:                            if (show_abb.equals("true"))
0591:                                abb = "ST" + st.getId().toString() + " ";
0592:                            String btstring = abb + st.getDescription();
0593:
0594:                            Object[] ro = new Object[5];
0595:                            ro[0] = st.getDueDate();
0596:                            ro[1] = btstring;
0597:                            ro[2] = "";
0598:                            ro[3] = "navy";
0599:                            ro[4] = null;
0600:
0601:                            tm.addRow(ro);
0602:                            tds_.add(st);
0603:                            tm.tableChanged(new TableModelEvent(tm));
0604:                        }
0605:                    } catch (Exception e) {
0606:                        // Errmsg.errmsg(e);
0607:                        return;
0608:                    }
0609:                }
0610:                // sort the table by date
0611:                tm.sortByColumn(0);
0612:
0613:            }
0614:
0615:            private void addtodoActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_addtodoActionPerformed
0616:
0617:                String tdtext = todotext.getText();
0618:                Calendar c = tododate_cb.getCalendar();
0619:
0620:                if (tdtext.length() == 0 || c == null) {
0621:                    Errmsg
0622:                            .notice(Resource
0623:                                    .getResourceString("todomissingdata"));
0624:                    return;
0625:                }
0626:
0627:                AppointmentModel calmod_ = AppointmentModel.getReference();
0628:                Appointment r = calmod_.newAppt();
0629:
0630:                c.set(Calendar.HOUR, 0);
0631:                c.set(Calendar.MINUTE, 0);
0632:                c.set(Calendar.SECOND, 0);
0633:                c.set(Calendar.AM_PM, Calendar.AM);
0634:                r.setDate(c.getTime());
0635:                r.setText(tdtext);
0636:                r.setTodo(true);
0637:                r.setPrivate(false);
0638:
0639:                if (jtbRed.isSelected())
0640:                    r.setColor("red");
0641:                else if (jtbBlue.isSelected())
0642:                    r.setColor("blue");
0643:                else if (jtbGreen.isSelected())
0644:                    r.setColor("green");
0645:                else if (jtbWhite.isSelected())
0646:                    r.setColor("white");
0647:                else
0648:                    r.setColor("black");
0649:                // r.setColor( "black");
0650:
0651:                r.setFrequency(Repeat.ONCE);
0652:                r.setTimes(new Integer(1));
0653:                r.setRepeatFlag(false);
0654:
0655:                // code taken from AppointmentPanel.java
0656:                String cat = (String) cat_cb.getSelectedItem();
0657:                // System.out.println( cat+"==" );
0658:                if (cat.equals("") || cat.equals(CategoryModel.UNCATEGORIZED)) {
0659:                    r.setCategory(null);
0660:                } else {
0661:                    r.setCategory(cat);
0662:                }
0663:                // r.setCategory("");
0664:
0665:                calmod_.saveAppt(r, true);
0666:
0667:                requestFocus();
0668:
0669:            }// GEN-LAST:event_addtodoActionPerformed
0670:
0671:            private void dtcommon(boolean del) {
0672:
0673:                // figure out which row is selected to be marked as done
0674:
0675:                List items = getSelectedItems(false);
0676:                for (int i = 0; i < items.size(); ++i) {
0677:
0678:                    try {
0679:
0680:                        Object o = items.get(i);
0681:                        if (o instanceof  Appointment) {
0682:                            int key = ((Appointment) o).getKey();
0683:                            AppointmentModel.getReference().do_todo(key, del);
0684:                        } else if (o instanceof  Project) {
0685:                            Project p = (Project) o;
0686:                            TaskModel.getReference().closeProject(
0687:                                    p.getId().intValue());
0688:                        } else if (o instanceof  Task) {
0689:                            Task t = (Task) o;
0690:                            TaskModel.getReference().close(
0691:                                    t.getTaskNumber().intValue());
0692:                        } else if (o instanceof  Subtask) {
0693:                            Subtask s = (Subtask) o;
0694:                            s.setCloseDate(new Date());
0695:                            TaskModel.getReference().saveSubTask(s);
0696:                        }
0697:
0698:                    } catch (Exception e) {
0699:                        Errmsg.errmsg(e);
0700:                    }
0701:                }
0702:            }
0703:
0704:            private void exitMenuItemActionPerformed(
0705:                    java.awt.event.ActionEvent evt) {// GEN-FIRST:event_exitMenuItemActionPerformed
0706:                this .fr_.dispose();
0707:            }// GEN-LAST:event_exitMenuItemActionPerformed
0708:
0709:            private JPanel getButtonPanel() {
0710:                if (buttonPanel == null) {
0711:                    buttonPanel = new JPanel();
0712:                    buttonPanel.add(getDoneButton(), null);
0713:                    buttonPanel.add(getDoneDelButton(), null);
0714:
0715:                }
0716:                return buttonPanel;
0717:            }
0718:
0719:            /**
0720:             * This method initializes catmenuitem
0721:             * 
0722:             * @return javax.swing.JMenuItem
0723:             */
0724:            private JMenuItem getCatmenuitem() {
0725:                if (catmenuitem == null) {
0726:                    catmenuitem = new JMenuItem();
0727:                    catmenuitem.setIcon(new javax.swing.ImageIcon(getClass()
0728:                            .getResource("/resource/Preferences16.gif")));
0729:                    ResourceHelper.setText(catmenuitem, "choosecat");
0730:                    catmenuitem
0731:                            .addActionListener(new java.awt.event.ActionListener() {
0732:                                public void actionPerformed(
0733:                                        java.awt.event.ActionEvent e) {
0734:                                    CategoryChooser.getReference().setVisible(
0735:                                            true);
0736:                                }
0737:                            });
0738:                }
0739:                return catmenuitem;
0740:            }
0741:
0742:            /**
0743:             * This method initializes doneButton
0744:             * 
0745:             * @return javax.swing.JButton
0746:             */
0747:            private JButton getDoneButton() {
0748:                if (doneButton == null) {
0749:                    doneButton = new JButton();
0750:                    ResourceHelper.setText(doneButton, "Done_(No_Delete)");
0751:                    doneButton
0752:                            .addActionListener(new java.awt.event.ActionListener() {
0753:                                public void actionPerformed(
0754:                                        java.awt.event.ActionEvent e) {
0755:                                    dtcommon(false);
0756:                                }
0757:                            });
0758:                    doneButton.setIcon(new ImageIcon(getClass().getResource(
0759:                            "/resource/Properties16.gif")));
0760:                }
0761:                return doneButton;
0762:            }
0763:
0764:            /**
0765:             * This method initializes doneDelButton
0766:             * 
0767:             * @return javax.swing.JButton
0768:             */
0769:            private JButton getDoneDelButton() {
0770:                if (doneDelButton == null) {
0771:                    doneDelButton = new JButton();
0772:                    ResourceHelper.setText(doneDelButton, "Done_(Delete)");
0773:                    doneDelButton
0774:                            .addActionListener(new java.awt.event.ActionListener() {
0775:                                public void actionPerformed(
0776:                                        java.awt.event.ActionEvent e) {
0777:                                    dtcommon(true);
0778:                                }
0779:                            });
0780:                    doneDelButton.setIcon(new ImageIcon(getClass().getResource(
0781:                            "/resource/Delete16.gif")));
0782:                }
0783:                return doneDelButton;
0784:            }
0785:
0786:            // function to mark a todo as done
0787:            private List getSelectedItems(boolean appts_only) {
0788:                List lst = new ArrayList();
0789:                int[] indices = todoTable.getSelectedRows();
0790:                for (int i = 0; i < indices.length; ++i) {
0791:                    int index = indices[i];
0792:                    try {
0793:
0794:                        // need to ask the table for the original (befor sorting) index
0795:                        // of the selected row
0796:                        TableSorter tm = (TableSorter) todoTable.getModel();
0797:                        int k = tm.getMappedIndex(index);
0798:
0799:                        // ignore the "today" row - which was the first in the original
0800:                        // table (index=0)
0801:                        if (k == 0)
0802:                            continue;
0803:
0804:                        Object o = tds_.elementAt(k - 1);
0805:                        if (!appts_only || o instanceof  Appointment)
0806:                            lst.add(o);
0807:                    } catch (Exception e) {
0808:                        Errmsg.errmsg(e);
0809:                    }
0810:                }
0811:
0812:                return lst;
0813:            }
0814:
0815:            /**
0816:             * This method is called from within the constructor to initialize the form.
0817:             * WARNING: Do NOT modify this code. The content of this method is always
0818:             * regenerated by the Form Editor.
0819:             */
0820:            private void initComponents()// GEN-BEGIN:initComponents
0821:            {
0822:                jScrollPane1 = new javax.swing.JScrollPane();
0823:                todoTable = new StripedTable();
0824:                jPanel1 = new javax.swing.JPanel();
0825:                todotext = new javax.swing.JTextField();
0826:
0827:                // place jcalendar here
0828:                tododate_cb = new JDateChooser();
0829:
0830:                addtodo = new javax.swing.JButton();
0831:                GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
0832:                GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
0833:                GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
0834:                GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
0835:                GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
0836:                GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
0837:                jLabel1 = new javax.swing.JLabel();
0838:                jLabel2 = new javax.swing.JLabel();
0839:
0840:                jtbRed = new JToggleButton("", false);
0841:                jtbBlue = new JToggleButton("", false);
0842:                jtbGreen = new JToggleButton("", false);
0843:                jtbBlack = new JToggleButton("", true);
0844:                jtbWhite = new JToggleButton("", false);
0845:
0846:                cat_cb = new JComboBox();
0847:
0848:                try {
0849:
0850:                    Collection acats = CategoryModel.getReference()
0851:                            .getCategories();
0852:                    Iterator ait = acats.iterator();
0853:                    while (ait.hasNext()) {
0854:                        cat_cb.addItem(ait.next());
0855:                    }
0856:                    cat_cb.setSelectedIndex(0);
0857:                } catch (Exception e) {
0858:                    Errmsg.errmsg(e);
0859:                }
0860:
0861:                jScrollPane1.setMinimumSize(new java.awt.Dimension(450, 21));
0862:                todoTable.setBorder(new javax.swing.border.LineBorder(
0863:                        new java.awt.Color(0, 0, 0)));
0864:                // todoTable.setGridColor(java.awt.Color.blue);
0865:                DefaultListSelectionModel mylsmodel = new DefaultListSelectionModel();
0866:                mylsmodel
0867:                        .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
0868:                todoTable.setSelectionModel(mylsmodel);
0869:                todoTable.addMouseListener(new java.awt.event.MouseAdapter() {
0870:                    public void mouseClicked(java.awt.event.MouseEvent evt) {
0871:                        todoTableMouseClicked(evt);
0872:                    }
0873:                });
0874:
0875:                jScrollPane1.setViewportView(todoTable);
0876:
0877:                jPanel1.setLayout(new java.awt.GridBagLayout());
0878:
0879:                jPanel1.setMinimumSize(new java.awt.Dimension(550, 112));
0880:                // jPanel1.setMinimumSize(new java.awt.Dimension(550, 102));
0881:
0882:                jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(
0883:                        null, Resource.getResourceString("todoquickentry"),
0884:                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
0885:                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
0886:                        null));
0887:                addtodo.setIcon(new javax.swing.ImageIcon(getClass()
0888:                        .getResource("/resource/Save16.gif")));
0889:                ResourceHelper.setText(addtodo, "Add");
0890:                addtodo.addActionListener(new java.awt.event.ActionListener() {
0891:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0892:                        addtodoActionPerformed(evt);
0893:                    }
0894:                });
0895:
0896:                ResourceHelper.setText(jLabel1, "To_Do");
0897:                jLabel1.setLabelFor(todotext);
0898:                ResourceHelper.setText(jLabel2, "Date");
0899:                jLabel2.setLabelFor(tododate_cb);
0900:
0901:                // Set up the context menu for the table.
0902:                ActionListener alEdit = new java.awt.event.ActionListener() {
0903:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0904:                        onEditTodo();
0905:                    }
0906:                };
0907:                new PopupMenuHelper(todoTable,
0908:                        new PopupMenuHelper.Entry[] {
0909:                                new PopupMenuHelper.Entry(alDoneDelete,
0910:                                        "Done_(Delete)"),
0911:                                new PopupMenuHelper.Entry(alDoneNoDelete,
0912:                                        "Done_(No_Delete)"),
0913:                                new PopupMenuHelper.Entry(alEdit, "Edit"),
0914:                                new PopupMenuHelper.Entry(alMoveToFollowingDay,
0915:                                        "Move_To_Following_Day"),
0916:                                new PopupMenuHelper.Entry(alChangeDate,
0917:                                        "changedate"), });
0918:
0919:                gridBagConstraints8.gridx = 2;
0920:                gridBagConstraints8.gridy = 2;
0921:                gridBagConstraints8.insets = new java.awt.Insets(4, 4, 4, 4);
0922:                gridBagConstraints9.gridx = 1;
0923:                gridBagConstraints9.gridy = 2;
0924:                gridBagConstraints9.weightx = 0.0D;
0925:                gridBagConstraints9.fill = java.awt.GridBagConstraints.HORIZONTAL;
0926:                gridBagConstraints9.insets = new java.awt.Insets(0, 4, 4, 4);
0927:
0928:                gridBagConstraints11.gridx = 0;
0929:                gridBagConstraints11.gridy = 3;
0930:                gridBagConstraints11.insets = new java.awt.Insets(0, 0, 0, 0);
0931:                gridBagConstraints11.gridwidth = 2;
0932:                gridBagConstraints11.weightx = 1.0D;
0933:
0934:                gridBagConstraints12.gridx = 1;
0935:                gridBagConstraints12.gridy = 1;
0936:                gridBagConstraints12.fill = java.awt.GridBagConstraints.BOTH;
0937:                gridBagConstraints12.weightx = 1.0D;
0938:                gridBagConstraints12.insets = new java.awt.Insets(0, 4, 0, 0);
0939:                gridBagConstraints13.gridx = 0;
0940:                gridBagConstraints13.gridy = 1;
0941:                gridBagConstraints13.insets = new java.awt.Insets(0, 4, 0, 0);
0942:                gridBagConstraints13.fill = java.awt.GridBagConstraints.BOTH;
0943:                gridBagConstraints13.weightx = 1.0D;
0944:                gridBagConstraints14.gridx = 0;
0945:                gridBagConstraints14.gridy = 2;
0946:
0947:                gridBagConstraints14.weightx = 10.0D;
0948:                // gridBagConstraints14.weightx = 0.0D;
0949:
0950:                gridBagConstraints14.fill = java.awt.GridBagConstraints.HORIZONTAL;
0951:                gridBagConstraints14.insets = new java.awt.Insets(0, 4, 4, 4);
0952:                jPanel1.add(addtodo, gridBagConstraints8);
0953:
0954:                // set jtb size, set tuned colors
0955:
0956:                jtbRed.setIcon(new ToggleButtonIcon(new Color((new Integer(
0957:                        Prefs.getPref(PrefName.UCS_RED))).intValue())));
0958:                // jtbRed.setBackground( Color.LIGHT_GRAY );
0959:
0960:                jtbBlue.setIcon(new ToggleButtonIcon(new Color((new Integer(
0961:                        Prefs.getPref(PrefName.UCS_BLUE))).intValue())));
0962:                // jtbBlue.setBackground( Color.LIGHT_GRAY );
0963:
0964:                jtbGreen.setIcon(new ToggleButtonIcon(new Color((new Integer(
0965:                        Prefs.getPref(PrefName.UCS_GREEN))).intValue())));
0966:                // jtbGreen.setBackground( Color.LIGHT_GRAY );
0967:
0968:                jtbBlack.setIcon(new ToggleButtonIcon(new Color((new Integer(
0969:                        Prefs.getPref(PrefName.UCS_BLACK))).intValue())));
0970:                // jtbBlack.setBackground( Color.LIGHT_GRAY );
0971:
0972:                jtbWhite.setIcon(new ToggleButtonIcon(new Color((new Integer(
0973:                        Prefs.getPref(PrefName.UCS_WHITE))).intValue())));
0974:                // jtbWhite.setBackground( Color.LIGHT_GRAY );
0975:
0976:                jtbRed.setMargin(new Insets(0, 0, 0, 0));
0977:                jtbBlue.setMargin(new Insets(0, 0, 0, 0));
0978:                jtbGreen.setMargin(new Insets(0, 0, 0, 0));
0979:                jtbBlack.setMargin(new Insets(0, 0, 0, 0));
0980:                jtbWhite.setMargin(new Insets(0, 0, 0, 0));
0981:                ButtonGroup mutator = new ButtonGroup();
0982:                mutator.add(jtbRed);
0983:                mutator.add(jtbBlue);
0984:                mutator.add(jtbGreen);
0985:                mutator.add(jtbBlack);
0986:                mutator.add(jtbWhite);
0987:                JPanel bjp = new JPanel();
0988:                JPanel bjp0 = new JPanel();
0989:                bjp0.setLayout(new BorderLayout());
0990:                bjp.setLayout(new GridLayout(1, 5));
0991:                bjp.add(jtbRed);
0992:                bjp.add(jtbBlue);
0993:                bjp.add(jtbGreen);
0994:                bjp.add(jtbBlack);
0995:                bjp.add(jtbWhite);
0996:                bjp0.add(bjp, BorderLayout.WEST);
0997:
0998:                JLabel lbl = new JLabel();
0999:                ResourceHelper.setText(lbl, "Category");
1000:                lbl.setLabelFor(cat_cb);
1001:
1002:                JPanel yetAnotherInASeriesOfSeeminglyEndlessPanels = new JPanel();
1003:                yetAnotherInASeriesOfSeeminglyEndlessPanels
1004:                        .setLayout(new FlowLayout(FlowLayout.CENTER));
1005:
1006:                bjp0.add(yetAnotherInASeriesOfSeeminglyEndlessPanels,
1007:                        BorderLayout.CENTER);
1008:                yetAnotherInASeriesOfSeeminglyEndlessPanels.add(lbl);
1009:                yetAnotherInASeriesOfSeeminglyEndlessPanels.add(cat_cb);
1010:
1011:                jPanel1.add(tododate_cb, gridBagConstraints9);
1012:                jPanel1.add(bjp0, gridBagConstraints11);
1013:                jPanel1.add(jLabel2, gridBagConstraints12);
1014:
1015:                jPanel1.add(jLabel1, gridBagConstraints13);
1016:                jPanel1.add(todotext, gridBagConstraints14);
1017:
1018:                GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
1019:                GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
1020:                GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
1021:                setLayout(new GridBagLayout());
1022:                gridBagConstraints1.gridx = 0;
1023:                gridBagConstraints1.gridy = 0;
1024:                gridBagConstraints1.weightx = 1.0;
1025:                gridBagConstraints1.weighty = 1.0;
1026:                gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
1027:                gridBagConstraints1.insets = new java.awt.Insets(4, 4, 4, 4);
1028:                gridBagConstraints1.gridwidth = 1;
1029:                gridBagConstraints2.gridx = 0;
1030:                gridBagConstraints2.gridy = 2;
1031:                gridBagConstraints2.insets = new java.awt.Insets(4, 4, 4, 4);
1032:                gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1033:                gridBagConstraints15.gridx = 0;
1034:                gridBagConstraints15.gridy = 1;
1035:                gridBagConstraints15.fill = java.awt.GridBagConstraints.BOTH;
1036:                add(jScrollPane1, gridBagConstraints1);
1037:                add(jPanel1, gridBagConstraints2);
1038:                add(getButtonPanel(), gridBagConstraints15);
1039:
1040:            }// GEN-END:initComponents
1041:
1042:            private void onDoneDelete(java.awt.event.ActionEvent evt)// GEN-FIRST:event_jMenuItem2ActionPerformed
1043:            {// GEN-HEADEREND:event_jMenuItem2ActionPerformed
1044:                // mark a todo done and delete it
1045:                dtcommon(true);
1046:            }// GEN-LAST:event_jMenuItem2ActionPerformed
1047:
1048:            private void onDoneNoDelete(java.awt.event.ActionEvent evt)// GEN-FIRST:event_jMenuItem1ActionPerformed
1049:            {// GEN-HEADEREND:event_jMenuItem1ActionPerformed
1050:                // make a todo done and do not delete it
1051:                dtcommon(false);
1052:            }// GEN-LAST:event_jMenuItem1ActionPerformed
1053:
1054:            private void onEditTodo() {
1055:                // get task number from column 0 of selected row
1056:                int row = todoTable.getSelectedRow();
1057:                if (row == -1)
1058:                    return;
1059:
1060:                // Ensure only one row is selected.
1061:                todoTable.getSelectionModel().setSelectionInterval(row, row);
1062:                TableSorter tm = (TableSorter) todoTable.getModel();
1063:                int k = tm.getMappedIndex(row);
1064:
1065:                // ignore the "today" row - which was the first in the original table
1066:                // (index=0)
1067:                if (k == 0)
1068:                    return;
1069:
1070:                Object o = tds_.elementAt(k - 1);
1071:                if (o instanceof  Appointment) {
1072:
1073:                    Date d = (Date) tm.getValueAt(row, 0);
1074:                    GregorianCalendar cal = new GregorianCalendar();
1075:                    cal.setTime(d);
1076:
1077:                    // bring up an appt editor window
1078:                    AppointmentListView ag = new AppointmentListView(cal
1079:                            .get(Calendar.YEAR), cal.get(Calendar.MONTH), cal
1080:                            .get(Calendar.DATE));
1081:                    Appointment ap = (Appointment) o;
1082:                    ag.showApp(ap.getKey());
1083:
1084:                    MultiView.getMainView().addView(ag);
1085:
1086:                    // MultiView cv = MultiView.getMainView();
1087:                    // if (cv != null)
1088:                    // cv.goTo(cal);
1089:                } else if (o instanceof  Project) {
1090:                    MultiView cv = MultiView.getMainView();
1091:                    if (cv != null)
1092:                        cv.showTasksForProject((Project) o);
1093:                } else if (o instanceof  Task) {
1094:                    try {
1095:                        TaskView tskg = new TaskView((Task) o,
1096:                                TaskView.T_CHANGE, null);
1097:                        tskg.setVisible(true);
1098:                    } catch (Exception e) {
1099:                        Errmsg.errmsg(e);
1100:                        return;
1101:                    }
1102:                } else if (o instanceof  Subtask) {
1103:                    int taskid = ((Subtask) o).getTask().intValue();
1104:                    Task t;
1105:                    try {
1106:                        t = TaskModel.getReference().getTask(taskid);
1107:                        TaskView tskg = new TaskView(t, TaskView.T_CHANGE, null);
1108:                        tskg.setVisible(true);
1109:                    } catch (Exception e) {
1110:                        Errmsg.errmsg(e);
1111:                        return;
1112:                    }
1113:
1114:                }
1115:            }
1116:
1117:            public void print() throws Exception {
1118:                TablePrinter.printTable(todoTable);
1119:            }
1120:
1121:            private void printListActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_printListActionPerformed
1122:
1123:                // user has requested a print of the table
1124:                try {
1125:                    TablePrinter.printTable(todoTable);
1126:                } catch (Exception e) {
1127:                    Errmsg.errmsg(e);
1128:                }
1129:            }// GEN-LAST:event_printListActionPerformed
1130:
1131:            private void todoTableMouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_todoTableMouseClicked
1132:                // ask controller to bring up appt editor on double click
1133:                if (evt.getClickCount() < 2)
1134:                    return;
1135:                onEditTodo();
1136:            }// GEN-LAST:event_todoTableMouseClicked
1137:        } // @jve:decl-index=0:visual-constraint="39,18"
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.