1 56 package org.objectstyle.cayenne.modeler.editor.datanode; 57 58 import java.awt.BorderLayout ; 59 60 import javax.swing.JButton ; 61 import javax.swing.JPanel ; 62 import javax.swing.JPasswordField ; 63 import javax.swing.JTextField ; 64 65 import com.jgoodies.forms.builder.PanelBuilder; 66 import com.jgoodies.forms.layout.CellConstraints; 67 import com.jgoodies.forms.layout.FormLayout; 68 69 72 public class JDBCDataSourceView extends JPanel { 73 74 protected JTextField driver; 75 protected JTextField url; 76 protected JTextField userName; 77 protected JPasswordField password; 78 protected JTextField minConnections; 79 protected JTextField maxConnections; 80 protected JButton syncWithLocal; 81 82 public JDBCDataSourceView() { 83 84 driver = new JTextField (); 85 url = new JTextField (); 86 userName = new JTextField (); 87 password = new JPasswordField (); 88 minConnections = new JTextField (6); 89 maxConnections = new JTextField (6); 90 syncWithLocal = new JButton ("Sync with Local"); 91 syncWithLocal.setToolTipText("Update from local DataSource"); 92 93 CellConstraints cc = new CellConstraints(); 95 FormLayout layout = new FormLayout( 96 "right:80dlu, 3dlu, fill:50dlu, 3dlu, fill:74dlu, 3dlu, fill:70dlu", 97 "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p"); 98 99 PanelBuilder builder = new PanelBuilder(layout); 100 builder.setDefaultDialogBorder(); 101 102 builder.addSeparator("JDBC Configuration", cc.xywh(1, 1, 7, 1)); 103 builder.addLabel("JDBC Driver:", cc.xy(1, 3)); 104 builder.add(driver, cc.xywh(3, 3, 5, 1)); 105 builder.addLabel("DB URL:", cc.xy(1, 5)); 106 builder.add(url, cc.xywh(3, 5, 5, 1)); 107 builder.addLabel("User Name:", cc.xy(1, 7)); 108 builder.add(userName, cc.xywh(3, 7, 5, 1)); 109 builder.addLabel("Password:", cc.xy(1, 9)); 110 builder.add(password, cc.xywh(3, 9, 5, 1)); 111 builder.addLabel("Min Connections:", cc.xy(1, 11)); 112 builder.add(minConnections, cc.xy(3, 11)); 113 builder.addLabel("Max Connections:", cc.xy(1, 13)); 114 builder.add(maxConnections, cc.xy(3, 13)); 115 builder.add(syncWithLocal, cc.xy(7, 13)); 116 117 this.setLayout(new BorderLayout ()); 118 this.add(builder.getPanel(), BorderLayout.CENTER); 119 } 120 121 public JTextField getDriver() { 122 return driver; 123 } 124 125 public JPasswordField getPassword() { 126 return password; 127 } 128 129 public JTextField getUrl() { 130 return url; 131 } 132 133 public JTextField getUserName() { 134 return userName; 135 } 136 137 public JTextField getMaxConnections() { 138 return maxConnections; 139 } 140 141 public JTextField getMinConnections() { 142 return minConnections; 143 } 144 145 public JButton getSyncWithLocal() { 146 return syncWithLocal; 147 } 148 } | Popular Tags |