Manage Legal Notices - Delete
[habeas.git] / src / habeas / ClarificationDetailsDialog.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 javax.swing.JOptionPane;
9
10 /**
11 *
12 * @author hari
13 */
14 public class ClarificationDetailsDialog extends javax.swing.JDialog {
15
16 private int selected_id;
17
18 /**
19 * Creates new form ClarificationDetailsDialog
20 */
21 public ClarificationDetailsDialog(java.awt.Frame parent, boolean modal) {
22 super(parent, modal);
23 initComponents();
24 }
25
26 /**
27 * This method is called from within the constructor to initialize the form.
28 * WARNING: Do NOT modify this code. The content of this method is always
29 * regenerated by the Form Editor.
30 */
31 @SuppressWarnings("unchecked")
32 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
33 private void initComponents() {
34
35 checkClarificationPending = new javax.swing.JCheckBox();
36 jLabel1 = new javax.swing.JLabel();
37 jScrollPane1 = new javax.swing.JScrollPane();
38 textClarificationRemarks = new javax.swing.JTextArea();
39 buttonApply = new javax.swing.JButton();
40 buttonCancel = new javax.swing.JButton();
41
42 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
43 setTitle("Clarification Details");
44 setLocationByPlatform(true);
45
46 checkClarificationPending.setText("Clarification Pending");
47
48 jLabel1.setText("Clarification Remarks");
49
50 textClarificationRemarks.setColumns(20);
51 textClarificationRemarks.setRows(5);
52 jScrollPane1.setViewportView(textClarificationRemarks);
53
54 buttonApply.setMnemonic('a');
55 buttonApply.setText("Apply");
56 buttonApply.addActionListener(new java.awt.event.ActionListener() {
57 public void actionPerformed(java.awt.event.ActionEvent evt) {
58 buttonApplyActionPerformed(evt);
59 }
60 });
61
62 buttonCancel.setMnemonic('c');
63 buttonCancel.setText("Cancel");
64 buttonCancel.addActionListener(new java.awt.event.ActionListener() {
65 public void actionPerformed(java.awt.event.ActionEvent evt) {
66 buttonCancelActionPerformed(evt);
67 }
68 });
69
70 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
71 getContentPane().setLayout(layout);
72 layout.setHorizontalGroup(
73 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
74 .addGroup(layout.createSequentialGroup()
75 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
76 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
77 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
78 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
79 .addGroup(layout.createSequentialGroup()
80 .addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
81 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
82 .addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
83 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
84 .addComponent(checkClarificationPending, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE)
85 .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
86 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
87 );
88 layout.setVerticalGroup(
89 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
90 .addGroup(layout.createSequentialGroup()
91 .addContainerGap()
92 .addComponent(checkClarificationPending)
93 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
94 .addComponent(jLabel1)
95 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
96 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
97 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
98 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
99 .addComponent(buttonApply)
100 .addComponent(buttonCancel))
101 .addContainerGap())
102 );
103
104 pack();
105 }// </editor-fold>//GEN-END:initComponents
106
107 private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
108 // TODO add your handling code here:
109 dispose ();
110 }//GEN-LAST:event_buttonCancelActionPerformed
111
112 private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
113 // TODO add your handling code here:
114 boolean rt = Utility.updateNoticeClarificationDetails (selected_id,
115 checkClarificationPending.isSelected(),
116 textClarificationRemarks.getText());
117 if (rt == false)
118 JOptionPane.showMessageDialog(this, ERROR_UPDATING);
119 else
120 dispose ();
121 }//GEN-LAST:event_buttonApplyActionPerformed
122 private static final String ERROR_UPDATING = "Error in updating";
123
124 /**
125 * @param args the command line arguments
126 */
127 public static void main(String args[]) {
128 /* Set the Nimbus look and feel */
129 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
130 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
131 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
132 */
133 try {
134 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
135 if ("Nimbus".equals(info.getName())) {
136 javax.swing.UIManager.setLookAndFeel(info.getClassName());
137 break;
138 }
139 }
140 } catch (ClassNotFoundException ex) {
141 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
142 } catch (InstantiationException ex) {
143 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
144 } catch (IllegalAccessException ex) {
145 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
146 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
147 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
148 }
149 //</editor-fold>
150
151 /* Create and display the dialog */
152 java.awt.EventQueue.invokeLater(new Runnable() {
153 public void run() {
154 ClarificationDetailsDialog dialog = new ClarificationDetailsDialog(new javax.swing.JFrame(), true);
155 dialog.addWindowListener(new java.awt.event.WindowAdapter() {
156 @Override
157 public void windowClosing(java.awt.event.WindowEvent e) {
158 System.exit(0);
159 }
160 });
161 dialog.setVisible(true);
162 }
163 });
164 }
165
166 // Variables declaration - do not modify//GEN-BEGIN:variables
167 private javax.swing.JButton buttonApply;
168 private javax.swing.JButton buttonCancel;
169 private javax.swing.JCheckBox checkClarificationPending;
170 private javax.swing.JLabel jLabel1;
171 private javax.swing.JScrollPane jScrollPane1;
172 private javax.swing.JTextArea textClarificationRemarks;
173 // End of variables declaration//GEN-END:variables
174
175 void setFields(int selid, boolean clarification_pending, String
176 clarification_remarks) {
177 selected_id = selid;
178 checkClarificationPending.setSelected(clarification_pending);
179 textClarificationRemarks.setText(clarification_remarks);
180 }
181 }