Manage Legal Notices - Clarification Details
authorHarishankar <v.harishankar@gmail.com>
Tue, 31 Mar 2020 08:56:50 +0000 (14:26 +0530)
committerHarishankar <v.harishankar@gmail.com>
Tue, 31 Mar 2020 08:56:50 +0000 (14:26 +0530)
Created the screen for updating clarification details.

src/habeas/ClarificationDetailsDialog.form [new file with mode: 0644]
src/habeas/ClarificationDetailsDialog.java [new file with mode: 0644]
src/habeas/ManageNoticesDialog.form
src/habeas/ManageNoticesDialog.java
src/habeas/Utility.java

diff --git a/src/habeas/ClarificationDetailsDialog.form b/src/habeas/ClarificationDetailsDialog.form
new file mode 100644 (file)
index 0000000..51f448d
--- /dev/null
@@ -0,0 +1,110 @@
+<?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="Clarification 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" alignment="0" attributes="0">
+              <EmptySpace max="32767" attributes="0"/>
+              <Group type="103" groupAlignment="1" attributes="0">
+                  <Group type="102" attributes="0">
+                      <Component id="buttonApply" min="-2" pref="106" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="buttonCancel" min="-2" pref="106" max="-2" attributes="0"/>
+                  </Group>
+                  <Group type="103" groupAlignment="0" max="-2" attributes="0">
+                      <Component id="checkClarificationPending" max="32767" attributes="0"/>
+                      <Component id="jLabel1" max="32767" attributes="0"/>
+                      <Component id="jScrollPane1" pref="369" max="32767" attributes="0"/>
+                  </Group>
+              </Group>
+              <EmptySpace pref="21" max="32767" 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="checkClarificationPending" min="-2" max="-2" attributes="0"/>
+              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="jScrollPane1" min="-2" pref="96" max="-2" attributes="0"/>
+              <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="checkClarificationPending">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Clarification Pending"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JLabel" name="jLabel1">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Clarification Remarks"/>
+      </Properties>
+    </Component>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JTextArea" name="textClarificationRemarks">
+          <Properties>
+            <Property name="columns" type="int" value="20"/>
+            <Property name="rows" type="int" value="5"/>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </Container>
+    <Component class="javax.swing.JButton" name="buttonApply">
+      <Properties>
+        <Property name="mnemonic" type="int" value="97"/>
+        <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/ClarificationDetailsDialog.java b/src/habeas/ClarificationDetailsDialog.java
new file mode 100644 (file)
index 0000000..cbb64e1
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * 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 javax.swing.JOptionPane;
+
+/**
+ *
+ * @author hari
+ */
+public class ClarificationDetailsDialog extends javax.swing.JDialog {
+
+    private int selected_id;
+
+    /**
+     * Creates new form ClarificationDetailsDialog
+     */
+    public ClarificationDetailsDialog(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() {
+
+        checkClarificationPending = new javax.swing.JCheckBox();
+        jLabel1 = new javax.swing.JLabel();
+        jScrollPane1 = new javax.swing.JScrollPane();
+        textClarificationRemarks = new javax.swing.JTextArea();
+        buttonApply = new javax.swing.JButton();
+        buttonCancel = new javax.swing.JButton();
+
+        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+        setTitle("Clarification Details");
+        setLocationByPlatform(true);
+
+        checkClarificationPending.setText("Clarification Pending");
+
+        jLabel1.setText("Clarification Remarks");
+
+        textClarificationRemarks.setColumns(20);
+        textClarificationRemarks.setRows(5);
+        jScrollPane1.setViewportView(textClarificationRemarks);
+
+        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(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+                    .addGroup(layout.createSequentialGroup()
+                        .addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+                        .addComponent(checkClarificationPending, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE)))
+                .addContainerGap(21, Short.MAX_VALUE))
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addContainerGap()
+                .addComponent(checkClarificationPending)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                .addComponent(jLabel1)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 96, 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:
+        boolean rt = Utility.updateNoticeClarificationDetails (selected_id,
+                checkClarificationPending.isSelected(), 
+                textClarificationRemarks.getText());
+        if (rt == false) 
+            JOptionPane.showMessageDialog(this, ERROR_UPDATING);
+        else
+            dispose ();
+    }//GEN-LAST:event_buttonApplyActionPerformed
+    private static final String ERROR_UPDATING = "Error in updating";
+
+    /**
+     * @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(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+        } catch (InstantiationException ex) {
+            java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+        } catch (IllegalAccessException ex) {
+            java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+            java.util.logging.Logger.getLogger(ClarificationDetailsDialog.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() {
+                ClarificationDetailsDialog dialog = new ClarificationDetailsDialog(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 checkClarificationPending;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JTextArea textClarificationRemarks;
+    // End of variables declaration//GEN-END:variables
+
+    void setFields(int selid, boolean clarification_pending, String 
+            clarification_remarks) {
+        selected_id = selid;
+        checkClarificationPending.setSelected(clarification_pending);
+        textClarificationRemarks.setText(clarification_remarks);
+    }
+}
index c537409..75f457f 100644 (file)
             <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuBillDetailsActionPerformed"/>
           </Events>
         </MenuItem>
             <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuBillDetailsActionPerformed"/>
           </Events>
         </MenuItem>
+        <MenuItem class="javax.swing.JMenuItem" name="menuClarificationDetails">
+          <Properties>
+            <Property name="mnemonic" type="int" value="114"/>
+            <Property name="text" type="java.lang.String" value="Clarification Details..."/>
+          </Properties>
+          <Events>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuClarificationDetailsActionPerformed"/>
+          </Events>
+        </MenuItem>
       </SubComponents>
     </Container>
   </NonVisualComponents>
       </SubComponents>
     </Container>
   </NonVisualComponents>
index b1b5c47..50928a4 100644 (file)
@@ -50,6 +50,7 @@ public class ManageNoticesDialog extends javax.swing.JDialog {
         menuDraftStatus = new javax.swing.JMenuItem();
         menuDispatchDetails = new javax.swing.JMenuItem();
         menuBillDetails = new javax.swing.JMenuItem();
         menuDraftStatus = new javax.swing.JMenuItem();
         menuDispatchDetails = new javax.swing.JMenuItem();
         menuBillDetails = new javax.swing.JMenuItem();
+        menuClarificationDetails = new javax.swing.JMenuItem();
         jScrollPane1 = new javax.swing.JScrollPane();
         tableNotices = new javax.swing.JTable();
 
         jScrollPane1 = new javax.swing.JScrollPane();
         tableNotices = new javax.swing.JTable();
 
@@ -90,6 +91,15 @@ public class ManageNoticesDialog extends javax.swing.JDialog {
         });
         popMenu.add(menuBillDetails);
 
         });
         popMenu.add(menuBillDetails);
 
+        menuClarificationDetails.setMnemonic('r');
+        menuClarificationDetails.setText("Clarification Details...");
+        menuClarificationDetails.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                menuClarificationDetailsActionPerformed(evt);
+            }
+        });
+        popMenu.add(menuClarificationDetails);
+
         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
         setTitle("Manage Notices");
         setLocationByPlatform(true);
         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
         setTitle("Manage Notices");
         setLocationByPlatform(true);
@@ -187,6 +197,19 @@ public class ManageNoticesDialog extends javax.swing.JDialog {
         frm.setVisible(true);
     }//GEN-LAST:event_menuBillDetailsActionPerformed
 
         frm.setVisible(true);
     }//GEN-LAST:event_menuBillDetailsActionPerformed
 
+    private void menuClarificationDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuClarificationDetailsActionPerformed
+        // TODO add your handling code here:
+        int selid = getSelectedNotice();
+        if (selid == -1) return;
+        ArrayList<Object> notice = Utility.getNoticeDetails(selid);
+        if (notice == null) return;
+        ClarificationDetailsDialog frm = new ClarificationDetailsDialog(
+                (Frame)this.getParent(), true);
+        
+        frm.setFields (selid, (boolean)notice.get(14), (String)notice.get(15));
+        frm.setVisible(true);
+    }//GEN-LAST:event_menuClarificationDetailsActionPerformed
+
     /**
      * @param args the command line arguments
      */
     /**
      * @param args the command line arguments
      */
@@ -232,6 +255,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 menuBillDetails;
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JScrollPane jScrollPane1;
     private javax.swing.JMenuItem menuBillDetails;
+    private javax.swing.JMenuItem menuClarificationDetails;
     private javax.swing.JMenuItem menuDescription;
     private javax.swing.JMenuItem menuDispatchDetails;
     private javax.swing.JMenuItem menuDraftStatus;
     private javax.swing.JMenuItem menuDescription;
     private javax.swing.JMenuItem menuDispatchDetails;
     private javax.swing.JMenuItem menuDraftStatus;
index 6ca96e5..f7fdae7 100644 (file)
@@ -340,6 +340,26 @@ public class Utility {
             return false;
         }
 
             return false;
         }
 
+    }
+
+    static boolean updateNoticeClarificationDetails(int selected_id, boolean 
+            clarification_pending, String clarification_remarks) {
+        try {
+            Connection conn = DriverManager.getConnection(JDBC + connectionURL);
+            PreparedStatement st = conn.prepareStatement ("UPDATE legalnotices"
+                    + " SET ClarificationPending=?, ClarificationRemarks=? "
+                    + "WHERE id=?;");
+            st.setBoolean(1, clarification_pending);
+            st.setString(2, clarification_remarks);
+            st.setInt (3, selected_id);
+            st.execute();
+            conn.close ();
+            return true;
+        } catch (SQLException ex) {
+            Logger.getLogger(Utility.class.getName()).log(Level.SEVERE, null, ex);
+            return false;
+        }
+        
     }
     public Utility () {
         
     }
     public Utility () {