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