Fixed Final and Lock error
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-codelistmapping-import-widget@100224 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
363d673c82
commit
2b630e06af
|
@ -163,7 +163,7 @@ public class CodelistMappingFileUploadPanel extends FormPanel {
|
|||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
card.showErrorAndHide("Error uploading the xml file", reason,
|
||||
failureDetails, caught);
|
||||
caught);
|
||||
}
|
||||
|
||||
public void operationComplete() {
|
||||
|
|
|
@ -5,9 +5,12 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
|||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
||||
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.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
import org.gcube.portlets.user.td.monitorwidget.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;
|
||||
|
@ -20,15 +23,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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -36,16 +34,16 @@ import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingOperationInProgressCard extends WizardCard implements
|
||||
MonitorDialogListener {
|
||||
|
||||
public class CodelistMappingOperationInProgressCard extends WizardCard
|
||||
implements MonitorDialogListener {
|
||||
|
||||
protected CodelistMappingOperationInProgressCard thisCard;
|
||||
protected CodelistMappingSession codelistMappingSession;
|
||||
protected TRId newTrId;
|
||||
protected HtmlLayoutContainer resultField;
|
||||
|
||||
public CodelistMappingOperationInProgressCard(final CodelistMappingSession codelistMappingSession) {
|
||||
public CodelistMappingOperationInProgressCard(
|
||||
final CodelistMappingSession codelistMappingSession) {
|
||||
super("Operation In Progress", "");
|
||||
|
||||
this.codelistMappingSession = codelistMappingSession;
|
||||
|
@ -68,7 +66,8 @@ MonitorDialogListener {
|
|||
|
||||
description.setHTML(2, 0,
|
||||
"<span style=\"font-weight:bold;\";>Name: </span>");
|
||||
description.setText(2, 1, codelistMappingSession.getResourceTD().getName());
|
||||
description.setText(2, 1, codelistMappingSession.getResourceTD()
|
||||
.getName());
|
||||
|
||||
FramedPanel summary = new FramedPanel();
|
||||
summary.setHeadingText("Import Summary");
|
||||
|
@ -87,10 +86,9 @@ MonitorDialogListener {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void importCodelistMapping() {
|
||||
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(codelistMappingSession,
|
||||
new AsyncCallback<String>() {
|
||||
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(
|
||||
codelistMappingSession, new AsyncCallback<String>() {
|
||||
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
|
@ -102,12 +100,25 @@ MonitorDialogListener {
|
|||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
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 import codelist mapping",
|
||||
"An error occured in import codelist mapping: "
|
||||
+ caught.getLocalizedMessage(),
|
||||
caught.getStackTrace().toString(), caught);
|
||||
caught);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -123,12 +134,6 @@ MonitorDialogListener {
|
|||
importCodelistMapping();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, getEventBus());
|
||||
|
@ -181,13 +186,19 @@ MonitorDialogListener {
|
|||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
AlertMessageBox d = new AlertMessageBox("Error in Codelist Mapping Import",
|
||||
reason);
|
||||
d.addHideHandler(new HideHandler() {
|
||||
public void onHide(HideEvent event) {
|
||||
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 {
|
||||
UtilsGXT3.alert("Error in Codelist Mapping Import", reason);
|
||||
}
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
|
|
@ -5,6 +5,8 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
|||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
||||
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.resource.ResourceTD;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
|
@ -33,19 +35,17 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingTableDetailCard extends WizardCard
|
||||
implements MonitorDialogListener {
|
||||
public class CodelistMappingTableDetailCard extends WizardCard implements
|
||||
MonitorDialogListener {
|
||||
|
||||
protected CodelistMappingSession codelistMappingSession;
|
||||
protected CodelistMappingTableDetailCard thisCard;
|
||||
|
||||
protected VerticalLayoutContainer p;
|
||||
|
||||
|
||||
protected TextField name;
|
||||
protected TextArea description;
|
||||
|
||||
|
||||
protected ResourceTD resourceDetails = new ResourceTD();
|
||||
|
||||
public CodelistMappingTableDetailCard(
|
||||
|
@ -58,15 +58,14 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
|||
|
||||
form.setHeadingText("Details");
|
||||
|
||||
|
||||
p = new VerticalLayoutContainer();
|
||||
form.add(p);
|
||||
|
||||
name = new TextField();
|
||||
name.setAllowBlank(false);
|
||||
name.setEmptyText("Enter a name...");
|
||||
if(codelistMappingSession.getLocalFileName()!=null&&
|
||||
!codelistMappingSession.getLocalFileName().isEmpty()){
|
||||
if (codelistMappingSession.getLocalFileName() != null
|
||||
&& !codelistMappingSession.getLocalFileName().isEmpty()) {
|
||||
name.setValue(codelistMappingSession.getLocalFileName());
|
||||
} else {
|
||||
|
||||
|
@ -150,11 +149,15 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
|||
|
||||
codelistMappingSession.setResourceTD(resourceDetails);
|
||||
|
||||
/*CodelistMappingOperationInProgressCard codelistMappingOperationInProgressCard = new CodelistMappingOperationInProgressCard(
|
||||
codelistMappingSession);
|
||||
getWizardWindow().addCard(codelistMappingOperationInProgressCard);
|
||||
Log.info("NextCard CodelistMappingOperationInProgressCard");
|
||||
getWizardWindow().nextCard();*/
|
||||
/*
|
||||
* CodelistMappingOperationInProgressCard
|
||||
* codelistMappingOperationInProgressCard = new
|
||||
* CodelistMappingOperationInProgressCard( codelistMappingSession);
|
||||
* getWizardWindow
|
||||
* ().addCard(codelistMappingOperationInProgressCard);
|
||||
* Log.info("NextCard CodelistMappingOperationInProgressCard");
|
||||
* getWizardWindow().nextCard();
|
||||
*/
|
||||
importCodelistMapping();
|
||||
|
||||
} catch (Throwable e) {
|
||||
|
@ -162,10 +165,9 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void importCodelistMapping() {
|
||||
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(codelistMappingSession,
|
||||
new AsyncCallback<String>() {
|
||||
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(
|
||||
codelistMappingSession, new AsyncCallback<String>() {
|
||||
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
|
@ -177,12 +179,25 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
|||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
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 import codelist mapping",
|
||||
"An error occured in import codelist mapping: "
|
||||
+ caught.getLocalizedMessage(),
|
||||
caught.getStackTrace().toString(), caught);
|
||||
caught);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -208,9 +223,22 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
|||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
getWizardWindow().fireFailed(caught, "Error in Codelist Mapping Import", details);
|
||||
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 {
|
||||
getWizardWindow().fireFailed(null,
|
||||
"Error in Codelist Mapping Import", caught);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -232,5 +260,4 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
|||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.workspace.WorkspacePanel;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
||||
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.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
|
@ -135,10 +137,24 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
|
|||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
thisCard.showErrorAndHide("Error",
|
||||
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",
|
||||
"Error retrieving the file from the workspace: "
|
||||
+ caught.getLocalizedMessage(),
|
||||
caught.toString(), caught);
|
||||
caught);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ColumnSelectionCard extends WizardCard {
|
|||
Log.error("CodelistMappingSession has TRId null: "+codelistMappingSession.getConnectedTR());
|
||||
}
|
||||
|
||||
columnsGridPanel = new ColumnDataGridPanel(trId);
|
||||
columnsGridPanel = new ColumnDataGridPanel(this, trId);
|
||||
|
||||
columnsGridPanel
|
||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
|
|
|
@ -2,8 +2,11 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
|||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
||||
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.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
@ -23,19 +26,22 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
|
||||
protected TabResource selectedTabResource = null;
|
||||
|
||||
public TabResourcesSelectionCard(final CodelistMappingSession codelistMappingSession) {
|
||||
public TabResourcesSelectionCard(
|
||||
final CodelistMappingSession codelistMappingSession) {
|
||||
super("Select the Codelist before curation", "");
|
||||
Log.debug("TabResourcesSelectionCard");
|
||||
this.codelistMappingSession = codelistMappingSession;
|
||||
thisCard = this;
|
||||
|
||||
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,res);
|
||||
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,
|
||||
res);
|
||||
|
||||
tabResourcesSelectionPanel
|
||||
.addSelectionHandler(new SelectionHandler<TabResource>() {
|
||||
|
||||
public void onSelection(SelectionEvent<TabResource> event) {
|
||||
codelistMappingSession.setConnectedTR(tabResourcesSelectionPanel
|
||||
codelistMappingSession
|
||||
.setConnectedTR(tabResourcesSelectionPanel
|
||||
.getSelectedItem());
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
}
|
||||
|
@ -77,10 +83,6 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void retrieveLastTable() {
|
||||
|
@ -88,11 +90,15 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
getWizardWindow().setEnableBackButton(false);
|
||||
|
||||
TDGWTServiceAsync.INSTANCE.getLastTable(codelistMappingSession
|
||||
.getConnectedTR().getTrId(),
|
||||
new AsyncCallback<TableData>() {
|
||||
.getConnectedTR().getTrId(), new AsyncCallback<TableData>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
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",
|
||||
|
@ -107,6 +113,7 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
d.show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TableData result) {
|
||||
|
@ -140,11 +147,10 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
}
|
||||
|
||||
protected void callDeleteLastTable() {
|
||||
Log.debug("Delete TR:" + codelistMappingSession.getConnectedTR()
|
||||
.getTrId());
|
||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(codelistMappingSession.getConnectedTR()
|
||||
.getTrId(),
|
||||
new AsyncCallback<Void>() {
|
||||
Log.debug("Delete TR:"
|
||||
+ codelistMappingSession.getConnectedTR().getTrId());
|
||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(codelistMappingSession
|
||||
.getConnectedTR().getTrId(), new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
|
@ -171,7 +177,6 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
protected void updateConnectedTRInfo(TableData table) {
|
||||
TabResource tabResource = codelistMappingSession.getConnectedTR();
|
||||
tabResource.setTrId(table.getTrId());
|
||||
|
@ -185,8 +190,7 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
Log.info("NextCard ColumnSelectionCard");
|
||||
ColumnSelectionCard columnSelectionCard = new ColumnSelectionCard(
|
||||
codelistMappingSession);
|
||||
getWizardWindow().addCard(
|
||||
columnSelectionCard);
|
||||
getWizardWindow().addCard(columnSelectionCard);
|
||||
getWizardWindow().nextCard();
|
||||
} catch (Throwable e) {
|
||||
Log.error("goNext: " + e.getLocalizedMessage());
|
||||
|
|
|
@ -5,12 +5,15 @@ 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.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.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 +40,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;
|
||||
|
@ -216,7 +218,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.codelistmappingimportwidget.client.dataresource.ResourceBundle.INSTANCE.delete());
|
||||
deleteTRItem
|
||||
.setIcon(org.gcube.portlets.user.td.codelistmappingimportwidget.client.dataresource.ResourceBundle.INSTANCE
|
||||
.delete());
|
||||
deleteTRItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
|
@ -267,20 +271,25 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
parent.showErrorAndHide("Error Locked",
|
||||
caught.getLocalizedMessage(), caught);
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
parent.showErrorAndHide("Error Final",
|
||||
caught.getLocalizedMessage(),
|
||||
caught);
|
||||
} else {
|
||||
Log.debug("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);
|
||||
}
|
||||
|
@ -345,18 +354,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
|
|
|
@ -3,8 +3,13 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client.grid;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.ColumnSelectionCard;
|
||||
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.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
@ -44,15 +49,19 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
protected final CheckBoxSelectionModel<ColumnData> sm;
|
||||
|
||||
protected final Grid<ColumnData> grid;
|
||||
protected TRId trId;
|
||||
|
||||
public ColumnDataGridPanel(TRId trId) {
|
||||
protected TRId trId;
|
||||
private ColumnSelectionCard parent;
|
||||
|
||||
public ColumnDataGridPanel(ColumnSelectionCard parent, TRId trId) {
|
||||
Log.debug("ColumnDataGridPanel");
|
||||
if (trId == null) {
|
||||
Log.error("ColumnDataGridPanel: TRId is null");
|
||||
}
|
||||
Log.debug("ColumnDataGridPanel: " + trId.toString());
|
||||
this.parent = parent;
|
||||
this.trId = trId;
|
||||
|
||||
setHeaderVisible(false);
|
||||
// setHeadingText("Columns");
|
||||
|
||||
|
@ -122,12 +131,26 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getColumns(trId, new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
parent.getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
parent.showErrorAndHide("Error Locked",
|
||||
caught.getLocalizedMessage(), caught);
|
||||
} else {
|
||||
Log.error("No load columns: "
|
||||
+ caught.getLocalizedMessage());
|
||||
|
||||
}
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
|
@ -141,8 +164,6 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ColumnData getSelectedItem() {
|
||||
return grid.getSelectionModel().getSelectedItem();
|
||||
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.util;
|
||||
|
||||
import com.google.gwt.core.client.Callback;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.sencha.gxt.widget.core.client.Dialog;
|
||||
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
||||
import com.sencha.gxt.widget.core.client.box.MessageBox;
|
||||
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 ErrorMessageBox {
|
||||
|
||||
|
||||
private static final String DETAILS = "Details";
|
||||
|
||||
|
||||
public static void showError(String title, String failureReason, final String failureDetails)
|
||||
{
|
||||
showError(title, failureReason, failureDetails, new NOPCallBack<Dialog, Void>());
|
||||
}
|
||||
|
||||
public static void showError(String title, String failureReason, final String failureDetails, final Callback<Dialog, Void> callback)
|
||||
{
|
||||
final MessageBox box = new MessageBox(title);
|
||||
box.setMessage(failureReason);
|
||||
box.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
Dialog dialog = (Dialog) event.getSource();
|
||||
|
||||
if (dialog.getHideButton().getText().equals(DETAILS)){
|
||||
//box.close();
|
||||
showErrorDetails("Error details", failureDetails);
|
||||
} else callback.onSuccess(dialog);
|
||||
}
|
||||
});
|
||||
|
||||
box.show();
|
||||
}
|
||||
|
||||
public static void showErrorDetails(String title, String failureDetails)
|
||||
{
|
||||
final Dialog simple = new Dialog();
|
||||
simple.setHeadingText(title);
|
||||
simple.setPredefinedButtons(PredefinedButton.OK);
|
||||
simple.setBodyStyleName("pad-text");
|
||||
|
||||
|
||||
simple.add(new Label("<PRE>"+failureDetails+"</PRE>"));
|
||||
|
||||
|
||||
simple.setHideOnButtonClick(true);
|
||||
simple.setWidth(400);
|
||||
simple.setHeight(400);
|
||||
simple.show();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class Format {
|
||||
|
||||
/**
|
||||
* Converts a file size into a {@link String} representation adding the misure unit.
|
||||
* @param size the file size.
|
||||
* @return the textual representation.
|
||||
*/
|
||||
public static String fileSize(long size) {
|
||||
StringBuilder text = new StringBuilder();
|
||||
if (size < 1024) {
|
||||
text.append(size);
|
||||
text.append(" bytes");
|
||||
} else if (size < 1048576) {
|
||||
text.append(Math.round(((size * 10) / 1024)) / 10);
|
||||
text.append(" KB");
|
||||
} else if (size < 1073741824) {
|
||||
text.append(Math.round(((size * 10) / 1048576)) / 10);
|
||||
text.append(" MB");
|
||||
} else {
|
||||
text.append(Math.round(((size * 10) / 1073741824)) / 10);
|
||||
text.append(" GB");
|
||||
}
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.util;
|
||||
|
||||
import com.google.gwt.core.client.Callback;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @param <T>
|
||||
* @param <F>
|
||||
*/
|
||||
public class NOPCallBack<T,F> implements Callback<T, F> {
|
||||
|
||||
public void onFailure(F reason) {}
|
||||
|
||||
public void onSuccess(T result) {}
|
||||
|
||||
}
|
Loading…
Reference in New Issue