4c7d97b87c9d4adccae6cacc96ae78991ffd0335
[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.JFileChooser;
10 import javax.swing.JOptionPane;
11 import javax.swing.filechooser.FileFilter;
12 import javax.swing.filechooser.FileNameExtensionFilter;
13
14 /**
15 *
16 * @author hari
17 */
18 public class MainFrame extends javax.swing.JFrame {
19
20 /**
21 * Creates new form MainFrame
22 */
23 public MainFrame() {
24 initComponents();
25 }
26
27 /**
28 * This method is called from within the constructor to initialize the form.
29 * WARNING: Do NOT modify this code. The content of this method is always
30 * regenerated by the Form Editor.
31 */
32 @SuppressWarnings("unchecked")
33 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
34 private void initComponents() {
35
36 jMenuBar1 = new javax.swing.JMenuBar();
37 menuMaster = new javax.swing.JMenu();
38 menuClientMaster = new javax.swing.JMenuItem();
39 menuLawyerNotices = new javax.swing.JMenu();
40 menuCreateNotice = new javax.swing.JMenuItem();
41 menuManageNotices = new javax.swing.JMenuItem();
42 jSeparator1 = new javax.swing.JPopupMenu.Separator();
43 menuGenerateRaisedBills = new javax.swing.JMenuItem();
44 menuNoticesReports = new javax.swing.JMenu();
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 menuAwaitingPayment.setMnemonic('a');
103 menuAwaitingPayment.setText("Bills awaiting payment...");
104 menuAwaitingPayment.addActionListener(new java.awt.event.ActionListener() {
105 public void actionPerformed(java.awt.event.ActionEvent evt) {
106 menuAwaitingPaymentActionPerformed(evt);
107 }
108 });
109 menuNoticesReports.add(menuAwaitingPayment);
110
111 menuLawyerNotices.add(menuNoticesReports);
112
113 jMenuBar1.add(menuLawyerNotices);
114
115 menuSettings.setMnemonic('S');
116 menuSettings.setText("Settings");
117
118 menuDatabaseSettings.setMnemonic('D');
119 menuDatabaseSettings.setText("Database...");
120 menuDatabaseSettings.addActionListener(new java.awt.event.ActionListener() {
121 public void actionPerformed(java.awt.event.ActionEvent evt) {
122 menuDatabaseSettingsActionPerformed(evt);
123 }
124 });
125 menuSettings.add(menuDatabaseSettings);
126
127 menuStationery.setMnemonic('S');
128 menuStationery.setText("Stationery Settings...");
129 menuStationery.addActionListener(new java.awt.event.ActionListener() {
130 public void actionPerformed(java.awt.event.ActionEvent evt) {
131 menuStationeryActionPerformed(evt);
132 }
133 });
134 menuSettings.add(menuStationery);
135
136 jMenuBar1.add(menuSettings);
137
138 setJMenuBar(jMenuBar1);
139
140 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
141 getContentPane().setLayout(layout);
142 layout.setHorizontalGroup(
143 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
144 .addGap(0, 586, Short.MAX_VALUE)
145 );
146 layout.setVerticalGroup(
147 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
148 .addGap(0, 292, Short.MAX_VALUE)
149 );
150
151 pack();
152 }// </editor-fold>//GEN-END:initComponents
153
154 private void menuDatabaseSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDatabaseSettingsActionPerformed
155 // TODO add your handling code here:
156 DatabaseSettingsDialog frm = new DatabaseSettingsDialog (this, true);
157 frm.setVisible(true);
158 }//GEN-LAST:event_menuDatabaseSettingsActionPerformed
159
160 private void menuClientMasterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuClientMasterActionPerformed
161 // TODO add your handling code here:
162 ClientMasterDialog frm = new ClientMasterDialog (this, true);
163 frm.setVisible(true);
164 }//GEN-LAST:event_menuClientMasterActionPerformed
165
166 private void menuCreateNoticeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCreateNoticeActionPerformed
167 // TODO add your handling code here:
168 CreateNoticeDialog frm = new CreateNoticeDialog(this, true);
169 frm.setVisible(true);
170 }//GEN-LAST:event_menuCreateNoticeActionPerformed
171
172 private void menuManageNoticesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuManageNoticesActionPerformed
173 // TODO add your handling code here:
174 ManageNoticesDialog frm = new ManageNoticesDialog(this, true);
175 frm.setVisible(true);
176 }//GEN-LAST:event_menuManageNoticesActionPerformed
177
178 private void menuStationeryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuStationeryActionPerformed
179 // TODO add your handling code here:
180 StationerySettingsDialog frm = new StationerySettingsDialog(this, true);
181 frm.setVisible(true);
182 }//GEN-LAST:event_menuStationeryActionPerformed
183
184 private void menuGenerateRaisedBillsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuGenerateRaisedBillsActionPerformed
185 // TODO add your handling code here:
186 GenerateRaisedBillsDialog frm = new GenerateRaisedBillsDialog(this, true);
187 frm.setVisible(true);
188
189 }//GEN-LAST:event_menuGenerateRaisedBillsActionPerformed
190
191 private void menuAwaitingPaymentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAwaitingPaymentActionPerformed
192 // TODO add your handling code here:
193 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
194 String [] cols = {"Reference Number", "Description", "Bill Date", "Bill Amount", "Client"};
195 ArrayList<Object> data = Utility.getPendingPaymentBills ();
196 if (data == null) {
197 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
198 return;
199 }
200 frm.setupReportTable(REPORT_TITLE_BILLS_AWAITING_PAYMENT, cols, data);
201 frm.setVisible(true);
202 }//GEN-LAST:event_menuAwaitingPaymentActionPerformed
203 private static final String ERROR_DISPLAYING_REPORT = "Error displaying report";
204 private static final String REPORT_TITLE_BILLS_AWAITING_PAYMENT = "Bills Awaiting Payment";
205
206 /**
207 * @param args the command line arguments
208 */
209 public static void main(String args[]) {
210 /* Set the Nimbus look and feel */
211 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
212 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
213 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
214 */
215 try {
216 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
217 if ("Nimbus".equals(info.getName())) {
218 javax.swing.UIManager.setLookAndFeel(info.getClassName());
219 break;
220 }
221 }
222 } catch (ClassNotFoundException ex) {
223 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
224 } catch (InstantiationException ex) {
225 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
226 } catch (IllegalAccessException ex) {
227 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
228 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
229 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
230 }
231 //</editor-fold>
232
233 /* Create and display the form */
234 java.awt.EventQueue.invokeLater(new Runnable() {
235 public void run() {
236 new MainFrame().setVisible(true);
237 }
238 });
239 }
240
241 // Variables declaration - do not modify//GEN-BEGIN:variables
242 private javax.swing.JMenuBar jMenuBar1;
243 private javax.swing.JPopupMenu.Separator jSeparator1;
244 private javax.swing.JMenuItem menuAwaitingPayment;
245 private javax.swing.JMenuItem menuClientMaster;
246 private javax.swing.JMenuItem menuCreateNotice;
247 private javax.swing.JMenuItem menuDatabaseSettings;
248 private javax.swing.JMenuItem menuGenerateRaisedBills;
249 private javax.swing.JMenu menuLawyerNotices;
250 private javax.swing.JMenuItem menuManageNotices;
251 private javax.swing.JMenu menuMaster;
252 private javax.swing.JMenu menuNoticesReports;
253 private javax.swing.JMenu menuSettings;
254 private javax.swing.JMenuItem menuStationery;
255 // End of variables declaration//GEN-END:variables
256 }