merged with brach release 2.13
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@71675 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ff8bf34e70
commit
bc643e20c2
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
|
|
16
pom.xml
16
pom.xml
|
@ -152,22 +152,6 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- REMOVE THIS -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.gcube.portlets.user</groupId> -->
|
||||
<!-- <artifactId>opengcubeapplication</artifactId> -->
|
||||
<!-- <version>1.0.0-SNAPSHOT</version> -->
|
||||
<!-- <scope>system</scope> -->
|
||||
<!-- <systemPath>/home/backup-old-home/francesco-mangiacrapa/workspace/opengcubeapplication/target/opengcubeapplication-1.0.0-SNAPSHOT.jar</systemPath> -->
|
||||
<!-- <exclusions> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <artifactId>opengcubeapplication</artifactId> -->
|
||||
<!-- <groupId>org.gcube.portlets.user</groupId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- </exclusions> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
|
|
|
@ -119,6 +119,7 @@ import com.extjs.gxt.ui.client.widget.Info;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HasWidgets;
|
||||
|
||||
|
@ -244,7 +245,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
final FileModel parentModel = parent;
|
||||
|
||||
|
||||
|
||||
finalDialog.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
||||
|
||||
@Override
|
||||
|
@ -288,9 +288,17 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if(result)
|
||||
eventBus.fireEvent(new RefreshFolderEvent(parentFileModel));
|
||||
if(result){
|
||||
FileModel parentToRefresh=null;
|
||||
|
||||
if(isNewFolder)
|
||||
parentToRefresh = parentModel;
|
||||
else
|
||||
parentToRefresh = parentFileModel;
|
||||
|
||||
eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh));
|
||||
GWT.log("share completed refresh folder : "+parentModel.getName());
|
||||
}
|
||||
explorerPanel.unmask();
|
||||
}
|
||||
});
|
||||
|
@ -383,8 +391,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
@Override
|
||||
public void onRefreshItem(RefreshFolderEvent refreshtemEvent) {
|
||||
|
||||
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshtemEvent.getFolderTarget().getIdentifier());
|
||||
notifySubscriber(refreshtemEvent);
|
||||
if(refreshtemEvent.getFolderTarget()!=null){
|
||||
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshtemEvent.getFolderTarget().getIdentifier());
|
||||
notifySubscriber(refreshtemEvent);
|
||||
}
|
||||
else
|
||||
GWT.log("warn: escape refresh because item is null");
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -824,7 +836,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
if(dgt.isValidForm()){
|
||||
|
||||
rpcWorkspaceService.renameItem(target.getIdentifier(), newName, new AsyncCallback<Boolean>(){
|
||||
rpcWorkspaceService.renameItem(target.getIdentifier(), newName, target.getName(), new AsyncCallback<Boolean>(){
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -859,8 +871,24 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
private void doDeleteItem(final DeleteItemEvent event){
|
||||
|
||||
MessageBoxConfirm mbc = new MessageBoxConfirm(ConstantsExplorer.MESSAGE_DELETE, ConstantsExplorer.MESSAGE_CONFIRM_DELETE_ITEM + " "+ event.getFileTarget().getName() +"?");
|
||||
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
||||
String title = "";
|
||||
String msg = "";
|
||||
|
||||
if(event.getFileTarget().isShared()){
|
||||
title = ConstantsExplorer.MESSAGE_DELETE;
|
||||
msg = "This item is shared. Deleting this item will affect other users. Continue?";
|
||||
}
|
||||
|
||||
else{
|
||||
title = ConstantsExplorer.MESSAGE_DELETE;
|
||||
msg = ConstantsExplorer.MESSAGE_CONFIRM_DELETE_ITEM + " "+ event.getFileTarget().getName() +"?";
|
||||
}
|
||||
|
||||
|
||||
MessageBoxConfirm mbc = new MessageBoxConfirm(title, msg);
|
||||
|
||||
|
||||
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
||||
|
||||
public void handleEvent(MessageBoxEvent be) {
|
||||
|
||||
|
@ -882,12 +910,23 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
FileModel fileModel = event.getFileTarget();
|
||||
if(explorerPanel.getAsycTreePanel().deleteItem(fileModel.getIdentifier())){
|
||||
explorerPanel.getAsycTreePanel().selectItem(fileModel.getParentFileModel().getIdentifier()); //Select parent of item deleted
|
||||
notifySubscriber(event);
|
||||
|
||||
}
|
||||
//Timer is used for chrome
|
||||
Timer t = new Timer() {
|
||||
public void run() {
|
||||
|
||||
FileModel fileModel = event.getFileTarget();
|
||||
if(explorerPanel.getAsycTreePanel().deleteItem(fileModel.getIdentifier())){
|
||||
explorerPanel.getAsycTreePanel().selectItem(fileModel.getParentFileModel().getIdentifier()); //Select parent of item deleted
|
||||
notifySubscriber(event);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Schedule the timer to run once every second, 1000 ms.
|
||||
t.schedule(250);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1204,13 +1243,21 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
@Override
|
||||
public void onSuccess(String url) {
|
||||
|
||||
String reportUrl = url;
|
||||
// int last = currentUrl.lastIndexOf("/");
|
||||
// String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
|
||||
// Log.trace("Url: "+reportUrl);
|
||||
// System.out.println("currentUrl " +currentUrl);
|
||||
System.out.println("reportUrl " +reportUrl);
|
||||
new WindowOpenUrl(reportUrl, "_self", "");
|
||||
if(url==null || url.isEmpty()){
|
||||
|
||||
String currentUrl = portalURL();
|
||||
int last = currentUrl.lastIndexOf("/");
|
||||
String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
|
||||
// Log.trace("Url: "+reportUrl);
|
||||
System.out.println("currentUrl " +currentUrl);
|
||||
System.out.println("reportUrl " +reportUrl);
|
||||
new WindowOpenUrl(reportUrl, "_self", "");
|
||||
}
|
||||
else{
|
||||
String reportUrl = url;
|
||||
System.out.println("reportUrl " +reportUrl);
|
||||
new WindowOpenUrl(reportUrl, "_self", "");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -1234,13 +1281,23 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
@Override
|
||||
public void onSuccess(String url) {
|
||||
|
||||
String templateUrl = url;
|
||||
// int last = currentUrl.lastIndexOf("/");
|
||||
// String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
|
||||
// Log.trace("Url: "+templateUrl);
|
||||
// System.out.println("currentUrl " +currentUrl);
|
||||
// System.out.println("reportUrl " +templateUrl);
|
||||
new WindowOpenUrl(templateUrl, "_self", "");
|
||||
if(url==null || url.isEmpty()){
|
||||
|
||||
|
||||
String currentUrl = portalURL();
|
||||
int last = currentUrl.lastIndexOf("/");
|
||||
String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
|
||||
// Log.trace("Url: "+templateUrl);
|
||||
System.out.println("currentUrl " +currentUrl);
|
||||
System.out.println("reportUrl " +templateUrl);
|
||||
new WindowOpenUrl(templateUrl, "_self", "");
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
String templateUrl = url;
|
||||
new WindowOpenUrl(templateUrl, "_self", "");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -1473,10 +1530,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
this.explorerPanel.getAsycTreePanel().setSizeTreePanel(width, height);
|
||||
this.explorerPanel.getAsycTreePanel().setHeaderTreeVisible(false);
|
||||
|
||||
|
||||
return explorerPanel.getAsycTreePanel();
|
||||
}
|
||||
|
||||
public void hideSharingFacilities() {
|
||||
explorerPanel.getAsycTreePanel().getContextMenuTree().setHideSharing();
|
||||
}
|
||||
|
||||
public void refreshRoot(){
|
||||
if(explorerPanel.getAsycTreePanel()!=null)
|
||||
|
|
|
@ -256,5 +256,11 @@ public interface Icons extends ClientBundle {
|
|||
|
||||
@Source("icons/mime/csv.gif")
|
||||
ImageResource csv();
|
||||
|
||||
@Source("icons/excel.gif")
|
||||
ImageResource excel();
|
||||
|
||||
@Source("icons/ppt.gif")
|
||||
ImageResource ppt();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,20 +26,34 @@ public class Resources {
|
|||
private static final String TIFF = "tiff";
|
||||
private static final String SVG = "svg";
|
||||
private static final String MSWORD = "msword";
|
||||
// private static final String DOCX = "msword";
|
||||
private static final String EXCEL = "excel";
|
||||
private static final String DOC = "doc";
|
||||
private static final String DOCX = "vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
private static final String EXCEL = "vnd.ms-excel";
|
||||
private static final String TXT = "plain";
|
||||
private static final String MPEG = "mpeg";
|
||||
private static final String SWF = "swf";
|
||||
private static final String FLV = "flv";
|
||||
private static final String AVI = "avi";
|
||||
private static final Object CSV = "csv";
|
||||
private static final String CSV = "csv";
|
||||
private static final String PPT = "vnd.ms-powerpoint";
|
||||
private static final String PPTX = "vnd.openxmlformats-officedocument.presentationml.presentation";
|
||||
private static final String XSLX = "vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
|
||||
public static AbstractImagePrototype getIconTable(){
|
||||
|
||||
return AbstractImagePrototype.create(ICONS.table());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype getIconPpt(){
|
||||
|
||||
return AbstractImagePrototype.create(ICONS.ppt());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype getIconExcel(){
|
||||
|
||||
return AbstractImagePrototype.create(ICONS.excel());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype getIconUsers(){
|
||||
|
||||
return AbstractImagePrototype.create(ICONS.users());
|
||||
|
@ -441,7 +455,7 @@ public class Resources {
|
|||
return Resources.getIconJpeg();
|
||||
} else if (XHTLXML.equals(fileExtension)) {
|
||||
return Resources.getIconXml();
|
||||
} else if (MSWORD.equals(fileExtension) || MSWORD.equals(fileExtension)) {
|
||||
} else if (fileExtension.contains(MSWORD) || DOC.equals(fileExtension) || fileExtension.contains(DOCX)) {
|
||||
return Resources.getIconDoc();
|
||||
} else if (XML.equals(fileExtension)) {
|
||||
return Resources.getIconXml();
|
||||
|
@ -463,6 +477,10 @@ public class Resources {
|
|||
return Resources.getIconGif();
|
||||
} else if (TXT.equals(fileExtension)) {
|
||||
return Resources.getIconTxt();
|
||||
}else if (fileExtension.contains(PPT) || fileExtension.equals(PPTX)) {
|
||||
return Resources.getIconPpt();
|
||||
}else if (fileExtension.contains(EXCEL) || fileExtension.contains(XSLX)) {
|
||||
return Resources.getIconExcel();
|
||||
}
|
||||
|
||||
// default case
|
||||
|
@ -532,6 +550,8 @@ public class Resources {
|
|||
int sl = type.indexOf("/");
|
||||
String extension = type.substring(sl+1, type.length());
|
||||
|
||||
|
||||
// System.out.println("extensions - "+extension);
|
||||
return Resources.getIconByExtension(extension);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 130 B |
|
@ -61,7 +61,7 @@ public interface GWTWorkspaceService extends RemoteService{
|
|||
|
||||
public Boolean removeItem(String itemId) throws Exception;
|
||||
|
||||
public Boolean renameItem(String itemId, String newName) throws Exception;
|
||||
public Boolean renameItem(String itemId, String newName, String oldName) throws Exception;
|
||||
|
||||
public Boolean removeSmartFolder(String itemId, String name) throws Exception;
|
||||
|
||||
|
@ -116,27 +116,9 @@ public interface GWTWorkspaceService extends RemoteService{
|
|||
|
||||
public InfoContactModel getOwnerByItemId(String itemId) throws Exception;
|
||||
|
||||
// public ArrayList<List<FileModel>> getChildrenListsByParentsIdentifier(String itemIdentifier) throws Exception;
|
||||
|
||||
// public List<GWTUser> getUsers() throws Exception;
|
||||
//
|
||||
// public List<PortalUser> getPortalUsers() throws Exception;
|
||||
//
|
||||
// public void importDocumentAlternatives(List<String> alternativesOIDs, String destinationFolderId) throws Exception;
|
||||
//
|
||||
// public void importDocumentParts(List<String> partsOIDs, String destinationFolderId) throws Exception;
|
||||
//
|
||||
// public WorkspaceSelectionState loadSelectionState() throws Exception;
|
||||
|
||||
// public void saveSelectionState(WorkspaceSelectionState selectionState) throws Exception;
|
||||
//
|
||||
// public void sendRequest(String itemId, List<AddresseeUser> addresses) throws Exception;
|
||||
//
|
||||
// public Boolean setItemDescription(String itemId, String newDescription) throws Exception;
|
||||
//
|
||||
|
||||
|
||||
|
||||
public String itemExistsInWorkpaceFolder(String parentId, String itemName) throws Exception;
|
||||
|
||||
List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId)
|
||||
throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface GWTWorkspaceServiceAsync {
|
|||
|
||||
void removeItem(String itemId, AsyncCallback<Boolean> callback);
|
||||
|
||||
void renameItem(String itemId, String newName, AsyncCallback<Boolean> callback);
|
||||
void renameItem(String itemId, String newName, String oldName, AsyncCallback<Boolean> callback);
|
||||
|
||||
void createFolder(String nameFolder, String description, FileModel parent, AsyncCallback<FolderModel> callback);
|
||||
|
||||
|
@ -122,29 +122,11 @@ public interface GWTWorkspaceServiceAsync {
|
|||
void getOwnerByItemId(String itemId,
|
||||
AsyncCallback<InfoContactModel> callback);
|
||||
|
||||
// void getListParentsByItemIdentifier(String itemIdentifier,AsyncCallback<ArrayList<String>> callback);
|
||||
|
||||
// void getChildrenListsByParentsIdentifier(String itemIdentifier,AsyncCallback<ArrayList<List<FileModel>>> callback);
|
||||
|
||||
// public void getUsers(AsyncCallback<List<GWTUser>> callback);
|
||||
//
|
||||
// void getPortalUsers(AsyncCallback<List<PortalUser>> callback);
|
||||
//
|
||||
// public void importDocumentAlternatives(List<String> alternativesOIDs, String destinationFolderId, AsyncCallback<Void> callback);
|
||||
//
|
||||
// public void importDocumentParts(List<String> partsOIDs, String destinationFolderId, AsyncCallback<Void> callback);
|
||||
//
|
||||
// public void loadSelectionState(AsyncCallback<WorkspaceSelectionState> callback);
|
||||
//
|
||||
|
||||
// public void saveSelectionState(WorkspaceSelectionState selectionState, AsyncCallback<Void> callback);
|
||||
//
|
||||
// public void sendRequest(String itemId, List<AddresseeUser> addressees, AsyncCallback<Void> callback);
|
||||
//
|
||||
// public void setItemDescription(String itemId, String newDescription, AsyncCallback<Boolean> callback);
|
||||
|
||||
|
||||
void itemExistsInWorkpaceFolder(String parentId, String itemName,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void getListUserSharedBySharedItem(String sharedItemId,
|
||||
AsyncCallback<List<InfoContactModel>> callback);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.extjs.gxt.ui.client.event.SelectionListener;
|
|||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
||||
public class ContextMenuTree {
|
||||
|
@ -38,11 +39,12 @@ public class ContextMenuTree {
|
|||
private HandlerManager eventBus = AppControllerExplorer.getEventBus();
|
||||
private List<FileModel> listSelectedItems = null;
|
||||
|
||||
private boolean hideSharing = false;
|
||||
|
||||
public ContextMenuTree() {
|
||||
this.contextMenu.setWidth(140);
|
||||
this.listSelectedItems = new ArrayList<FileModel>();
|
||||
createContextMenu();
|
||||
this.contextMenu.setWidth(140);
|
||||
this.listSelectedItems = new ArrayList<FileModel>();
|
||||
createContextMenu();
|
||||
|
||||
}
|
||||
|
||||
|
@ -51,77 +53,77 @@ public class ContextMenuTree {
|
|||
//SPECIFIC OPERATION
|
||||
|
||||
//Preview Image
|
||||
MenuItem previewImage = new MenuItem();
|
||||
previewImage.setId(ConstantsExplorer.PRW);
|
||||
previewImage.setText(ConstantsExplorer.MESSAGE_PREVIEW);
|
||||
previewImage.setIcon(Resources.getIconPreview());
|
||||
MenuItem previewImage = new MenuItem();
|
||||
previewImage.setId(ConstantsExplorer.PRW);
|
||||
previewImage.setText(ConstantsExplorer.MESSAGE_PREVIEW);
|
||||
previewImage.setIcon(Resources.getIconPreview());
|
||||
|
||||
previewImage.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
previewImage.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
// FileModel selected = treePanel.getSelectionModel().getSelectedItem();
|
||||
// FileModel selected = treePanel.getSelectionModel().getSelectedItem();
|
||||
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
|
||||
if(selected!=null){
|
||||
eventBus.fireEvent(new ImagePreviewEvent(selected, ce.getClientX(), ce.getClientY()));
|
||||
}
|
||||
if(selected!=null){
|
||||
eventBus.fireEvent(new ImagePreviewEvent(selected, ce.getClientX(), ce.getClientY()));
|
||||
}
|
||||
|
||||
//clearListSelectedItems();
|
||||
}
|
||||
});
|
||||
//clearListSelectedItems();
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(previewImage);
|
||||
contextMenu.add(previewImage);
|
||||
|
||||
//Open Url
|
||||
MenuItem openUrl = new MenuItem();
|
||||
openUrl.setId(ConstantsExplorer.LNK);
|
||||
openUrl.setText(ConstantsExplorer.MESSAGE_OPEN_URL);
|
||||
openUrl.setIcon(Resources.getIconOpenUrl());
|
||||
MenuItem openUrl = new MenuItem();
|
||||
openUrl.setId(ConstantsExplorer.LNK);
|
||||
openUrl.setText(ConstantsExplorer.MESSAGE_OPEN_URL);
|
||||
openUrl.setIcon(Resources.getIconOpenUrl());
|
||||
|
||||
openUrl.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
openUrl.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
|
||||
if(selected!=null){
|
||||
eventBus.fireEvent(new OpenUrlEvent(selected));
|
||||
}
|
||||
if(selected!=null){
|
||||
eventBus.fireEvent(new OpenUrlEvent(selected));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(openUrl);
|
||||
contextMenu.add(openUrl);
|
||||
|
||||
|
||||
//Open Report Template
|
||||
MenuItem openReportTemplate = new MenuItem();
|
||||
openReportTemplate.setId(ConstantsExplorer.ORT);
|
||||
openReportTemplate.setText(ConstantsExplorer.MESSAGE_OPEN_REPORT_TEMPLATE);
|
||||
openReportTemplate.setIcon(Resources.getIconOpenUrl());
|
||||
MenuItem openReportTemplate = new MenuItem();
|
||||
openReportTemplate.setId(ConstantsExplorer.ORT);
|
||||
openReportTemplate.setText(ConstantsExplorer.MESSAGE_OPEN_REPORT_TEMPLATE);
|
||||
openReportTemplate.setIcon(Resources.getIconOpenUrl());
|
||||
|
||||
openReportTemplate.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
openReportTemplate.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
|
||||
if(selected!=null){
|
||||
eventBus.fireEvent(new OpenReportsEvent(selected));
|
||||
}
|
||||
}
|
||||
});
|
||||
if(selected!=null){
|
||||
eventBus.fireEvent(new OpenReportsEvent(selected));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(openReportTemplate);
|
||||
contextMenu.add(openReportTemplate);
|
||||
|
||||
|
||||
//Open Report Template
|
||||
MenuItem openReport = new MenuItem();
|
||||
openReport.setId(ConstantsExplorer.ORP);
|
||||
openReport.setText(ConstantsExplorer.MESSAGE_OPEN_REPORT);
|
||||
openReport.setIcon(Resources.getIconOpenUrl());
|
||||
MenuItem openReport = new MenuItem();
|
||||
openReport.setId(ConstantsExplorer.ORP);
|
||||
openReport.setText(ConstantsExplorer.MESSAGE_OPEN_REPORT);
|
||||
openReport.setIcon(Resources.getIconOpenUrl());
|
||||
|
||||
openReport.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
openReport.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
|
@ -133,16 +135,16 @@ public class ContextMenuTree {
|
|||
}
|
||||
});
|
||||
|
||||
contextMenu.add(openReport);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
contextMenu.add(openReport);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
|
||||
//END SPECIFIC OPERATION
|
||||
|
||||
|
||||
MenuItem insertFolder = new MenuItem();
|
||||
insertFolder.setId(ConstantsExplorer.INS);
|
||||
insertFolder.setText(ConstantsExplorer.MESSAGE_ADD_FOLDER);
|
||||
insertFolder.setIcon(Resources.getIconAddFolder());
|
||||
MenuItem insertFolder = new MenuItem();
|
||||
insertFolder.setId(ConstantsExplorer.INS);
|
||||
insertFolder.setText(ConstantsExplorer.MESSAGE_ADD_FOLDER);
|
||||
insertFolder.setIcon(Resources.getIconAddFolder());
|
||||
|
||||
|
||||
insertFolder.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
|
@ -157,15 +159,15 @@ public class ContextMenuTree {
|
|||
}
|
||||
});
|
||||
|
||||
contextMenu.add(insertFolder);
|
||||
contextMenu.add(insertFolder);
|
||||
|
||||
|
||||
MenuItem createShareFolder = new MenuItem();
|
||||
createShareFolder.setId(ConstantsExplorer.ISHF);
|
||||
createShareFolder.setText(ConstantsExplorer.MESSAGE_ADD_SHARED_FOLDER);
|
||||
createShareFolder.setIcon(Resources.getIconSharedFolder());
|
||||
MenuItem createShareFolder = new MenuItem();
|
||||
createShareFolder.setId(ConstantsExplorer.ISHF);
|
||||
createShareFolder.setText(ConstantsExplorer.MESSAGE_ADD_SHARED_FOLDER);
|
||||
createShareFolder.setIcon(Resources.getIconSharedFolder());
|
||||
|
||||
createShareFolder.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
createShareFolder.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
final FileModel sourceFileModel = listSelectedItems.get(0);
|
||||
|
@ -175,72 +177,71 @@ public class ContextMenuTree {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(createShareFolder);
|
||||
contextMenu.add(createShareFolder);
|
||||
|
||||
|
||||
//Add Url
|
||||
MenuItem addUrl = new MenuItem();
|
||||
addUrl.setId(ConstantsExplorer.CLK);
|
||||
addUrl.setText(ConstantsExplorer.MESSAGE_ADD_URL);
|
||||
addUrl.setIcon(Resources.getIconAddUrl());
|
||||
MenuItem addUrl = new MenuItem();
|
||||
addUrl.setId(ConstantsExplorer.CLK);
|
||||
addUrl.setText(ConstantsExplorer.MESSAGE_ADD_URL);
|
||||
addUrl.setIcon(Resources.getIconAddUrl());
|
||||
|
||||
addUrl.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
addUrl.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
FileModel selected = listSelectedItems.get(0);
|
||||
|
||||
FileModel parent = getDirectoryOrParent(selected);
|
||||
FileModel parent = getDirectoryOrParent(selected);
|
||||
|
||||
if(parent!=null){
|
||||
eventBus.fireEvent(new CreateUrlEvent(null, parent));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(addUrl);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
|
||||
MenuItem copy = new MenuItem();
|
||||
copy.setId(ConstantsExplorer.CPI);
|
||||
copy.setText(ConstantsExplorer.COPYITEM);
|
||||
copy.setIcon(Resources.getIconCopy());
|
||||
|
||||
copy.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
for (FileModel target : listSelectedItems) {
|
||||
if(target.getIdentifier()!=null){
|
||||
CopyAndPaste.copy(target.getIdentifier());
|
||||
if(parent!=null){
|
||||
eventBus.fireEvent(new CreateUrlEvent(null, parent));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(addUrl);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
|
||||
MenuItem copy = new MenuItem();
|
||||
copy.setId(ConstantsExplorer.CPI);
|
||||
copy.setText(ConstantsExplorer.COPYITEM);
|
||||
copy.setIcon(Resources.getIconCopy());
|
||||
|
||||
copy.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
for (FileModel target : listSelectedItems) {
|
||||
if(target.getIdentifier()!=null){
|
||||
CopyAndPaste.copy(target.getIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(copy);
|
||||
|
||||
MenuItem paste = new MenuItem();
|
||||
paste.setId(ConstantsExplorer.PSI);
|
||||
paste.setText(ConstantsExplorer.PASTEITEM);
|
||||
paste.setIcon(Resources.getIconPaste());
|
||||
MenuItem paste = new MenuItem();
|
||||
paste.setId(ConstantsExplorer.PSI);
|
||||
paste.setText(ConstantsExplorer.PASTEITEM);
|
||||
paste.setIcon(Resources.getIconPaste());
|
||||
|
||||
paste.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
paste.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
for (FileModel target : listSelectedItems) {
|
||||
FileModel parentTarget = getDirectoryOrParent(target);
|
||||
if(parentTarget!=null){
|
||||
for (FileModel target : listSelectedItems) {
|
||||
FileModel parentTarget = getDirectoryOrParent(target);
|
||||
if(parentTarget!=null){
|
||||
|
||||
eventBus.fireEvent(new PasteItemEvent(CopyAndPaste.getCopiedfileModelId(), parentTarget.getIdentifier()));
|
||||
CopyAndPaste.setCopiedfileModelId(null);
|
||||
eventBus.fireEvent(new PasteItemEvent(CopyAndPaste.getCopiedfileModelId(), parentTarget.getIdentifier()));
|
||||
CopyAndPaste.setCopiedfileModelId(null);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(paste);
|
||||
|
||||
|
@ -250,18 +251,16 @@ public class ContextMenuTree {
|
|||
share.setIcon(Resources.getIconShareFolder());
|
||||
|
||||
share.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
for (FileModel target : listSelectedItems) {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
for (FileModel target : listSelectedItems) {
|
||||
|
||||
if(target.getIdentifier()!=null){
|
||||
eventBus.fireEvent(new CreateSharedFolderEvent(target, target.getParentFileModel(),false));
|
||||
if(target.getIdentifier()!=null){
|
||||
eventBus.fireEvent(new CreateSharedFolderEvent(target, target.getParentFileModel(),false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(share);
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem unShare = new MenuItem();
|
||||
unShare.setId(ConstantsExplorer.USHR);
|
||||
|
@ -269,194 +268,200 @@ public class ContextMenuTree {
|
|||
unShare.setIcon(Resources.getIconUnShareUser());
|
||||
|
||||
unShare.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
for (FileModel target : listSelectedItems) {
|
||||
if(target.getIdentifier()!=null){
|
||||
eventBus.fireEvent( new UnShareFolderEvent(target));
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
for (FileModel target : listSelectedItems) {
|
||||
if(target.getIdentifier()!=null){
|
||||
eventBus.fireEvent( new UnShareFolderEvent(target));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(unShare);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
MenuItem rename = new MenuItem();
|
||||
rename.setId(ConstantsExplorer.RNM);
|
||||
rename.setText("Rename Item");
|
||||
rename.setIcon(Resources.getIconRenameItem());
|
||||
|
||||
rename.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
contextMenu.add(share);
|
||||
contextMenu.add(unShare);
|
||||
|
||||
for (FileModel target : listSelectedItems) {
|
||||
if(target.getIdentifier()!=null){
|
||||
eventBus.fireEvent(new RenameItemEvent(target));
|
||||
|
||||
|
||||
|
||||
|
||||
MenuItem rename = new MenuItem();
|
||||
rename.setId(ConstantsExplorer.RNM);
|
||||
rename.setText("Rename Item");
|
||||
rename.setIcon(Resources.getIconRenameItem());
|
||||
|
||||
rename.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
for (FileModel target : listSelectedItems) {
|
||||
if(target.getIdentifier()!=null){
|
||||
eventBus.fireEvent(new RenameItemEvent(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(rename);
|
||||
contextMenu.add(rename);
|
||||
|
||||
MenuItem remove = new MenuItem();
|
||||
remove.setId(ConstantsExplorer.REM);
|
||||
remove.setText(ConstantsExplorer.MESSAGE_DELETE_ITEM);
|
||||
remove.setIcon(Resources.getIconDeleteItem());
|
||||
MenuItem remove = new MenuItem();
|
||||
remove.setId(ConstantsExplorer.REM);
|
||||
remove.setText(ConstantsExplorer.MESSAGE_DELETE_ITEM);
|
||||
remove.setIcon(Resources.getIconDeleteItem());
|
||||
|
||||
remove.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
remove.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new DeleteItemEvent(sel));
|
||||
}
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new DeleteItemEvent(sel));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(remove);
|
||||
contextMenu.add(remove);
|
||||
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
|
||||
MenuItem show = new MenuItem();
|
||||
show.setId(ConstantsExplorer.SHW);
|
||||
show.setText(ConstantsExplorer.MESSAGE_SHOW);
|
||||
show.setIcon(Resources.getIconShow());
|
||||
MenuItem show = new MenuItem();
|
||||
show.setId(ConstantsExplorer.SHW);
|
||||
show.setText(ConstantsExplorer.MESSAGE_SHOW);
|
||||
show.setIcon(Resources.getIconShow());
|
||||
|
||||
show.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
show.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
|
||||
for (final FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new FileDownloadEvent(sel.getIdentifier(), sel.getName(), DownloadType.SHOW));
|
||||
}
|
||||
}
|
||||
});
|
||||
for (final FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new FileDownloadEvent(sel.getIdentifier(), sel.getName(), DownloadType.SHOW));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
contextMenu.add(show);
|
||||
contextMenu.add(show);
|
||||
|
||||
|
||||
|
||||
MenuItem viewWebDav = new MenuItem();
|
||||
viewWebDav.setId(ConstantsExplorer.WDV);
|
||||
viewWebDav.setText(ConstantsExplorer.MESSAGE_WEBDAV_URL);
|
||||
viewWebDav.setIcon(Resources.getIconUrlWebDav());
|
||||
MenuItem viewWebDav = new MenuItem();
|
||||
viewWebDav.setId(ConstantsExplorer.WDV);
|
||||
viewWebDav.setText(ConstantsExplorer.MESSAGE_WEBDAV_URL);
|
||||
viewWebDav.setIcon(Resources.getIconUrlWebDav());
|
||||
|
||||
viewWebDav.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
viewWebDav.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
|
||||
for (final FileModel sel : listSelectedItems)
|
||||
eventBus.fireEvent(new WebDavUrlEvent(sel.getIdentifier()));
|
||||
for (final FileModel sel : listSelectedItems)
|
||||
eventBus.fireEvent(new WebDavUrlEvent(sel.getIdentifier()));
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
contextMenu.add(viewWebDav);
|
||||
contextMenu.add(viewWebDav);
|
||||
|
||||
|
||||
MenuItem sendTo = new MenuItem();
|
||||
sendTo.setId(ConstantsExplorer.SDT);
|
||||
sendTo.setText(ConstantsExplorer.MESSAGE_SEND_TO);
|
||||
sendTo.setIcon(Resources.getIconSendTo());
|
||||
MenuItem sendTo = new MenuItem();
|
||||
sendTo.setId(ConstantsExplorer.SDT);
|
||||
sendTo.setText(ConstantsExplorer.MESSAGE_SEND_TO);
|
||||
sendTo.setIcon(Resources.getIconSendTo());
|
||||
|
||||
sendTo.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
sendTo.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
if(listSelectedItems!=null && listSelectedItems.size()>0)
|
||||
eventBus.fireEvent(new SendMessageEvent(listSelectedItems));
|
||||
if(listSelectedItems!=null && listSelectedItems.size()>0)
|
||||
eventBus.fireEvent(new SendMessageEvent(listSelectedItems));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
contextMenu.add(sendTo);
|
||||
contextMenu.add(sendTo);
|
||||
|
||||
|
||||
|
||||
MenuItem upload = new MenuItem();
|
||||
upload.setId(ConstantsExplorer.UPL);
|
||||
upload.setText(ConstantsExplorer.MESSAGE_UPLOAD_FILE);
|
||||
upload.setIcon(Resources.getIconFileUpload());
|
||||
MenuItem upload = new MenuItem();
|
||||
upload.setId(ConstantsExplorer.UPL);
|
||||
upload.setText(ConstantsExplorer.MESSAGE_UPLOAD_FILE);
|
||||
upload.setIcon(Resources.getIconFileUpload());
|
||||
|
||||
upload.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
upload.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
for (final FileModel sel : listSelectedItems) {
|
||||
for (final FileModel sel : listSelectedItems) {
|
||||
|
||||
FileModel parent = getDirectoryOrParent(sel);
|
||||
eventBus.fireEvent(new FileUploadEvent(parent, UploadType.FILE));
|
||||
FileModel parent = getDirectoryOrParent(sel);
|
||||
eventBus.fireEvent(new FileUploadEvent(parent, UploadType.FILE));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
contextMenu.add(upload);
|
||||
contextMenu.add(upload);
|
||||
|
||||
|
||||
MenuItem uploadArchive = new MenuItem();
|
||||
uploadArchive.setId(ConstantsExplorer.UPA);
|
||||
uploadArchive.setText(ConstantsExplorer.MESSAGE_UPLOAD_ARCHIVE);
|
||||
uploadArchive.setIcon(Resources.getIconArchiveUpload());
|
||||
MenuItem uploadArchive = new MenuItem();
|
||||
uploadArchive.setId(ConstantsExplorer.UPA);
|
||||
uploadArchive.setText(ConstantsExplorer.MESSAGE_UPLOAD_ARCHIVE);
|
||||
uploadArchive.setIcon(Resources.getIconArchiveUpload());
|
||||
|
||||
uploadArchive.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
uploadArchive.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
|
||||
FileModel parent = getDirectoryOrParent(sel);
|
||||
FileModel parent = getDirectoryOrParent(sel);
|
||||
|
||||
eventBus.fireEvent(new FileUploadEvent(parent, UploadType.ARCHIVE));
|
||||
}
|
||||
eventBus.fireEvent(new FileUploadEvent(parent, UploadType.ARCHIVE));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(uploadArchive);
|
||||
contextMenu.add(uploadArchive);
|
||||
|
||||
|
||||
MenuItem downloadArchive = new MenuItem();
|
||||
downloadArchive.setId(ConstantsExplorer.DWL);
|
||||
downloadArchive.setText(ConstantsExplorer.MESSAGE_DOWNLOAD_ITEM);
|
||||
downloadArchive.setIcon(Resources.getIconDownload());
|
||||
MenuItem downloadArchive = new MenuItem();
|
||||
downloadArchive.setId(ConstantsExplorer.DWL);
|
||||
downloadArchive.setText(ConstantsExplorer.MESSAGE_DOWNLOAD_ITEM);
|
||||
downloadArchive.setIcon(Resources.getIconDownload());
|
||||
|
||||
downloadArchive.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
downloadArchive.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new FileDownloadEvent(sel.getIdentifier(), sel.getName(), DownloadType.DOWNLOAD));
|
||||
}
|
||||
}
|
||||
});
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new FileDownloadEvent(sel.getIdentifier(), sel.getName(), DownloadType.DOWNLOAD));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(downloadArchive);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
contextMenu.add(downloadArchive);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
|
||||
|
||||
MenuItem refreshItem = new MenuItem();
|
||||
refreshItem.setId(ConstantsExplorer.RFH);
|
||||
refreshItem.setText(ConstantsExplorer.MESSAGE_REFRESH_FOLDER);
|
||||
refreshItem.setIcon(Resources.getIconRefresh());
|
||||
MenuItem refreshItem = new MenuItem();
|
||||
refreshItem.setId(ConstantsExplorer.RFH);
|
||||
refreshItem.setText(ConstantsExplorer.MESSAGE_REFRESH_FOLDER);
|
||||
refreshItem.setIcon(Resources.getIconRefresh());
|
||||
|
||||
refreshItem.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
refreshItem.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new RefreshFolderEvent(sel));
|
||||
}
|
||||
}
|
||||
});
|
||||
for (FileModel sel : listSelectedItems) {
|
||||
eventBus.fireEvent(new RefreshFolderEvent(sel));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(refreshItem);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
contextMenu.add(refreshItem);
|
||||
contextMenu.add(new SeparatorMenuItem());
|
||||
|
||||
}
|
||||
|
||||
|
@ -465,6 +470,10 @@ public class ContextMenuTree {
|
|||
}
|
||||
|
||||
|
||||
public void setHideSharing() {
|
||||
hideSharing = true;
|
||||
}
|
||||
|
||||
public void openContextMenuOnItem(FileModel targetFileModel, int posX, int posY) {
|
||||
clearListSelectedItems();
|
||||
listSelectedItems.add(0, targetFileModel);
|
||||
|
@ -485,7 +494,7 @@ public class ContextMenuTree {
|
|||
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //set invisible unshare
|
||||
contextMenu.showAt(posX, posY);
|
||||
}
|
||||
// treePanel.fireEvent(Events.ContextMenu);
|
||||
// treePanel.fireEvent(Events.ContextMenu);
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,53 +539,61 @@ public class ContextMenuTree {
|
|||
contextMenu.getItemByItemId(ConstantsExplorer.ISHF).setVisible(true); //insert shared folder
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //UNSHARE
|
||||
}
|
||||
|
||||
GWT.log("HideSharing = " + hideSharing);
|
||||
//not supported in tree Reports
|
||||
if (hideSharing) {
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.SHR).setVisible(false); //SHARE
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.ISHF).setVisible(false); //insert shared folder
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //UNSHARE
|
||||
}
|
||||
}
|
||||
else{
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.SHW).setVisible(true);
|
||||
|
||||
switch(selectedItem.getGXTFolderItemType()){
|
||||
|
||||
case EXTERNAL_IMAGE:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.PRW).setVisible(true);
|
||||
break;
|
||||
case EXTERNAL_FILE:
|
||||
break;
|
||||
case EXTERNAL_PDF_FILE:
|
||||
break;
|
||||
case EXTERNAL_URL:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.LNK).setVisible(true);
|
||||
break;
|
||||
case REPORT_TEMPLATE:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.ORT).setVisible(true);
|
||||
break;
|
||||
case REPORT:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.ORP).setVisible(true);
|
||||
break;
|
||||
case QUERY:
|
||||
break;
|
||||
case TIME_SERIES:
|
||||
break;
|
||||
// case AQUAMAPS_ITEM:
|
||||
// break;
|
||||
case PDF_DOCUMENT:
|
||||
break;
|
||||
case IMAGE_DOCUMENT:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.PRW).setVisible(true);
|
||||
break;
|
||||
case DOCUMENT:
|
||||
break;
|
||||
case URL_DOCUMENT:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.LNK).setVisible(true);
|
||||
break;
|
||||
case METADATA:
|
||||
break;
|
||||
case WORKFLOW_REPORT:
|
||||
break;
|
||||
case WORKFLOW_TEMPLATE:
|
||||
break;
|
||||
case EXTERNAL_RESOURCE_LINK:
|
||||
break;
|
||||
default:
|
||||
case EXTERNAL_IMAGE:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.PRW).setVisible(true);
|
||||
break;
|
||||
case EXTERNAL_FILE:
|
||||
break;
|
||||
case EXTERNAL_PDF_FILE:
|
||||
break;
|
||||
case EXTERNAL_URL:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.LNK).setVisible(true);
|
||||
break;
|
||||
case REPORT_TEMPLATE:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.ORT).setVisible(true);
|
||||
break;
|
||||
case REPORT:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.ORP).setVisible(true);
|
||||
break;
|
||||
case QUERY:
|
||||
break;
|
||||
case TIME_SERIES:
|
||||
break;
|
||||
// case AQUAMAPS_ITEM:
|
||||
// break;
|
||||
case PDF_DOCUMENT:
|
||||
break;
|
||||
case IMAGE_DOCUMENT:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.PRW).setVisible(true);
|
||||
break;
|
||||
case DOCUMENT:
|
||||
break;
|
||||
case URL_DOCUMENT:
|
||||
contextMenu.getItemByItemId(ConstantsExplorer.LNK).setVisible(true);
|
||||
break;
|
||||
case METADATA:
|
||||
break;
|
||||
case WORKFLOW_REPORT:
|
||||
break;
|
||||
case WORKFLOW_TEMPLATE:
|
||||
break;
|
||||
case EXTERNAL_RESOURCE_LINK:
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.extjs.gxt.ui.client.widget.form.TextArea;
|
|||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
|
@ -35,7 +36,6 @@ public class DialogAddFolderAndSmart extends Dialog {
|
|||
layout.setDefaultWidth(300);
|
||||
setLayout(layout);
|
||||
|
||||
|
||||
setButtonAlign(HorizontalAlignment.CENTER);
|
||||
// setHideOnButtonClick(true);
|
||||
// setIcon(IconHelper.createStyle("user"));
|
||||
|
|
|
@ -11,7 +11,10 @@ import com.extjs.gxt.ui.client.event.ButtonEvent;
|
|||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.FormEvent;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.Info;
|
||||
import com.extjs.gxt.ui.client.widget.Window;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.FileUploadField;
|
||||
|
@ -19,8 +22,11 @@ import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
|||
import com.extjs.gxt.ui.client.widget.form.FormPanel.Encoding;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormPanel.Method;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Hidden;
|
||||
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
|
@ -35,128 +41,121 @@ public class DialogUpload extends Window {
|
|||
private Button btnSubmit = new Button("Submit");
|
||||
private Button btnCancel = new Button("Cancel");
|
||||
|
||||
// private Text txtParentPath = new Text();
|
||||
// private int widthSize = 300;
|
||||
// private final Dialog simple = new Dialog();
|
||||
|
||||
private String parentIdentifier = "";
|
||||
private String parentName = "";
|
||||
|
||||
public DialogUpload(String headerTitle, String parentName, final FileModel parent, String fieldLabel){
|
||||
|
||||
this.setHeaderVisible(true);
|
||||
// this.setHeading("File Upload in: " + parentPath);
|
||||
this.setHeading(headerTitle + parentName);
|
||||
// this.setHeading(ConstantsExplorer.FILEUPLOADHEADER + parentPath);
|
||||
|
||||
// this.txtParentPath.setText("Parent Folder : " + parentPath);
|
||||
|
||||
this.setStyleAttribute("margin", "10px");
|
||||
|
||||
// Create a FormPanel and point it at a service.
|
||||
|
||||
this.parentIdentifier = parent.getIdentifier();
|
||||
this.parentName = parentName;
|
||||
this.setStyleAttribute("margin", "10px");
|
||||
|
||||
// Create a FormPanel and point it at a service.
|
||||
formPanel.setHeaderVisible(false);
|
||||
formPanel.setFrame(true);
|
||||
formPanel.setAction(ConstantsExplorer.UPLOAD_WORKSPACE_SERVICE);
|
||||
formPanel.setEncoding(Encoding.MULTIPART);
|
||||
formPanel.setMethod(Method.POST);
|
||||
|
||||
formPanel.setButtonAlign(HorizontalAlignment.CENTER);
|
||||
formPanel.setWidth(400);
|
||||
// Create a FormPanel and point it at a service.
|
||||
formPanel.setHeaderVisible(false);
|
||||
formPanel.setFrame(true);
|
||||
formPanel.setAction(ConstantsExplorer.UPLOAD_WORKSPACE_SERVICE);
|
||||
formPanel.setEncoding(Encoding.MULTIPART);
|
||||
formPanel.setMethod(Method.POST);
|
||||
|
||||
// TextField<String> name = new TextField<String>();
|
||||
// name.setFieldLabel("Name");
|
||||
// formPanel.add(name);
|
||||
formPanel.setButtonAlign(HorizontalAlignment.CENTER);
|
||||
formPanel.setWidth(400);
|
||||
|
||||
fileUploadField.setAllowBlank(false);
|
||||
fileUploadField.setName("uploadFormElement");
|
||||
// fileUploadField.setRegex("^[a-zA-Z0-9_-]+[ a-zA-Z0-9_().-]+$");
|
||||
// fileUploadField.setAutoValidate(true);
|
||||
// fileUploadField.getMessages().setRegexText(ConstantsExplorer.MESSAGE_NAME_FORCE_APHANUMERIC);
|
||||
// TextField<String> name = new TextField<String>();
|
||||
// name.setFieldLabel("Name");
|
||||
// formPanel.add(name);
|
||||
|
||||
fileUploadField.setAllowBlank(false);
|
||||
fileUploadField.setName("uploadFormElement");
|
||||
|
||||
// Add a label
|
||||
formPanel.add(new Hidden("idFolder",parent.getIdentifier()));
|
||||
|
||||
formPanel.add(new Hidden("uploadType",fieldLabel));
|
||||
// fileUploadField.setFieldLabel(ConstantsExplorer.FILE);
|
||||
fileUploadField.setFieldLabel(fieldLabel);
|
||||
|
||||
// fileUploadField.setWidth(widthSize);
|
||||
|
||||
// fileUploadField.setStyleAttribute("width", "350px");
|
||||
|
||||
// fileUploadField.setSize(400, 50);
|
||||
|
||||
formPanel.add(fileUploadField);
|
||||
|
||||
// formPanel.add(this.txtParentPath);
|
||||
formPanel.add(new Hidden("idFolder",parent.getIdentifier()));
|
||||
|
||||
|
||||
// formPanel.add(btn);
|
||||
|
||||
formPanel.addButton(btnSubmit);
|
||||
formPanel.add(new Hidden("uploadType",fieldLabel));
|
||||
// fileUploadField.setFieldLabel(ConstantsExplorer.FILE);
|
||||
fileUploadField.setFieldLabel(fieldLabel);
|
||||
formPanel.add(fileUploadField);
|
||||
formPanel.addButton(btnSubmit);
|
||||
|
||||
formPanel.addButton(btnCancel);
|
||||
formPanel.addButton(btnCancel);
|
||||
|
||||
|
||||
// handle the post
|
||||
formPanel.addListener(Events.Submit, new Listener<FormEvent>() {
|
||||
// handle the post
|
||||
formPanel.addListener(Events.Submit, new Listener<FormEvent>() {
|
||||
|
||||
public void handleEvent(FormEvent event) {
|
||||
public void handleEvent(FormEvent event) {
|
||||
// When the form submission is successfully completed, this
|
||||
// event is
|
||||
// fired. Assuming the service returned a response of type
|
||||
// text/html,
|
||||
|
||||
isStatusCompleted = true;
|
||||
isStatusCompleted = true;
|
||||
|
||||
// Log.trace("onSubmitComplete");
|
||||
// Log.trace("onSubmitComplete");
|
||||
String result = event.getResultHtml();
|
||||
|
||||
// Log.trace("Result "+result);
|
||||
// Log.trace("Result "+result);
|
||||
hide();
|
||||
|
||||
messageBoxWait.getMessageBoxWait().close();
|
||||
|
||||
if (result == null) {
|
||||
// MessageUtil.showErrorMessage("Error during upload", "An error occurred during file upload.");
|
||||
// MessageUtil.showErrorMessage("Error during upload", "An error occurred during file upload.");
|
||||
new MessageBoxAlert("Error during upload", "An error occurred during file upload.", null);
|
||||
return;
|
||||
}
|
||||
|
||||
//expected <pre>200:Upload complete</pre>
|
||||
//we strip tags added by webserver
|
||||
String strippedResult = result.replace("<pre>", "").replace("</pre>", "");
|
||||
/*we strip tags added by webserver,
|
||||
*
|
||||
* Massi fix because webkit returns
|
||||
* <pre style="word-wrap: break-word; white-space: pre-wrap;">OK:File france_flag.png(0) imported correctly in /Workspace</pre>
|
||||
*
|
||||
* TODO: recall it next time
|
||||
*/
|
||||
//String strippedResult = result.replace("<pre>", "").replace("</pre>", ""); //this won't work for webkit
|
||||
//replaced by new HTML(result).getText()
|
||||
String strippedResult = new HTML(result).getText();
|
||||
|
||||
|
||||
System.out.println(result);
|
||||
// com.google.gwt.user.client.Window.alert(result);
|
||||
// com.google.gwt.user.client.Window.alert("Stripped: " + strippedResult);
|
||||
|
||||
UploadResultMessage resultMessage = UploadResultMessage.parseResult(strippedResult);
|
||||
// Log.trace("status: "+resultMessage.getStatus());
|
||||
final UploadResultMessage resultMessage = UploadResultMessage.parseResult(strippedResult);
|
||||
|
||||
switch (resultMessage.getStatus()) {
|
||||
case ERROR:
|
||||
new MessageBoxAlert("Error during upload", resultMessage.getMessage(), null);
|
||||
break;
|
||||
case UNKNOWN:
|
||||
new MessageBoxAlert("Error during upload", resultMessage.getMessage(), null);
|
||||
break;
|
||||
case WARN: {
|
||||
// workspace.refreshRoot();
|
||||
// MessageUtil.showWarnMessage("Upload completed with warnings", resultMessage.getMessage());
|
||||
new MessageBoxAlert("Upload completed with warnings", resultMessage.getMessage(), null);
|
||||
break;
|
||||
}
|
||||
case OK: {
|
||||
// workspace.refreshRoot();
|
||||
new MessageBoxInfo("Upload completed successfully", resultMessage.getMessage(), null);
|
||||
AppControllerExplorer.getEventBus().fireEvent(new CompletedFileUploadEvent(parent,null));
|
||||
}
|
||||
case ERROR:
|
||||
new MessageBoxAlert("Error during upload", resultMessage.getMessage(), null);
|
||||
break;
|
||||
case UNKNOWN:
|
||||
new MessageBoxAlert("Error during upload", resultMessage.getMessage(), null);
|
||||
break;
|
||||
case WARN: {
|
||||
new MessageBoxAlert("Upload completed with warnings", resultMessage.getMessage(), null);
|
||||
break;
|
||||
}
|
||||
case OK: {
|
||||
Timer t = new Timer() {
|
||||
public void run() {
|
||||
AppControllerExplorer.getEventBus().fireEvent(new CompletedFileUploadEvent(parent, null));
|
||||
new MessageBoxInfo("Upload completed successfully", resultMessage.getMessage(), null);
|
||||
}
|
||||
};
|
||||
|
||||
t.schedule(250);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add(formPanel);
|
||||
add(formPanel);
|
||||
|
||||
this.addListeners();
|
||||
|
||||
|
@ -169,79 +168,121 @@ public class DialogUpload extends Window {
|
|||
|
||||
private void addListeners() {
|
||||
|
||||
// fileUploadField.addListener(Events.OnChange, new Listener<BaseEvent>() {
|
||||
//
|
||||
// @Override
|
||||
// public void handleEvent(BaseEvent be) {
|
||||
//// Window.alert("qui");
|
||||
// }
|
||||
// });
|
||||
|
||||
btnSubmit.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
if (fileUploadField.getValue()==null || !(fileUploadField.getValue().length()>2)) {
|
||||
new MessageBoxAlert(ConstantsExplorer.ERROR, ConstantsExplorer.NOFILESPECIFIED, null);
|
||||
return;
|
||||
}
|
||||
|
||||
// com.google.gwt.user.client.Window.alert("parentIdentifier "+parentIdentifier);
|
||||
// com.google.gwt.user.client.Window.alert("fileUploadField.getValue() "+fileUploadField.getValue());
|
||||
// com.google.gwt.user.client.Window.alert("parentName "+parentName);
|
||||
/*
|
||||
* TODO: recall: Some browser would write in fileUploadField.getValue() C:\fakepath\$fileName
|
||||
*/
|
||||
String normalizedFileName = fileUploadField.getValue();
|
||||
|
||||
// com.google.gwt.user.client.Window.alert("fileUploadField.getValue() "+fileUploadField.getValue());
|
||||
if (normalizedFileName.contains("\\")) {
|
||||
normalizedFileName = normalizedFileName.substring(normalizedFileName.lastIndexOf("\\")+1); //remove C:\fakepath\ if exists
|
||||
// com.google.gwt.user.client.Window.alert("normalizedFileName= "+normalizedFileName);
|
||||
}
|
||||
final String label = normalizedFileName;
|
||||
AppControllerExplorer.rpcWorkspaceService.itemExistsInWorkpaceFolder(parentIdentifier, normalizedFileName, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(final String itemId) {
|
||||
|
||||
if(itemId!=null){
|
||||
|
||||
MessageBoxConfirm msg = new MessageBoxConfirm("Replace "+label+"?", label + " exists in folder "+parentName + ". Overwrite?");
|
||||
|
||||
|
||||
// fileUploadField.addKeyListener(new KeyListener() { // KEY ENTER
|
||||
//
|
||||
// public void componentKeyPress(ComponentEvent event) {
|
||||
// if (event.getKeyCode() == KeyboardEvents.Enter.getEventCode())
|
||||
// btnSubmit.fireEvent(Events.OnClick);
|
||||
//
|
||||
// }
|
||||
// });
|
||||
msg.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
||||
|
||||
public void handleEvent(MessageBoxEvent be) {
|
||||
|
||||
//IF NOT CANCELLED
|
||||
String clickedButton = be.getButtonClicked().getItemId();
|
||||
|
||||
if(clickedButton.equals(Dialog.YES)){
|
||||
|
||||
removeItemAndSubmitForm(itemId);
|
||||
}
|
||||
|
||||
|
||||
btnSubmit.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
if (fileUploadField.getValue()==null || !(fileUploadField.getValue().length()>2)) {
|
||||
new MessageBoxAlert(ConstantsExplorer.ERROR, ConstantsExplorer.NOFILESPECIFIED, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}else
|
||||
submitForm(); //ITEM does NOT EXIST SO SUBMIT FORM;
|
||||
|
||||
messageBoxWait = new MessageBoxWait(ConstantsExplorer.PROGRESS, ConstantsExplorer.SAVINGYOURFILE, fileUploadField.getValue());
|
||||
}
|
||||
|
||||
//Progress bar for upload
|
||||
final Timer t = new Timer()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (isStatusCompleted)
|
||||
{
|
||||
cancel();
|
||||
messageBoxWait.getMessageBoxWait().close();
|
||||
}
|
||||
}
|
||||
};
|
||||
t.scheduleRepeating(500);
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Info.display("Error", "Sorry an error occurred on the server "+caught.getLocalizedMessage() + ". Please try again later");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
formPanel.submit();
|
||||
}
|
||||
});
|
||||
btnCancel.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
btnCancel.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
public void submitForm(){
|
||||
|
||||
//
|
||||
// // Add an event handler to the form.
|
||||
// formPanel.addHandler(Events., Type<new FormHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onSubmitComplete(FormSubmitCompleteEvent event) {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSubmit(FormSubmitEvent event) {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
// });
|
||||
messageBoxWait = new MessageBoxWait(ConstantsExplorer.PROGRESS, ConstantsExplorer.SAVINGYOURFILE, fileUploadField.getValue());
|
||||
|
||||
}
|
||||
//Progress bar for upload
|
||||
final Timer t = new Timer()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (isStatusCompleted)
|
||||
{
|
||||
cancel();
|
||||
messageBoxWait.getMessageBoxWait().close();
|
||||
}
|
||||
}
|
||||
};
|
||||
t.scheduleRepeating(500);
|
||||
formPanel.submit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void removeItemAndSubmitForm(String itemId){
|
||||
|
||||
AppControllerExplorer.rpcWorkspaceService.removeItem(itemId, new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Info.display("Error", "Sorry an error occurred on the server "+caught.getMessage() + ". Please try again later");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if(result)
|
||||
submitForm();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ public class MessageBoxInfo {
|
|||
private MessageBox box = null;
|
||||
|
||||
public MessageBoxInfo(String title, String msg) {
|
||||
box = MessageBox.info(title, msg, null);
|
||||
InfoDisplay.display(title, msg);
|
||||
}
|
||||
|
||||
public MessageBoxInfo(String title, String msg, Listener<MessageBoxEvent> listener){
|
||||
box = MessageBox.info(title, msg, listener);
|
||||
InfoDisplay.display(title, msg);
|
||||
}
|
||||
|
||||
public MessageBox getMessageBoxConfirm(){
|
||||
|
|
|
@ -82,7 +82,6 @@ import org.gcube.portlets.user.workspace.server.util.AllScope;
|
|||
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
||||
import org.gcube.portlets.user.workspace.server.util.Util;
|
||||
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.apache.log4j.Logger;
|
|||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||
import org.gcube.portlets.user.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
||||
|
@ -23,6 +24,7 @@ import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.ItemNotFoun
|
|||
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderBulkCreator;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderItemType;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ExternalUrl;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ts.TimeSeries;
|
||||
|
@ -460,6 +462,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
logger.trace("removeItem item: "+itemId);
|
||||
|
||||
workspace.removeItem(itemId);
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
} catch (InsufficientPrivilegesException e) {
|
||||
|
@ -476,7 +479,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
}
|
||||
|
||||
@Override
|
||||
public Boolean renameItem(String itemId, String newName) throws Exception {
|
||||
public Boolean renameItem(String itemId, String newName, String oldName) throws Exception {
|
||||
|
||||
workspaceLogger.trace("renameItem itemId: "+itemId+" newName: "+newName);
|
||||
|
||||
|
@ -485,16 +488,37 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
|
||||
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
||||
logger.trace("renameItem itemId: "+itemId+" newName: "+newName);
|
||||
logger.trace("rename item itemId: "+itemId+" old name "+ oldName +", new name: "+newName);
|
||||
|
||||
workspace.renameItem(itemId, newName);
|
||||
|
||||
//NOTIFIER
|
||||
WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||
|
||||
if(wsItem.isShared()){
|
||||
|
||||
try{
|
||||
List<InfoContactModel> listSharedContact = new ArrayList<InfoContactModel>();
|
||||
NotificationsProducer notification = getNotificationProducer();
|
||||
listSharedContact = getListUserSharedByFolderSharedId(wsItem.getIdSharedFolder());
|
||||
if(Util.isASharedFolder(wsItem)){
|
||||
notification.notifyFolderRenamed(listSharedContact, oldName, newName, wsItem.getIdSharedFolder());
|
||||
}else{
|
||||
WorkspaceFolder sharedFolder = (WorkspaceFolder) workspace.getItem(wsItem.getIdSharedFolder());
|
||||
notification.notifyItemUpdated(listSharedContact, wsItem, sharedFolder);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
workspaceLogger.error("An error occurred in checkNotify ", e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in server Item rename", e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -923,7 +947,33 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
try{
|
||||
|
||||
urlPortlet = app.getURLFromApplicationProfile(oid, Util.getAslSession(this.getThreadLocalRequest().getSession()),this.getThreadLocalRequest().getSession());
|
||||
ASLSession session = Util.getAslSession(this.getThreadLocalRequest().getSession());
|
||||
|
||||
if(Util.isVRE(session)){
|
||||
|
||||
// GET WORKSPACE
|
||||
Workspace workspace = HomeLibrary.getUserWorkspace(session);
|
||||
|
||||
// GET ITEM FROM WORKSPACE
|
||||
WorkspaceItem item = workspace.getItem(oid);
|
||||
|
||||
// ITEM IS A WorkspaceItemType.FOLDER_ITEM?
|
||||
if (item.getType().equals(WorkspaceItemType.FOLDER_ITEM)) {
|
||||
FolderItem folderItem = (FolderItem) item;
|
||||
|
||||
if(folderItem.getFolderItemType().equals(FolderItemType.REPORT)){
|
||||
setValueInSession("idreport", oid);
|
||||
|
||||
}else if(folderItem.getFolderItemType().equals(FolderItemType.REPORT_TEMPLATE)){
|
||||
setValueInSession("idtemplate", oid);
|
||||
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
urlPortlet = app.getURLFromApplicationProfile(oid, Util.getAslSession(this.getThreadLocalRequest().getSession()),this.getThreadLocalRequest().getSession());
|
||||
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("getURLFromApplicationProfile", e);
|
||||
|
@ -1580,7 +1630,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
WorkspaceItem wsItem = workspace.getItem(folderSharedId);
|
||||
|
||||
if(wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
|
||||
if(Util.isASharedFolder(wsItem)){
|
||||
|
||||
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
|
||||
|
||||
|
@ -1610,6 +1660,45 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId) throws Exception{
|
||||
|
||||
workspaceLogger.trace("getListUserSharedBySharedItem "+ sharedItemId);
|
||||
|
||||
try {
|
||||
Workspace workspace = getWorkspace();
|
||||
|
||||
WorkspaceItem wsItem = workspace.getItem(sharedItemId);
|
||||
|
||||
if(wsItem!=null && wsItem.isShared()){
|
||||
|
||||
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder());
|
||||
|
||||
if(wsFolder!=null){
|
||||
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
|
||||
List<String> listPortalLogin = wsFolder.getUsers();
|
||||
|
||||
workspaceLogger.trace("getListUserSharedByFolderSharedId return "+ listPortalLogin.size() + " user");
|
||||
|
||||
if(isTestMode())
|
||||
return builder.buildGxtInfoContactFromPortalLoginTestMode(listPortalLogin);
|
||||
|
||||
|
||||
return builder.buildGxtInfoContactFromPortalLogin(listPortalLogin);
|
||||
}
|
||||
|
||||
}
|
||||
return new ArrayList<InfoContactModel>();
|
||||
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in getListUserSharedByItemId ", e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unSharedFolderByFolderSharedId(String folderSharedId) throws Exception{
|
||||
|
||||
|
@ -1641,7 +1730,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
// contacts = new ArrayList<InfoContactModel>();
|
||||
// contacts.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
||||
// }
|
||||
|
||||
workspaceLogger.trace("UNSHARE WITH: ");
|
||||
printContacts(contacts);
|
||||
|
||||
np.notifyFolderUnSharing(contacts, unSharedFolder);
|
||||
|
@ -1725,4 +1814,43 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String itemExistsInWorkpaceFolder(String parentId, String itemName) throws Exception {
|
||||
|
||||
workspaceLogger.trace("get itemExistsInWorkpace by parentId: "+parentId);
|
||||
System.out.println("get itemExistsInWorkpace by parentId: "+parentId);
|
||||
|
||||
try {
|
||||
Workspace workspace = getWorkspace();
|
||||
|
||||
WorkspaceItem wsItem = workspace.getItem(parentId); //GET PARENT
|
||||
|
||||
if(wsItem.getType().equals(WorkspaceItemType.FOLDER) || wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
|
||||
|
||||
WorkspaceItem itemFound = workspace.find(itemName, parentId);
|
||||
|
||||
if(itemFound==null)
|
||||
return null;
|
||||
|
||||
return itemFound.getId();
|
||||
}
|
||||
else
|
||||
throw new Exception("Invalid Folder parent");
|
||||
|
||||
|
||||
} catch (InternalErrorException e) {
|
||||
|
||||
return null;
|
||||
|
||||
} catch (ItemNotFoundException e) {
|
||||
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
String error = "an error occurred on search item in folder ";
|
||||
workspaceLogger.error(error, e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public class UploadServlet extends HttpServlet {
|
|||
return;
|
||||
}
|
||||
|
||||
if (item.getType() != WorkspaceItemType.FOLDER) {
|
||||
if (item.getType() != WorkspaceItemType.FOLDER && item.getType() != WorkspaceItemType.SHARED_FOLDER) {
|
||||
logger.error("Error processing request in upload servlet: Wrong destination item");
|
||||
sendError(response, "Internal error: Wrong destination item");
|
||||
return;
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.workspace.server.notifications;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||
|
@ -23,7 +24,7 @@ import org.gcube.portlets.user.workspace.server.util.Util;
|
|||
*/
|
||||
public class NotificationsProducer {
|
||||
|
||||
protected GCUBELog gcubeLogger = new GCUBELog(NotificationsProducer.class);
|
||||
protected GCUBEClientLog gcubeLogger = new GCUBEClientLog(NotificationsProducer.class);
|
||||
protected GCUBEScope scope;
|
||||
|
||||
protected NotificationsManager notificationsMng;
|
||||
|
@ -70,17 +71,18 @@ public class NotificationsProducer {
|
|||
for (InfoContactModel infoContactModel : listContacts) {
|
||||
try{
|
||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
gcubeLogger.trace("Send notifies new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
gcubeLogger.trace("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("Send notifies new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
System.out.println("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
||||
|
||||
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getLogin(), sharedFolder);
|
||||
|
||||
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getId(), sharedFolder);
|
||||
|
||||
if(!notify)
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||
}
|
||||
}catch (Exception e) {
|
||||
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
|
||||
|
@ -96,6 +98,92 @@ public class NotificationsProducer {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Runs a new thread to notify the contacts passed in input
|
||||
* @param listContacts
|
||||
* @param sharedFolder
|
||||
*/
|
||||
public void notifyFolderRenamed(final List<InfoContactModel> listSharedContact, final String itemOldName, final String itemNewName, final String idsharedFolder) {
|
||||
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
gcubeLogger.trace("Send notifies shared folder was renamed is running...");
|
||||
|
||||
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||
try{
|
||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
gcubeLogger.trace("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
||||
|
||||
boolean notify = notificationsMng.notifyFolderRenaming(infoContactModel.getLogin(), itemOldName, itemNewName, idsharedFolder);
|
||||
|
||||
|
||||
if(!notify)
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||
}
|
||||
}catch (Exception e) {
|
||||
gcubeLogger.error("An error occured in notifyFolderRenamed ", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
gcubeLogger.trace("notifies share folder was renamed is completed");
|
||||
}
|
||||
}.start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs a new thread to notify the contacts passed in input
|
||||
* @param listContacts
|
||||
* @param sharedFolder
|
||||
*/
|
||||
public void notifyItemUpdated(final List<InfoContactModel> listSharedContact, final WorkspaceItem item, final WorkspaceFolder sharedFolder) {
|
||||
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
gcubeLogger.trace("Send notifies shared item was updated is running...");
|
||||
|
||||
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||
try{
|
||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
||||
|
||||
boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(), item, sharedFolder);
|
||||
|
||||
if(!notify)
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||
}
|
||||
}catch (Exception e) {
|
||||
gcubeLogger.error("An error occured in notifyItemUpdated ", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
gcubeLogger.trace("notifies shared item was updated is completed");
|
||||
}
|
||||
}.start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs a new thread to notify the new contacts passed in input
|
||||
* @param listSharedContact - list of contacts already shared
|
||||
|
@ -109,30 +197,37 @@ public class NotificationsProducer {
|
|||
public void run() {
|
||||
|
||||
try{
|
||||
//CREATE TEMPORARY HASH
|
||||
HashMap<String, InfoContactModel> hashLoginAlreadyShared = new HashMap<String, InfoContactModel>();
|
||||
|
||||
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||
hashLoginAlreadyShared.put(infoContactModel.getLogin(),infoContactModel);
|
||||
}
|
||||
|
||||
if(listSharedContact==null)
|
||||
return;
|
||||
|
||||
for (InfoContactModel infoContactModel : listSharingContact) {
|
||||
|
||||
if(!listSharedContact.contains(infoContactModel)){ //if is new contact.. notifies share
|
||||
|
||||
if(hashLoginAlreadyShared.get(infoContactModel.getLogin())==null){ //if is new contact.. notifies share
|
||||
|
||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
for (InfoContactModel contact : listSharedContact) { //NOTIFIES ALREADY SHARED CONTACTS
|
||||
|
||||
try{
|
||||
|
||||
gcubeLogger.trace("Send notifies added user "+ infoContactModel.getId() +" to share folder "+sharedFolder.getName() + " for user "+contact.getId());
|
||||
gcubeLogger.trace("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("Send notifies added user "+ infoContactModel.getId() +" to share folder "+sharedFolder.getName() + " for user "+contact.getId());
|
||||
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
||||
|
||||
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getId(), sharedFolder, infoContactModel.getId());
|
||||
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(), sharedFolder, infoContactModel.getLogin());
|
||||
|
||||
if(!notify)
|
||||
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getId());
|
||||
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||
|
||||
}catch (Exception e) {
|
||||
gcubeLogger.error("An error occured in notifyFolderAddedUser ", e);
|
||||
|
@ -171,17 +266,17 @@ public class NotificationsProducer {
|
|||
try{
|
||||
|
||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
gcubeLogger.trace("User id: " +userId + " send notifies un shared folder "+unSharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("User id: " +userId + " send notifies un shared folder "+unSharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
||||
|
||||
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getId(), unSharedFolder);
|
||||
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), unSharedFolder);
|
||||
|
||||
if(!notify)
|
||||
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getId());
|
||||
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||
}
|
||||
}catch (Exception e) {
|
||||
gcubeLogger.error("An error occured in notifyFolderUnSharing ", e);
|
||||
|
@ -219,23 +314,22 @@ public class NotificationsProducer {
|
|||
try{
|
||||
|
||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
gcubeLogger.trace("Send notifies added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("Send notifies added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||
|
||||
//DEBUG
|
||||
// System.out.println("Send notify folder un share user "+infoContactModel.getId());
|
||||
|
||||
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getId(), workspaceItem, sharedFolder);
|
||||
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
||||
|
||||
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
||||
|
||||
if(!notify){
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||
//DEBUG
|
||||
System.out.println("An error occured when notify user: "+infoContactModel.getId());
|
||||
System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
|
@ -271,28 +365,28 @@ public class NotificationsProducer {
|
|||
public void run() {
|
||||
|
||||
// printContacts(listContacts);
|
||||
gcubeLogger.trace("Send notifies remove item in shared folder is running...");
|
||||
gcubeLogger.trace("Sending notificationremove item in shared folder is running...");
|
||||
|
||||
System.out.println("Send notifies remove item in shared folder is running...");
|
||||
System.out.println("Sending notification remove item in shared folder is running...");
|
||||
|
||||
for (InfoContactModel infoContactModel : listContacts) {
|
||||
try{
|
||||
|
||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
gcubeLogger.trace("Send notifies remove item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("Send notifies remove item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
||||
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||
|
||||
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getId(), workspaceItem, sharedFolder);
|
||||
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
||||
|
||||
if(!notify){
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("An error occured when notify user: "+infoContactModel.getId());
|
||||
System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.portlets.user.workspace.server.util;
|
|||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||
|
@ -16,6 +17,8 @@ import org.gcube.portlets.user.homelibrary.home.HomeLibrary;
|
|||
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItemType;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
||||
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
||||
|
@ -41,12 +44,13 @@ public class Util {
|
|||
// public static final String TEST_SCOPE = "/gcube/devsec";
|
||||
// public static final String TEST_USER = "pasquale.pagano";
|
||||
|
||||
public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
||||
public static final String TEST_SCOPE = "/gcube";
|
||||
// public static final String TEST_USER = "federico.defaveri";
|
||||
// public static final String TEST_USER = "massimiliano.assante";
|
||||
// public static final String TEST_USER = "pasquale.pagano";
|
||||
// public static final String TEST_USER = "francesco.mangiacrapa";
|
||||
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
||||
// public static final String TEST_USER = "aureliano.gentile";
|
||||
public static final String TEST_USER = "test.user";
|
||||
public static final String TEST_USER_FULL_NAME = "Test User";
|
||||
|
||||
|
@ -65,12 +69,13 @@ public class Util {
|
|||
//for test only
|
||||
// httpSession.setAttribute(USERNAME_ATTRIBUTE, TEST_USER);
|
||||
session = SessionManager.getInstance().getASLSession(sessionID, TEST_USER);
|
||||
session.setScope(TEST_SCOPE);
|
||||
if(!withoutPortal){ //TEMPORARY SOLUTION
|
||||
defaultLogger.error("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND");
|
||||
session.setScope(TEST_SCOPE);
|
||||
session.setUserAvatarId(TEST_USER + "Avatar");
|
||||
session.setUserFullName(TEST_USER_FULL_NAME);
|
||||
session.setUserEmailAddress(TEST_USER + "@mail.test");
|
||||
// httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
||||
}
|
||||
|
||||
withoutPortal = true;
|
||||
|
@ -215,4 +220,26 @@ public class Util {
|
|||
return session.getUsername();
|
||||
}
|
||||
|
||||
public static boolean isVRE(ASLSession session){
|
||||
|
||||
String currentScope = session.getScopeName();
|
||||
|
||||
int slashCount = StringUtils.countMatches(currentScope, "/");
|
||||
|
||||
if(slashCount < 3){
|
||||
defaultLogger.trace("currentScope is not VRE");
|
||||
return false;
|
||||
}
|
||||
|
||||
defaultLogger.trace("currentScope is VRE");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isASharedFolder(WorkspaceItem wsItem){
|
||||
if(wsItem!=null)
|
||||
return wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue