Manage Legal Notices - Clarification Details
[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.TRAILING)
77 .addGroup(layout.createSequentialGroup()
78 .addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
79 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
80 .addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
81 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
82 .addComponent(checkClarificationPending, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
83 .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
84 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE)))
85 .addContainerGap(21, Short.MAX_VALUE))
86 );
87 layout.setVerticalGroup(
88 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
89 .addGroup(layout.createSequentialGroup()
90 .addContainerGap()
91 .addComponent(checkClarificationPending)
92 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
93 .addComponent(jLabel1)
94 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
95 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
96 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
97 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
98 .addComponent(buttonApply)
99 .addComponent(buttonCancel))
100 .addContainerGap())
101 );
102
103 pack();
104 }// </editor-fold>//GEN-END:initComponents
105
106 private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
107 // TODO add your handling code here:
108 dispose ();
109 }//GEN-LAST:event_buttonCancelActionPerformed
110
111 private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
112 // TODO add your handling code here:
113 boolean rt = Utility.updateNoticeClarificationDetails (selected_id,
114 checkClarificationPending.isSelected(),
115 textClarificationRemarks.getText());
116 if (rt == false)
117 JOptionPane.showMessageDialog(this, ERROR_UPDATING);
118 else
119 dispose ();
120 }//GEN-LAST:event_buttonApplyActionPerformed
121 private static final String ERROR_UPDATING = "Error in updating";
122
123 /**
124 * @param args the command line arguments
125 */
126 public static void main(String args[]) {
127 /* Set the Nimbus look and feel */
128 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
129 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
130 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
131 */
132 try {
133 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
134 if ("Nimbus".equals(info.getName())) {
135 javax.swing.UIManager.setLookAndFeel(info.getClassName());
136 break;
137 }
138 }
139 } catch (ClassNotFoundException ex) {
140 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
141 } catch (InstantiationException ex) {
142 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
143 } catch (IllegalAccessException ex) {
144 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
145 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
146 java.util.logging.Logger.getLogger(ClarificationDetailsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
147 }
148 //</editor-fold>
149
150 /* Create and display the dialog */
151 java.awt.EventQueue.invokeLater(new Runnable() {
152 public void run() {
153 ClarificationDetailsDialog dialog = new ClarificationDetailsDialog(new javax.swing.JFrame(), true);
154 dialog.addWindowListener(new java.awt.event.WindowAdapter() {
155 @Override
156 public void windowClosing(java.awt.event.WindowEvent e) {
157 System.exit(0);
158 }
159 });
160 dialog.setVisible(true);
161 }
162 });
163 }
164
165 // Variables declaration - do not modify//GEN-BEGIN:variables
166 private javax.swing.JButton buttonApply;
167 private javax.swing.JButton buttonCancel;
168 private javax.swing.JCheckBox checkClarificationPending;
169 private javax.swing.JLabel jLabel1;
170 private javax.swing.JScrollPane jScrollPane1;
171 private javax.swing.JTextArea textClarificationRemarks;
172 // End of variables declaration//GEN-END:variables
173
174 void setFields(int selid, boolean clarification_pending, String
175 clarification_remarks) {
176 selected_id = selid;
177 checkClarificationPending.setSelected(clarification_pending);
178 textClarificationRemarks.setText(clarification_remarks);
179 }
180 }