1452: Implement a GUI for StatMan Algorithms Importer
Task-Url: https://support.d4science.org/issues/1452 Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122463 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9a095f8845
commit
42cf40b1de
|
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewMainCodeEvent;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
||||
|
@ -456,7 +456,7 @@ public class ProjectManager {
|
|||
&& project.getMainCode().getItemDescription() != null
|
||||
&& itemDescription.getId().compareTo(
|
||||
project.getMainCode().getItemDescription().getId()) == 0) {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention",
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"All previous configurations will be lost. Would you like to delete main code?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
||||
|
@ -466,7 +466,7 @@ public class ProjectManager {
|
|||
case NO:
|
||||
break;
|
||||
case YES:
|
||||
deleteItemOnServer(itemDescription,true);
|
||||
deleteItemOnServer(itemDescription, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -476,22 +476,43 @@ public class ProjectManager {
|
|||
});
|
||||
mb.setWidth(300);
|
||||
mb.show();
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
deleteItemOnServer(itemDescription, false);
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"Would you like to delete this resource?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
||||
@Override
|
||||
public void onDialogHide(DialogHideEvent event) {
|
||||
switch (event.getHideButton()) {
|
||||
case NO:
|
||||
break;
|
||||
case YES:
|
||||
deleteItemOnServer(itemDescription, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mb.setWidth(300);
|
||||
mb.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void deleteItemOnServer(ItemDescription itemDescription, final boolean mainCode){
|
||||
|
||||
private void deleteItemOnServer(ItemDescription itemDescription,
|
||||
final boolean mainCode) {
|
||||
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor();
|
||||
|
||||
StatAlgoImporterServiceAsync.INSTANCE.deleteResourceOnProject(
|
||||
itemDescription, new AsyncCallback<Project>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
|
@ -502,13 +523,13 @@ public class ProjectManager {
|
|||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Project result) {
|
||||
project=result;
|
||||
if(mainCode){
|
||||
monitor.hide();
|
||||
project = result;
|
||||
if (mainCode) {
|
||||
fireProjectStatusDeleteMainCodeEvent();
|
||||
} else {
|
||||
fireProjectStatusDeleteEvent();
|
||||
|
@ -550,7 +571,7 @@ public class ProjectManager {
|
|||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
|
||||
protected void fireProjectStatusDeleteMainCodeEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.DELETE_MAIN_CODE, project);
|
||||
|
|
|
@ -27,15 +27,12 @@ import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
|||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||
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.AccordionLayoutContainer.AccordionLayoutAppearance;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.DialogHideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
@ -313,33 +310,14 @@ public class ExplorerProjectPanel extends ContentPanel {
|
|||
}
|
||||
|
||||
private void deleteItem(SelectEvent event) {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"Would you like to delete this resource?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
||||
@Override
|
||||
public void onDialogHide(DialogHideEvent event) {
|
||||
switch (event.getHideButton()) {
|
||||
case NO:
|
||||
break;
|
||||
case YES:
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
DeleteItemEvent deleteItemEvent = new DeleteItemEvent(
|
||||
itemDescription);
|
||||
eventBus.fireEvent(deleteItemEvent);
|
||||
Log.debug("Fired: " + deleteItemEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mb.setWidth(300);
|
||||
mb.show();
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
DeleteItemEvent deleteItemEvent = new DeleteItemEvent(
|
||||
itemDescription);
|
||||
eventBus.fireEvent(deleteItemEvent);
|
||||
Log.debug("Fired: " + deleteItemEvent);
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
|
|
Loading…
Reference in New Issue