diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/client/toolbar/GxtToolbarFunctionality.java b/src/main/java/org/gcube/portlets/user/databasesmanager/client/toolbar/GxtToolbarFunctionality.java index 40b38a5..c010906 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/client/toolbar/GxtToolbarFunctionality.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/client/toolbar/GxtToolbarFunctionality.java @@ -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() { + + @Override + public void handleEvent(WindowEvent be) { + // TODO Auto-generated method stub + //collpse the dialog + be.getWindow().collapse(); + + } + }); + + dialog.addListener(Events.Maximize, + new Listener() { + + @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() { @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); - + } }