1 24 25 package org.objectweb.cjdbc.console.wizard.tab; 26 27 import java.awt.GridBagConstraints ; 28 import java.awt.GridBagLayout ; 29 import java.awt.event.ActionEvent ; 30 import java.awt.event.ActionListener ; 31 32 import javax.swing.BorderFactory ; 33 import javax.swing.JButton ; 34 import javax.swing.JComponent ; 35 import javax.swing.JLabel ; 36 import javax.swing.JPanel ; 37 import javax.swing.JSlider ; 38 import javax.swing.JTextField ; 39 40 import org.objectweb.cjdbc.common.i18n.WizardTranslate; 41 import org.objectweb.cjdbc.console.wizard.WizardConstants; 42 import org.objectweb.cjdbc.console.wizard.WizardTab; 43 import org.objectweb.cjdbc.console.wizard.WizardTabs; 44 45 54 public class RecoveryTab extends WizardTab implements ActionListener 55 { 56 57 public JTextField driver; 58 59 public JTextField driverPath; 60 61 public JTextField login; 62 63 public JTextField url; 64 65 public JTextField password; 66 67 public JSlider requestTimeout; 68 69 public JButton selectBackend; 70 71 76 public RecoveryTab(WizardTabs tabs) 77 { 78 super(tabs, WizardConstants.TAB_RECOVERY); 79 80 84 JPanel general = new JPanel (); 85 general.setBorder(BorderFactory.createTitledBorder(WizardTranslate 86 .get("label.jdbcrecovery"))); 87 general.setLayout(new GridBagLayout ()); 88 GridBagConstraints generalconstraints = new GridBagConstraints (); 89 generalconstraints.fill = GridBagConstraints.HORIZONTAL; 90 generalconstraints.weightx = 1.0; 91 92 generalconstraints.gridy = ++generalconstraints.gridy; 94 driver = new JTextField (""); 95 generalconstraints.gridx = 0; 96 general.add(new JLabel (WizardTranslate.get("label.backendDriver")), 97 generalconstraints); 98 generalconstraints.gridx = 1; 99 general.add(driver, generalconstraints); 100 101 generalconstraints.gridy = ++generalconstraints.gridy; 103 driverPath = new JTextField (""); 104 generalconstraints.gridx = 0; 105 general.add(new JLabel (WizardTranslate.get("label.backendDriverPath")), 106 generalconstraints); 107 generalconstraints.gridx = 1; 108 general.add(driverPath, generalconstraints); 109 110 generalconstraints.gridy = ++generalconstraints.gridy; 112 url = new JTextField (""); 113 generalconstraints.gridx = 0; 114 general.add(new JLabel (WizardTranslate.get("label.backendUrl")), 115 generalconstraints); 116 generalconstraints.gridx = 1; 117 general.add(url, generalconstraints); 118 119 generalconstraints.gridy = ++generalconstraints.gridy; 121 login = new JTextField (""); 122 generalconstraints.gridx = 0; 123 general.add(new JLabel (WizardTranslate.get("label.username")), 124 generalconstraints); 125 generalconstraints.gridx = 1; 126 general.add(login, generalconstraints); 127 128 generalconstraints.gridy = ++generalconstraints.gridy; 130 password = new JTextField (""); 131 generalconstraints.gridx = 0; 132 general.add(new JLabel (WizardTranslate.get("label.password")), 133 generalconstraints); 134 generalconstraints.gridx = 1; 135 general.add(password, generalconstraints); 136 137 generalconstraints.gridy = ++generalconstraints.gridy; 139 requestTimeout = new JSlider (JSlider.HORIZONTAL, 0, 2000, 60); 140 requestTimeout.setPaintTicks(true); 141 requestTimeout.setPaintLabels(true); 142 requestTimeout.setMajorTickSpacing(500); 143 generalconstraints.gridx = 0; 144 general.add(new JLabel (WizardTranslate.get("label.requestTimeout")), 145 generalconstraints); 146 generalconstraints.gridx = 1; 147 general.add(requestTimeout, generalconstraints); 148 149 generalconstraints.gridy = ++generalconstraints.gridy; 151 generalconstraints.gridy = ++generalconstraints.gridy; 152 selectBackend = new JButton (WizardTranslate.get("label.selectbackend")); 153 selectBackend.addActionListener(this); 154 generalconstraints.gridx = 1; 155 general.add(selectBackend, generalconstraints); 156 157 this.add(general, constraints); 158 constraints.gridy = ++constraints.gridy; 159 } 160 161 164 public void actionPerformed(ActionEvent e) 165 { 166 JComponent source = (JComponent ) e.getSource(); 167 if (source == selectBackend) 168 { 169 String select = WizardTab.showBackendSelectDialog(); 170 if (select != null) 171 { 172 url.setText(types.getString(select + ".url")); 173 driver.setText(types.getString(select + ".driver")); 174 } 175 } 176 177 } 178 179 } | Popular Tags |