Updated delete resources

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-resources-widget@117012 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-07-06 11:01:21 +00:00
parent 6f1a439d4f
commit 71223f3d28
3 changed files with 31 additions and 14 deletions

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.td.resourceswidget.client; package org.gcube.portlets.user.td.resourceswidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor;
@ -315,7 +317,9 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
} }
private void requestRemove() { private void requestRemove() {
parent.requestRemove(descriptor); ArrayList<ResourceTDDescriptor> resources=new ArrayList<ResourceTDDescriptor>();
resources.add(descriptor);
parent.requestRemove(resources);
} }

View File

@ -382,7 +382,7 @@ public class ResourcesListViewPanel extends FramedPanel {
} }
})); }));
listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); listView.getSelectionModel().setSelectionMode(SelectionMode.MULTI);
listView.getSelectionModel().addSelectionChangedHandler( listView.getSelectionModel().addSelectionChangedHandler(
new SelectionChangedHandler<ResourceTDDescriptor>() { new SelectionChangedHandler<ResourceTDDescriptor>() {
@Override @Override
@ -569,8 +569,12 @@ public class ResourcesListViewPanel extends FramedPanel {
@Override @Override
public void onSelection(SelectionEvent<Item> event) { public void onSelection(SelectionEvent<Item> event) {
ResourceTDDescriptor selected = listView.getSelectionModel() List<ResourceTDDescriptor> resources= listView.getSelectionModel()
.getSelectedItem(); .getSelectedItems();
ResourceTDDescriptor selected=null;
if(resources!=null&&resources.size()>0){
selected=resources.get(0);
}
Log.debug("selected: " + selected); Log.debug("selected: " + selected);
requestOpen(selected); requestOpen(selected);
} }
@ -584,8 +588,12 @@ public class ResourcesListViewPanel extends FramedPanel {
@Override @Override
public void onSelection(SelectionEvent<Item> event) { public void onSelection(SelectionEvent<Item> event) {
ResourceTDDescriptor selected = listView.getSelectionModel() List<ResourceTDDescriptor> resources= listView.getSelectionModel()
.getSelectedItem(); .getSelectedItems();
ResourceTDDescriptor selected=null;
if(resources!=null&&resources.size()>0){
selected=resources.get(0);
}
Log.debug("selected: " + selected); Log.debug("selected: " + selected);
requestSave(selected); requestSave(selected);
} }
@ -599,10 +607,11 @@ public class ResourcesListViewPanel extends FramedPanel {
@Override @Override
public void onSelection(SelectionEvent<Item> event) { public void onSelection(SelectionEvent<Item> event) {
ResourceTDDescriptor selected = listView.getSelectionModel() List<ResourceTDDescriptor> selected= listView.getSelectionModel()
.getSelectedItem(); .getSelectedItems();
Log.debug("selected: " + selected); Log.debug("selected: " + selected);
requestRemove(selected); ArrayList<ResourceTDDescriptor> resources=new ArrayList<ResourceTDDescriptor>(selected);
requestRemove(resources);
} }
}); });
@ -770,10 +779,11 @@ public class ResourcesListViewPanel extends FramedPanel {
}); });
} }
protected void requestRemove(ResourceTDDescriptor resourceTDDescriptor) { protected void requestRemove(ArrayList<ResourceTDDescriptor> resourcesList) {
ArrayList<ResourceTDDescriptor> resources=new ArrayList<ResourceTDDescriptor>(resourcesList);
removeResourceSession = new RemoveResourceSession(trId, removeResourceSession = new RemoveResourceSession(trId,
resourceTDDescriptor); resources);
TDGWTServiceAsync.INSTANCE.removeResource(removeResourceSession, TDGWTServiceAsync.INSTANCE.removeResource(removeResourceSession,
new AsyncCallback<Void>() { new AsyncCallback<Void>() {

View File

@ -601,9 +601,12 @@ public class ResourcesPanel extends FramedPanel {
} }
protected void requestRemove(ResourceTDDescriptor resourceTDDescriptor) { protected void requestRemove(ResourceTDDescriptor resourceTDDescriptor) {
ArrayList<ResourceTDDescriptor> resources=new ArrayList<ResourceTDDescriptor>();
resources.add(resourceTDDescriptor);
removeResourceSession = new RemoveResourceSession(trId, removeResourceSession = new RemoveResourceSession(trId,
resourceTDDescriptor); resources);
TDGWTServiceAsync.INSTANCE.removeResource(removeResourceSession, TDGWTServiceAsync.INSTANCE.removeResource(removeResourceSession,
new AsyncCallback<Void>() { new AsyncCallback<Void>() {