Manage Legal Notices - Dispatch Details
authorHarishankar <v.harishankar@gmail.com>
Mon, 30 Mar 2020 16:57:24 +0000 (22:27 +0530)
committerHarishankar <v.harishankar@gmail.com>
Mon, 30 Mar 2020 16:57:24 +0000 (22:27 +0530)
Created the screen for updating dispatch details

src/habeas/DatabaseSettingsDialog.form
src/habeas/DatabaseSettingsDialog.java
src/habeas/DispatchDetailsDialog.form [new file with mode: 0644]
src/habeas/DispatchDetailsDialog.java [new file with mode: 0644]
src/habeas/DraftStatusDialog.form
src/habeas/DraftStatusDialog.java
src/habeas/Habeas.java
src/habeas/ManageNoticesDialog.form
src/habeas/ManageNoticesDialog.java
src/habeas/Utility.java

index a9ebf5e..cf74391 100644 (file)
@@ -5,7 +5,6 @@
     <Property name="defaultCloseOperation" type="int" value="2"/>
     <Property name="title" type="java.lang.String" value="Connection"/>
     <Property name="locationByPlatform" type="boolean" value="true"/>
-    <Property name="resizable" type="boolean" value="false"/>
   </Properties>
   <SyntheticProperties>
     <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
index 0b7475f..c28c82d 100644 (file)
@@ -40,7 +40,6 @@ public class DatabaseSettingsDialog extends javax.swing.JDialog {
         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
         setTitle("Connection");
         setLocationByPlatform(true);
-        setResizable(false);
 
         jLabel1.setText("Path to Database");
 
diff --git a/src/habeas/DispatchDetailsDialog.form b/src/habeas/DispatchDetailsDialog.form
new file mode 100644 (file)
index 0000000..3f219c3
--- /dev/null
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
+  <Properties>
+    <Property name="defaultCloseOperation" type="int" value="2"/>
+    <Property name="title" type="java.lang.String" value="Dispatch Details"/>
+    <Property name="locationByPlatform" type="boolean" value="true"/>
+  </Properties>
+  <SyntheticProperties>
+    <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+    <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
+  </SyntheticProperties>
+  <AuxValues>
+    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+  </AuxValues>
+
+  <Layout>
+    <DimensionLayout dim="0">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Component id="checkNoticeSent" max="32767" attributes="0"/>
+                  <Component id="checkNoticeDelivered" max="32767" attributes="0"/>
+                  <Group type="102" attributes="0">
+                      <Group type="103" groupAlignment="1" attributes="0">
+                          <Component id="jLabel3" max="32767" attributes="0"/>
+                          <Component id="jLabel2" max="32767" attributes="0"/>
+                          <Component id="jLabel1" pref="137" max="32767" attributes="0"/>
+                      </Group>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="dateSending" pref="330" max="32767" attributes="0"/>
+                          <Component id="textRPADReference" max="32767" attributes="0"/>
+                          <Component id="dateDelivery" max="32767" attributes="0"/>
+                      </Group>
+                  </Group>
+                  <Group type="102" alignment="1" attributes="0">
+                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                      <Component id="buttonApply" min="-2" pref="102" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="buttonCancel" min="-2" pref="102" max="-2" attributes="0"/>
+                  </Group>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="checkNoticeSent" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="dateSending" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="textRPADReference" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+              <Component id="checkNoticeDelivered" min="-2" max="-2" attributes="0"/>
+              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="dateDelivery" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace pref="17" max="32767" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="buttonApply" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="buttonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Component class="javax.swing.JCheckBox" name="checkNoticeSent">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Notice Sent"/>
+      </Properties>
+    </Component>
+    <Component class="org.jdesktop.swingx.JXDatePicker" name="dateSending">
+    </Component>
+    <Component class="javax.swing.JLabel" name="jLabel1">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Date of sending"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JLabel" name="jLabel2">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="RPAD reference"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JTextField" name="textRPADReference">
+    </Component>
+    <Component class="javax.swing.JCheckBox" name="checkNoticeDelivered">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Notice delivered"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JLabel" name="jLabel3">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Date of delivery"/>
+      </Properties>
+    </Component>
+    <Component class="org.jdesktop.swingx.JXDatePicker" name="dateDelivery">
+    </Component>
+    <Component class="javax.swing.JButton" name="buttonApply">
+      <Properties>
+        <Property name="mnemonic" type="int" value="65"/>
+        <Property name="text" type="java.lang.String" value="Apply"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonApplyActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="buttonCancel">
+      <Properties>
+        <Property name="mnemonic" type="int" value="99"/>
+        <Property name="text" type="java.lang.String" value="Cancel"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCancelActionPerformed"/>
+      </Events>
+    </Component>
+  </SubComponents>
+</Form>
diff --git a/src/habeas/DispatchDetailsDialog.java b/src/habeas/DispatchDetailsDialog.java
new file mode 100644 (file)
index 0000000..4cfa913
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package habeas;
+
+import java.util.Date;
+import javax.swing.JOptionPane;
+
+/**
+ *
+ * @author hari
+ */
+public class DispatchDetailsDialog extends javax.swing.JDialog {
+
+    private int selected_id;
+
+    /**
+     * Creates new form DispatchDetailsDialog
+     */
+    public DispatchDetailsDialog(java.awt.Frame parent, boolean modal) {
+        super(parent, modal);
+        initComponents();
+    }
+
+    /**
+     * This method is called from within the constructor to initialize the form.
+     * WARNING: Do NOT modify this code. The content of this method is always
+     * regenerated by the Form Editor.
+     */
+    @SuppressWarnings("unchecked")
+    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+    private void initComponents() {
+
+        checkNoticeSent = new javax.swing.JCheckBox();
+        dateSending = new org.jdesktop.swingx.JXDatePicker();
+        jLabel1 = new javax.swing.JLabel();
+        jLabel2 = new javax.swing.JLabel();
+        textRPADReference = new javax.swing.JTextField();
+        checkNoticeDelivered = new javax.swing.JCheckBox();
+        jLabel3 = new javax.swing.JLabel();
+        dateDelivery = new org.jdesktop.swingx.JXDatePicker();
+        buttonApply = new javax.swing.JButton();
+        buttonCancel = new javax.swing.JButton();
+
+        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+        setTitle("Dispatch Details");
+        setLocationByPlatform(true);
+
+        checkNoticeSent.setText("Notice Sent");
+
+        jLabel1.setText("Date of sending");
+
+        jLabel2.setText("RPAD reference");
+
+        checkNoticeDelivered.setText("Notice delivered");
+
+        jLabel3.setText("Date of delivery");
+
+        buttonApply.setMnemonic('A');
+        buttonApply.setText("Apply");
+        buttonApply.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                buttonApplyActionPerformed(evt);
+            }
+        });
+
+        buttonCancel.setMnemonic('c');
+        buttonCancel.setText("Cancel");
+        buttonCancel.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                buttonCancelActionPerformed(evt);
+            }
+        });
+
+        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+        getContentPane().setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addComponent(checkNoticeSent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                    .addComponent(checkNoticeDelivered, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                    .addGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE))
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addComponent(dateSending, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
+                            .addComponent(textRPADReference)
+                            .addComponent(dateDelivery, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                        .addGap(0, 0, Short.MAX_VALUE)
+                        .addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))
+                .addContainerGap())
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addContainerGap()
+                .addComponent(checkNoticeSent)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(dateSending, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(jLabel1))
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(jLabel2)
+                    .addComponent(textRPADReference, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                .addComponent(checkNoticeDelivered)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(jLabel3)
+                    .addComponent(dateDelivery, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(buttonApply)
+                    .addComponent(buttonCancel))
+                .addContainerGap())
+        );
+
+        pack();
+    }// </editor-fold>//GEN-END:initComponents
+
+    private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
+        // TODO add your handling code here:
+        dispose ();
+    }//GEN-LAST:event_buttonCancelActionPerformed
+
+    private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
+        // TODO add your handling code here:
+        if (checkNoticeSent.isSelected() && 
+                ("".equals(textRPADReference.getText()) || dateSending.getDate() == null)) {
+            JOptionPane.showMessageDialog(this, MANDATORY_FIELDS_MISSING);
+            return;
+        }
+        if (checkNoticeDelivered.isSelected() && dateDelivery.getDate() == null) {
+            JOptionPane.showMessageDialog(this, MANDATORY_FIELDS_MISSING);
+            return;
+        }
+        boolean rt = Utility.updateNoticeDispatchDetails 
+        (selected_id,checkNoticeSent.isSelected(), dateSending.getDate(), 
+                textRPADReference.getText(),
+                checkNoticeDelivered.isSelected(), dateDelivery.getDate());
+        if (rt == false) 
+            JOptionPane.showMessageDialog(this, ERROR_UPDATING);
+        else
+            dispose ();
+    }//GEN-LAST:event_buttonApplyActionPerformed
+    private static final String ERROR_UPDATING = "Error in updating";
+    private static final String MANDATORY_FIELDS_MISSING = "Mandatory fields missing!";
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String args[]) {
+        /* Set the Nimbus look and feel */
+        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
+        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
+         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
+         */
+        try {
+            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
+                if ("Nimbus".equals(info.getName())) {
+                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
+                    break;
+                }
+            }
+        } catch (ClassNotFoundException ex) {
+            java.util.logging.Logger.getLogger(DispatchDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+        } catch (InstantiationException ex) {
+            java.util.logging.Logger.getLogger(DispatchDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+        } catch (IllegalAccessException ex) {
+            java.util.logging.Logger.getLogger(DispatchDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+            java.util.logging.Logger.getLogger(DispatchDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+        }
+        //</editor-fold>
+
+        /* Create and display the dialog */
+        java.awt.EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                DispatchDetailsDialog dialog = new DispatchDetailsDialog(new javax.swing.JFrame(), true);
+                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+                    @Override
+                    public void windowClosing(java.awt.event.WindowEvent e) {
+                        System.exit(0);
+                    }
+                });
+                dialog.setVisible(true);
+            }
+        });
+    }
+
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JButton buttonApply;
+    private javax.swing.JButton buttonCancel;
+    private javax.swing.JCheckBox checkNoticeDelivered;
+    private javax.swing.JCheckBox checkNoticeSent;
+    private org.jdesktop.swingx.JXDatePicker dateDelivery;
+    private org.jdesktop.swingx.JXDatePicker dateSending;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JLabel jLabel2;
+    private javax.swing.JLabel jLabel3;
+    private javax.swing.JTextField textRPADReference;
+    // End of variables declaration//GEN-END:variables
+
+    void setFields(int selid, boolean notice_sent, Date sent_date, 
+            String rpad_reference, boolean notice_delivered, 
+            Date delivery_date) {
+        selected_id = selid;
+        checkNoticeSent.setSelected(notice_sent);
+        dateSending.setDate(sent_date);
+        checkNoticeDelivered.setSelected(notice_delivered);
+        textRPADReference.setText(rpad_reference);
+        dateDelivery.setDate(delivery_date);
+    }
+}
index cd6f65f..2c8baa8 100644 (file)
               </Group>
               <EmptySpace max="32767" attributes="0"/>
           </Group>
