some bugs fixed for the "Show Create Table" functionality

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98415 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-07-04 09:24:13 +00:00
parent 6807afaf2c
commit 8412019b17
1 changed files with 151 additions and 131 deletions

View File

@ -206,6 +206,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
public void onSelectedItem(
SelectedItemEvent selectedItemEvent) {
centerBottom.removeAll();
centerBottom.layout(true);
// System.out
// .println("GxtBorderLayoutPanel: Event received");
@ -332,7 +335,18 @@ public class GxtBorderLayoutPanel extends ContentPanel {
ShowCreateTableEvent showCreateTableEvent) {
// TODO Auto-generated method stub
getTableDetails();
// get the selected table
List<FileModel> data = treePanel.getTreePanel()
.getSelectionModel().getSelectedItems();
// the selected item is a table
FileModel selectedTable = data.get(0);
rootLogger.log(Level.INFO, "the selected table is: "
+ selectedTable);
getTableDetails(selectedTable);
}
});
@ -783,7 +797,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
column.setWidth(100);
column.setSortable(false);
configs.add(column);
for (int i = 0; i < listAttributes.size(); i++) {
@ -851,8 +864,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// text.setAllowBlank(false);
column.setEditor(new CellEditor(textProperty));
configs.add(column);
column = new ColumnConfig();
@ -914,7 +925,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
}
private void getTableDetails() {
private void getTableDetails(final FileModel selectedTable) {
this.mask("Loading", "x-mask-loading");
@ -922,15 +933,16 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.SEVERE, "Start RPC - getTableDetails");
// get the selected table
List<FileModel> data = treePanel.getTreePanel().getSelectionModel()
.getSelectedItems();
// the selected item is a table
final FileModel selectedTable = data.get(0);
rootLogger.log(Level.INFO, "the selected table is: " + selectedTable);
// // get the selected table
//
// List<FileModel> data = treePanel.getTreePanel().getSelectionModel()
// .getSelectedItems();
//
// // the selected item is a table
// final FileModel selectedTable = data.get(0);
//
// rootLogger.log(Level.INFO, "the selected table is: " +
// selectedTable);
// recover data inputs
@ -974,6 +986,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
.log(Level.INFO, "SchemaName: " + selectedTable.getName());
}
if (selectedTable.isTableDetailsDisplayed()) {
displayTableDetails(selectedTable);
} else {
// call remote service
RPCservice.getTableDetails(dataInput,
new AsyncCallback<LinkedHashMap<String, FileModel>>() {
@ -1017,7 +1035,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
for (int i = 0; i < result.size(); i++) {
if (array[i].toString().contains("CreateTable")) {
if (array[i].toString().contains(
"CreateTable")) {
// recover the showCreateTable statement
@ -1029,8 +1048,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
}
if (array[i].toString()
.contains("Column Names")) {
if (array[i].toString().contains(
"Column Names")) {
// recover the column names
@ -1042,7 +1061,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
}
if (array[i].toString().contains("NumberRows")) {
if (array[i].toString().contains(
"NumberRows")) {
// recover the column names
@ -1060,6 +1080,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
displayTableDetails(selectedTable);
selectedTable.setTableDetailsDisplayed(true);
}
}
@ -1067,13 +1090,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
}
}
private void displayTableDetails(FileModel table) {
rootLogger.log(Level.INFO, "displaying table details");
List<Result> tableDetails = table.getTableDetails();
// System.out.println("GxtBorderLayout->size info: " + dataDB.size());
@ -1093,7 +1115,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// grid.setAutoExpandColumn("name");
grid.setBorders(true);
// grid.setAutoWidth(true);
// RowData data = new RowData(.5, .1);
@ -1110,7 +1131,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
this.unmask();
}
}
}