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,
|
public void operationFailed(Throwable caught, String reason,
|
||||||
String failureDetails) {
|
String failureDetails) {
|
||||||
card.showErrorAndHide("Error uploading the xml file", reason,
|
card.showErrorAndHide("Error uploading the xml file", reason,
|
||||||
failureDetails, caught);
|
caught);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void operationComplete() {
|
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.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
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.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
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.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.event.SessionExpiredEvent;
|
||||||
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.widgetcommonevent.shared.TRId;
|
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.google.gwt.user.client.ui.FlexTable;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
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.BoxLayoutContainer.BoxLayoutData;
|
||||||
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
|
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;
|
||||||
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
|
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>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CodelistMappingOperationInProgressCard extends WizardCard implements
|
public class CodelistMappingOperationInProgressCard extends WizardCard
|
||||||
MonitorDialogListener {
|
implements MonitorDialogListener {
|
||||||
|
|
||||||
|
|
||||||
protected CodelistMappingOperationInProgressCard thisCard;
|
protected CodelistMappingOperationInProgressCard thisCard;
|
||||||
protected CodelistMappingSession codelistMappingSession;
|
protected CodelistMappingSession codelistMappingSession;
|
||||||
protected TRId newTrId;
|
protected TRId newTrId;
|
||||||
protected HtmlLayoutContainer resultField;
|
protected HtmlLayoutContainer resultField;
|
||||||
|
|
||||||
public CodelistMappingOperationInProgressCard(final CodelistMappingSession codelistMappingSession) {
|
public CodelistMappingOperationInProgressCard(
|
||||||
|
final CodelistMappingSession codelistMappingSession) {
|
||||||
super("Operation In Progress", "");
|
super("Operation In Progress", "");
|
||||||
|
|
||||||
this.codelistMappingSession = codelistMappingSession;
|
this.codelistMappingSession = codelistMappingSession;
|
||||||
|
@ -68,7 +66,8 @@ MonitorDialogListener {
|
||||||
|
|
||||||
description.setHTML(2, 0,
|
description.setHTML(2, 0,
|
||||||
"<span style=\"font-weight:bold;\";>Name: </span>");
|
"<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();
|
FramedPanel summary = new FramedPanel();
|
||||||
summary.setHeadingText("Import Summary");
|
summary.setHeadingText("Import Summary");
|
||||||
|
@ -87,10 +86,9 @@ MonitorDialogListener {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void importCodelistMapping() {
|
public void importCodelistMapping() {
|
||||||
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(codelistMappingSession,
|
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(
|
||||||
new AsyncCallback<String>() {
|
codelistMappingSession, new AsyncCallback<String>() {
|
||||||
|
|
||||||
public void onSuccess(String taskId) {
|
public void onSuccess(String taskId) {
|
||||||
openMonitorDialog(taskId);
|
openMonitorDialog(taskId);
|
||||||
|
@ -103,11 +101,24 @@ MonitorDialogListener {
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
showErrorAndHide(
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
"Error in import codelist mapping",
|
Log.error(caught.getLocalizedMessage());
|
||||||
"An error occured in import codelist mapping: "
|
showErrorAndHide("Error Locked",
|
||||||
+ caught.getLocalizedMessage(),
|
caught.getLocalizedMessage(), caught);
|
||||||
caught.getStackTrace().toString(), 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -122,13 +133,7 @@ MonitorDialogListener {
|
||||||
getWizardWindow().setNextButtonToFinish();
|
getWizardWindow().setNextButtonToFinish();
|
||||||
importCodelistMapping();
|
importCodelistMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
protected void openMonitorDialog(String taskId) {
|
protected void openMonitorDialog(String taskId) {
|
||||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, getEventBus());
|
MonitorDialog monitorDialog = new MonitorDialog(taskId, getEventBus());
|
||||||
|
@ -181,13 +186,19 @@ MonitorDialogListener {
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
AlertMessageBox d = new AlertMessageBox("Error in Codelist Mapping Import",
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
reason);
|
Log.error(caught.getLocalizedMessage());
|
||||||
d.addHideHandler(new HideHandler() {
|
showErrorAndHide("Error Locked", caught.getLocalizedMessage(),
|
||||||
public void onHide(HideEvent event) {
|
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();
|
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.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
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.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD;
|
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||||
|
@ -33,18 +35,16 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CodelistMappingTableDetailCard extends WizardCard
|
public class CodelistMappingTableDetailCard extends WizardCard implements
|
||||||
implements MonitorDialogListener {
|
MonitorDialogListener {
|
||||||
|
|
||||||
protected CodelistMappingSession codelistMappingSession;
|
protected CodelistMappingSession codelistMappingSession;
|
||||||
protected CodelistMappingTableDetailCard thisCard;
|
protected CodelistMappingTableDetailCard thisCard;
|
||||||
|
|
||||||
protected VerticalLayoutContainer p;
|
protected VerticalLayoutContainer p;
|
||||||
|
|
||||||
|
|
||||||
protected TextField name;
|
protected TextField name;
|
||||||
protected TextArea description;
|
protected TextArea description;
|
||||||
|
|
||||||
|
|
||||||
protected ResourceTD resourceDetails = new ResourceTD();
|
protected ResourceTD resourceDetails = new ResourceTD();
|
||||||
|
|
||||||
|
@ -55,21 +55,20 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
||||||
this.codelistMappingSession = codelistMappingSession;
|
this.codelistMappingSession = codelistMappingSession;
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
FramedPanel form = new FramedPanel();
|
FramedPanel form = new FramedPanel();
|
||||||
|
|
||||||
form.setHeadingText("Details");
|
form.setHeadingText("Details");
|
||||||
|
|
||||||
|
|
||||||
p = new VerticalLayoutContainer();
|
p = new VerticalLayoutContainer();
|
||||||
form.add(p);
|
form.add(p);
|
||||||
|
|
||||||
name = new TextField();
|
name = new TextField();
|
||||||
name.setAllowBlank(false);
|
name.setAllowBlank(false);
|
||||||
name.setEmptyText("Enter a name...");
|
name.setEmptyText("Enter a name...");
|
||||||
if(codelistMappingSession.getLocalFileName()!=null&&
|
if (codelistMappingSession.getLocalFileName() != null
|
||||||
!codelistMappingSession.getLocalFileName().isEmpty()){
|
&& !codelistMappingSession.getLocalFileName().isEmpty()) {
|
||||||
name.setValue(codelistMappingSession.getLocalFileName());
|
name.setValue(codelistMappingSession.getLocalFileName());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
name.setAllowBlank(false);
|
name.setAllowBlank(false);
|
||||||
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
||||||
|
@ -150,22 +149,25 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
||||||
|
|
||||||
codelistMappingSession.setResourceTD(resourceDetails);
|
codelistMappingSession.setResourceTD(resourceDetails);
|
||||||
|
|
||||||
/*CodelistMappingOperationInProgressCard codelistMappingOperationInProgressCard = new CodelistMappingOperationInProgressCard(
|
/*
|
||||||
codelistMappingSession);
|
* CodelistMappingOperationInProgressCard
|
||||||
getWizardWindow().addCard(codelistMappingOperationInProgressCard);
|
* codelistMappingOperationInProgressCard = new
|
||||||
Log.info("NextCard CodelistMappingOperationInProgressCard");
|
* CodelistMappingOperationInProgressCard( codelistMappingSession);
|
||||||
getWizardWindow().nextCard();*/
|
* getWizardWindow
|
||||||
|
* ().addCard(codelistMappingOperationInProgressCard);
|
||||||
|
* Log.info("NextCard CodelistMappingOperationInProgressCard");
|
||||||
|
* getWizardWindow().nextCard();
|
||||||
|
*/
|
||||||
importCodelistMapping();
|
importCodelistMapping();
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void importCodelistMapping() {
|
protected void importCodelistMapping() {
|
||||||
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(codelistMappingSession,
|
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(
|
||||||
new AsyncCallback<String>() {
|
codelistMappingSession, new AsyncCallback<String>() {
|
||||||
|
|
||||||
public void onSuccess(String taskId) {
|
public void onSuccess(String taskId) {
|
||||||
openMonitorDialog(taskId);
|
openMonitorDialog(taskId);
|
||||||
|
@ -178,18 +180,31 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
showErrorAndHide(
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
"Error in import codelist mapping",
|
Log.error(caught.getLocalizedMessage());
|
||||||
"An error occured in import codelist mapping: "
|
showErrorAndHide("Error Locked",
|
||||||
+ caught.getLocalizedMessage(),
|
caught.getLocalizedMessage(), caught);
|
||||||
caught.getStackTrace().toString(), 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openMonitorDialog(String taskId){
|
protected void openMonitorDialog(String taskId) {
|
||||||
MonitorDialog monitorDialog=new MonitorDialog(taskId,getEventBus());
|
MonitorDialog monitorDialog = new MonitorDialog(taskId, getEventBus());
|
||||||
monitorDialog.add(thisCard);
|
monitorDialog.add(thisCard);
|
||||||
monitorDialog.show();
|
monitorDialog.show();
|
||||||
}
|
}
|
||||||
|
@ -197,7 +212,7 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
||||||
@Override
|
@Override
|
||||||
public void operationComplete(TRId trId) {
|
public void operationComplete(TRId trId) {
|
||||||
getWizardWindow().fireCompleted(trId);
|
getWizardWindow().fireCompleted(trId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -208,29 +223,41 @@ public class CodelistMappingTableDetailCard extends WizardCard
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operationStopped(TRId trId, String reason, String details) {
|
public void operationStopped(TRId trId, String reason, String details) {
|
||||||
getWizardWindow().fireCompleted(trId);
|
getWizardWindow().fireCompleted(trId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operationAborted() {
|
public void operationAborted() {
|
||||||
getWizardWindow().fireAborted();
|
getWizardWindow().fireAborted();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operationPutInBackground() {
|
public void operationPutInBackground() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.codelistmappingimportwidget.client.workspace.WorkspacePanel;
|
||||||
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.codelisthelper.CodelistMappingSession;
|
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.exception.TDGWTSessionExpiredException;
|
||||||
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.SessionExpiredType;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
|
@ -135,10 +137,24 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
thisCard.showErrorAndHide("Error",
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
"Error retrieving the file from the workspace: "
|
Log.error(caught.getLocalizedMessage());
|
||||||
+ caught.getLocalizedMessage(),
|
showErrorAndHide("Error Locked",
|
||||||
caught.toString(), caught);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ColumnSelectionCard extends WizardCard {
|
||||||
Log.error("CodelistMappingSession has TRId null: "+codelistMappingSession.getConnectedTR());
|
Log.error("CodelistMappingSession has TRId null: "+codelistMappingSession.getConnectedTR());
|
||||||
}
|
}
|
||||||
|
|
||||||
columnsGridPanel = new ColumnDataGridPanel(trId);
|
columnsGridPanel = new ColumnDataGridPanel(this, trId);
|
||||||
|
|
||||||
columnsGridPanel
|
columnsGridPanel
|
||||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
.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.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
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.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.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.WizardCard;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -23,19 +26,22 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
|
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
|
||||||
protected TabResource selectedTabResource = null;
|
protected TabResource selectedTabResource = null;
|
||||||
|
|
||||||
public TabResourcesSelectionCard(final CodelistMappingSession codelistMappingSession) {
|
public TabResourcesSelectionCard(
|
||||||
|
final CodelistMappingSession codelistMappingSession) {
|
||||||
super("Select the Codelist before curation", "");
|
super("Select the Codelist before curation", "");
|
||||||
Log.debug("TabResourcesSelectionCard");
|
Log.debug("TabResourcesSelectionCard");
|
||||||
this.codelistMappingSession = codelistMappingSession;
|
this.codelistMappingSession = codelistMappingSession;
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
|
|
||||||
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,res);
|
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,
|
||||||
|
res);
|
||||||
|
|
||||||
tabResourcesSelectionPanel
|
tabResourcesSelectionPanel
|
||||||
.addSelectionHandler(new SelectionHandler<TabResource>() {
|
.addSelectionHandler(new SelectionHandler<TabResource>() {
|
||||||
|
|
||||||
public void onSelection(SelectionEvent<TabResource> event) {
|
public void onSelection(SelectionEvent<TabResource> event) {
|
||||||
codelistMappingSession.setConnectedTR(tabResourcesSelectionPanel
|
codelistMappingSession
|
||||||
|
.setConnectedTR(tabResourcesSelectionPanel
|
||||||
.getSelectedItem());
|
.getSelectedItem());
|
||||||
getWizardWindow().setEnableNextButton(true);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +60,7 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Log.debug("TabResourcesSelectionCard Call sayNextCard");
|
Log.debug("TabResourcesSelectionCard Call sayNextCard");
|
||||||
retrieveLastTable();
|
retrieveLastTable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -76,45 +82,46 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(false);
|
||||||
getWizardWindow().setEnableBackButton(true);
|
getWizardWindow().setEnableBackButton(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void retrieveLastTable() {
|
protected void retrieveLastTable() {
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(false);
|
||||||
getWizardWindow().setEnableBackButton(false);
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.getLastTable(codelistMappingSession
|
TDGWTServiceAsync.INSTANCE.getLastTable(codelistMappingSession
|
||||||
.getConnectedTR().getTrId(),
|
.getConnectedTR().getTrId(), new AsyncCallback<TableData>() {
|
||||||
new AsyncCallback<TableData>() {
|
|
||||||
|
|
||||||
@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().fireEvent(
|
||||||
AlertMessageBox d = new AlertMessageBox("Attention",
|
new SessionExpiredEvent(
|
||||||
"This tabular resource does not have a valid table");
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
d.addHideHandler(new HideHandler() {
|
} 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
|
||||||
public void onSuccess(TableData result) {
|
public void onSuccess(TableData result) {
|
||||||
Log.debug("Retrieve last table: " + result);
|
Log.debug("Retrieve last table: " + result);
|
||||||
updateConnectedTRInfo(result);
|
updateConnectedTRInfo(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +133,7 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
|
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
|
||||||
.name())) {
|
.name())) {
|
||||||
callDeleteLastTable();
|
callDeleteLastTable();
|
||||||
|
|
||||||
} else if (mb.getHideButton() == mb
|
} else if (mb.getHideButton() == mb
|
||||||
.getButtonById(PredefinedButton.NO.name())) {
|
.getButtonById(PredefinedButton.NO.name())) {
|
||||||
getWizardWindow().setEnableNextButton(true);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
@ -138,39 +145,37 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
mb.show();
|
mb.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void callDeleteLastTable(){
|
|
||||||
Log.debug("Delete TR:" + codelistMappingSession.getConnectedTR()
|
|
||||||
.getTrId());
|
|
||||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(codelistMappingSession.getConnectedTR()
|
|
||||||
.getTrId(),
|
|
||||||
new AsyncCallback<Void>() {
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
protected void callDeleteLastTable() {
|
||||||
AlertMessageBox d = new AlertMessageBox("Error",
|
Log.debug("Delete TR:"
|
||||||
"Error on delete TabResource: "
|
+ codelistMappingSession.getConnectedTR().getTrId());
|
||||||
+ caught.getLocalizedMessage());
|
TDGWTServiceAsync.INSTANCE.removeTabularResource(codelistMappingSession
|
||||||
d.addHideHandler(new HideHandler() {
|
.getConnectedTR().getTrId(), new AsyncCallback<Void>() {
|
||||||
|
|
||||||
public void onHide(HideEvent event) {
|
public void onFailure(Throwable caught) {
|
||||||
getWizardWindow().setEnableNextButton(true);
|
AlertMessageBox d = new AlertMessageBox("Error",
|
||||||
getWizardWindow().setEnableBackButton(true);
|
"Error on delete TabResource: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
}
|
public void onHide(HideEvent event) {
|
||||||
});
|
getWizardWindow().setEnableNextButton(true);
|
||||||
d.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
|
||||||
tabResourcesSelectionPanel.gridReload();
|
|
||||||
getWizardWindow().setEnableNextButton(false);
|
|
||||||
getWizardWindow().setEnableBackButton(true);
|
getWizardWindow().setEnableBackButton(true);
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
tabResourcesSelectionPanel.gridReload();
|
||||||
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
getWizardWindow().setEnableBackButton(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void updateConnectedTRInfo(TableData table) {
|
protected void updateConnectedTRInfo(TableData table) {
|
||||||
TabResource tabResource = codelistMappingSession.getConnectedTR();
|
TabResource tabResource = codelistMappingSession.getConnectedTR();
|
||||||
|
@ -185,8 +190,7 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
Log.info("NextCard ColumnSelectionCard");
|
Log.info("NextCard ColumnSelectionCard");
|
||||||
ColumnSelectionCard columnSelectionCard = new ColumnSelectionCard(
|
ColumnSelectionCard columnSelectionCard = new ColumnSelectionCard(
|
||||||
codelistMappingSession);
|
codelistMappingSession);
|
||||||
getWizardWindow().addCard(
|
getWizardWindow().addCard(columnSelectionCard);
|
||||||
columnSelectionCard);
|
|
||||||
getWizardWindow().nextCard();
|
getWizardWindow().nextCard();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("goNext: " + e.getLocalizedMessage());
|
Log.error("goNext: " + e.getLocalizedMessage());
|
||||||
|
|
|
@ -5,12 +5,15 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
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.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.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.widgetcommonevent.client.event.SessionExpiredEvent;
|
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.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
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 org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.GWT;
|
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.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;
|
||||||
|
@ -107,7 +109,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
//new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
// new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +218,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
contextMenu = new Menu();
|
contextMenu = new Menu();
|
||||||
MenuItem deleteTRItem = new MenuItem("Delete");
|
MenuItem deleteTRItem = new MenuItem("Delete");
|
||||||
deleteTRItem.setId("DeleteTR");
|
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>() {
|
deleteTRItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -268,19 +272,24 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
Log.debug("Error retrieving tabular resource: "
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
+ caught.getLocalizedMessage());
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
parent.showErrorAndHide("Error Locked",
|
||||||
AlertMessageBox d = new AlertMessageBox("Error!",
|
caught.getLocalizedMessage(), caught);
|
||||||
"Error retrieving tabular resources on server!");
|
} else {
|
||||||
d.addHideHandler(new HideHandler() {
|
if (caught instanceof TDGWTIsFinalException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
public void onHide(HideEvent event) {
|
parent.showErrorAndHide("Error Final",
|
||||||
//
|
caught.getLocalizedMessage(),
|
||||||
|
caught);
|
||||||
|
} else {
|
||||||
|
Log.debug("Error retrieving tabular resource: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Error!",
|
||||||
|
"Error retrieving tabular resources on server!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
}
|
}
|
||||||
callback.onFailure(caught);
|
callback.onFailure(caught);
|
||||||
}
|
}
|
||||||
|
@ -345,18 +354,9 @@ 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",
|
UtilsGXT3.alert("Error",
|
||||||
"Error on delete TabResource: "
|
"Error on delete TabResource: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
d.addHideHandler(new HideHandler() {
|
|
||||||
|
|
||||||
public void onHide(HideEvent event) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
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.ArrayList;
|
||||||
import java.util.List;
|
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.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.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 org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -44,27 +49,31 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
protected final CheckBoxSelectionModel<ColumnData> sm;
|
protected final CheckBoxSelectionModel<ColumnData> sm;
|
||||||
|
|
||||||
protected final Grid<ColumnData> grid;
|
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");
|
Log.debug("ColumnDataGridPanel");
|
||||||
if(trId==null){
|
if (trId == null) {
|
||||||
Log.error("ColumnDataGridPanel: TRId is null");
|
Log.error("ColumnDataGridPanel: TRId is null");
|
||||||
}
|
}
|
||||||
Log.debug("ColumnDataGridPanel: "+trId.toString());
|
Log.debug("ColumnDataGridPanel: " + trId.toString());
|
||||||
this.trId=trId;
|
this.parent = parent;
|
||||||
|
this.trId = trId;
|
||||||
|
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
//setHeadingText("Columns");
|
// setHeadingText("Columns");
|
||||||
|
|
||||||
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
|
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
|
||||||
props.label(), 120,"Column");
|
props.label(), 120, "Column");
|
||||||
|
|
||||||
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
|
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
|
||||||
|
|
||||||
sm = new CheckBoxSelectionModel<ColumnData>(identity);
|
sm = new CheckBoxSelectionModel<ColumnData>(identity);
|
||||||
|
|
||||||
List<ColumnConfig<ColumnData, ?>> l = new ArrayList<ColumnConfig<ColumnData, ?>>();
|
List<ColumnConfig<ColumnData, ?>> l = new ArrayList<ColumnConfig<ColumnData, ?>>();
|
||||||
|
|
||||||
l.add(labelCol);
|
l.add(labelCol);
|
||||||
ColumnModel<ColumnData> cm = new ColumnModel<ColumnData>(l);
|
ColumnModel<ColumnData> cm = new ColumnModel<ColumnData>(l);
|
||||||
|
|
||||||
|
@ -122,12 +131,26 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
|
|
||||||
protected void loadData(ListLoadConfig loadConfig,
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
TDGWTServiceAsync.INSTANCE
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
.getColumns(trId, new AsyncCallback<ArrayList<ColumnData>>() {
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.error("No load columns: "
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
+ caught.getLocalizedMessage());
|
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);
|
callback.onFailure(caught);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +164,6 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ColumnData getSelectedItem() {
|
public ColumnData getSelectedItem() {
|
||||||
return grid.getSelectionModel().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