Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@99105 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3c1547d314
commit
77e89611ea
|
@ -3,12 +3,17 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.td.openwidget.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
||||
import org.gcube.portlets.user.td.openwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
|
||||
|
@ -86,19 +91,26 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.debug("Attention",
|
||||
"This tabular resource does not have a valid table");
|
||||
AlertMessageBox d = new AlertMessageBox("Attention",
|
||||
"This tabular resource does not have a valid table");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.debug("Attention",
|
||||
"This tabular resource does not have a valid table");
|
||||
AlertMessageBox d = new AlertMessageBox(
|
||||
"Attention",
|
||||
"This tabular resource does not have a valid table");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
deleteTRWithLastTableNull();
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
public void onHide(HideEvent event) {
|
||||
deleteTRWithLastTableNull();
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,32 +143,35 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
}
|
||||
|
||||
protected void callDeleteLastTable() {
|
||||
Log.debug("Delete TR:"
|
||||
Log.debug("Call Delete TR:"
|
||||
+ tdOpenSession.getSelectedTabResource().getTrId());
|
||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(tdOpenSession
|
||||
.getSelectedTabResource().getTrId(), new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
Log.debug("Remove tabular resource success");
|
||||
Log.debug("Check current tr for close: "+trId);
|
||||
if (trId!=null && trId.getId()!=null && trId.getId().compareTo(
|
||||
tdOpenSession.getSelectedTabResource().getTrId()
|
||||
.getId()) == 0) {
|
||||
Log.debug("Check current tr for close: " + trId);
|
||||
if (trId != null
|
||||
&& trId.getId() != null
|
||||
&& trId.getId().compareTo(
|
||||
tdOpenSession.getSelectedTabResource()
|
||||
.getTrId().getId()) == 0) {
|
||||
Log.debug("Fire Close Event on current TR");
|
||||
getEventBus().fireEvent(new RibbonEvent(RibbonType.CLOSE));
|
||||
} else {
|
||||
|
@ -181,18 +196,18 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
tdOpenSession.getSelectedTabResource(),
|
||||
new AsyncCallback<Void>() {
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
"Error on set TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
d.show();
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error on set TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error on set TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,11 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.openwidget.client.resources.ResourceBundleTDOpen;
|
||||
import org.gcube.portlets.user.td.openwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
@ -41,7 +43,6 @@ import com.sencha.gxt.data.shared.loader.ListLoader;
|
|||
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
|
@ -90,9 +91,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
|
||||
private TabResource removableTR;
|
||||
|
||||
private WizardCard parent;
|
||||
private TabResourcesSelectionCard parent;
|
||||
|
||||
public TabResourcesSelectionPanel(WizardCard parent, ResourceBundle res) {
|
||||
public TabResourcesSelectionPanel(TabResourcesSelectionCard parent, ResourceBundle res) {
|
||||
this.res = res;
|
||||
this.parent = parent;
|
||||
Log.debug("TabResourcesSelectionPanel");
|
||||
|
@ -277,19 +278,10 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.debug("Error retrieving tabular resource: "
|
||||
Log.error("Error retrieving tabular resource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
|
||||
AlertMessageBox d = new AlertMessageBox("Error!",
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error retrieving tabular resources on server!");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
//
|
||||
}
|
||||
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
@ -357,21 +349,31 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
parent.getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
Log.debug("Remove tabular resource success");
|
||||
Log.debug("Check current tr for close: "+parent.trId);
|
||||
if (parent.trId!=null && parent.trId.getId()!=null && parent.trId.getId().compareTo(
|
||||
removableTR.getTrId()
|
||||
.getId()) == 0) {
|
||||
Log.debug("Fire Close Event on current TR");
|
||||
parent.getEventBus().fireEvent(new RibbonEvent(RibbonType.CLOSE));
|
||||
} else {
|
||||
Log.debug("No tr opened");
|
||||
}
|
||||
gridReload();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package org.gcube.portlets.user.td.openwidget.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,51 @@
|
|||
package org.gcube.portlets.user.td.openwidget.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