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;
|
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.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.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
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.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.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.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.widgetcommonevent.shared.TRId;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
|
@ -86,19 +91,26 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.debug("Attention",
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
"This tabular resource does not have a valid table");
|
getEventBus()
|
||||||
AlertMessageBox d = new AlertMessageBox("Attention",
|
.fireEvent(
|
||||||
"This tabular resource does not have a valid table");
|
new SessionExpiredEvent(
|
||||||
d.addHideHandler(new HideHandler() {
|
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) {
|
public void onHide(HideEvent event) {
|
||||||
deleteTRWithLastTableNull();
|
deleteTRWithLastTableNull();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -131,32 +143,35 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void callDeleteLastTable() {
|
protected void callDeleteLastTable() {
|
||||||
Log.debug("Delete TR:"
|
Log.debug("Call Delete TR:"
|
||||||
+ tdOpenSession.getSelectedTabResource().getTrId());
|
+ tdOpenSession.getSelectedTabResource().getTrId());
|
||||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(tdOpenSession
|
TDGWTServiceAsync.INSTANCE.removeTabularResource(tdOpenSession
|
||||||
.getSelectedTabResource().getTrId(), new AsyncCallback<Void>() {
|
.getSelectedTabResource().getTrId(), new AsyncCallback<Void>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
AlertMessageBox d = new AlertMessageBox("Error",
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
"Error on delete TabResource: "
|
getEventBus()
|
||||||
+ caught.getLocalizedMessage());
|
.fireEvent(
|
||||||
d.addHideHandler(new HideHandler() {
|
new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
public void onHide(HideEvent event) {
|
} else {
|
||||||
// TODO Auto-generated method stub
|
Log.error("Error on delete TabResource: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
}
|
UtilsGXT3.alert("Error",
|
||||||
});
|
"Error on delete TabResource: "
|
||||||
d.show();
|
+ caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(Void result) {
|
||||||
Log.debug("Remove tabular resource success");
|
Log.debug("Remove tabular resource success");
|
||||||
Log.debug("Check current tr for close: "+trId);
|
Log.debug("Check current tr for close: " + trId);
|
||||||
if (trId!=null && trId.getId()!=null && trId.getId().compareTo(
|
if (trId != null
|
||||||
tdOpenSession.getSelectedTabResource().getTrId()
|
&& trId.getId() != null
|
||||||
.getId()) == 0) {
|
&& trId.getId().compareTo(
|
||||||
|
tdOpenSession.getSelectedTabResource()
|
||||||
|
.getTrId().getId()) == 0) {
|
||||||
Log.debug("Fire Close Event on current TR");
|
Log.debug("Fire Close Event on current TR");
|
||||||
getEventBus().fireEvent(new RibbonEvent(RibbonType.CLOSE));
|
getEventBus().fireEvent(new RibbonEvent(RibbonType.CLOSE));
|
||||||
} else {
|
} else {
|
||||||
|
@ -181,18 +196,18 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
tdOpenSession.getSelectedTabResource(),
|
tdOpenSession.getSelectedTabResource(),
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<Void>() {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
AlertMessageBox d = new AlertMessageBox("Error",
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
"Error on set TabResource: "
|
getEventBus()
|
||||||
+ caught.getLocalizedMessage());
|
.fireEvent(
|
||||||
d.addHideHandler(new HideHandler() {
|
new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
public void onHide(HideEvent event) {
|
} else {
|
||||||
// TODO Auto-generated method stub
|
Log.error("Error on set TabResource: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
}
|
UtilsGXT3.alert("Error",
|
||||||
|
"Error on set TabResource: "
|
||||||
});
|
+ caught.getLocalizedMessage());
|
||||||
d.show();
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
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.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.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.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
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.data.shared.loader.LoadResultListStoreBinding;
|
||||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
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.box.ConfirmMessageBox;
|
||||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
@ -90,9 +91,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
private TabResource removableTR;
|
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.res = res;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
Log.debug("TabResourcesSelectionPanel");
|
Log.debug("TabResourcesSelectionPanel");
|
||||||
|
@ -277,19 +278,10 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
Log.debug("Error retrieving tabular resource: "
|
Log.error("Error retrieving tabular resource: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
AlertMessageBox d = new AlertMessageBox("Error!",
|
|
||||||
"Error retrieving tabular resources on server!");
|
"Error retrieving tabular resources on server!");
|
||||||
d.addHideHandler(new HideHandler() {
|
|
||||||
|
|
||||||
public void onHide(HideEvent event) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
}
|
}
|
||||||
callback.onFailure(caught);
|
callback.onFailure(caught);
|
||||||
}
|
}
|
||||||
|
@ -357,21 +349,31 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
AlertMessageBox d = new AlertMessageBox("Error",
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
"Error on delete TabResource: "
|
parent.getEventBus()
|
||||||
+ caught.getLocalizedMessage());
|
.fireEvent(
|
||||||
d.addHideHandler(new HideHandler() {
|
new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
public void onHide(HideEvent event) {
|
} else {
|
||||||
// TODO Auto-generated method stub
|
Log.error("Error on delete TabResource: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
}
|
UtilsGXT3.alert("Error",
|
||||||
});
|
"Error on delete TabResource: "
|
||||||
d.show();
|
+ caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
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();
|
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