version 1.27, 2004/03/08 20:03:39
|
version 1.32, 2004/03/15 12:52:00
|
Line 739 public class FM2SQL extends JFrame imple
|
Line 739 public class FM2SQL extends JFrame imple
|
}; |
}; |
thread.start(); |
thread.start(); |
} |
} |
|
if (command.equals("Delete Tables")) |
|
{ |
|
|
|
Thread thread = new Thread() |
|
{ |
|
public void run() |
|
{ |
|
setEnabled(false); |
|
delete(); |
|
setEnabled(true); |
|
} |
|
|
|
}; |
|
thread.start(); |
|
} |
|
|
if (command.equals("show Tables")) |
if (command.equals("show Tables")) |
{ |
{ |
Line 832 public class FM2SQL extends JFrame imple
|
Line 847 public class FM2SQL extends JFrame imple
|
} |
} |
|
|
} |
} |
|
public void delete() |
|
{ |
|
Vector vectors[] = getListFromTable(); |
|
Convert.user = bean.user; |
|
Convert.passwd = bean.passwd; |
|
Convert.userDest = destBean.user; |
|
Convert.passwdDest = destBean.passwd; |
|
try |
|
{ |
|
|
|
fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
|
fmInstance.setEnabled(false); |
|
Convert.delete(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1], vectors[2], vectors[3],vectors[4], mode); |
|
|
|
destBean.setConnection((String) destURLBox.getSelectedItem()); |
|
DefaultListModel model = new DefaultListModel(); |
|
tables = destBean.getTableNames(); |
|
for (int j = 0; j < tables.size(); ++j) |
|
model.addElement(tables.get(j)); |
|
if (debug) |
|
System.out.println("hallo" + tables + " "); |
|
tListDest.setModel(model); |
|
fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
|
} catch (Exception e4) |
|
{ |
|
ByteArrayOutputStream b = new ByteArrayOutputStream(); |
|
PrintStream stream = new PrintStream(b); |
|
e4.printStackTrace(stream); |
|
showErrorDialog(b.toString(), "Delete of table failed"); |
|
fmInstance.setEnabled(true); |
|
} |
|
|
|
} |
|
|
/** |
/** |
* Copys the content of source to destination and makes new table if necessary |
* Copys the content of source to destination and makes new table if necessary |
*/ |
*/ |
Line 877 public class FM2SQL extends JFrame imple
|
Line 926 public class FM2SQL extends JFrame imple
|
if(appendItem.isSelected()) mode = Convert.DataBase.APPEND_MODE; |
if(appendItem.isSelected()) mode = Convert.DataBase.APPEND_MODE; |
else |
else |
if(updateItem.isSelected()) mode = Convert.DataBase.UPDATE_MODE; |
if(updateItem.isSelected()) mode = Convert.DataBase.UPDATE_MODE; |
|
else |
|
if(deleteItem.isSelected()) mode = Convert.DataBase.DELETE_MODE; |
|
|
// TODO add id vector in table and write it out |
// TODO add id vector in table and write it out |
Convert.DataBase source = new Convert.DataBase(bean,vectors[0],vectors[1],vectors[2],vectors[3],vectors[4],mode); |
Convert.DataBase source = new Convert.DataBase(bean,vectors[0],vectors[1],vectors[2],vectors[3],vectors[4],mode); |
Convert.DataBase destination = new Convert.DataBase(destBean,new Vector(),new Vector(),new Vector(),new Vector(),new Vector(),-1); |
Convert.DataBase destination = new Convert.DataBase(destBean,new Vector(),new Vector(),new Vector(),new Vector(),new Vector(),-1); |
Line 922 public class FM2SQL extends JFrame imple
|
Line 974 public class FM2SQL extends JFrame imple
|
|
|
if (database.mode == Convert.DataBase.CONVERT_MODE) |
if (database.mode == Convert.DataBase.CONVERT_MODE) |
{ |
{ |
convertItem.setSelected(true); |
convertItem.doClick(); |
convert.setText("Convert Tables"); |
|
convert.setActionCommand("Convert Tables"); |
|
mode = Convert.DataBase.CONVERT_MODE; |
|
} else if (database.mode == Convert.DataBase.APPEND_MODE) |
} else if (database.mode == Convert.DataBase.APPEND_MODE) |
{ |
{ |
appendItem.setSelected(true); |
appendItem.doClick(); |
convert.setText("Append Tables"); |
|
convert.setActionCommand("Append Tables"); |
|
mode = Convert.DataBase.APPEND_MODE; |
|
} else if (database.mode == Convert.DataBase.UPDATE_MODE) |
} else if (database.mode == Convert.DataBase.UPDATE_MODE) |
{ |
{ |
updateItem.setSelected(true); |
updateItem.doClick(); |
convert.setText("Update Tables"); |
} else if (database.mode == Convert.DataBase.DELETE_MODE) |
convert.setActionCommand("Update Tables"); |
{ |
mode = Convert.DataBase.UPDATE_MODE; |
deleteItem.doClick(); |
} |
} |
delimiter=database.delimiter; |
delimiter=database.delimiter; |
database.bean.getConnection(); |
database.bean.getConnection(); |
Line 967 public class FM2SQL extends JFrame imple
|
Line 1013 public class FM2SQL extends JFrame imple
|
Object idcomboBox=tC.tableModel.getValueAt(index,ID_INDEX); |
Object idcomboBox=tC.tableModel.getValueAt(index,ID_INDEX); |
|
|
indices[i] = index; |
indices[i] = index; |
if(comboBox!=null) ((JComboBox)comboBox).setSelectedItem(database.layouts.get(i)); |
if (comboBox != null) |
|
{ |
|
String layout = database.layouts.get(i).toString(); |
|
((JComboBox) comboBox).setSelectedItem(layout); |
|
if (layout != "") |
|
{ |
|
bean.makeQuery("select * from" + bean.getQC() + table + bean.getQC() + " layout " + bean.getQC() + layout + bean.getQC(), 1); |
|
|
|
Vector idVec = bean.getColumnNames(); |
|
if (idVec == null) |
|
idVec = new Vector(); |
|
idVec.add(0, ""); |
|
((JComboBox) idcomboBox).setModel(new DefaultComboBoxModel(idVec)); |
|
} |
|
|
|
} |
if(idcomboBox!=null)((JComboBox)idcomboBox).setSelectedItem(bean.ids.get(i)); |
if(idcomboBox!=null)((JComboBox)idcomboBox).setSelectedItem(bean.ids.get(i)); |
tC.tableModel.fireTableDataChanged(); |
tC.tableModel.fireTableDataChanged(); |
noDBUpdate = false; |
noDBUpdate = false; |
Line 1217 public class FM2SQL extends JFrame imple
|
Line 1278 public class FM2SQL extends JFrame imple
|
if (columnName.equals("Layouts")) |
if (columnName.equals("Layouts")) |
{ |
{ |
|
|
bean.makeQuery("select * from"+bean.getQC()+table+bean.getQC(),1); |
bean.makeQuery("select * from"+bean.getQC()+table+bean.getQC()+" layout "+bean.getQC()+layout+bean.getQC(),1); |
|
|
Vector idVec = bean.getColumnNames(); |
Vector idVec = bean.getColumnNames(); |
if (idVec == null) |
if (idVec == null) |
Line 1226 public class FM2SQL extends JFrame imple
|
Line 1287 public class FM2SQL extends JFrame imple
|
JComboBox box = ((JComboBox) model.getValueAt(row, ID_INDEX)); |
JComboBox box = ((JComboBox) model.getValueAt(row, ID_INDEX)); |
box.setModel(new DefaultComboBoxModel(idVec)); |
box.setModel(new DefaultComboBoxModel(idVec)); |
box.setSelectedItem(id); |
box.setSelectedItem(id); |
|
|
|
tC.tableModel.fireTableCellUpdated(row,ID_INDEX); |
} |
} |
|
|
} |
} |