f20df552cfbf187bc5abc950938fbed4ababcc4a
[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 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 jMenuBar1.add(menuLawyerNotices);
98
99 menuSettings.setMnemonic('S');
100 menuSettings.setText("Settings");
101
102 menuDatabaseSettings.setMnemonic('D');
103 menuDatabaseSettings.setText("Database...");
104 menuDatabaseSettings.addActionListener(new java.awt.event.ActionListener() {
105 public void actionPerformed(java.awt.event.ActionEvent evt) {
106 menuDatabaseSettingsActionPerformed(evt);
107 }
108 });
109 menuSettings.add(menuDatabaseSettings);
110
111 menuStationery.setMnemonic('S');
112 menuStationery.setText("Stationery Settings...");
113 menuStationery.addActionListener(new java.awt.event.ActionListener() {
114 public void actionPerformed(java.awt.event.ActionEvent evt) {
115 menuStationeryActionPerformed(evt);
116 }
117 });
118 menuSettings.add(menuStationery);
119
120 jMenuBar1.add(menuSettings);
121
122 setJMenuBar(jMenuBar1);
123
124 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
125 getContentPane().setLayout(layout);
126 layout.setHorizontalGroup(
127 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
128 .addGap(0, 586, Short.MAX_VALUE)
129 );
130 layout.setVerticalGroup(
131 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
132 .addGap(0, 292, Short.MAX_VALUE)
133 );
134
135 pack();
136 }// </editor-fold>//GEN-END:initComponents
137
138 private void menuDatabaseSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDatabaseSettingsActionPerformed
139 // TODO add your handling code here:
140 DatabaseSettingsDialog frm = new DatabaseSettingsDialog (this, true);
141 frm.setVisible(true);
142 }//GEN-LAST:event_menuDatabaseSettingsActionPerformed
143
144 private void menuClientMasterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuClientMasterActionPerformed
145 // TODO add your handling code here:
146 ClientMasterDialog frm = new ClientMasterDialog (this, true);
147 frm.setVisible(true);
148 }//GEN-LAST:event_menuClientMasterActionPerformed
149
150 private void menuCreateNoticeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCreateNoticeActionPerformed
151 // TODO add your handling code here:
152 CreateNoticeDialog frm = new CreateNoticeDialog(this, true);
153 frm.setVisible(true);
154 }//GEN-LAST:event_menuCreateNoticeActionPerformed
155
156 private void menuManageNoticesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuManageNoticesActionPerformed
157 // TODO add your handling code here:
158 ManageNoticesDialog frm = new ManageNoticesDialog(this, true);
159 frm.setVisible(true);
160 }//GEN-LAST:event_menuManageNoticesActionPerformed
161
162 private void menuStationeryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuStationeryActionPerformed
163 // TODO add your handling code here:
164 StationerySettingsDialog frm = new StationerySettingsDialog(this, true);
165 frm.setVisible(true);
166 }//GEN-LAST:event_menuStationeryActionPerformed
167
168 private void menuGenerateRaisedBillsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuGenerateRaisedBillsActionPerformed
169 // TODO add your handling code here:
170 GenerateRaisedBillsDialog frm = new GenerateRaisedBillsDialog(this, true);
171 frm.setVisible(true);
172
173 }//GEN-LAST:event_menuGenerateRaisedBillsActionPerformed
174 private static final String ERROR_RETRIEVING_RAISED_BILLS = "Error retrieving bills"
175 + " or no bills are raised at this time.";
176 private static final String FODT_EXT = "fodt";
177 private static final String FLAT_OPENDOCUMENT_TEXT = "Flat OpenDocument text";
178 private static final String ERROR_GENERATING = "Error generating";
179
180 /**
181 * @param args the command line arguments
182 */
183 public static void main(String args[]) {
184 /* Set the Nimbus look and feel */
185 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
186 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
187 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
188 */
189 try {
190 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
191 if ("Nimbus".equals(info.getName())) {
192 javax.swing.UIManager.setLookAndFeel(info.getClassName());
193 break;
194 }
195 }
196 } catch (ClassNotFoundException ex) {
197 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
198 } catch (InstantiationException ex) {
199 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
200 } catch (IllegalAccessException ex) {
201 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
202 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
203 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
204 }
205 //</editor-fold>
206
207 /* Create and display the form */
208 java.awt.EventQueue.invokeLater(new Runnable() {
209 public void run() {
210 new MainFrame().setVisible(true);
211 }
212 });
213 }
214
215 // Variables declaration - do not modify//GEN-BEGIN:variables
216 private javax.swing.JMenuBar jMenuBar1;
217 private javax.swing.JPopupMenu.Separator jSeparator1;
218 private javax.swing.JMenuItem menuClientMaster;
219 private javax.swing.JMenuItem menuCreateNotice;
220 private javax.swing.JMenuItem menuDatabaseSettings;
221 private javax.swing.JMenuItem menuGenerateRaisedBills;
222 private javax.swing.JMenu menuLawyerNotices;
223 private javax.swing.JMenuItem menuManageNotices;
224 private javax.swing.JMenu menuMaster;
225 private javax.swing.JMenu menuSettings;
226 private javax.swing.JMenuItem menuStationery;
227 // End of variables declaration//GEN-END:variables
228 }