X-Git-Url: https://harishankar.org/repos/?p=habeas.git;a=blobdiff_plain;f=src%2Fhabeas%2FManageNoticesDialog.java;h=b1b5c47db8c0a84d1f19558eb99cde2f23ccf503;hp=c23923e8ab22af20530fe0ef15ae95dcfd207662;hb=d70d1fecd85b5f5b7a6eea4ac59fd8926bb5fe8f;hpb=2ec9a68e727e3b67f003b43acd8593660fc90d26 diff --git a/src/habeas/ManageNoticesDialog.java b/src/habeas/ManageNoticesDialog.java index c23923e..b1b5c47 100644 --- a/src/habeas/ManageNoticesDialog.java +++ b/src/habeas/ManageNoticesDialog.java @@ -5,12 +5,11 @@ */ package habeas; +import java.awt.Frame; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.util.ArrayList; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; +import java.util.Date; import javax.swing.table.DefaultTableModel; /** @@ -26,7 +25,6 @@ public class ManageNoticesDialog extends javax.swing.JDialog { super(parent, modal); initComponents(); populateNotices (); - tableNotices.add(popMenu); tableNotices.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { @@ -48,10 +46,22 @@ public class ManageNoticesDialog extends javax.swing.JDialog { private void initComponents() { popMenu = new javax.swing.JPopupMenu(); + menuDescription = new javax.swing.JMenuItem(); menuDraftStatus = new javax.swing.JMenuItem(); + menuDispatchDetails = new javax.swing.JMenuItem(); + menuBillDetails = new javax.swing.JMenuItem(); jScrollPane1 = new javax.swing.JScrollPane(); tableNotices = new javax.swing.JTable(); + menuDescription.setMnemonic('e'); + menuDescription.setText("Description..."); + menuDescription.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + menuDescriptionActionPerformed(evt); + } + }); + popMenu.add(menuDescription); + menuDraftStatus.setMnemonic('D'); menuDraftStatus.setText("Draft Status..."); menuDraftStatus.setToolTipText(""); @@ -62,6 +72,24 @@ public class ManageNoticesDialog extends javax.swing.JDialog { }); popMenu.add(menuDraftStatus); + menuDispatchDetails.setMnemonic('h'); + menuDispatchDetails.setText("Dispatch Details..."); + menuDispatchDetails.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + menuDispatchDetailsActionPerformed(evt); + } + }); + popMenu.add(menuDispatchDetails); + + menuBillDetails.setMnemonic('B'); + menuBillDetails.setText("Bill Details..."); + menuBillDetails.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + menuBillDetailsActionPerformed(evt); + } + }); + popMenu.add(menuBillDetails); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Manage Notices"); setLocationByPlatform(true); @@ -112,10 +140,53 @@ public class ManageNoticesDialog extends javax.swing.JDialog { int selid = getSelectedNotice (); if (selid == -1) return; - System.out.println (selid); + DraftStatusDialog frm = new DraftStatusDialog((Frame) this.getParent(), true); + ArrayList notice = Utility.getNoticeDetails (selid); + if (notice == null) return; + + frm.setFields(selid, (boolean)notice.get(4), (boolean)notice.get(5)); + frm.setVisible(true); }//GEN-LAST:event_menuDraftStatusActionPerformed + private void menuDescriptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDescriptionActionPerformed + // TODO add your handling code here: + int selid = getSelectedNotice(); + if (selid == -1) return; + ArrayList notice = Utility.getNoticeDetails(selid); + if (notice == null) return; + + DescriptionDialog frm = new DescriptionDialog((Frame)this.getParent(), true); + frm.setFields(selid, (String)notice.get(0), (String)notice.get(1), (Date)notice.get(2)); + frm.setVisible(true); + populateNotices(); + }//GEN-LAST:event_menuDescriptionActionPerformed + + private void menuDispatchDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDispatchDetailsActionPerformed + // TODO add your handling code here: + int selid = getSelectedNotice(); + if (selid == -1) return; + ArrayList notice = Utility.getNoticeDetails(selid); + if (notice == null) return; + + DispatchDetailsDialog frm = new DispatchDetailsDialog((Frame) this.getParent(), true); + frm.setFields (selid, (boolean)notice.get(6), (Date)notice.get(7), + (String)notice.get(8), (boolean) notice.get(9),(Date) notice.get(10)); + frm.setVisible(true); + }//GEN-LAST:event_menuDispatchDetailsActionPerformed + + private void menuBillDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuBillDetailsActionPerformed + // TODO add your handling code here: + int selid = getSelectedNotice(); + if (selid == -1) return; + ArrayList notice = Utility.getNoticeDetails(selid); + if (notice == null) return; + + BillDetailsDialog frm = new BillDetailsDialog((Frame) this.getParent(),true); + frm.setFields (selid, (String)notice.get(11), (int)notice.get(12), (Date)notice.get(13)); + frm.setVisible(true); + }//GEN-LAST:event_menuBillDetailsActionPerformed + /** * @param args the command line arguments */ @@ -160,6 +231,9 @@ public class ManageNoticesDialog extends javax.swing.JDialog { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JMenuItem menuBillDetails; + private javax.swing.JMenuItem menuDescription; + private javax.swing.JMenuItem menuDispatchDetails; private javax.swing.JMenuItem menuDraftStatus; private javax.swing.JPopupMenu popMenu; private javax.swing.JTable tableNotices;