- bug fixed in class GxtBorderLayoutPanel.When a table is selected ad displayed in the panel, on the click of a table in the tables' list, buttons getdetails ad samplings have not be disabled if a new table is not selected.
- name changed in randomSample method in the servlet in order to create the file csv. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100093 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
10007df08a
commit
6528b95a3b
|
@ -101,7 +101,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// dialog used to display the tables list
|
||||
private Dialog tablesLoaded = null;
|
||||
// to keep track of selected table in the tables list
|
||||
private String selectedTable = null;
|
||||
private String selectedTable = "";
|
||||
private String currentselectedTable="";
|
||||
private FileModel table = new FileModel("");
|
||||
// variables to perform the table search
|
||||
private String keyword = "";
|
||||
|
@ -234,6 +235,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
|
||||
// clean variable at each item selection event
|
||||
table = new FileModel("");
|
||||
|
||||
// clean variable
|
||||
selectedTable = "";
|
||||
currentselectedTable="";
|
||||
|
||||
if (DepthSelectedItem != 3) {
|
||||
centerUpper.removeAll();
|
||||
|
@ -305,8 +310,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// if the selected table is equal to the previous table
|
||||
// keep track that table details have been just
|
||||
// displayed
|
||||
if (!(table.getName().equals(selectedTable))) {
|
||||
table.setName(selectedTable);
|
||||
if (!(table.getName().equals(currentselectedTable))) {
|
||||
table.setName(currentselectedTable);
|
||||
table.setTableDetailsDisplayed(false);
|
||||
}
|
||||
rootLogger.log(Level.INFO,
|
||||
|
@ -329,10 +334,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// method to load the tables list
|
||||
private void loadTables() {
|
||||
// clean variable
|
||||
selectedTable = null;
|
||||
// selectedTable = null;
|
||||
|
||||
// disable table details and sampling buttons
|
||||
toolbar.disableButtonsOperationsOnTable();
|
||||
// toolbar.disableButtonsOperationsOnTable();
|
||||
// clear the panel
|
||||
// centerBottom.removeAll();
|
||||
// centerBottom.layout(true);
|
||||
|
@ -564,31 +569,20 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
}
|
||||
});
|
||||
|
||||
// listener to manage the table selection in the grid
|
||||
grid.getSelectionModel().addSelectionChangedListener(
|
||||
new SelectionChangedListener<Result>() {
|
||||
@Override
|
||||
public void selectionChanged(
|
||||
SelectionChangedEvent<Result> se) {
|
||||
selectedTable = grid.getSelectionModel()
|
||||
.getSelectedItems().get(0).getValue();
|
||||
rootLogger.log(Level.INFO, "table selected: "
|
||||
+ selectedTable);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// listener to manage the table selection in the grid
|
||||
grid.addListener(Events.RowClick, new Listener<GridEvent<Result>>() {
|
||||
@Override
|
||||
public void handleEvent(final GridEvent<Result> be) {
|
||||
rootLogger.log(Level.INFO, "table clicked: "
|
||||
rootLogger.log(Level.INFO, "RowClick Event->table clicked: "
|
||||
+ grid.getSelectionModel().getSelectedItems().get(0)
|
||||
.getValue());
|
||||
// select the item
|
||||
grid.getSelectionModel().select(
|
||||
grid.getSelectionModel().getSelectedItems().get(0),
|
||||
true);
|
||||
|
||||
|
||||
|
||||
// tablesLoaded.addListener(Events.Hide, new
|
||||
// Listener<WindowEvent>() {
|
||||
// @Override
|
||||
|
@ -599,6 +593,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() {
|
||||
@Override
|
||||
|
@ -683,18 +678,23 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
tablesLoaded.setTopComponent(toolBarTop);
|
||||
|
||||
// listener to manage the table selection in the grid
|
||||
Button ok = (Button) tablesLoaded.getButtonBar().getWidget(0);
|
||||
final Button ok = (Button) tablesLoaded.getButtonBar().getWidget(0);
|
||||
ok.disable();
|
||||
rootLogger.log(Level.INFO, "button: " + ok.getText());
|
||||
Button canc = (Button) tablesLoaded.getButtonBar().getWidget(1);
|
||||
rootLogger.log(Level.INFO, "button: " + canc.getText());
|
||||
|
||||
|
||||
|
||||
// listener for buttons
|
||||
ok.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
keyword = null;
|
||||
startSearchTable = false;
|
||||
if (selectedTable != null) {
|
||||
|
||||
// if (selectedTable != null) {
|
||||
if (!currentselectedTable.equals(selectedTable)){
|
||||
currentselectedTable = selectedTable;
|
||||
// refresh the content in the two panels
|
||||
centerBottom.removeAll();
|
||||
centerBottom.layout(true);
|
||||
|
@ -702,7 +702,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
centerUpper.layout(true);
|
||||
|
||||
// display the table in the panel "Database Information"
|
||||
displayTableName(selectedTable);
|
||||
displayTableName(currentselectedTable);
|
||||
|
||||
// to get the selected item in the tree panel
|
||||
List<FileModel> data = treePanel.getTreePanel()
|
||||
|
@ -711,7 +711,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
|
||||
// fire event
|
||||
eventBus.fireEvent(new SelectedTableEvent(selectedItem,
|
||||
selectedTable));
|
||||
currentselectedTable));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -727,6 +727,23 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
tablesLoaded.hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// listener to manage the table selection in the grid
|
||||
grid.getSelectionModel().addSelectionChangedListener(
|
||||
new SelectionChangedListener<Result>() {
|
||||
@Override
|
||||
public void selectionChanged(
|
||||
SelectionChangedEvent<Result> se) {
|
||||
selectedTable = grid.getSelectionModel()
|
||||
.getSelectedItems().get(0).getValue();
|
||||
rootLogger.log(Level.INFO, "SelectionChangedListener->table selected: "
|
||||
+ selectedTable);
|
||||
|
||||
ok.enable();
|
||||
}
|
||||
});
|
||||
tablesLoaded.add(grid);
|
||||
tablesLoaded.show();
|
||||
}
|
||||
|
@ -1197,12 +1214,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", "");
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
} else {
|
||||
// the table has a schema because the selected item is a schema
|
||||
schema = selectedItem;
|
||||
|
@ -1212,12 +1229,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", schema.getName());
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
}
|
||||
|
||||
// to mask the entire content panel
|
||||
|
@ -1332,12 +1349,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", "");
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
} else {
|
||||
// the table has a schema
|
||||
schema = selectedItem;
|
||||
|
@ -1347,12 +1364,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", schema.getName());
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
}
|
||||
// to mask the entire content panel
|
||||
obj.mask("Sampling the table", "x-mask-loading");
|
||||
|
@ -1429,12 +1446,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", "");
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
} else {
|
||||
// the table has a schema
|
||||
schema = selectedItem;
|
||||
|
@ -1444,12 +1461,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", schema.getName());
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
}
|
||||
|
||||
// to mask the entire content panel
|
||||
|
@ -1829,12 +1846,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", "");
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
} else {
|
||||
// the table has a schema
|
||||
schema = selectedItem;
|
||||
|
@ -1844,12 +1861,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
dataInput.put("ResourceName", resource.getName());
|
||||
dataInput.put("DatabaseName", database.getName());
|
||||
dataInput.put("SchemaName", schema.getName());
|
||||
dataInput.put("TableName", selectedTable);
|
||||
dataInput.put("TableName", currentselectedTable);
|
||||
|
||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||
rootLogger.log(Level.INFO, "TableName: " + selectedTable);
|
||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||
}
|
||||
|
||||
// details for the table are displayed if they have not been displayed
|
||||
|
|
|
@ -1126,7 +1126,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
output.add(row);
|
||||
}
|
||||
|
||||
String name = "SmartSampling" + "_" + tab;
|
||||
String name = "RandomSampling" + "_" + tab;
|
||||
String fileName = storeResultIntoCSVFile(output, name);
|
||||
|
||||
HttpServletRequest request = this.getThreadLocalRequest();
|
||||
|
|
Loading…
Reference in New Issue