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