some bugs fixed and messagebox added for get details and sampling operations

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98589 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-07-14 12:20:18 +00:00
parent 1adb58e887
commit 8b53e63c90
1 changed files with 576 additions and 245 deletions

View File

@ -40,6 +40,7 @@ import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.LayoutContainer; import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox; import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.TextField; import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor; import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
@ -74,6 +75,7 @@ import com.extjs.gxt.ui.client.event.MessageBoxEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent; import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener; import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener; import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.event.WindowEvent;
import com.extjs.gxt.ui.client.data.BasePagingLoadResult; import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
//class that represents the container of all components //class that represents the container of all components
@ -281,7 +283,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
selectedItem.isSchema(), selectedItem.isSchema(),
selectedItem.getDatabaseType()); selectedItem.getDatabaseType());
table=new FileModel(""); table = new FileModel("");
if (DepthSelectedItem != 3) { if (DepthSelectedItem != 3) {
@ -425,25 +427,26 @@ public class GxtBorderLayoutPanel extends ContentPanel {
List<FileModel> data = treePanel.getTreePanel() List<FileModel> data = treePanel.getTreePanel()
.getSelectionModel().getSelectedItems(); .getSelectionModel().getSelectedItems();
// if ((data.get(0).isDatabase())&&(data.get(0).getDatabaseType().equals(ConstantsPortlet.MYSQL))){ // if
// ((data.get(0).isDatabase())&&(data.get(0).getDatabaseType().equals(ConstantsPortlet.MYSQL))){
if (!(table.getName().equals(selectedTable))){ if (!(table.getName().equals(selectedTable))) {
table.setName(selectedTable); table.setName(selectedTable);
table.setTableDetailsDisplayed(false); table.setTableDetailsDisplayed(false);
} }
// } // }
// else{ // else{
// the selected item is a table // the selected item is a table
// FileModel Table = new FileModel(selectedTable); // FileModel Table = new FileModel(selectedTable);
rootLogger.log(Level.INFO, "the selected table is: " rootLogger.log(Level.INFO, "the selected table is: "
+ table.getName()); + table.getName());
getTableDetails(table); getTableDetails(table);
// } // }
} }
}); });
@ -456,8 +459,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.SEVERE, "Start RPC - loadTables"); rootLogger.log(Level.SEVERE, "Start RPC - loadTables");
// to mask the entire content panel // to mask the entire content panel
// this.mask("Loading", "x-mask-loading"); // this.mask("Loading", "x-mask-loading");
@ -755,7 +756,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
final EditorGrid<Result> grid = new EditorGrid<Result>(result, cm); final EditorGrid<Result> grid = new EditorGrid<Result>(result, cm);
// final Grid<Result> grid = new Grid<Result>(result, cm); // final Grid<Result> grid = new Grid<Result>(result, cm);
// grid = new Grid<Result>(result, cm); // grid = new Grid<Result>(result, cm);
@ -776,68 +777,73 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// grid.getSelectionModel().selectAll(); // grid.getSelectionModel().selectAll();
//listener for row selection in the grid // listener for row selection in the grid
// grid.getSelectionModel().addSelectionChangedListener( // grid.getSelectionModel().addSelectionChangedListener(
// new SelectionChangedListener<Result>() { // new SelectionChangedListener<Result>() {
// //
// @Override // @Override
// public void selectionChanged( // public void selectionChanged(
// final SelectionChangedEvent<Result> se) { // final SelectionChangedEvent<Result> se) {
// // TODO Auto-generated method stub // // TODO Auto-generated method stub
// //
// //
// //
// // System.out.println("table slected: " + // // System.out.println("table slected: " +
// // selectedTable); // // selectedTable);
// //
// // Fire event // // Fire event
// eventBus.fireEvent(new SelectedTableEvent()); // eventBus.fireEvent(new SelectedTableEvent());
// //
// tablesLoaded.getButtonById(Dialog.OK) // tablesLoaded.getButtonById(Dialog.OK)
// .addSelectionListener( // .addSelectionListener(
// new SelectionListener<ButtonEvent>() { // new SelectionListener<ButtonEvent>() {
// //
// @Override // @Override
// public void componentSelected( // public void componentSelected(
// ButtonEvent ce) { // ButtonEvent ce) {
// //
// selectedTable = se.getSelectedItem().getValue(); // selectedTable = se.getSelectedItem().getValue();
// //
// } // }
// }); // });
// //
// } // }
// }); // });
// listener to manage the table selection in the grid
grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() { grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() {
@Override @Override
public void handleEvent(final GridEvent<Result> be) { public void handleEvent(final GridEvent<Result> be) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
be.getValue().toString(); // be.getValue().toString();
// System.out.println("table selected: " + // System.out.println("table selected: " +
// be.getValue().toString()); // be.getValue().toString());
rootLogger.log(Level.INFO, "table selected: " + be.getValue().toString()); rootLogger.log(Level.INFO, "table selected: "
+ be.getValue().toString());
// Fire event
eventBus.fireEvent(new SelectedTableEvent());
tablesLoaded.getButtonById(Dialog.OK)
.addSelectionListener(
new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(
ButtonEvent ce) {
selectedTable = be.getValue().toString(); selectedTable = be.getValue().toString();
} // tablesLoaded.addListener(Events.Hide, new
}); // Listener<WindowEvent>() {
//
// @Override
// public void handleEvent(WindowEvent be) {
// // TODO Auto-generated method stub
//
// System.out.println("closing the window");
//
// }
// });
// if (selectedTable!=null){
// // Fire event
// eventBus.fireEvent(new SelectedTableEvent());
//
// }
} }
}); });
@ -955,6 +961,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// Dialog tablesLoaded = new Dialog(); // Dialog tablesLoaded = new Dialog();
tablesLoaded = new Dialog(); tablesLoaded = new Dialog();
tablesLoaded.setLayout(new FitLayout()); tablesLoaded.setLayout(new FitLayout());
tablesLoaded.addButton(new Button("CANCEL"));
tablesLoaded.setHeading("Tables"); tablesLoaded.setHeading("Tables");
tablesLoaded.setResizable(false); tablesLoaded.setResizable(false);
@ -966,10 +974,72 @@ public class GxtBorderLayoutPanel extends ContentPanel {
tablesLoaded.setHideOnButtonClick(true); tablesLoaded.setHideOnButtonClick(true);
tablesLoaded.setMaximizable(true); tablesLoaded.setMaximizable(true);
tablesLoaded.setClosable(false);
tablesLoaded.setBottomComponent(toolBar); tablesLoaded.setBottomComponent(toolBar);
tablesLoaded.add(grid); tablesLoaded.add(grid);
// listener to manage the table selection in the grid
tablesLoaded.getButtonById(Dialog.OK).addSelectionListener(
new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
// selectedTable = be.getValue().toString();
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
// TODO Auto-generated method stub
rootLogger.log(Level.INFO, "button clicked");
eventBus.fireEvent(new SelectedTableEvent());
}
};
if (selectedTable != null) {
// MessageBox.alert("Information",
// "The table "+selectedTable+ " was selected",
// null);
MessageBox.info("Information", "The table "
+ selectedTable + " was selected", l);
// eventBus.fireEvent(new SelectedTableEvent());
} else {
// MessageBox.alert("Warning",
// "No table "+selectedTable+ " was selected",
// null);
MessageBox.info("Information",
"No table was selected", null);
}
}
});
// tablesLoaded.getButtonById("CANCEL").addSelectionListener(
// new SelectionListener<ButtonEvent>() {
//
// @Override
// public void componentSelected(ButtonEvent ce) {
// // TODO Auto-generated method stub
//
// tablesLoaded.hide();
//
// }
// });
tablesLoaded.show(); tablesLoaded.show();
// ToolBar toolBar = new ToolBar(); // ToolBar toolBar = new ToolBar();
@ -1263,7 +1333,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// to mask the entire content panel // to mask the entire content panel
this.mask("Sampling the " + selectedTable + " table", "x-mask-loading"); // this.mask("Sampling the " + selectedTable + " table",
// "x-mask-loading");
// this.mask("Sampling the table", "x-mask-loading");
// System.out.println("Start RPC - submitQuery"); // System.out.println("Start RPC - submitQuery");
@ -1290,7 +1362,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// recover data inputs // recover data inputs
LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>(); final LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>();
// check if the table has an associated schema // check if the table has an associated schema
FileModel schema; FileModel schema;
@ -1435,19 +1507,34 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// // selectedItem.getName()); // // selectedItem.getName());
// } // }
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
// TODO Auto-generated method stub
Button btn = be.getButtonClicked();
if (btn.getText().equals("Yes")) {
// to mask the entire content panel
obj.mask("Sampling the table", "x-mask-loading");
// call remote service // call remote service
RPCservice.sample(dataInput, new AsyncCallback<List<Result>>() { RPCservice.sample(dataInput,
new AsyncCallback<List<Result>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
// Window.alert(caught.getMessage()); // Window.alert(caught.getMessage());
// System.out.println("FAILURE"); // System.out.println("FAILURE");
rootLogger.log(Level.SEVERE, "FAILURE RPC sample"); rootLogger.log(Level.SEVERE,
"FAILURE RPC sample");
MessageBox.alert("Error ", MessageBox.alert("Error ", "<br/>Message:"
"<br/>Message:" + caught.getMessage(), null); + caught.getMessage(), null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -1458,21 +1545,27 @@ public class GxtBorderLayoutPanel extends ContentPanel {
@Override @Override
public void onSuccess(List<Result> result) { public void onSuccess(List<Result> result) {
rootLogger.log(Level.SEVERE, "SUCCESS RPC sample"); rootLogger.log(Level.SEVERE,
"SUCCESS RPC sample");
// rows = new ArrayList<Row>(); // rows = new ArrayList<Row>();
// System.out.println("result size: " + result.size()); // System.out.println("result size: " +
// result.size());
rootLogger.log(Level.SEVERE, "output size: " + result.size()); rootLogger.log(Level.SEVERE,
"output size: " + result.size());
// get the attributes list for the result table // get the attributes list for the result
// table
getListAttributes(result.get(0).getValue()); getListAttributes(result.get(0).getValue());
// remove the header in order to parse only the result // remove the header in order to parse only
// the result
result.remove(0); result.remove(0);
// parse the result in order to obtain a table // parse the result in order to obtain a
// table
parseResult(result); parseResult(result);
} }
@ -1481,11 +1574,21 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
}
};
MessageBox.confirm("Confirm", "Are you sure you want to sample the "
+ selectedTable + " table?", l);
}
private void smartSample() { private void smartSample() {
// to mask the entire content panel // to mask the entire content panel
this.mask("Sampling the " + selectedTable + " table", "x-mask-loading"); // this.mask("Sampling the " + selectedTable + " table",
// "x-mask-loading");
final GxtBorderLayoutPanel obj = this; final GxtBorderLayoutPanel obj = this;
@ -1511,7 +1614,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// recover data inputs for the algorithm // recover data inputs for the algorithm
LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>(); final LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>();
// check if the table has an associated schema // check if the table has an associated schema
FileModel schema; FileModel schema;
@ -1659,19 +1762,33 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// // selectedItem.getName()); // // selectedItem.getName());
// } // }
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
// TODO Auto-generated method stub
Button btn = be.getButtonClicked();
if (btn.getText().equals("Yes")) {
// to mask the entire content panel
obj.mask("Sampling the table", "x-mask-loading");
// call remote service // call remote service
RPCservice.smartSample(dataInput, new AsyncCallback<List<Result>>() { RPCservice.smartSample(dataInput,
new AsyncCallback<List<Result>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
// Window.alert(caught.getMessage()); // Window.alert(caught.getMessage());
// System.out.println("FAILURE"); // System.out.println("FAILURE");
rootLogger.log(Level.SEVERE, "FAILURE RPC smartSample"); rootLogger.log(Level.SEVERE,
"FAILURE RPC smartSample");
MessageBox.alert("Error ", MessageBox.alert("Error ", "<br/>Message:"
"<br/>Message:" + caught.getMessage(), null); + caught.getMessage(), null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -1682,21 +1799,27 @@ public class GxtBorderLayoutPanel extends ContentPanel {
@Override @Override
public void onSuccess(List<Result> result) { public void onSuccess(List<Result> result) {
rootLogger.log(Level.SEVERE, "SUCCESS RPC smartSample"); rootLogger.log(Level.SEVERE,
"SUCCESS RPC smartSample");
// rows = new ArrayList<Row>(); // rows = new ArrayList<Row>();
// System.out.println("result size: " + result.size()); // System.out.println("result size: " +
// result.size());
rootLogger.log(Level.SEVERE, "output size: " + result.size()); rootLogger.log(Level.SEVERE,
"output size: " + result.size());
// get the attributes list for the result table // get the attributes list for the result
// table
getListAttributes(result.get(0).getValue()); getListAttributes(result.get(0).getValue());
// remove the header in order to parse only the result // remove the header in order to parse only
// the result
result.remove(0); result.remove(0);
// parse the result in order to obtain a table // parse the result in order to obtain a
// table
parseResult(result); parseResult(result);
} }
@ -1705,10 +1828,20 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
}
};
MessageBox.confirm("Confirm", "Are you sure you want to sample the "
+ selectedTable + " table?", l);
}
private void randomSample() { private void randomSample() {
// to mask the entire content panel // to mask the entire content panel
this.mask("Sampling the " + selectedTable + " table", "x-mask-loading"); // this.mask("Sampling the " + selectedTable + " table",
// "x-mask-loading");
final GxtBorderLayoutPanel obj = this; final GxtBorderLayoutPanel obj = this;
@ -1734,7 +1867,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// recover data inputs for the algorithm // recover data inputs for the algorithm
LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>(); final LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>();
// check if the table has an associated schema // check if the table has an associated schema
FileModel schema; FileModel schema;
@ -1883,19 +2016,34 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// // selectedItem.getName()); // // selectedItem.getName());
// } // }
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
// TODO Auto-generated method stub
Button btn = be.getButtonClicked();
if (btn.getText().equals("Yes")) {
// to mask the entire content panel
obj.mask("Sampling the table", "x-mask-loading");
// call remote service // call remote service
RPCservice.randomSample(dataInput, new AsyncCallback<List<Result>>() { RPCservice.randomSample(dataInput,
new AsyncCallback<List<Result>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
// Window.alert(caught.getMessage()); // Window.alert(caught.getMessage());
// System.out.println("FAILURE"); // System.out.println("FAILURE");
rootLogger.log(Level.SEVERE, "FAILURE RPC randomSample"); rootLogger.log(Level.SEVERE,
"FAILURE RPC randomSample");
MessageBox.alert("Error ", MessageBox.alert("Error ", "<br/>Message:"
"<br/>Message:" + caught.getMessage(), null); + caught.getMessage(), null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -1906,21 +2054,27 @@ public class GxtBorderLayoutPanel extends ContentPanel {
@Override @Override
public void onSuccess(List<Result> result) { public void onSuccess(List<Result> result) {
rootLogger.log(Level.SEVERE, "SUCCESS RPC randomSample"); rootLogger.log(Level.SEVERE,
"SUCCESS RPC randomSample");
// rows = new ArrayList<Row>(); // rows = new ArrayList<Row>();
// System.out.println("result size: " + result.size()); // System.out.println("result size: " +
// result.size());
rootLogger.log(Level.SEVERE, "output size: " + result.size()); rootLogger.log(Level.SEVERE,
"output size: " + result.size());
// get the attributes list for the result table // get the attributes list for the result
// table
getListAttributes(result.get(0).getValue()); getListAttributes(result.get(0).getValue());
// remove the header in order to parse only the result // remove the header in order to parse only
// the result
result.remove(0); result.remove(0);
// parse the result in order to obtain a table // parse the result in order to obtain a
// table
parseResult(result); parseResult(result);
} }
@ -1929,6 +2083,15 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
}
};
MessageBox.confirm("Confirm", "Are you sure you want to sample the "
+ selectedTable + " table?", l);
}
// start the parsing of the submit result in order to obtain a table // start the parsing of the submit result in order to obtain a table
private void parseResult(List<Result> result) { private void parseResult(List<Result> result) {
@ -1956,6 +2119,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
if (submitQueryEventManaged == true) { if (submitQueryEventManaged == true) {
submitQueryEventManaged = false;
Dialog form = toolbar.getDialogForm(); Dialog form = toolbar.getDialogForm();
if (form.isMasked()) if (form.isMasked())
@ -2033,6 +2198,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
if (submitQueryEventManaged == true) { if (submitQueryEventManaged == true) {
submitQueryEventManaged = false;
Dialog form = toolbar.getDialogForm(); Dialog form = toolbar.getDialogForm();
if (form.isMasked()) if (form.isMasked())
@ -2051,6 +2218,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
if (submitQueryEventManaged == true) { if (submitQueryEventManaged == true) {
submitQueryEventManaged = false;
Dialog form = toolbar.getDialogForm(); Dialog form = toolbar.getDialogForm();
if (form.isMasked()) if (form.isMasked())
@ -2306,8 +2475,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// to mask the entire content panel // to mask the entire content panel
this.mask("Loading details for " + selectedTable + " table", // this.mask("Loading details for " + selectedTable + " table",
"x-mask-loading"); // "x-mask-loading");
// to unmask the entire content panel // to unmask the entire content panel
final GxtBorderLayoutPanel obj = this; final GxtBorderLayoutPanel obj = this;
@ -2340,7 +2509,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// recover data inputs // recover data inputs
LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>(); final LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>();
// check if the table has an associated schema // check if the table has an associated schema
FileModel schema; FileModel schema;
@ -2493,19 +2662,41 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} else { } else {
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
// TODO Auto-generated method stub
Button btn = be.getButtonClicked();
if (btn.getText().equals("Yes")) {
// to mask the entire content panel
obj.mask("Loading details", "x-mask-loading");
// call remote service // call remote service
RPCservice.getTableDetails(dataInput, RPCservice
.getTableDetails(
dataInput,
new AsyncCallback<LinkedHashMap<String, FileModel>>() { new AsyncCallback<LinkedHashMap<String, FileModel>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(
// TODO Auto-generated method stub Throwable caught) {
// TODO Auto-generated method
// stub
rootLogger.log(Level.SEVERE, rootLogger
.log(Level.SEVERE,
"FAILURE RPC getTableDetails"); "FAILURE RPC getTableDetails");
MessageBox.alert("Error ", MessageBox
"<br/>Message:" + caught.getMessage(), null); .alert("Error ",
"<br/>Message:"
+ caught.getMessage(),
null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -2516,66 +2707,93 @@ public class GxtBorderLayoutPanel extends ContentPanel {
@Override @Override
public void onSuccess( public void onSuccess(
LinkedHashMap<String, FileModel> result) { LinkedHashMap<String, FileModel> result) {
// TODO Auto-generated method stub // TODO Auto-generated method
// stub
rootLogger.log(Level.SEVERE, rootLogger
.log(Level.SEVERE,
"SUCCESS RPC getTableDetails"); "SUCCESS RPC getTableDetails");
// details are recovered about the selected table // details are recovered about
// the selected table
if (result.size() != 0) { if (result.size() != 0) {
// recover keys from the result // recover keys from the
// result
Set<String> keys = result.keySet(); Set<String> keys = result
.keySet();
Object[] array = keys.toArray(); Object[] array = keys
.toArray();
// System.out.println("array size: " + // System.out.println("array size: "
// +
// array.length); // array.length);
// recover details // recover details
List<Result> TableDetails = new ArrayList<Result>(); List<Result> TableDetails = new ArrayList<Result>();
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result
.size(); i++) {
if (array[i].toString().contains( if (array[i]
.toString()
.contains(
"CreateTable")) { "CreateTable")) {
// recover the showCreateTable statement // recover the
// showCreateTable
// statement
Result row = new Result("CreateTable", Result row = new Result(
result.get(array[i].toString()) "CreateTable",
result.get(
array[i].toString())
.getName()); .getName());
TableDetails.add(row); TableDetails
.add(row);
} }
if (array[i].toString().contains( if (array[i]
.toString()
.contains(
"Column Names")) { "Column Names")) {
// recover the column names // recover the
// column names
Result row = new Result("Column Names", Result row = new Result(
result.get(array[i].toString()) "Column Names",
result.get(
array[i].toString())
.getName()); .getName());
TableDetails.add(row); TableDetails
.add(row);
} }
if (array[i].toString().contains( if (array[i]
.toString()
.contains(
"NumberRows")) { "NumberRows")) {
// recover the column names // recover the
// column names
Result row = new Result("NumberRows", Result row = new Result(
result.get(array[i].toString()) "NumberRows",
result.get(
array[i].toString())
.getName()); .getName());
TableDetails.add(row); TableDetails
.add(row);
} }
@ -2600,6 +2818,119 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
};
MessageBox.confirm("Confirm",
"Are you sure you want to get details for " + selectedTable
+ " table?", l);
// // call remote service
// RPCservice.getTableDetails(dataInput,
// new AsyncCallback<LinkedHashMap<String, FileModel>>() {
//
// @Override
// public void onFailure(Throwable caught) {
// // TODO Auto-generated method stub
//
// rootLogger.log(Level.SEVERE,
// "FAILURE RPC getTableDetails");
//
// MessageBox.alert("Error ",
// "<br/>Message:" + caught.getMessage(), null);
//
// if (obj.isMasked()) {
// obj.unmask();
// }
//
// }
//
// @Override
// public void onSuccess(
// LinkedHashMap<String, FileModel> result) {
// // TODO Auto-generated method stub
//
// rootLogger.log(Level.SEVERE,
// "SUCCESS RPC getTableDetails");
//
// // details are recovered about the selected table
//
// if (result.size() != 0) {
//
// // recover keys from the result
//
// Set<String> keys = result.keySet();
//
// Object[] array = keys.toArray();
//
// // System.out.println("array size: " +
// // array.length);
//
// // recover details
//
// List<Result> TableDetails = new ArrayList<Result>();
//
// for (int i = 0; i < result.size(); i++) {
//
// if (array[i].toString().contains(
// "CreateTable")) {
//
// // recover the showCreateTable statement
//
// Result row = new Result("CreateTable",
// result.get(array[i].toString())
// .getName());
//
// TableDetails.add(row);
//
// }
//
// if (array[i].toString().contains(
// "Column Names")) {
//
// // recover the column names
//
// Result row = new Result("Column Names",
// result.get(array[i].toString())
// .getName());
//
// TableDetails.add(row);
//
// }
//
// if (array[i].toString().contains(
// "NumberRows")) {
//
// // recover the column names
//
// Result row = new Result("NumberRows",
// result.get(array[i].toString())
// .getName());
//
// TableDetails.add(row);
//
// }
//
// }
//
// Table.setTableDetails(TableDetails);
//
// displayTableDetails(Table);
//
// Table.setTableDetailsDisplayed(true);
//
// }
//
// // if (obj.isMasked()) {
// // obj.unmask();
// // }
//
// }
// });
}
}
private void displayTableDetails(FileModel table) { private void displayTableDetails(FileModel table) {
rootLogger.log(Level.INFO, "displaying table details"); rootLogger.log(Level.INFO, "displaying table details");