Added UtilsGXT3
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@93264 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7a0551ba9a
commit
c7f8a71d1b
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.expressionwidget.client;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.progress.ColumnFilterProgressDialog;
|
import org.gcube.portlets.user.td.expressionwidget.client.progress.ColumnFilterProgressDialog;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.resource.ExpressionResources;
|
import org.gcube.portlets.user.td.expressionwidget.client.resource.ExpressionResources;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterSession;
|
import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
@ -16,10 +17,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.sencha.gxt.widget.core.client.Window;
|
import com.sencha.gxt.widget.core.client.Window;
|
||||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +109,7 @@ public class ColumnFilterDialog extends Window {
|
||||||
HTML errorMessage = new HTML(
|
HTML errorMessage = new HTML(
|
||||||
"This type of column is not supported for now!");
|
"This type of column is not supported for now!");
|
||||||
add(errorMessage);
|
add(errorMessage);
|
||||||
alert("Error",
|
UtilsGXT3.alert("Error",
|
||||||
"This type of column is not supported for now!");
|
"This type of column is not supported for now!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +139,7 @@ public class ColumnFilterDialog extends Window {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.error("Error retrieving column: "
|
Log.error("Error retrieving column: "
|
||||||
+ caught.getMessage());
|
+ caught.getMessage());
|
||||||
alert("Error retrieving column", caught.getMessage());
|
UtilsGXT3.alert("Error retrieving column", caught.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(ColumnData result) {
|
public void onSuccess(ColumnData result) {
|
||||||
|
@ -172,7 +170,7 @@ public class ColumnFilterDialog extends Window {
|
||||||
Log.error("Error submitting the column filter: "
|
Log.error("Error submitting the column filter: "
|
||||||
+ caught.getMessage()+ " "+caught.getCause());
|
+ caught.getMessage()+ " "+caught.getCause());
|
||||||
caught.printStackTrace();
|
caught.printStackTrace();
|
||||||
alert("Error submitting the column filter", caught
|
UtilsGXT3.alert("Error submitting the column filter", caught
|
||||||
.getMessage());
|
.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -185,15 +183,5 @@ public class ColumnFilterDialog extends Window {
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void alert(String title, String message) {
|
|
||||||
final AlertMessageBox d = new AlertMessageBox(title, message);
|
|
||||||
d.addHideHandler(new HideHandler() {
|
|
||||||
|
|
||||||
public void onHide(HideEvent event) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.expressionwidget.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
@ -11,7 +12,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.sencha.gxt.core.client.dom.XElement;
|
|
||||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.event.BeforeShowEvent;
|
import com.sencha.gxt.widget.core.client.event.BeforeShowEvent;
|
||||||
|
@ -45,14 +45,13 @@ public class MultiColumnFilterPanel extends SimplePanel {
|
||||||
this.multiColumnFilterDialog=multiColumnFilterDialog;
|
this.multiColumnFilterDialog=multiColumnFilterDialog;
|
||||||
this.trId=trId;
|
this.trId=trId;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
XElement el=this.getElement().<XElement>cast();
|
UtilsGXT3.mask(this.getElement());
|
||||||
el.mask("Loading...");
|
|
||||||
load(trId);
|
load(trId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void create(){
|
protected void create(){
|
||||||
this.getElement().<XElement>cast().unmask();
|
UtilsGXT3.umask(this.getElement());
|
||||||
|
|
||||||
VerticalLayoutContainer vl=new VerticalLayoutContainer();
|
VerticalLayoutContainer vl=new VerticalLayoutContainer();
|
||||||
vl.setBorders(false);
|
vl.setBorders(false);
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.gcube.portlets.user.td.expressionwidget.client.utils;
|
||||||
|
|
||||||
|
import com.sencha.gxt.widget.core.client.box.MessageBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InfoMessageBox extends MessageBox {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a message box with an info icon and the specified title and
|
||||||
|
* message.
|
||||||
|
*
|
||||||
|
* @param title
|
||||||
|
* the message box title
|
||||||
|
* @param message
|
||||||
|
* the message displayed in the message box
|
||||||
|
*/
|
||||||
|
public InfoMessageBox(String title, String message) {
|
||||||
|
super(title, message);
|
||||||
|
|
||||||
|
setIcon(ICONS.info());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package org.gcube.portlets.user.td.expressionwidget.client.utils;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.Element;
|
||||||
|
import com.sencha.gxt.core.client.dom.XElement;
|
||||||
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class UtilsGXT3 {
|
||||||
|
public static void mask(Element element) {
|
||||||
|
XElement el = element.<XElement> cast();
|
||||||
|
el.mask("Loading...");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void umask(Element element) {
|
||||||
|
element.<XElement> cast().unmask();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void alert(String title, String message) {
|
||||||
|
final AlertMessageBox d = new AlertMessageBox(title, message);
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(String title, String message) {
|
||||||
|
final InfoMessageBox d = new InfoMessageBox(title, message);
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue