1 33 34 package com.nqadmin.swingSet.formatting; 35 36 import com.nqadmin.swingSet.SSDBNav; 37 import java.util.Locale ; 38 39 40 44 public class FormattingTests extends javax.swing.JFrame implements SSDBNav { 45 46 47 public FormattingTests() { 48 initComponents(); 49 } 50 51 56 private void initComponents() { sSConnection1 = new com.nqadmin.swingSet.datasources.SSConnection(); 58 sSJdbcRowSetImpl1 = new com.nqadmin.swingSet.datasources.SSJdbcRowSetImpl(); 59 rowSetHelperPopup1 = new com.nqadmin.swingSet.formatting.helpers.RowSetHelperPopup(); 60 helperPopup1 = new com.nqadmin.swingSet.formatting.helpers.HelperPopup(); 61 helperPopup2 = new com.nqadmin.swingSet.formatting.helpers.HelperPopup(); 62 helperPopup3 = new com.nqadmin.swingSet.formatting.helpers.HelperPopup(); 63 sSDataNavigator1 = new com.nqadmin.swingSet.SSDataNavigator(); 64 jPanel1 = new javax.swing.JPanel (); 65 sSFormattedTextField1 = new com.nqadmin.swingSet.formatting.SSFormattedTextField(); 66 sSFormattedTextField2 = new com.nqadmin.swingSet.formatting.SSFormattedTextField(); 67 sSDateField1 = new com.nqadmin.swingSet.formatting.SSDateField(); 68 sSDateField2 = new com.nqadmin.swingSet.formatting.SSDateField(); 69 sSBooleanField1 = new com.nqadmin.swingSet.formatting.SSBooleanField(); 70 sSFormattedTextField3 = new com.nqadmin.swingSet.formatting.SSFormattedTextField(); 71 sSIntegerField1 = new com.nqadmin.swingSet.formatting.SSIntegerField(); 72 jScrollPane1 = new javax.swing.JScrollPane (); 73 sSMemoField1 = new com.nqadmin.swingSet.formatting.SSMemoField(); 74 jLabel1 = new javax.swing.JLabel (); 75 jLabel2 = new javax.swing.JLabel (); 76 jLabel3 = new javax.swing.JLabel (); 77 jLabel5 = new javax.swing.JLabel (); 78 jLabel6 = new javax.swing.JLabel (); 79 jLabel7 = new javax.swing.JLabel (); 80 jLabel8 = new javax.swing.JLabel (); 81 82 sSConnection1.setDriverName("org.postgresql.Driver"); 83 sSConnection1.setUrl("jdbc:postgresql://localhost/mag"); 84 sSConnection1.setUsername("dags"); 85 try { 86 sSConnection1.createConnection(); 87 } 88 catch(java.lang.ClassNotFoundException nfe) { 89 System.out.println(nfe); 90 } 91 catch(java.lang.Exception ex) { 92 System.out.println(ex); 93 } 94 95 sSJdbcRowSetImpl1.setSSConnection(sSConnection1); 96 sSJdbcRowSetImpl1.setCommand("select * from accounts ORDER BY account_id"); 97 98 try { 99 sSJdbcRowSetImpl1.execute(); 100 } 101 catch (java.sql.SQLException se) { 102 System.out.println(se); 103 } 104 105 rowSetHelperPopup1.setConnection(sSConnection1); 106 rowSetHelperPopup1.setDataColumn("account_id"); 107 rowSetHelperPopup1.setListColumn("account_name"); 108 rowSetHelperPopup1.setOrderBy("account_name"); 109 rowSetHelperPopup1.setRowSet(sSJdbcRowSetImpl1); 110 111 helperPopup1.setConnection(sSConnection1); 112 helperPopup1.setDataColumn("account_id"); 113 helperPopup1.setListColumn("account_name"); 114 helperPopup1.setOrderBy("account_name"); 115 helperPopup1.setTable("accounts"); 116 117 helperPopup2.setColumnType(1); 118 helperPopup2.setConnection(sSConnection1); 119 helperPopup2.setDataColumn("currency_id"); 120 helperPopup2.setListColumn("currency_name"); 121 helperPopup2.setOrderBy("currency_name"); 122 helperPopup2.setTable("currencies"); 123 124 helperPopup3.setColumnType(0); 125 helperPopup3.setConnection(sSConnection1); 126 helperPopup3.setDataColumn("account_type_id"); 127 helperPopup3.setListColumn("account_type_name"); 128 helperPopup3.setOrderBy("account_type_name"); 129 helperPopup3.setTable("accounts_types"); 130 131 132 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 133 sSDataNavigator1.setDBNav(this); 134 sSDataNavigator1.setFocusable(false); 135 sSDataNavigator1.setSSRowSet(sSJdbcRowSetImpl1); 136 getContentPane().add(sSDataNavigator1, java.awt.BorderLayout.SOUTH); 137 138 jPanel1.setLayout(null); 139 140 sSFormattedTextField1.setColumns(10); 141 sSFormattedTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT); 142 sSFormattedTextField1.setColumnName("account_id"); 143 sSFormattedTextField1.setHelper(rowSetHelperPopup1); 144 sSFormattedTextField1.setNavigator(sSDataNavigator1); 145 sSFormattedTextField1.addActionListener(new java.awt.event.ActionListener () { 146 public void actionPerformed(java.awt.event.ActionEvent evt) { 147 sSFormattedTextField1ActionPerformed(evt); 148 } 149 }); 150 151 jPanel1.add(sSFormattedTextField1); 152 sSFormattedTextField1.setBounds(120, 30, 70, 19); 153 154 sSFormattedTextField2.setColumnName("account_name"); 155 sSFormattedTextField2.setNavigator(sSDataNavigator1); 156 jPanel1.add(sSFormattedTextField2); 157 sSFormattedTextField2.setBounds(120, 60, 310, 19); 158 159 sSDateField1.setColumnName("valid_since"); 160 sSDateField1.setNavigator(sSDataNavigator1); 161 jPanel1.add(sSDateField1); 162 sSDateField1.setBounds(120, 120, 110, 19); 163 164 sSDateField2.setColumnName("valid_until"); 165 sSDateField2.setNavigator(sSDataNavigator1); 166 167 jPanel1.add(sSDateField2); 168 sSDateField2.setBounds(120, 150, 110, 19); 169 170 sSBooleanField1.setText("Habilitada"); 171 sSBooleanField1.setColumnName("is_enabled"); 172 sSBooleanField1.setNavigator(sSDataNavigator1); 173 sSBooleanField1.setRowSet(sSJdbcRowSetImpl1); 174 jPanel1.add(sSBooleanField1); 175 sSBooleanField1.setBounds(210, 30, 110, 23); 176 177 sSFormattedTextField3.setColumns(6); 178 sSFormattedTextField3.setColumnName("currency_id"); 179 sSFormattedTextField3.setHelper(helperPopup2); 180 sSFormattedTextField3.setNavigator(sSDataNavigator1); 181 sSFormattedTextField3.setSSRowSet(sSJdbcRowSetImpl1); 182 jPanel1.add(sSFormattedTextField3); 183 sSFormattedTextField3.setBounds(120, 90, 70, 19); 184 185 sSIntegerField1.setColumnName("account_type_id"); 186 sSIntegerField1.setHelper(helperPopup3); 187 sSIntegerField1.setNavigator(sSDataNavigator1); 188 sSIntegerField1.setSSRowSet(sSJdbcRowSetImpl1); 189 jPanel1.add(sSIntegerField1); 190 sSIntegerField1.setBounds(120, 180, 60, 19); 191 192 sSMemoField1.setColumnName("instructions"); 193 sSMemoField1.setNavigator(sSDataNavigator1); 194 sSMemoField1.setNextFocusableComponent(sSFormattedTextField1); 195 sSMemoField1.setRowSet(sSJdbcRowSetImpl1); 196 jScrollPane1.setViewportView(sSMemoField1); 197 198 jPanel1.add(jScrollPane1); 199 jScrollPane1.setBounds(120, 210, 430, 100); 200 201 jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 202 jLabel1.setText("Cuenta"); 203 jPanel1.add(jLabel1); 204 jLabel1.setBounds(10, 30, 100, 15); 205 206 jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 207 jLabel2.setText("Denominacion"); 208 jPanel1.add(jLabel2); 209 jLabel2.setBounds(10, 60, 100, 15); 210 211 jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 212 jLabel3.setText("Moneda"); 213 jPanel1.add(jLabel3); 214 jLabel3.setBounds(10, 90, 100, 15); 215 216 jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 217 jLabel5.setText("Vigente desde"); 218 jPanel1.add(jLabel5); 219 jLabel5.setBounds(10, 120, 100, 15); 220 221 jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 222 jLabel6.setText("Vigente Hasta"); 223 jPanel1.add(jLabel6); 224 jLabel6.setBounds(10, 150, 100, 15); 225 226 jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 227 jLabel7.setText("Tipo"); 228 jPanel1.add(jLabel7); 229 jLabel7.setBounds(10, 180, 100, 15); 230 231 jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 232 jLabel8.setText("Instrucciones"); 233 jPanel1.add(jLabel8); 234 jLabel8.setBounds(10, 210, 100, 15); 235 236 getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); 237 238 java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); 239 setBounds((screenSize.width-594)/2, (screenSize.height-376)/2, 594, 376); 240 } 242 private void sSFormattedTextField1ActionPerformed(java.awt.event.ActionEvent evt) { } 246 249 public static void main(String args[]) { 250 java.awt.EventQueue.invokeLater(new Runnable () { 251 public void run() { 252 new FormattingTests().setVisible(true); 253 } 254 }); 255 } 256 257 com.nqadmin.swingSet.formatting.helpers.HelperPopup helperPopup1; 259 com.nqadmin.swingSet.formatting.helpers.HelperPopup helperPopup2; 260 com.nqadmin.swingSet.formatting.helpers.HelperPopup helperPopup3; 261 javax.swing.JLabel jLabel1; 262 javax.swing.JLabel jLabel2; 263 javax.swing.JLabel jLabel3; 264 javax.swing.JLabel jLabel5; 265 javax.swing.JLabel jLabel6; 266 javax.swing.JLabel jLabel7; 267 javax.swing.JLabel jLabel8; 268 javax.swing.JPanel jPanel1; 269 javax.swing.JScrollPane jScrollPane1; 270 com.nqadmin.swingSet.formatting.helpers.RowSetHelperPopup rowSetHelperPopup1; 271 com.nqadmin.swingSet.formatting.SSBooleanField sSBooleanField1; 272 com.nqadmin.swingSet.datasources.SSConnection sSConnection1; 273 com.nqadmin.swingSet.SSDataNavigator sSDataNavigator1; 274 com.nqadmin.swingSet.formatting.SSDateField sSDateField1; 275 com.nqadmin.swingSet.formatting.SSDateField sSDateField2; 276 com.nqadmin.swingSet.formatting.SSFormattedTextField sSFormattedTextField1; 277 com.nqadmin.swingSet.formatting.SSFormattedTextField sSFormattedTextField2; 278 com.nqadmin.swingSet.formatting.SSFormattedTextField sSFormattedTextField3; 279 com.nqadmin.swingSet.formatting.SSIntegerField sSIntegerField1; 280 com.nqadmin.swingSet.datasources.SSJdbcRowSetImpl sSJdbcRowSetImpl1; 281 com.nqadmin.swingSet.formatting.SSMemoField sSMemoField1; 282 284 public void performNavigationOps(int _navigationType) { 285 System.out.println("performNavigationOps"); 286 } 287 288 public void performRefreshOps() { 289 } 290 291 public void performPreInsertOps() { 292 System.out.println("performPreInsertOps"); 293 294 sSFormattedTextField1.setValue(new Integer (99999999)); 295 sSFormattedTextField2.setValue(new String ("nombre de la nueva cuenta")); 296 sSFormattedTextField3.setValue(new String ("ARS")); 297 sSDateField1.setValue(new java.sql.Date (2000)); 298 sSDateField2.setValue(new java.sql.Date (2001)); 299 sSIntegerField1.setValue(new Integer (1)); 300 sSMemoField1.setText("Esta es una instruccion de ejemplo"); 301 sSBooleanField1.setSelected(true); 302 303 323 } 324 325 public void performPreDeletionOps() { 326 } 327 328 public void performPostInsertOps() { 329 System.out.println("performPostInsertOptions"); 330 } 331 332 public void performPostDeletionOps() { 333 } 334 335 public void performCancelOps() { 336 } 337 338 } 339 | Popular Tags |