-          <Group type="102" alignment="1" attributes="0">
-              <EmptySpace pref="195" max="32767" attributes="0"/>
+          <Group type="102" attributes="0">
+              <EmptySpace pref="183" max="32767" attributes="0"/>
               <Component id="buttonUpdate" min="-2" pref="92" max="-2" attributes="0"/>
               <EmptySpace max="-2" attributes="0"/>
-              <Component id="buttonCancel" min="-2" pref="80" max="-2" attributes="0"/>
+              <Component id="buttonCancel" min="-2" pref="92" max="-2" attributes="0"/>
               <EmptySpace max="-2" attributes="0"/>
           </Group>
       </Group>
index 0322a50..4bf55d9 100644 (file)
@@ -78,11 +78,11 @@ public class DraftStatusDialog extends javax.swing.JDialog {
                     .addComponent(checkDraftCreated, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                     .addComponent(checkDraftApproved, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE))
                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
-            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
-                .addContainerGap(195, Short.MAX_VALUE)
+            .addGroup(layout.createSequentialGroup()
+                .addContainerGap(183, Short.MAX_VALUE)
                 .addComponent(buttonUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addContainerGap())
         );
         layout.setVerticalGroup(
index e6fa843..73efc94 100644 (file)
@@ -24,7 +24,7 @@ public class Habeas {
         Utility.getConnectionURL();
         
         try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
         } catch (ClassNotFoundException ex) {
             Logger.getLogger(Habeas.class.getName()).log(Level.SEVERE, null, ex);
         } catch (InstantiationException ex) {
index 3a5c2f1..db94879 100644 (file)
             <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuDraftStatusActionPerformed"/>
           </Events>
         </MenuItem>
+        <MenuItem class="javax.swing.JMenuItem" name="menuDispatchDetails">
+          <Properties>
+            <Property name="mnemonic" type="int" value="104"/>
+            <Property name="text" type="java.lang.String" value="Dispatch Details..."/>
+          </Properties>
+          <Events>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuDispatchDetailsActionPerformed"/>
+          </Events>
+        </MenuItem>
       </SubComponents>
     </Container>
   </NonVisualComponents>
index 73d73fe..60a9125 100644 (file)
@@ -25,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) {
@@ -49,6 +48,7 @@ public class ManageNoticesDialog extends javax.swing.JDialog {
         popMenu = new javax.swing.JPopupMenu();
         menuDescription = new javax.swing.JMenuItem();
         menuDraftStatus = new javax.swing.JMenuItem();
+        menuDispatchDetails = new javax.swing.JMenuItem();
         jScrollPane1 = new javax.swing.JScrollPane();
         tableNotices = new javax.swing.JTable();
 
@@ -70,6 +70,15 @@ 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);
+
         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
         setTitle("Manage Notices");
         setLocationByPlatform(true);
@@ -133,14 +142,28 @@ public class ManageNoticesDialog extends javax.swing.JDialog {
         // TODO add your handling code here:
         int selid = getSelectedNotice();
         if (selid == -1) return;
-        DescriptionDialog frm = new DescriptionDialog((Frame)this.getParent(), true);
         ArrayList<Object> 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<Object> 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
+
     /**
      * @param args the command line arguments
      */
@@ -186,6 +209,7 @@ public class ManageNoticesDialog extends javax.swing.JDialog {
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JScrollPane jScrollPane1;
     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;
index f36623b..4a4042c 100644 (file)
@@ -240,6 +240,38 @@ public class Utility {
         }
         
     }
+
+    static boolean updateNoticeDispatchDetails(int selid, boolean notice_sent, 
+            java.util.Date sent_date, String rpad_reference, 
+            boolean notice_delivered, java.util.Date delivery_date) {
+        try {
+            Connection conn = DriverManager.getConnection(JDBC + connectionURL);
+            PreparedStatement st = conn.prepareStatement("UPDATE legalnotices"
+                    + " SET NoticeSent=?, SentDate=?, RPADReference=?,"
+                    + " NoticeDelivered=?, DeliveryDate=? WHERE id=?;");
+            
+            st.setBoolean(1, notice_sent);
+            st.setDate(2,  toSqlDate(sent_date));
+            st.setString(3, rpad_reference);
+            st.setBoolean(4, notice_delivered);
+            st.setDate(5, toSqlDate(delivery_date));
+            st.setInt (6, selid);
+            st.execute();
+            conn.close();
+            return true;
+        } catch (SQLException ex) {
+            Logger.getLogger(Utility.class.getName()).log(Level.SEVERE, null, ex);
+            return false;
+        }
+        
+    }
+
+    private static Date toSqlDate(java.util.Date date) {
+            if (date == null)
+                return null;
+            Date sqldate = new Date (date.getTime()/1000);
+            return sqldate;
+    }
     public Utility () {
         
     }