enhancements
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@90497 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
215a64a024
commit
56e0006123
|
@ -214,7 +214,7 @@ public class AppController implements SubscriberInterface {
|
|||
|
||||
|
||||
@Override
|
||||
public void onCopyAndPaste(PasteItemEvent pasteItemEvent) {
|
||||
public void onCutCopyAndPaste(PasteItemEvent pasteItemEvent) {
|
||||
|
||||
String folderDestinationId = null;
|
||||
if(pasteItemEvent.getFolderDestinationId()!=null){ //IF FOLDER DESTINATION EXISTS
|
||||
|
@ -232,7 +232,7 @@ public class AppController implements SubscriberInterface {
|
|||
|
||||
if(folderDestinationId!=null){
|
||||
// Info.display("Info", "pasting...");
|
||||
AppControllerExplorer.getEventBus().fireEvent(new PasteItemEvent(pasteItemEvent.getIds(), folderDestinationId));
|
||||
AppControllerExplorer.getEventBus().fireEvent(new PasteItemEvent(pasteItemEvent.getIds(), folderDestinationId, pasteItemEvent.getOperationType()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -26,7 +26,8 @@ import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
|||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||
import org.gcube.portlets.user.workspace.client.view.grids.GxtGridFilterGroupPanel;
|
||||
import org.gcube.portlets.user.workspace.client.view.tree.CopyAndPaste;
|
||||
import org.gcube.portlets.user.workspace.client.view.tree.CutCopyAndPaste;
|
||||
import org.gcube.portlets.user.workspace.client.view.tree.CutCopyAndPaste.OperationType;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.ButtonArrowAlign;
|
||||
import com.extjs.gxt.ui.client.Style.ButtonScale;
|
||||
|
@ -66,6 +67,7 @@ public class GxtToolBarItemFunctionality {
|
|||
private Button btnPublicLink;
|
||||
private Button btnCopyItem;
|
||||
private Button btnPasteItem;
|
||||
private Button btnCutItem;
|
||||
|
||||
public GxtToolBarItemFunctionality() {
|
||||
initToolBar();
|
||||
|
@ -137,29 +139,28 @@ public class GxtToolBarItemFunctionality {
|
|||
toolBar.add(btnRenameItem);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//COPY
|
||||
btnCopyItem = new Button("Copy", Resources.getIconRenameItem());
|
||||
btnCopyItem = new Button("Copy", Resources.getIconCopy());
|
||||
btnCopyItem.setScale(ButtonScale.SMALL);
|
||||
btnCopyItem.setIconAlign(IconAlign.TOP);
|
||||
btnCopyItem.setIcon(Resources.getIconCopy());
|
||||
toolBar.add(btnCopyItem);
|
||||
|
||||
|
||||
//CUT
|
||||
btnCutItem = new Button("Cut", Resources.getIconCut());
|
||||
btnCutItem.setScale(ButtonScale.SMALL);
|
||||
btnCutItem.setIconAlign(IconAlign.TOP);
|
||||
// toolBar.add(btnCutItem);
|
||||
|
||||
//PASTE
|
||||
btnPasteItem = new Button("Paste", Resources.getIconRenameItem());
|
||||
btnPasteItem = new Button("Paste", Resources.getIconPaste());
|
||||
btnPasteItem.setScale(ButtonScale.SMALL);
|
||||
btnPasteItem.setIconAlign(IconAlign.TOP);
|
||||
btnPasteItem.setIcon(Resources.getIconPaste());
|
||||
btnPasteItem.setEnabled(false); //BY DEFAULT IS DISABLED
|
||||
|
||||
toolBar.add(btnPasteItem);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
btnDownloadFile = new Button(ConstantsPortlet.DOWNLOADITEM,Resources.getIconDownload());
|
||||
btnDownloadFile.setScale(ButtonScale.SMALL);
|
||||
btnDownloadFile.setIconAlign(IconAlign.TOP);
|
||||
|
@ -311,7 +312,27 @@ public class GxtToolBarItemFunctionality {
|
|||
|
||||
List<String> listTarget = gridGroupViewContainer.getIdsSelectedItems();
|
||||
if(listTarget!=null && listTarget.size()>0){
|
||||
CopyAndPaste.copy(listTarget);
|
||||
CutCopyAndPaste.copy(listTarget, OperationType.COPY);
|
||||
btnPasteItem.setEnabled(true);
|
||||
}
|
||||
|
||||
// final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
|
||||
//
|
||||
// if(fileGridModel.getIdentifier()!=null){
|
||||
// CopyAndPaste.copy(fileGridModel.getIdentifier());
|
||||
// btnPasteItem.setEnabled(true);
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
btnCutItem.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
List<String> listTarget = gridGroupViewContainer.getIdsSelectedItems();
|
||||
if(listTarget!=null && listTarget.size()>0){
|
||||
CutCopyAndPaste.copy(listTarget, OperationType.CUT);
|
||||
btnPasteItem.setEnabled(true);
|
||||
}
|
||||
|
||||
|
@ -336,8 +357,15 @@ public class GxtToolBarItemFunctionality {
|
|||
if(parentTarget!=null)
|
||||
parentId=parentTarget.getIdentifier();
|
||||
|
||||
AppController.getEventBus().fireEvent(new PasteItemEvent(CopyAndPaste.getCopiedIdsFilesModel(), parentId));
|
||||
CopyAndPaste.setCopiedIdsFileModels(null);
|
||||
PasteItemEvent event = new PasteItemEvent(CutCopyAndPaste.getCopiedIdsFilesModel(), parentId, CutCopyAndPaste.getOperationType());
|
||||
|
||||
if(event.getOperationType().equals(OperationType.CUT))
|
||||
event.setFolderSourceId(null);
|
||||
|
||||
AppController.getEventBus().fireEvent(event);
|
||||
|
||||
CutCopyAndPaste.setCopiedIdsFileModels(null);
|
||||
CutCopyAndPaste.setOperationType(null);
|
||||
btnPasteItem.setEnabled(false);
|
||||
|
||||
}
|
||||
|
@ -621,6 +649,7 @@ public class GxtToolBarItemFunctionality {
|
|||
this.btnDownloadFile.disable();
|
||||
this.btnOpen.disable();
|
||||
this.btnCopyItem.disable();
|
||||
this.btnCutItem.disable();
|
||||
// this.btnGetInfo.disable();
|
||||
// this.btnGetSharedLink.disable();
|
||||
} else {
|
||||
|
@ -629,6 +658,7 @@ public class GxtToolBarItemFunctionality {
|
|||
this.btnDownloadFile.enable();
|
||||
this.btnOpen.enable();
|
||||
this.btnCopyItem.enable();
|
||||
this.btnCutItem.enable();
|
||||
// this.btnGetInfo.enable();
|
||||
}
|
||||
|
||||
|
@ -661,6 +691,7 @@ public class GxtToolBarItemFunctionality {
|
|||
//ONLY ENABLED
|
||||
this.btnRemoveItem.setEnabled(active);
|
||||
this.btnCopyItem.setEnabled(active);
|
||||
this.btnCutItem.setEnabled(active);
|
||||
}
|
||||
|
||||
public ToolBar getToolBar() {
|
||||
|
|
Loading…
Reference in New Issue