table name displayed in the panel "Database Information"

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98662 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-07-15 16:43:38 +00:00
parent 8e9323bbd8
commit 421387df68
1 changed files with 354 additions and 352 deletions

View File

@ -621,8 +621,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// // selectedItem.getName()); // // selectedItem.getName());
// } // }
// create RpcProxy object to use the load configuration // create RpcProxy object to use the load configuration
// RpcProxy<PagingLoadResult<Result>> proxy = new // RpcProxy<PagingLoadResult<Result>> proxy = new
@ -842,6 +840,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "table selected: " rootLogger.log(Level.INFO, "table selected: "
+ selectedTable); + selectedTable);
} }
}); });
@ -887,7 +887,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
grid.getSelectionModel().getSelectedItems().get(0), grid.getSelectionModel().getSelectedItems().get(0),
true); true);
// selectedTable = grid.getSelectionModel().getSelectedItems().get(0).getValue(); // selectedTable =
// grid.getSelectionModel().getSelectedItems().get(0).getValue();
// tablesLoaded.addListener(Events.Hide, new // tablesLoaded.addListener(Events.Hide, new
// Listener<WindowEvent>() { // Listener<WindowEvent>() {
@ -910,7 +911,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
}); });
grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() { grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() {
@Override @Override
@ -919,16 +919,11 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "table edited: " rootLogger.log(Level.INFO, "table edited: "
+ be.getValue().toString()); + be.getValue().toString());
// selectedTable = be.getValue().toString(); // selectedTable = be.getValue().toString();
} }
}); });
grid.addListener(Events.Attach, new Listener<GridEvent<Result>>() { grid.addListener(Events.Attach, new Listener<GridEvent<Result>>() {
public void handleEvent(GridEvent<Result> be) { public void handleEvent(GridEvent<Result> be) {
@ -1079,14 +1074,16 @@ public class GxtBorderLayoutPanel extends ContentPanel {
if (selectedTable != null) { if (selectedTable != null) {
// display the table in the panel "Database Information"
displayTableName(selectedTable);
// fire event // fire event
eventBus.fireEvent(new SelectedTableEvent()); eventBus.fireEvent(new SelectedTableEvent());
} }
// Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>()
// {
// Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
// //
// @Override // @Override
// public void handleEvent(MessageBoxEvent be) { // public void handleEvent(MessageBoxEvent be) {
@ -1677,19 +1674,17 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// call remote service // call remote service
RPCservice.sample(dataInput, RPCservice.sample(dataInput, new AsyncCallback<List<Result>>() {
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, rootLogger.log(Level.SEVERE, "FAILURE RPC sample");
"FAILURE RPC sample");
MessageBox.alert("Error ", "<br/>Message:" MessageBox.alert("Error ",
+ caught.getMessage(), null); "<br/>Message:" + caught.getMessage(), null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -1700,16 +1695,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
@Override @Override
public void onSuccess(List<Result> result) { public void onSuccess(List<Result> result) {
rootLogger.log(Level.SEVERE, rootLogger.log(Level.SEVERE, "SUCCESS RPC sample");
"SUCCESS RPC sample");
// rows = new ArrayList<Row>(); // rows = new ArrayList<Row>();
// System.out.println("result size: " + // System.out.println("result size: " +
// result.size()); // result.size());
rootLogger.log(Level.SEVERE, rootLogger.log(Level.SEVERE, "output size: " + result.size());
"output size: " + result.size());
// get the attributes list for the result // get the attributes list for the result
// table // table
@ -1931,19 +1924,17 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// call remote service // call remote service
RPCservice.smartSample(dataInput, RPCservice.smartSample(dataInput, new AsyncCallback<List<Result>>() {
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, rootLogger.log(Level.SEVERE, "FAILURE RPC smartSample");
"FAILURE RPC smartSample");
MessageBox.alert("Error ", "<br/>Message:" MessageBox.alert("Error ",
+ caught.getMessage(), null); "<br/>Message:" + caught.getMessage(), null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -1954,16 +1945,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
@Override @Override
public void onSuccess(List<Result> result) { public void onSuccess(List<Result> result) {
rootLogger.log(Level.SEVERE, rootLogger.log(Level.SEVERE, "SUCCESS RPC smartSample");
"SUCCESS RPC smartSample");
// rows = new ArrayList<Row>(); // rows = new ArrayList<Row>();
// System.out.println("result size: " + // System.out.println("result size: " +
// result.size()); // result.size());
rootLogger.log(Level.SEVERE, rootLogger.log(Level.SEVERE, "output size: " + result.size());
"output size: " + result.size());
// get the attributes list for the result // get the attributes list for the result
// table // table
@ -2186,19 +2175,17 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// call remote service // call remote service
RPCservice.randomSample(dataInput, RPCservice.randomSample(dataInput, new AsyncCallback<List<Result>>() {
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, rootLogger.log(Level.SEVERE, "FAILURE RPC randomSample");
"FAILURE RPC randomSample");
MessageBox.alert("Error ", "<br/>Message:" MessageBox.alert("Error ",
+ caught.getMessage(), null); "<br/>Message:" + caught.getMessage(), null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -2209,16 +2196,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
@Override @Override
public void onSuccess(List<Result> result) { public void onSuccess(List<Result> result) {
rootLogger.log(Level.SEVERE, rootLogger.log(Level.SEVERE, "SUCCESS RPC randomSample");
"SUCCESS RPC randomSample");
// rows = new ArrayList<Row>(); // rows = new ArrayList<Row>();
// System.out.println("result size: " + // System.out.println("result size: " +
// result.size()); // result.size());
rootLogger.log(Level.SEVERE, rootLogger.log(Level.SEVERE, "output size: " + result.size());
"output size: " + result.size());
// get the attributes list for the result // get the attributes list for the result
// table // table
@ -2607,8 +2592,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
EditorGrid<Result> grid = new EditorGrid<Result>(store, EditorGrid<Result> grid = new EditorGrid<Result>(store,
createColumnModelForDBInfo(dataDB)); createColumnModelForDBInfo(dataDB));
// grid.setAutoExpandColumn("name"); // grid.setAutoExpandColumn("name");
grid.setBorders(true); grid.setBorders(true);
@ -2817,8 +2800,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
displayTableDetails(Table); displayTableDetails(Table);
} } else {
else {
// //
// Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() { // Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
// //
@ -2835,26 +2817,19 @@ public class GxtBorderLayoutPanel extends ContentPanel {
obj.mask("Loading details", "x-mask-loading"); obj.mask("Loading details", "x-mask-loading");
// call remote service // call remote service
RPCservice RPCservice.getTableDetails(dataInput,
.getTableDetails(
dataInput,
new AsyncCallback<LinkedHashMap<String, FileModel>>() { new AsyncCallback<LinkedHashMap<String, FileModel>>() {
@Override @Override
public void onFailure( public void onFailure(Throwable caught) {
Throwable caught) {
// TODO Auto-generated method // TODO Auto-generated method
// stub // stub
rootLogger rootLogger.log(Level.SEVERE,
.log(Level.SEVERE,
"FAILURE RPC getTableDetails"); "FAILURE RPC getTableDetails");
MessageBox MessageBox.alert("Error ",
.alert("Error ", "<br/>Message:" + caught.getMessage(), null);
"<br/>Message:"
+ caught.getMessage(),
null);
if (obj.isMasked()) { if (obj.isMasked()) {
obj.unmask(); obj.unmask();
@ -2868,8 +2843,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// TODO Auto-generated method // TODO Auto-generated method
// stub // stub
rootLogger rootLogger.log(Level.SEVERE,
.log(Level.SEVERE,
"SUCCESS RPC getTableDetails"); "SUCCESS RPC getTableDetails");
// details are recovered about // details are recovered about
@ -2880,11 +2854,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// recover keys from the // recover keys from the
// result // result
Set<String> keys = result Set<String> keys = result.keySet();
.keySet();
Object[] array = keys Object[] array = keys.toArray();
.toArray();
// System.out.println("array size: " // System.out.println("array size: "
// + // +
@ -2894,64 +2866,48 @@ public class GxtBorderLayoutPanel extends ContentPanel {
List<Result> TableDetails = new ArrayList<Result>(); List<Result> TableDetails = new ArrayList<Result>();
for (int i = 0; i < result for (int i = 0; i < result.size(); i++) {
.size(); i++) {
if (array[i] if (array[i].toString().contains(
.toString()
.contains(
"CreateTable")) { "CreateTable")) {
// recover the // recover the
// showCreateTable // showCreateTable
// statement // statement
Result row = new Result( Result row = new Result("CreateTable",
"CreateTable", result.get(array[i].toString())
result.get(
array[i].toString())
.getName()); .getName());
TableDetails TableDetails.add(row);
.add(row);
} }
if (array[i] if (array[i].toString().contains(
.toString()
.contains(
"Column Names")) { "Column Names")) {
// recover the // recover the
// column names // column names
Result row = new Result( Result row = new Result("Column Names",
"Column Names", result.get(array[i].toString())
result.get(
array[i].toString())
.getName()); .getName());
TableDetails TableDetails.add(row);
.add(row);
} }
if (array[i] if (array[i].toString().contains(
.toString()
.contains(
"NumberRows")) { "NumberRows")) {
// recover the // recover the
// column names // column names
Result row = new Result( Result row = new Result("NumberRows",
"NumberRows", result.get(array[i].toString())
result.get(
array[i].toString())
.getName()); .getName());
TableDetails TableDetails.add(row);
.add(row);
} }
@ -3132,4 +3088,50 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
private void displayTableName(String tableName) {
rootLogger.log(Level.INFO, "displaying table name" + table
+ " in the panel");
Result table = new Result("The selected table is:", tableName);
// create column configuration
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("index");
column.setHeader("Description");
column.setWidth(200);
configs.add(column);
column = new ColumnConfig();
column.setId("value");
column.setHeader("Value");
column.setWidth(600);
TextField<String> textValue = new TextField<String>();
// text.setAllowBlank(false);
column.setEditor(new CellEditor(textValue));
configs.add(column);
ColumnModel cm = new ColumnModel(configs);
ListStore<Result> store = new ListStore<Result>();
store.add(table);
//grid
EditorGrid<Result> grid = new EditorGrid<Result>(store,cm);
//display information in the panel
centerUpper.removeAll();
centerUpper.add(grid);
centerUpper.layout(true);
}
} }