import java.sql.SQLException;
import java.util.Vector;
-import com.quantum.Messages;
-import com.quantum.adapters.AdapterFactory;
-import com.quantum.adapters.DatabaseAdapter;
-import com.quantum.model.Bookmark;
-import com.quantum.model.Entity;
-import com.quantum.model.NotConnectedException;
-import com.quantum.sql.FilterSort;
-import com.quantum.sql.SQLHelper;
-import com.quantum.sql.SQLResults;
-
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
+import com.quantum.Messages;
+import com.quantum.adapters.DatabaseAdapter;
+import com.quantum.model.Bookmark;
+import com.quantum.model.Entity;
+import com.quantum.model.NotConnectedException;
+import com.quantum.sql.FilterSort;
+import com.quantum.sql.SQLHelper;
+import com.quantum.sql.SQLResults;
+
public class TableAdapter {
- private Table table = null;
-
public static final String DEFAULT = ""; //$NON-NLS-1$
public static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
public static final String UTF_16 = "UTF-16"; //$NON-NLS-1$
try {
if (entity != null) {
totalSize = SQLHelper.getSize(
- bookmark.getConnection(), entity.getCondQualifiedName(),
- AdapterFactory.getInstance().getAdapter(bookmark.getType()));
+ bookmark.getConnection(), entity.getQualifiedName(),
+ bookmark.getAdapter());
}
} catch (SQLException e) {
e.printStackTrace();
public String getQuery() {
if (entity != null) {
- DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType());
+ DatabaseAdapter adapter = bookmark.getAdapter();
if (adapter == null) throw new RuntimeException();
- else return adapter.getTableQuery((entity).getCondQualifiedName()) + extra.toString();
+ else return adapter.getTableQuery((entity).getQualifiedName()) + extra.toString();
}
return query;
}
}
}
public void loadTable(Table table) {
- this.table = table;
table.setHeaderVisible(true);
for (int i = 0; i < columnNames.size(); i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
}
}
- public TableViewer addTableViewer(Table table) {
- TableViewer tableViewer = new TableViewer(table);
- tableViewer.setUseHashlookup(true);
- String[] colNams = new String[columnNames.size()];
- for (int i = 0; i < columnNames.size(); i++) {
- colNams[i] = (String) columnNames.get(i);
- }
- tableViewer.setColumnProperties(colNams);
-
- // Create the cell editors
- CellEditor[] editors = new CellEditor[columnNames.size()];
- for (int i = 0; i < columnNames.size(); i++) {
- TextCellEditor textEditor = new TextCellEditor(table);
- ((Text) textEditor.getControl()).setTextLimit(60);
- editors[i] = textEditor;
- }
- // Assign the cell editors to the viewer
- tableViewer.setCellEditors(editors);
- // Set the cell modifier for the viewer
- //tableViewer.setCellModifier(new MetaDataModifier(this));
- // Set the default sorter for the viewer
- //tableViewer.setSorter(new ExampleTaskSorter(ExampleTaskSorter.DESCRIPTION));
-
- return tableViewer;
- }
+// public TableViewer addTableViewer(Table table) {
+// TableViewer tableViewer = new TableViewer(table);
+// tableViewer.setUseHashlookup(true);
+// String[] colNams = new String[columnNames.size()];
+// for (int i = 0; i < columnNames.size(); i++) {
+// colNams[i] = (String) columnNames.get(i);
+// }
+// tableViewer.setColumnProperties(colNams);
+//
+// // Create the cell editors
+// CellEditor[] editors = new CellEditor[columnNames.size()];
+// for (int i = 0; i < columnNames.size(); i++) {
+// TextCellEditor textEditor = new TextCellEditor(table);
+// ((Text) textEditor.getControl()).setTextLimit(60);
+// editors[i] = textEditor;
+// }
+// // Assign the cell editors to the viewer
+// tableViewer.setCellEditors(editors);
+// // Set the cell modifier for the viewer
+// //tableViewer.setCellModifier(new MetaDataModifier(this));
+// // Set the default sorter for the viewer
+// //tableViewer.setSorter(new ExampleTaskSorter(ExampleTaskSorter.DESCRIPTION));
+//
+// return tableViewer;
+// }
public int getPageSize() {
return pageSize;
this.extra = extra;
}
public String getTable() {
- return (entity != null) ? entity.getCondQualifiedName() : null;
+ return (entity != null) ? entity.getQualifiedName() : null;
}
public void setQuery(String query) {