dialog for submitQuery and related dialog result not modal.Ehen the result is retrieved the dialog submitQuery is not hidden
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98940 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7e62798189
commit
422bb45ba7
|
@ -97,7 +97,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
private GWTdbManagerServiceAsync RPCservice = null;
|
||||
|
||||
// variable that keeps track of the "submitquery" managed event
|
||||
private boolean submitQueryEventManaged = false;
|
||||
// private boolean submitQueryEventManaged = false;
|
||||
|
||||
// to keep track that the tables list is not null
|
||||
// private boolean tablesListNotNull = false;
|
||||
|
@ -343,8 +343,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
@Override
|
||||
public void onSubmitQuery(SubmitQueryEvent submitQueryEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Integer dialogID = toolbar.getDialogID();
|
||||
|
||||
|
||||
|
||||
submitQuery();
|
||||
submitQuery(dialogID);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -1043,10 +1047,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
}
|
||||
|
||||
// method to submit a query
|
||||
private void submitQuery() {
|
||||
private void submitQuery(Integer dialogID) {
|
||||
|
||||
// clear variable that keeps track of the managed event
|
||||
submitQueryEventManaged = false;
|
||||
// boolean submitQueryEventManaged = false;
|
||||
|
||||
// get the selected item
|
||||
List<FileModel> data = treePanel.getTreePanel().getSelectionModel()
|
||||
|
@ -1065,7 +1069,25 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// System.out.println("DatabaseName" + selectedItem.getDatabaseName());
|
||||
|
||||
// get data inserted in the form
|
||||
final SubmitQueryData dataQuery = toolbar.getSubmitQueryData();
|
||||
// final SubmitQueryData dataQuery = toolbar.getSubmitQueryData();
|
||||
|
||||
//get data list (inserted in the form)
|
||||
LinkedHashMap<Integer, SubmitQueryData> submitQueryDataList = toolbar.getSubmitQueryDataList();
|
||||
|
||||
//get dialog list
|
||||
LinkedHashMap<Integer, Dialog> dialogList = toolbar.getDialogFormList();
|
||||
|
||||
|
||||
//get the dialog related to the ID
|
||||
final Dialog form = dialogList.get(dialogID);
|
||||
//get the data form related to the ID
|
||||
final SubmitQueryData dataQuery = submitQueryDataList.get(dialogID);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// determine the language
|
||||
String dialect;
|
||||
|
@ -1159,7 +1181,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// btn.getHtml());
|
||||
// Button btn = ce.getButtonClicked();
|
||||
|
||||
Dialog form = toolbar.getDialogForm();
|
||||
// Dialog form = toolbar.getDialogForm();
|
||||
|
||||
if (form.isMasked())
|
||||
form.unmask();
|
||||
|
@ -1209,10 +1231,11 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
result.remove(0);
|
||||
|
||||
// variable that keeps track of the managed event
|
||||
submitQueryEventManaged = true;
|
||||
// submitQueryEventManaged = true;
|
||||
|
||||
// parse the result in order to obtain a table
|
||||
parseResult(result);
|
||||
boolean submitQueryEventManaged = true;
|
||||
parseResult(result, form, submitQueryEventManaged);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1334,7 +1357,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
|
||||
// parse the result in order to obtain a
|
||||
// table
|
||||
parseResult(result);
|
||||
parseResult(result, null, false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1489,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
|
||||
// parse the result in order to obtain a
|
||||
// table
|
||||
parseResult(result);
|
||||
parseResult(result, null, false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1597,7 +1620,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
|
||||
// parse the result in order to obtain a
|
||||
// table
|
||||
parseResult(result);
|
||||
parseResult(result, null, false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1615,10 +1638,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
}
|
||||
|
||||
// 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, Dialog dialog, final boolean submitQueryEventManaged) {
|
||||
|
||||
// to unmask the entire content panel
|
||||
final GxtBorderLayoutPanel obj = this;
|
||||
|
||||
final Dialog form = dialog;
|
||||
|
||||
RPCservice.parseCVSString(result, listAttributes,
|
||||
new AsyncCallback<List<Row>>() {
|
||||
|
@ -1646,14 +1671,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// operation is performed the entire panel is masked.
|
||||
if (submitQueryEventManaged == true) {
|
||||
|
||||
submitQueryEventManaged = false;
|
||||
|
||||
Dialog form = toolbar.getDialogForm();
|
||||
// submitQueryEventManaged = false;
|
||||
|
||||
// Dialog form = toolbar.getDialogForm();
|
||||
//
|
||||
if (form.isMasked())
|
||||
form.unmask();
|
||||
|
||||
form.hide();
|
||||
// form.hide();
|
||||
|
||||
} else {
|
||||
if (obj.isMasked()) {
|
||||
|
@ -1683,8 +1708,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// submitResult.setHeading("Submit Query");
|
||||
// submitResult.setWidth(290);
|
||||
// submitResult.setHeight(250);
|
||||
submitResult.setModal(true);
|
||||
submitResult.setBlinkModal(true);
|
||||
// submitResult.setModal(true);
|
||||
// submitResult.setBlinkModal(true);
|
||||
// submitResult.setBodyStyle("padding:9px;");
|
||||
submitResult.setSize(600, 400);
|
||||
// submitResult.setScrollMode(Scroll.AUTO);
|
||||
|
@ -1717,14 +1742,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
|
||||
if (submitQueryEventManaged == true) {
|
||||
// clear variable
|
||||
submitQueryEventManaged = false;
|
||||
|
||||
Dialog form = toolbar.getDialogForm();
|
||||
// submitQueryEventManaged = false;
|
||||
|
||||
// Dialog form = toolbar.getDialogForm();
|
||||
//
|
||||
if (form.isMasked())
|
||||
form.unmask();
|
||||
|
||||
form.hide();
|
||||
//
|
||||
// form.hide();
|
||||
|
||||
} else {
|
||||
if (obj.isMasked()) {
|
||||
|
@ -1735,13 +1760,13 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
|
||||
if (submitQueryEventManaged == true) {
|
||||
|
||||
submitQueryEventManaged = false;
|
||||
// submitQueryEventManaged = false;
|
||||
|
||||
Dialog form = toolbar.getDialogForm();
|
||||
// Dialog form = toolbar.getDialogForm();
|
||||
if (form.isMasked())
|
||||
form.unmask();
|
||||
|
||||
form.hide();
|
||||
//
|
||||
// form.hide();
|
||||
} else {
|
||||
if (obj.isMasked()) {
|
||||
obj.unmask();
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package org.gcube.portlets.user.databasesmanager.client.toolbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.gcube.portlets.user.databasesmanager.client.GWTdbManagerServiceAsync;
|
||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.FileModel;
|
||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.SubmitQueryData;
|
||||
import org.gcube.portlets.user.databasesmanager.client.events.LoadTablesEvent;
|
||||
import org.gcube.portlets.user.databasesmanager.client.events.RandomSamplingEvent;
|
||||
|
@ -41,12 +45,17 @@ public class GxtToolbarFunctionality {
|
|||
private Button btnSmartSample;
|
||||
private Button btnRandomSample;
|
||||
|
||||
private SubmitQueryData data;
|
||||
// private SubmitQueryData data;
|
||||
// toolbar
|
||||
private ToolBar toolBar;
|
||||
|
||||
// dialog list. Each dialog contains a form
|
||||
private LinkedHashMap<Integer, Dialog> dialogList = new LinkedHashMap<Integer, Dialog>();
|
||||
private LinkedHashMap<Integer, SubmitQueryData> submitQueryDataList = new LinkedHashMap<Integer, SubmitQueryData>();
|
||||
private static int ID = 0;
|
||||
|
||||
// the dialog that contains the form
|
||||
private Dialog dialog;
|
||||
// private Dialog dialog;
|
||||
private MessageBox sample;
|
||||
|
||||
// RPC service
|
||||
|
@ -75,7 +84,8 @@ public class GxtToolbarFunctionality {
|
|||
// btnSubmitQuery.setIcon(Resources.ICONS.text());
|
||||
btnTablesList.setScale(ButtonScale.SMALL);
|
||||
btnTablesList.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
btnTablesList.setToolTip("returns the list of tables contained in the database schema");
|
||||
btnTablesList
|
||||
.setToolTip("returns the list of tables contained in the database schema");
|
||||
toolBar.add(btnTablesList);
|
||||
|
||||
// Button for Submit Query
|
||||
|
@ -83,7 +93,8 @@ public class GxtToolbarFunctionality {
|
|||
// btnSubmitQuery.setIcon(Resources.ICONS.text());
|
||||
btnSubmitQuery.setScale(ButtonScale.SMALL);
|
||||
btnSubmitQuery.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
btnSubmitQuery.setToolTip("allows to submit a query to the selected database");
|
||||
btnSubmitQuery
|
||||
.setToolTip("allows to submit a query to the selected database");
|
||||
toolBar.add(btnSubmitQuery);
|
||||
|
||||
// // Button to get information about a database
|
||||
|
@ -96,7 +107,8 @@ public class GxtToolbarFunctionality {
|
|||
btnShowCreateTable = new Button(ConstantsPortlet.TABLEDETAILS);
|
||||
btnShowCreateTable.setScale(ButtonScale.SMALL);
|
||||
btnShowCreateTable.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
btnShowCreateTable.setToolTip("gets information about the selected table, e.g. create statement, number of rows, columns names");
|
||||
btnShowCreateTable
|
||||
.setToolTip("gets information about the selected table, e.g. create statement, number of rows, columns names");
|
||||
toolBar.add(btnShowCreateTable);
|
||||
toolBar.add(new SeparatorToolItem());
|
||||
|
||||
|
@ -111,14 +123,16 @@ public class GxtToolbarFunctionality {
|
|||
btnSmartSample = new Button(ConstantsPortlet.SMARTSAMPLING);
|
||||
btnSmartSample.setScale(ButtonScale.SMALL);
|
||||
btnSmartSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
btnSmartSample.setToolTip("retrieves the first 100 rows of the table, maximising the number of non empty columns");
|
||||
btnSmartSample
|
||||
.setToolTip("retrieves the first 100 rows of the table, maximising the number of non empty columns");
|
||||
toolBar.add(btnSmartSample);
|
||||
|
||||
// button for Random Sample
|
||||
btnRandomSample = new Button(ConstantsPortlet.RANDOMSAMPLING);
|
||||
btnRandomSample.setScale(ButtonScale.SMALL);
|
||||
btnRandomSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
btnRandomSample.setToolTip("retrieves 100 randomly picked rows from the table");
|
||||
btnRandomSample
|
||||
.setToolTip("retrieves 100 randomly picked rows from the table");
|
||||
toolBar.add(btnRandomSample);
|
||||
|
||||
// add(toolBar, new FlowData(10));
|
||||
|
@ -151,6 +165,7 @@ public class GxtToolbarFunctionality {
|
|||
btnSimpleSample.enable();
|
||||
btnSmartSample.enable();
|
||||
btnRandomSample.enable();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -165,13 +180,14 @@ public class GxtToolbarFunctionality {
|
|||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
// clear variable
|
||||
data = null;
|
||||
// data = null;
|
||||
|
||||
// dialog to insert inputs in order to submit a query
|
||||
dialog = new Dialog();
|
||||
final Dialog dialog = new Dialog();
|
||||
ID++;
|
||||
dialog.setLayout(new FitLayout());
|
||||
dialog.setModal(true);
|
||||
dialog.setBlinkModal(true);
|
||||
// dialog.setModal(true);
|
||||
// dialog.setBlinkModal(true);
|
||||
dialog.setButtons(Dialog.OKCANCEL);
|
||||
// dialog.setPlain(true);
|
||||
// dialog.setCollapsible(false);
|
||||
|
@ -192,9 +208,10 @@ public class GxtToolbarFunctionality {
|
|||
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
|
||||
|
||||
// recover info from dialog
|
||||
setInfoOnSubmitQuery(form);
|
||||
setInfoOnSubmitQuery(form, dialog);
|
||||
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"query submitted");
|
||||
|
@ -215,6 +232,7 @@ public class GxtToolbarFunctionality {
|
|||
dialog.hide();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -316,7 +334,7 @@ public class GxtToolbarFunctionality {
|
|||
});
|
||||
}
|
||||
|
||||
//selection buttons depending from the item selected in the tree
|
||||
// selection buttons depending from the item selected in the tree
|
||||
public void enableButtonOnToolbar(int infoTreeDepthSelectedItem,
|
||||
boolean infoSelectedItemIsSchema, String databaseType) {
|
||||
|
||||
|
@ -426,9 +444,12 @@ public class GxtToolbarFunctionality {
|
|||
|
||||
}
|
||||
|
||||
private void setInfoOnSubmitQuery(GxtFormSubmitQuery form) {
|
||||
private void setInfoOnSubmitQuery(GxtFormSubmitQuery form,
|
||||
Dialog SubmtQueryDialog) {
|
||||
|
||||
data = form.getSubmitQueryData();
|
||||
SubmitQueryData data = form.getSubmitQueryData();
|
||||
|
||||
// data = form.getSubmitQueryData();
|
||||
|
||||
String query = data.getQuery();
|
||||
|
||||
|
@ -437,21 +458,42 @@ public class GxtToolbarFunctionality {
|
|||
|
||||
} else {
|
||||
|
||||
dialog.mask("Loading", "x-mask-loading");
|
||||
//fire event
|
||||
dialogList.put(new Integer(ID), SubmtQueryDialog);
|
||||
submitQueryDataList.put(new Integer(ID), data);
|
||||
|
||||
|
||||
SubmtQueryDialog.mask("Loading", "x-mask-loading");
|
||||
|
||||
// fire event
|
||||
eventBus.fireEvent(new SubmitQueryEvent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SubmitQueryData getSubmitQueryData() {
|
||||
return data;
|
||||
// public SubmitQueryData getSubmitQueryData() {
|
||||
// return data;
|
||||
// }
|
||||
|
||||
// public LinkedHashMap<Dialog, ArrayList<String>> getDialogForm() {
|
||||
//
|
||||
// // return dialog;
|
||||
// return dialogList;
|
||||
//
|
||||
// }
|
||||
|
||||
public LinkedHashMap<Integer, Dialog> getDialogFormList() {
|
||||
return dialogList;
|
||||
}
|
||||
|
||||
public Dialog getDialogForm() {
|
||||
|
||||
return dialog;
|
||||
public LinkedHashMap<Integer, SubmitQueryData> getSubmitQueryDataList() {
|
||||
|
||||
return submitQueryDataList;
|
||||
}
|
||||
|
||||
public Integer getDialogID(){
|
||||
|
||||
return new Integer(ID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue