070a7f7de9d41d01d457dacd13de00082d8ce298
[habeas.git] / src / habeas / MainFrame.java
1 /*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6 package habeas;
7
8 import java.util.ArrayList;
9 import javax.swing.JOptionPane;
10
11 /**
12 *
13 * @author hari
14 */
15 public class MainFrame extends javax.swing.JFrame {
16
17 /**
18 * Creates new form MainFrame
19 */
20 public MainFrame() {
21 initComponents();
22 }
23
24 /**
25 * This method is called from within the constructor to initialize the form.
26 * WARNING: Do NOT modify this code. The content of this method is always
27 * regenerated by the Form Editor.
28 */
29 @SuppressWarnings("unchecked")
30 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
31 private void initComponents() {
32
33 jMenuBar1 = new javax.swing.JMenuBar();
34 menuMaster = new javax.swing.JMenu();
35 menuClientMaster = new javax.swing.JMenuItem();
36 menuLawyerNotices = new javax.swing.JMenu();
37 menuCreateNotice = new javax.swing.JMenuItem();
38 menuManageNotices = new javax.swing.JMenuItem();
39 jSeparator1 = new javax.swing.JPopupMenu.Separator();
40 menuGenerateRaisedBills = new javax.swing.JMenuItem();
41 menuNoticesReports = new javax.swing.JMenu();
42 menuNoticesToBeDrafted = new javax.swing.JMenuItem();
43 menuNoticesClarificationPending = new javax.swing.JMenuItem();
44 menuNoticeDraftAwaitingApproval = new javax.swing.JMenuItem();
45 menuNoticesSentNotYetDelivered = new javax.swing.JMenuItem();
46 menuAwaitingPayment = new javax.swing.JMenuItem();
47 menuSettings = new javax.swing.JMenu();
48 menuDatabaseSettings = new javax.swing.JMenuItem();
49 menuStationery = new javax.swing.JMenuItem();
50
51 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
52 setTitle("Habeas - Law Office Manager");
53 setLocationByPlatform(true);
54
55 menuMaster.setMnemonic('M');
56 menuMaster.setText("Master");
57
58 menuClientMaster.setMnemonic('c');
59 menuClientMaster.setText("Client Master...");
60 menuClientMaster.addActionListener(new java.awt.event.ActionListener() {
61 public void actionPerformed(java.awt.event.ActionEvent evt) {
62 menuClientMasterActionPerformed(evt);
63 }
64 });
65 menuMaster.add(menuClientMaster);
66
67 jMenuBar1.add(menuMaster);
68
69 menuLawyerNotices.setMnemonic('L');
70 menuLawyerNotices.setText("Lawyer Notices");
71
72 menuCreateNotice.setMnemonic('C');
73 menuCreateNotice.setText("Create New...");
74 menuCreateNotice.addActionListener(new java.awt.event.ActionListener() {
75 public void actionPerformed(java.awt.event.ActionEvent evt) {
76 menuCreateNoticeActionPerformed(evt);
77 }
78 });
79 menuLawyerNotices.add(menuCreateNotice);
80
81 menuManageNotices.setMnemonic('M');
82 menuManageNotices.setText("Manage Notices...");
83 menuManageNotices.addActionListener(new java.awt.event.ActionListener() {
84 public void actionPerformed(java.awt.event.ActionEvent evt) {
85 menuManageNoticesActionPerformed(evt);
86 }
87 });
88 menuLawyerNotices.add(menuManageNotices);
89 menuLawyerNotices.add(jSeparator1);
90
91 menuGenerateRaisedBills.setMnemonic('G');
92 menuGenerateRaisedBills.setText("Generate Raised Bills...");
93 menuGenerateRaisedBills.addActionListener(new java.awt.event.ActionListener() {
94 public void actionPerformed(java.awt.event.ActionEvent evt) {
95 menuGenerateRaisedBillsActionPerformed(evt);
96 }
97 });
98 menuLawyerNotices.add(menuGenerateRaisedBills);
99
100 menuNoticesReports.setMnemonic('r');
101 menuNoticesReports.setText("Reports");
102
103 menuNoticesToBeDrafted.setText("To Be Drafted...");
104 menuNoticesToBeDrafted.addActionListener(new java.awt.event.ActionListener() {
105 public void actionPerformed(java.awt.event.ActionEvent evt) {
106 menuNoticesToBeDraftedActionPerformed(evt);
107 }
108 });
109 menuNoticesReports.add(menuNoticesToBeDrafted);
110
111 menuNoticesClarificationPending.setMnemonic('c');
112 menuNoticesClarificationPending.setText("Clarifications pending...");
113 menuNoticesClarificationPending.addActionListener(new java.awt.event.ActionListener() {
114 public void actionPerformed(java.awt.event.ActionEvent evt) {
115 menuNoticesClarificationPendingActionPerformed(evt);
116 }
117 });
118 menuNoticesReports.add(menuNoticesClarificationPending);
119
120 menuNoticeDraftAwaitingApproval.setMnemonic('d');
121 menuNoticeDraftAwaitingApproval.setText("Drafts to be approved...");
122 menuNoticeDraftAwaitingApproval.addActionListener(new java.awt.event.ActionListener() {
123 public void actionPerformed(java.awt.event.ActionEvent evt) {
124 menuNoticeDraftAwaitingApprovalActionPerformed(evt);
125 }
126 });
127 menuNoticesReports.add(menuNoticeDraftAwaitingApproval);
128
129 menuNoticesSentNotYetDelivered.setMnemonic('s');
130 menuNoticesSentNotYetDelivered.setText("Notices sent not yet delivered...");
131 menuNoticesSentNotYetDelivered.addActionListener(new java.awt.event.ActionListener() {
132 public void actionPerformed(java.awt.event.ActionEvent evt) {
133 menuNoticesSentNotYetDeliveredActionPerformed(evt);
134 }
135 });
136 menuNoticesReports.add(menuNoticesSentNotYetDelivered);
137
138 menuAwaitingPayment.setMnemonic('a');
139 menuAwaitingPayment.setText("Bills awaiting payment...");
140 menuAwaitingPayment.addActionListener(new java.awt.event.ActionListener() {
141 public void actionPerformed(java.awt.event.ActionEvent evt) {
142 menuAwaitingPaymentActionPerformed(evt);
143 }
144 });
145 menuNoticesReports.add(menuAwaitingPayment);
146
147 menuLawyerNotices.add(menuNoticesReports);
148
149 jMenuBar1.add(menuLawyerNotices);
150
151 menuSettings.setMnemonic('S');
152 menuSettings.setText("Settings");
153
154 menuDatabaseSettings.setMnemonic('D');
155 menuDatabaseSettings.setText("Database...");
156 menuDatabaseSettings.addActionListener(new java.awt.event.ActionListener() {
157 public void actionPerformed(java.awt.event.ActionEvent evt) {
158 menuDatabaseSettingsActionPerformed(evt);
159 }
160 });
161 menuSettings.add(menuDatabaseSettings);
162
163 menuStationery.setMnemonic('S');
164 menuStationery.setText("Stationery Settings...");
165 menuStationery.addActionListener(new java.awt.event.ActionListener() {
166 public void actionPerformed(java.awt.event.ActionEvent evt) {
167 menuStationeryActionPerformed(evt);
168 }
169 });
170 menuSettings.add(menuStationery);
171
172 jMenuBar1.add(menuSettings);
173
174 setJMenuBar(jMenuBar1);
175
176 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
177 getContentPane().setLayout(layout);
178 layout.setHorizontalGroup(
179 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
180 .addGap(0, 586, Short.MAX_VALUE)
181 );
182 layout.setVerticalGroup(
183 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
184 .addGap(0, 292, Short.MAX_VALUE)
185 );
186
187 pack();
188 }// </editor-fold>//GEN-END:initComponents
189
190 private void menuDatabaseSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDatabaseSettingsActionPerformed
191 // TODO add your handling code here:
192 DatabaseSettingsDialog frm = new DatabaseSettingsDialog (this, true);
193 frm.setVisible(true);
194 }//GEN-LAST:event_menuDatabaseSettingsActionPerformed
195
196 private void menuClientMasterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuClientMasterActionPerformed
197 // TODO add your handling code here:
198 ClientMasterDialog frm = new ClientMasterDialog (this, true);
199 frm.setVisible(true);
200 }//GEN-LAST:event_menuClientMasterActionPerformed
201
202 private void menuCreateNoticeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCreateNoticeActionPerformed
203 // TODO add your handling code here:
204 CreateNoticeDialog frm = new CreateNoticeDialog(this, true);
205 frm.setVisible(true);
206 }//GEN-LAST:event_menuCreateNoticeActionPerformed
207
208 private void menuManageNoticesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuManageNoticesActionPerformed
209 // TODO add your handling code here:
210 ManageNoticesDialog frm = new ManageNoticesDialog(this, true);
211 frm.setVisible(true);
212 }//GEN-LAST:event_menuManageNoticesActionPerformed
213
214 private void menuStationeryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuStationeryActionPerformed
215 // TODO add your handling code here:
216 StationerySettingsDialog frm = new StationerySettingsDialog(this, true);
217 frm.setVisible(true);
218 }//GEN-LAST:event_menuStationeryActionPerformed
219
220 private void menuGenerateRaisedBillsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuGenerateRaisedBillsActionPerformed
221 // TODO add your handling code here:
222 GenerateRaisedBillsDialog frm = new GenerateRaisedBillsDialog(this, true);
223 frm.setVisible(true);
224
225 }//GEN-LAST:event_menuGenerateRaisedBillsActionPerformed
226
227 private void menuAwaitingPaymentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAwaitingPaymentActionPerformed
228 // TODO add your handling code here:
229 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
230 String [] cols = {"Reference Number", "Description", "Bill Date", "Bill Amount", "Client"};
231 int rep = 0;
232 ArrayList<Object> data = Utility.getReportData(rep, -1);
233 if (data == null) {
234 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
235 return;
236 }
237 frm.setupReportTable(rep, REPORT_TITLE_BILLS_AWAITING_PAYMENT, cols, data);
238 frm.setVisible(true);
239 }//GEN-LAST:event_menuAwaitingPaymentActionPerformed
240
241 private void menuNoticesSentNotYetDeliveredActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticesSentNotYetDeliveredActionPerformed
242 // TODO add your handling code here:
243 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
244 String[] cols = {"Reference Number", "Description", "Sent Date", "RPAD Reference", "Client"};
245 int rep = 1;
246 ArrayList<Object> data = Utility.getReportData (rep, -1);
247 if (data == null) {
248 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
249 return;
250 }
251 frm.setupReportTable(rep, REPORT_TITLE_NOTICES_SENT_NOT_DELIVERED, cols, data);
252 frm.setVisible (true);
253 }//GEN-LAST:event_menuNoticesSentNotYetDeliveredActionPerformed
254
255 private void menuNoticeDraftAwaitingApprovalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticeDraftAwaitingApprovalActionPerformed
256 // TODO add your handling code here:
257 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
258 String cols[] = {"Reference Number", "Description", "Entrustment Date", "Client"};
259 int rep = 2;
260 ArrayList<Object> data = Utility.getReportData(rep, -1);
261 if (data == null) {
262 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
263 return;
264 }
265 frm.setupReportTable(rep, REPORT_TITLE_DRAFTS_AWAITING_APPROVAL, cols, data);
266 frm.setVisible(true);
267 }//GEN-LAST:event_menuNoticeDraftAwaitingApprovalActionPerformed
268
269 private void menuNoticesClarificationPendingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticesClarificationPendingActionPerformed
270 // TODO add your handling code here:
271 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
272 String cols[] = {"Reference Number", "Description", "Entrustment Date",
273 "Clarification Remarks", "Client" };
274 int rep = 3;
275 ArrayList<Object> data = Utility.getReportData(rep, -1);
276 if (data == null) {
277 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
278 return;
279 }
280 frm.setupReportTable(rep, REPORT_TITLE_CLARIFICATIONS_PENDING, cols, data);
281 frm.setVisible(true);
282 }//GEN-LAST:event_menuNoticesClarificationPendingActionPerformed
283
284 private void menuNoticesToBeDraftedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticesToBeDraftedActionPerformed
285 // TODO add your handling code here:
286 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
287 String cols[] = {"Reference Number", "Description", "Entrustment Date",
288 "Clarification Remarks", "Client" };
289 int rep = 4;
290 ArrayList<Object> data = Utility.getReportData(rep, -1);
291 if (data == null) {
292 JOptionPane.showMessageDialog(this , ERROR_DISPLAYING_REPORT);
293 return;
294 }
295 frm.setupReportTable(rep, REPORT_TITLE_TO_BE_DRAFTED, cols, data);
296 frm.setVisible(true);
297
298 }//GEN-LAST:event_menuNoticesToBeDraftedActionPerformed
299 private static final String REPORT_TITLE_TO_BE_DRAFTED = "To Be Drafted";
300 private static final String REPORT_TITLE_CLARIFICATIONS_PENDING = "Clarifications Pending";
301 private static final String REPORT_TITLE_DRAFTS_AWAITING_APPROVAL = "Drafts To Be Approved";
302 public static final String REPORT_TITLE_NOTICES_SENT_NOT_DELIVERED = "Notices Sent Not Yet Delivered";
303 public static final String ERROR_DISPLAYING_REPORT = "Error displaying report";
304 public static final String REPORT_TITLE_BILLS_AWAITING_PAYMENT = "Bills Awaiting Payment";
305
306 /**
307 * @param args the command line arguments
308 */
309 public static void main(String args[]) {
310 /* Set the Nimbus look and feel */
311 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
312 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
313 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
314 */
315 try {
316 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
317 if ("Nimbus".equals(info.getName())) {
318 javax.swing.UIManager.setLookAndFeel(info.getClassName());
319 break;
320 }
321 }
322 } catch (ClassNotFoundException ex) {
323 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
324 } catch (InstantiationException ex) {
325 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
326 } catch (IllegalAccessException ex) {
327 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
328 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
329 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
330 }
331 //</editor-fold>
332
333 /* Create and display the form */
334 java.awt.EventQueue.invokeLater(new Runnable() {
335 public void run() {
336 new MainFrame().setVisible(true);
337 }
338 });
339 }
340
341 // Variables declaration - do not modify//GEN-BEGIN:variables
342 private javax.swing.JMenuBar jMenuBar1;
343 private javax.swing.JPopupMenu.Separator jSeparator1;
344 private javax.swing.JMenuItem menuAwaitingPayment;
345 private javax.swing.JMenuItem menuClientMaster;
346 private javax.swing.JMenuItem menuCreateNotice;
347 private javax.swing.JMenuItem menuDatabaseSettings;
348 private javax.swing.JMenuItem menuGenerateRaisedBills;
349 private javax.swing.JMenu menuLawyerNotices;
350 private javax.swing.JMenuItem menuManageNotices;
351 private javax.swing.JMenu menuMaster;
352 private javax.swing.JMenuItem menuNoticeDraftAwaitingApproval;
353 private javax.swing.JMenuItem menuNoticesClarificationPending;
354 private javax.swing.JMenu menuNoticesReports;
355 private javax.swing.JMenuItem menuNoticesSentNotYetDelivered;
356 private javax.swing.JMenuItem menuNoticesToBeDrafted;
357 private javax.swing.JMenu menuSettings;
358 private javax.swing.JMenuItem menuStationery;
359 // End of variables declaration//GEN-END:variables
360 }