added the event handler for the minimize dialog (that collapse the dialog). Method maximize overridden when a dialog is created in order to expand the dialog if it is has been collapsed with the minimize.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98993 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-07-25 13:54:30 +00:00
parent 422bb45ba7
commit 3913c2d6cf
1 changed files with 56 additions and 10 deletions

View File

@ -22,9 +22,14 @@ import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
import com.extjs.gxt.ui.client.Style.ButtonArrowAlign;
import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.event.WindowEvent;
import com.extjs.gxt.ui.client.event.WindowListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
@ -183,18 +188,31 @@ public class GxtToolbarFunctionality {
// data = null;
// dialog to insert inputs in order to submit a query
final Dialog dialog = new Dialog();
final Dialog dialog = new Dialog() {
//override the maximize event modifying it with a different behaviour if the mimimize event occurs
public void maximize() {
if (isCollapsed()) {
expand();
} else {
super.maximize();
}
}
};
ID++;
dialog.setLayout(new FitLayout());
// dialog.setModal(true);
// dialog.setBlinkModal(true);
// dialog.setBlinkModal(true);
dialog.setButtons(Dialog.OKCANCEL);
// dialog.setPlain(true);
// dialog.setCollapsible(false);
dialog.setResizable(false);
dialog.setMaximizable(true);
dialog.setMinimizable(true);
dialog.setHeading("Submit Query");
dialog.setSize(600, 500);
// dialog.setConstrain(false);
// dialog.setTitleCollapse(true);
// dialog.setWidth(290);
// dialog.setHeight(250);
@ -203,13 +221,42 @@ public class GxtToolbarFunctionality {
dialog.add(form);
dialog.show();
//mimimize event handled
dialog.addListener(Events.Minimize,
new Listener<WindowEvent>() {
@Override
public void handleEvent(WindowEvent be) {
// TODO Auto-generated method stub
//collpse the dialog
be.getWindow().collapse();
}
});
dialog.addListener(Events.Maximize,
new Listener<WindowEvent>() {
@Override
public void handleEvent(WindowEvent be) {
// TODO Auto-generated method stub
//expand the dialog
if (be.getWindow().isCollapsed()) {
be.getWindow().expand();
}
}
});
dialog.getButtonById(Dialog.OK).addSelectionListener(
new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
// recover info from dialog
setInfoOnSubmitQuery(form, dialog);
@ -232,7 +279,7 @@ public class GxtToolbarFunctionality {
dialog.hide();
}
});
}
});
@ -460,7 +507,6 @@ public class GxtToolbarFunctionality {
dialogList.put(new Integer(ID), SubmtQueryDialog);
submitQueryDataList.put(new Integer(ID), data);
SubmtQueryDialog.mask("Loading", "x-mask-loading");
@ -489,11 +535,11 @@ public class GxtToolbarFunctionality {
return submitQueryDataList;
}
public Integer getDialogID(){
public Integer getDialogID() {
return new Integer(ID);
}
}