version 1.12, 2004/01/15 13:25:37
|
version 1.14, 2004/01/28 12:22:35
|
Line 656 public class FM2SQL extends JFrame imple
|
Line 656 public class FM2SQL extends JFrame imple
|
}; |
}; |
thread.start(); |
thread.start(); |
} |
} |
|
if (command.equals("Update Tables")) |
|
{ |
|
|
|
Thread thread = new Thread() |
|
{ |
|
public void run() |
|
{ |
|
setEnabled(false); |
|
update(); |
|
setEnabled(true); |
|
} |
|
|
|
}; |
|
thread.start(); |
|
} |
|
|
if (command.equals("show Tables")) |
if (command.equals("show Tables")) |
{ |
{ |
Thread thread = new Thread() |
Thread thread = new Thread() |
Line 712 public class FM2SQL extends JFrame imple
|
Line 728 public class FM2SQL extends JFrame imple
|
|
|
} |
} |
/** |
/** |
|
* Updates the content of source to destination and makes new table if necessary |
|
*/ |
|
|
|
public void update() |
|
{ |
|
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.update(bean.url, box4.getSelectedItem().toString(), vectors[0], vectors[1], vectors[2], vectors[3],vectors[4], mode); |
|
|
|
destBean.setConnection((String) box4.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(), "Conversion 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 |
*/ |
*/ |
public void convert() |
public void convert() |
Line 726 public class FM2SQL extends JFrame imple
|
Line 778 public class FM2SQL extends JFrame imple
|
{ |
{ |
fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
fmInstance.setEnabled(false); |
fmInstance.setEnabled(false); |
Convert.convert(bean.url, box4.getSelectedItem().toString(), vectors[0], vectors[1],vectors[2],vectors[3],mode); |
Convert.convert(bean.url, box4.getSelectedItem().toString(), vectors[0], vectors[1],vectors[2],vectors[3],vectors[4],mode); |
|
|
destBean.setConnection((String) box4.getSelectedItem()); |
destBean.setConnection((String) box4.getSelectedItem()); |
DefaultListModel model = new DefaultListModel(); |
DefaultListModel model = new DefaultListModel(); |
Line 758 public class FM2SQL extends JFrame imple
|
Line 810 public class FM2SQL extends JFrame imple
|
else |
else |
if(updateItem.isSelected()) mode = Convert.DataBase.UPDATE_MODE; |
if(updateItem.isSelected()) mode = Convert.DataBase.UPDATE_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],new Vector(),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); |
|
|
try |
try |
Line 837 public class FM2SQL extends JFrame imple
|
Line 889 public class FM2SQL extends JFrame imple
|
if(index<0) throw new RuntimeException("Error table \""+table+"\" does no longer exist\n at server "+bean.url +"\n or you mispelled the tablename."); |
if(index<0) throw new RuntimeException("Error table \""+table+"\" does no longer exist\n at server "+bean.url +"\n or you mispelled the tablename."); |
noDBUpdate = true; |
noDBUpdate = true; |
tC.tableModel.setValueAt(new TableComponent.SQLCommand(database.selects.get(i).toString()),index,2); |
tC.tableModel.setValueAt(new TableComponent.SQLCommand(database.selects.get(i).toString()),index,2); |
|
|
String create =database.creates.get(i).toString(); |
String create =database.creates.get(i).toString(); |
tC.tableModel.setValueAt(new TableComponent.SQLCommand(create.equals("") ? create:" "+create),index,3); |
tC.tableModel.setValueAt(new TableComponent.SQLCommand(create.equals("") ? create:" "+create),index,3); |
|
tC.tableModel.setValueAt(new TableComponent.SQLCommand(bean.ids.get(i).toString()),index,4); |
|
|
Object comboBox=tC.tableModel.getValueAt(index,1); |
Object comboBox=tC.tableModel.getValueAt(index,1); |
indices[i] = index; |
indices[i] = index; |
if(comboBox!=null) ((JComboBox)comboBox).setSelectedItem(database.layouts.get(i)); |
if(comboBox!=null) ((JComboBox)comboBox).setSelectedItem(database.layouts.get(i)); |
Line 1403 public class FM2SQL extends JFrame imple
|
Line 1458 public class FM2SQL extends JFrame imple
|
data[1].add(" id "); |
data[1].add(" id "); |
// TODO add id vector DBBean |
// TODO add id vector DBBean |
data[0] = new Vector(); |
data[0] = new Vector(); |
|
|
for (int i = 0; i < tableNames.size(); i++) |
for (int i = 0; i < tableNames.size(); i++) |
{ |
{ |
String name = tableNames.get(i).toString(); |
String name = tableNames.get(i).toString(); |
Line 1424 public class FM2SQL extends JFrame imple
|
Line 1478 public class FM2SQL extends JFrame imple
|
dataRow.add(new TableComponent.SQLCommand("select * from "+bean.getQC()+name+bean.getQC())); |
dataRow.add(new TableComponent.SQLCommand("select * from "+bean.getQC()+name+bean.getQC())); |
|
|
data[0].add(dataRow); |
data[0].add(dataRow); |
|
|
|
// create row |
|
dataRow.add(new TableComponent.SQLCommand("")); |
|
// id row |
dataRow.add(new TableComponent.SQLCommand("")); |
dataRow.add(new TableComponent.SQLCommand("")); |
|
bean.ids.add(""); |
//System.out.println(dataRow); |
//System.out.println(dataRow); |
} |
} |
tC.tableModel.setDataVector(data[0], data[1]); |
tC.tableModel.setDataVector(data[0], data[1]); |
Line 1435 public class FM2SQL extends JFrame imple
|
Line 1494 public class FM2SQL extends JFrame imple
|
} |
} |
public Vector[] getListFromTable() |
public Vector[] getListFromTable() |
{ |
{ |
Vector[] vec = new Vector[4]; |
Vector[] vec = new Vector[5]; |
vec[0] = new Vector(); |
vec[0] = new Vector(); |
vec[1] = new Vector(); |
vec[1] = new Vector(); |
vec[2] = new Vector(); |
vec[2] = new Vector(); |
vec[3] = new Vector(); |
vec[3] = new Vector(); |
|
vec[4] = new Vector(); |
int[] rows = tC.table.getSelectedRows(); |
int[] rows = tC.table.getSelectedRows(); |
for (int i = 0; i < rows.length; i++) |
for (int i = 0; i < rows.length; i++) |
{ |
{ |
Line 1450 public class FM2SQL extends JFrame imple
|
Line 1510 public class FM2SQL extends JFrame imple
|
vec[1].add(layoutName); |
vec[1].add(layoutName); |
vec[2].add(tC.tableModel.getValueAt(rows[i], 2).toString()); |
vec[2].add(tC.tableModel.getValueAt(rows[i], 2).toString()); |
vec[3].add(tC.tableModel.getValueAt(rows[i], 3).toString()); |
vec[3].add(tC.tableModel.getValueAt(rows[i], 3).toString()); |
|
vec[4].add(tC.tableModel.getValueAt(rows[i], 4).toString()); |
|
|
} |
} |
return vec; |
return vec; |