gbLayout.setConstraints(tabLab, gbConstraints);
db.add(tabLab);
m_tabBox = new JCheckBox();
m_tabBox.setSelected(((DatabaseSaver)m_dsSaver.getSaverTemplate()).getRelationForTableName());
m_tabBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
m_tableText.setEnabled(!m_tabBox.isSelected());
}
});
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 4; gbConstraints.gridx = 1;
gbLayout.setConstraints(m_tabBox, gbConstraints);
db.add(m_tabBox);
JLabel idLab = new JLabel("Automatic primary key", SwingConstants.RIGHT);
idLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 5; gbConstraints.gridx = 0;
gbLayout.setConstraints(idLab, gbConstraints);
db.add(idLab);
m_idBox = new JCheckBox();
m_idBox.setSelected(((DatabaseSaver)m_dsSaver.getSaverTemplate()).getAutoKeyGeneration());
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 5; gbConstraints.gridx = 1;
gbLayout.setConstraints(m_idBox, gbConstraints);
db.add(m_idBox);
JPanel buttonsP = new JPanel();
buttonsP.setLayout(new FlowLayout());
JButton ok,cancel;
buttonsP.add(ok = new JButton("OK"));
buttonsP.add(cancel=new JButton("Cancel"));
ok.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
((DatabaseSaver)m_dsSaver.getSaverTemplate()).resetStructure();
((DatabaseConverter)m_dsSaver.getSaverTemplate()).setUrl(m_dbaseURLText.getText());
((DatabaseConverter)m_dsSaver.getSaverTemplate()).setUser(m_userNameText.getText());
((DatabaseConverter)m_dsSaver.getSaverTemplate()).setPassword(new String(m_passwordText.getPassword()));
if(!m_tabBox.isSelected()) {
((DatabaseSaver)m_dsSaver.getSaverTemplate()).setTableName(m_tableText.getText());
}
((DatabaseSaver)m_dsSaver.getSaverTemplate()).setAutoKeyGeneration(m_idBox.isSelected());
((DatabaseSaver)m_dsSaver.getSaverTemplate()).setRelationForTableName(m_tabBox.isSelected());
if (m_modifyListener != null) {
m_modifyListener.setModifiedStatus(SaverCustomizer.this, true);
}
if (m_parentWindow != null) {
m_parentWindow.dispose();
}
}
});
cancel.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
if (m_modifyListener != null) {
m_modifyListener.setModifiedStatus(SaverCustomizer.this, false);
}