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