Fixed Final and Lock error

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget@100236 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-26 16:15:38 +00:00 committed by Giancarlo Panichi
parent a933413393
commit 2871b486f7
7 changed files with 160 additions and 188 deletions

View File

@ -4,8 +4,8 @@ import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionColumnsMapping;
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Command;

View File

@ -4,18 +4,19 @@ import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionColumnsMapping;
import org.gcube.portlets.user.td.unionwizardwidget.client.custom.IconButton;
import org.gcube.portlets.user.td.unionwizardwidget.client.properties.ColumnDataProperties;
import org.gcube.portlets.user.td.unionwizardwidget.client.resources.UnionResourceBundle;
import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
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.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@ -158,11 +159,18 @@ public class ColumnMappingPanel extends ContentPanel {
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug("Error retrieving source columns: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error retrieving source columns",
"Error retrieving source columns on server!");
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.debug("Error retrieving source columns: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error retrieving source columns",
"Error retrieving source columns on server!");
}
}
}
@ -189,11 +197,18 @@ public class ColumnMappingPanel extends ContentPanel {
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug("Error retrieving union columns: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error retrieving union columns",
"Error retrieving union columns on server!");
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.debug("Error retrieving union columns: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error retrieving union columns",
"Error retrieving union columns on server!");
}
}
}
@ -321,8 +336,9 @@ public class ColumnMappingPanel extends ContentPanel {
.toString()) == 0)) {
storeComboUnionColumn.add(col);
} else {
if (col.getDataTypeName().compareTo(selectedSourceColumn
.getDataTypeName())==0) {
if (col.getDataTypeName().compareTo(
selectedSourceColumn
.getDataTypeName()) == 0) {
storeComboUnionColumn.add(col);
} else {
@ -462,8 +478,9 @@ public class ColumnMappingPanel extends ContentPanel {
.toString()) == 0)) {
storeComboUnionColumn.add(col);
} else {
if (col.getDataTypeName().compareTo(selectedSourceColumn
.getDataTypeName())==0) {
if (col.getDataTypeName().compareTo(
selectedSourceColumn
.getDataTypeName()) == 0) {
storeComboUnionColumn.add(col);
} else {

View File

@ -1,14 +1,15 @@
package org.gcube.portlets.user.td.unionwizardwidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
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.union.UnionSession;
import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
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.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.SelectionEvent;
@ -33,13 +34,15 @@ public class TabResourcesSelectionCard extends WizardCard {
this.unionSession = unionSession;
thisCard = this;
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,res);
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,
res);
tabResourcesSelectionPanel
.addSelectionHandler(new SelectionHandler<TabResource>() {
public void onSelection(SelectionEvent<TabResource> event) {
unionSession.setUnionTabularResource(tabResourcesSelectionPanel
unionSession
.setUnionTabularResource(tabResourcesSelectionPanel
.getSelectedItem());
getWizardWindow().setEnableNextButton(true);
}
@ -58,7 +61,7 @@ public class TabResourcesSelectionCard extends WizardCard {
public void execute() {
Log.debug("TabResourcesSelectionCard Call sayNextCard");
retrieveLastTable();
}
};
@ -80,17 +83,13 @@ public class TabResourcesSelectionCard extends WizardCard {
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(true);
}
protected void retrieveLastTable() {
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
TDGWTServiceAsync.INSTANCE.getLastTable(unionSession
.getUnionTabularResource().getTrId(),
new AsyncCallback<TableData>() {
@ -130,7 +129,7 @@ public class TabResourcesSelectionCard extends WizardCard {
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
.name())) {
callDeleteLastTable();
} else if (mb.getHideButton() == mb
.getButtonById(PredefinedButton.NO.name())) {
getWizardWindow().setEnableNextButton(true);
@ -142,28 +141,49 @@ public class TabResourcesSelectionCard extends WizardCard {
mb.show();
}
protected void callDeleteLastTable(){
Log.debug("Delete TR:" + unionSession.getUnionTabularResource()
.getTrId());
TDGWTServiceAsync.INSTANCE.removeTabularResource(unionSession.getUnionTabularResource()
.getTrId(),
protected void callDeleteLastTable() {
Log.debug("Delete TR:"
+ unionSession.getUnionTabularResource().getTrId());
TDGWTServiceAsync.INSTANCE.removeTabularResource(unionSession
.getUnionTabularResource().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) {
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
getWizardWindow().setEnableNextButton(true);
getWizardWindow().setEnableBackButton(true);
} else {
AlertMessageBox d = new AlertMessageBox(
"Error",
"Error on delete TabResource: "
+ caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
getWizardWindow().setEnableNextButton(
true);
getWizardWindow().setEnableBackButton(
true);
}
});
d.show();
}
});
d.show();
}
}
public void onSuccess(Void result) {
@ -174,7 +194,6 @@ public class TabResourcesSelectionCard extends WizardCard {
});
}
protected void updateConnectedTRInfo(TableData table) {
TabResource tabResource = unionSession.getUnionTabularResource();
@ -184,45 +203,52 @@ public class TabResourcesSelectionCard extends WizardCard {
retriveCurrentTabularResourceInfo();
}
protected void retriveCurrentTabularResourceInfo() {
TDGWTServiceAsync.INSTANCE.getTabResourceInformation(
unionSession.getTrId(), new AsyncCallback<TabResource>() {
protected void retriveCurrentTabularResourceInfo(){
TDGWTServiceAsync.INSTANCE
.getTabResourceInformation(unionSession.getTrId(), new AsyncCallback<TabResource>() {
public void onSuccess(TabResource result) {
Log.info("Retrived TR: " + result.getTrId());
unionSession.setCurrentTabularResource(result);
goNext();
}
public void onSuccess(TabResource result) {
Log.info("Retrived TR: " + result.getTrId());
unionSession.setCurrentTabularResource(result);
goNext();
}
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(true);
} else {
UtilsGXT3
.alert("Error",
"Error retrienving information on current tabular resource: ");
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(true);
}
}
}
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus().fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
UtilsGXT3.alert("Error",
"Error retrienving information on current tabular resource: ");
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(true);
}
}
});
});
}
protected void goNext() {
try {
Log.info("NextCard ColumnMappingCard");
ColumnMappingCard columnSelectionCard = new ColumnMappingCard(
unionSession);
getWizardWindow().addCard(
columnSelectionCard);
getWizardWindow().addCard(columnSelectionCard);
getWizardWindow().nextCard();
} catch (Throwable e) {
Log.error("goNext: " + e.getLocalizedMessage());
}
}
}

View File

@ -5,12 +5,14 @@ import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
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.widgetcommonevent.client.event.SessionExpiredEvent;
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.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@ -37,7 +39,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;
@ -107,7 +108,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
protected void init() {
setHeaderVisible(false);
//new Resizable(this, Dir.E, Dir.SE, Dir.S);
// new Resizable(this, Dir.E, Dir.SE, Dir.S);
}
@ -216,7 +217,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
contextMenu = new Menu();
MenuItem deleteTRItem = new MenuItem("Delete");
deleteTRItem.setId("DeleteTR");
deleteTRItem.setIcon(org.gcube.portlets.user.td.unionwizardwidget.client.resources.UnionResourceBundle.INSTANCE.delete());
deleteTRItem
.setIcon(org.gcube.portlets.user.td.unionwizardwidget.client.resources.UnionResourceBundle.INSTANCE
.delete());
deleteTRItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
@ -270,17 +273,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
} else {
Log.debug("Error retrieving tabular resource: "
+ caught.getLocalizedMessage());
AlertMessageBox d = new AlertMessageBox("Error!",
"Error retrieving tabular resources on server!");
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
//
}
});
d.show();
UtilsGXT3
.alert("Error!",
"Error retrieving tabular resources on server!");
}
callback.onFailure(caught);
}
@ -345,18 +340,24 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
AlertMessageBox d = new AlertMessageBox("Error",
"Error on delete TabResource: "
if (caught instanceof TDGWTSessionExpiredException) {
parent.getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.error("Error on delete TabResource: "
+ caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
UtilsGXT3.alert("Error",
"Error on delete TabResource: "
+ caught.getLocalizedMessage());
}
});
d.show();
}
}
public void onSuccess(Void result) {
@ -365,5 +366,4 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
});
}
}

View File

@ -4,6 +4,8 @@
package org.gcube.portlets.user.td.unionwizardwidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
@ -20,13 +22,10 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlexTable;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
*
@ -106,11 +105,24 @@ public class UnionOperationInProgressCard extends WizardCard implements
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
showErrorAndHide(
"Error in Union",
"An error occured in union: "
+ caught.getLocalizedMessage(),
caught.getStackTrace().toString(), caught);
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error Locked",
caught.getLocalizedMessage(), caught);
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error Final",
caught.getLocalizedMessage(),
caught);
} else {
showErrorAndHide(
"Error in Union",
"An error occured in union: "
+ caught.getLocalizedMessage(),
caught);
}
}
}
}
});
@ -177,12 +189,8 @@ public class UnionOperationInProgressCard extends WizardCard implements
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
AlertMessageBox d = new AlertMessageBox("Error in Union", reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
showErrorAndHide("Error in Union", reason, caught);
}
forceLayout();
}

View File

@ -1,28 +0,0 @@
package org.gcube.portlets.user.td.unionwizardwidget.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());
}
}

View File

@ -1,51 +0,0 @@
package org.gcube.portlets.user.td.unionwizardwidget.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();
}
}