diff --git a/.classpath b/.classpath
index 5cabfdb..2a4ed4d 100644
--- a/.classpath
+++ b/.classpath
@@ -14,7 +14,6 @@
-
diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs
index 2166963..020c803 100644
--- a/.settings/com.google.gdt.eclipse.core.prefs
+++ b/.settings/com.google.gdt.eclipse.core.prefs
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
-lastWarOutDir=/home/backup-old-home/francesco-mangiacrapa/workspace/workspace/target/workspace-6.0.0-SNAPSHOT
+lastWarOutDir=/home/francesco-mangiacrapa/workspace/workspace/target/workspace-6.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false
diff --git a/pom.xml b/pom.xml
index 9898e06..e594799 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,7 +102,7 @@
org.gcube.contentmanagement
storage-resource-link-plugin
- 1.0.0-SNAPSHOT
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
provided
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java
index 0e503dc..f65c8ef 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java
@@ -23,6 +23,8 @@ import org.gcube.portlets.user.workspace.client.event.FileDownloadEventHandler;
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
import org.gcube.portlets.user.workspace.client.event.FileUploadEventHandler;
import org.gcube.portlets.user.workspace.client.event.FilterScopeEvent;
+import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
+import org.gcube.portlets.user.workspace.client.event.GetInfoEventHandler;
import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEvent;
import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEventHandler;
import org.gcube.portlets.user.workspace.client.event.GridElementUnSelectedEvent;
@@ -63,6 +65,7 @@ import org.gcube.portlets.user.workspace.client.view.WorskpacePortlet;
import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel;
import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel;
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
+import org.gcube.portlets.user.workspace.client.window.DialogGetInfo;
import org.gcube.portlets.user.wsmail.client.forms.MailForm;
import com.google.gwt.core.client.GWT;
@@ -134,7 +137,17 @@ public class AppController implements SubscriberInterface {
}
}
});
+
+ eventBus.addHandler(GetInfoEvent.TYPE, new GetInfoEventHandler() {
+
+ @Override
+ public void onGetInfo(GetInfoEvent getInfoEvent) {
+ new DialogGetInfo(getInfoEvent.getSourceFile());
+ }
+ });
+
+ //********EVENTS TO NOTIFY SUBSCRIBERS
eventBus.addHandler(OpenReportsEvent.TYPE, new OpenReportsEventHandler() {
@Override
@@ -467,7 +480,7 @@ public class AppController implements SubscriberInterface {
if(isSelected){
FileModel lastParent = this.wsPortlet.getToolBarPath().getLastParent();
- if(lastParent!=null){
+ if(lastParent!=null && target.getParentFileModel()!=null){
boolean parentChanged = lastParent.getIdentifier().compareTo(target.getParentFileModel().getIdentifier())==0?false:true;
//RELOAD breadcrumb only if last parent id is changed
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java
index b178c15..3a345a8 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java
@@ -8,11 +8,11 @@ package org.gcube.portlets.user.workspace.client;
public class ConstantsPortlet {
// ToolBar button
- public static final String ADDFOLDER = "Add Folder";
- public static final String REMOVEITEM = "Remove Item";
- public static final String RENAMEITEM = "Rename Item";
- public static final String UPLOADFILE = "Upload File";
- public static final String DOWNLOADITEM = "Download Item";
+ public static final String ADDFOLDER = "New Folder";
+ public static final String REMOVEITEM = "Remove";
+ public static final String RENAMEITEM = "Rename";
+ public static final String UPLOADFILE = "Upload";
+ public static final String DOWNLOADITEM = "Download";
public static final String UPLOADARCHIVE = "Upload Archive";
public static final String GET_SEARCH_PARAMETER ="search";
@@ -38,11 +38,11 @@ public class ConstantsPortlet {
public static final String CANCEL = "Cancel";
public static final String SEARCHINWORSPACE = "Search in workspace";
public static final String SEARCHINMESSAGE = "Search in messages";
- public static final String VIEWSPACE = "Filter by Space";
+ public static final String VIEWSPACE = "";//"Filter by Space";
public static final String PREVIEW = "Preview";
public static final String OPEN = "Open";
- public static final String TITLEACCESSWEBDAV = "Access from Desktop";
+ public static final String TITLEACCESSWEBDAV = "Desktop Access";
//COOKIE SETTINGS
public static final String GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING = "GCUBE-Cookie-WorkspaceGridViewSetting";
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GetInfoEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetInfoEvent.java
new file mode 100644
index 0000000..d0ade7b
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetInfoEvent.java
@@ -0,0 +1,35 @@
+package org.gcube.portlets.user.workspace.client.event;
+
+import org.gcube.portlets.user.workspace.client.model.FileGridModel;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+/**
+ *
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ *
+ */
+public class GetInfoEvent extends GwtEvent {
+ public static Type TYPE = new Type();
+
+ private FileGridModel targetFile = null;
+
+ public GetInfoEvent(FileGridModel target) {
+ this.targetFile = target;
+ }
+
+ @Override
+ public Type getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(GetInfoEventHandler handler) {
+ handler.onGetInfo(this);
+
+ }
+
+ public FileGridModel getSourceFile() {
+ return targetFile;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GetInfoEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetInfoEventHandler.java
new file mode 100644
index 0000000..e496598
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetInfoEventHandler.java
@@ -0,0 +1,12 @@
+package org.gcube.portlets.user.workspace.client.event;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ *
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ *
+ */
+public interface GetInfoEventHandler extends EventHandler {
+ void onGetInfo(GetInfoEvent getInfoEvent);
+}
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java
index e5ba3a6..6f82c7c 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java
@@ -32,7 +32,6 @@ import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
/**
@@ -45,7 +44,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
private GxtComboBox comboBoxGxt = null;
private ComboBox cbViewScope = null;
- private HTML txtViewScope = new HTML(""+ConstantsPortlet.VIEWSPACE+":");
+// private HTML txtViewScope = new HTML(""+ConstantsPortlet.VIEWSPACE+":");
private final TextField textSearch = new TextField();
private Button bSearch = new Button(ConstantsPortlet.SEARCH);
private Button bCancel = new Button(ConstantsPortlet.CANCEL);
@@ -65,8 +64,8 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
public GxtSeachAndFilterPanel(HorizontalPanel toolbarContainer) {
- txtViewScope.getElement().getStyle().setColor("#15428B");
- txtViewScope.getElement().getStyle().setFontSize(12, Unit.PX);
+// txtViewScope.getElement().getStyle().setColor("#15428B");
+// txtViewScope.getElement().getStyle().setFontSize(12, Unit.PX);
setLayout(new FitLayout());
setBorders(true);
@@ -84,8 +83,8 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
hp.setStyleAttribute("padding", "2px");
- this.cbViewScope.setStyleAttribute("margin-left", "5px");
- this.cbViewScope.setStyleAttribute("margin-right", "70px");
+ this.cbViewScope.setStyleAttribute("margin-left", "132px");
+ // this.cbViewScope.setStyleAttribute("margin-right", "70px");
seVisibleButtonsCancelSave(false);
@@ -114,7 +113,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
hp2.setHorizontalAlign(HorizontalAlignment.RIGHT);
hp2.setVerticalAlign(VerticalAlignment.MIDDLE);
- hp2.add(txtViewScope);
+ //hp2.add(txtViewScope);
hp2.add(cbViewScope);
cbViewScope.setStyleAttribute("margin-top", "2px");
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItem.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItem.java
index b134809..f674300 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItem.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItem.java
@@ -11,6 +11,7 @@ import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent.UploadType;
+import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent;
import org.gcube.portlets.user.workspace.client.event.OpenReportsEvent;
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
@@ -28,7 +29,6 @@ import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
-import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
@@ -54,6 +54,7 @@ public class GxtToolBarItem {
private ToolBar toolBar = new ToolBar();
private Button btnPreview;
private ToggleButton btnGridView;
+ private Button btnGetInfo;
public GxtToolBarItem() {
initToolBar();
@@ -82,7 +83,23 @@ public class GxtToolBarItem {
btnAddFolder.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnAddFolder);
-// toolBar.add(new SeparatorToolItem());
+
+ btnUploadFile = new Button(ConstantsPortlet.UPLOADFILE,
+ Resources.getIconFileUpload());
+ btnUploadFile.setScale(ButtonScale.SMALL);
+ btnUploadFile.setIconAlign(IconAlign.TOP);
+ btnUploadFile.setArrowAlign(ButtonArrowAlign.BOTTOM);
+
+ toolBar.add(btnUploadFile);
+
+ toolBar.add(new SeparatorToolItem());
+
+ btnGetInfo = new Button("Info", Resources.getIconInfo());
+ btnGetInfo.setScale(ButtonScale.SMALL);
+ btnGetInfo.setIconAlign(IconAlign.TOP);
+ btnGetInfo.setArrowAlign(ButtonArrowAlign.BOTTOM);
+
+ toolBar.add(btnGetInfo);
// toolBar.add(new SeparatorToolItem());
btnRemoveItem = new Button(ConstantsPortlet.REMOVEITEM,
@@ -102,18 +119,12 @@ public class GxtToolBarItem {
btnRenameItem.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnRenameItem);
-// toolBar.add(new SeparatorToolItem());
-// toolBar.add(new SeparatorToolItem());
-
btnDownloadFile = new Button(ConstantsPortlet.DOWNLOADITEM,Resources.getIconDownload());
btnDownloadFile.setScale(ButtonScale.SMALL);
btnDownloadFile.setIconAlign(IconAlign.TOP);
btnDownloadFile.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnDownloadFile);
-
-// toolBar.add(new SeparatorToolItem());
-// toolBar.add(new SeparatorToolItem());
btnPreview = new Button(ConstantsPortlet.PREVIEW ,Resources.getIconPreview());
btnPreview.setScale(ButtonScale.SMALL);
@@ -121,9 +132,6 @@ public class GxtToolBarItem {
btnPreview.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnPreview);
-// toolBar.add(new SeparatorToolItem());
-// toolBar.add(new SeparatorToolItem());
-
btnOpen = new Button(ConstantsPortlet.OPEN ,Resources.getIconShow());
btnOpen.setScale(ButtonScale.SMALL);
btnOpen.setIconAlign(IconAlign.TOP);
@@ -139,21 +147,9 @@ public class GxtToolBarItem {
btnAccessFromDesktop.setIconAlign(IconAlign.TOP);
btnAccessFromDesktop.setArrowAlign(ButtonArrowAlign.BOTTOM);
-// btnAccessFromDesktop = new Button(ConstantsPortlet.TITLEACCESSWEBDAV);
-// btnAccessFromDesktop.setScale(ButtonScale.SMALL);
-// btnAccessFromDesktop.addStyleName("button-hyperlink");
-
toolBar.add(btnAccessFromDesktop);
-
- toolBar.add(new FillToolItem());
-
- btnUploadFile = new Button(ConstantsPortlet.UPLOADFILE,
- Resources.getIconFileUpload());
- btnUploadFile.setScale(ButtonScale.SMALL);
- btnUploadFile.setIconAlign(IconAlign.TOP);
- btnUploadFile.setArrowAlign(ButtonArrowAlign.BOTTOM);
-
- toolBar.add(btnUploadFile);
+ toolBar.add(new SeparatorToolItem());
+
// toolBar.add(new SeparatorToolItem());
// toolBar.add(new SeparatorToolItem());
@@ -229,6 +225,18 @@ public class GxtToolBarItem {
new DeleteItemEvent(fileGridModel));
}
});
+
+ btnGetInfo.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void componentSelected(ButtonEvent ce) {
+
+ final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
+
+ AppController.getEventBus().fireEvent(new GetInfoEvent(fileGridModel));
+
+ }
+ });
btnRenameItem.addSelectionListener(new SelectionListener() {
@@ -436,11 +444,13 @@ public class GxtToolBarItem {
this.btnRenameItem.disable();
this.btnDownloadFile.disable();
this.btnOpen.disable();
+ this.btnGetInfo.disable();
} else {
this.btnRemoveItem.enable();
this.btnRenameItem.enable();
this.btnDownloadFile.enable();
this.btnOpen.enable();
+ this.btnGetInfo.enable();
}
@@ -450,6 +460,7 @@ public class GxtToolBarItem {
btnRemoveItem.setEnabled(active);
btnRenameItem.setEnabled(active);
+ btnGetInfo.setEnabled(active);
btnDownloadFile.setEnabled(active);
btnPreview.setEnabled(active);
btnOpen.setEnabled(active);
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/window/DialogGetInfo.java b/src/main/java/org/gcube/portlets/user/workspace/client/window/DialogGetInfo.java
new file mode 100644
index 0000000..a51ddfe
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/window/DialogGetInfo.java
@@ -0,0 +1,199 @@
+package org.gcube.portlets.user.workspace.client.window;
+
+import java.util.List;
+
+import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
+import org.gcube.portlets.user.workspace.client.model.FileGridModel;
+import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
+
+import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
+import com.extjs.gxt.ui.client.event.ButtonEvent;
+import com.extjs.gxt.ui.client.event.SelectionListener;
+import com.extjs.gxt.ui.client.widget.Dialog;
+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;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ *
+ */
+public class DialogGetInfo extends Dialog {
+
+ private int widthDialog = 450;
+ private int heightTextArea = 50;
+ private TextField txtName = new TextField();
+ private TextField txtType = new TextField();
+ private TextField txtCategory = new TextField();
+ private TextField txtOwner = new TextField();
+
+ private TextField txtCreated = new TextField();
+ private TextField txtSize = new TextField();
+ private TextField txtLocation = new TextField();
+ private TextField txtShared = new TextField();
+ private TextArea textAreaSharedWith = new TextArea();
+ private final NumberFormat number = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
+
+
+ public DialogGetInfo(FileGridModel fileModel) {
+
+ FormLayout layout = new FormLayout();
+ layout.setLabelWidth(90);
+ layout.setDefaultWidth(300);
+ setLayout(layout);
+
+ setIcon(fileModel.getAbstractPrototypeIcon());
+ setHeading(fileModel.getName() + " Properties");
+
+ setButtonAlign(HorizontalAlignment.RIGHT);
+ setModal(true);
+// setBodyBorder(true);
+ setBodyStyle("padding: 9px; background: none");
+ setWidth(widthDialog);
+ setResizable(false);
+ setButtons(Dialog.OK);
+
+ txtName = new TextField();
+ txtName.setFieldLabel("Name");
+ txtName.setReadOnly(true);
+ textFieldSetValue(txtName,fileModel.getName());
+ add(txtName);
+
+ txtType = new TextField();
+ txtType.setFieldLabel("Type");
+ txtType.setReadOnly(true);
+ textFieldSetValue(txtType,fileModel.getType());
+ add(txtType);
+
+ txtCategory = new TextField();
+ txtCategory.setFieldLabel("Category");
+ txtCategory.setReadOnly(true);
+ textFieldSetValue(txtCategory,fileModel.getShortcutCategory());
+ add(txtCategory);
+
+ txtOwner = new TextField();
+ txtOwner.setFieldLabel("Owner");
+ txtOwner.setReadOnly(true);
+ loadOwner(fileModel.getIdentifier());
+ add(txtOwner);
+
+ txtCreated = new TextField();
+ txtCreated.setFieldLabel("Created");
+ txtCreated.setReadOnly(true);
+ textFieldSetValue(txtCreated,fileModel.getCreationDate().toString());
+ add(txtCreated);
+
+ txtSize = new TextField();
+ txtSize.setFieldLabel("Size");
+ txtSize.setReadOnly(true);
+
+ textFieldSetValue(txtSize,getFormattedSize(fileModel.getSize()));
+ add(txtSize);
+
+
+ txtShared = new TextField();
+ txtShared.setFieldLabel("Shared");
+ txtShared.setReadOnly(true);
+ textFieldSetValue(txtShared,fileModel.isShared()+"");
+ add(txtShared);
+
+
+ if(fileModel.isShared()){
+
+ textAreaSharedWith.setFieldLabel("Shared with");
+ textAreaSharedWith.setHeight(heightTextArea);
+ textAreaSharedWith.setReadOnly(true);
+ getListSharedContacts(fileModel.getIdentifier());
+ add(textAreaSharedWith);
+ }
+
+
+ this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void componentSelected(ButtonEvent ce) {
+ hide();
+ }
+ });
+
+
+
+ this.show();
+ }
+
+ private void textFieldSetValue(TextField field, String value){
+
+ if(value==null || value.isEmpty())
+ field.setValue("unknown");
+ else
+ field.setValue(value);
+ }
+
+ private void loadOwner(final String itemId){
+
+ txtOwner.mask();
+ AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(itemId, new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ GWT.log("an error occured in get Owner by Id "+itemId + " "+caught.getMessage());
+ txtOwner.unmask();
+ }
+
+ @Override
+ public void onSuccess(InfoContactModel result) {
+ textFieldSetValue(txtOwner,result.getName());
+ txtOwner.unmask();
+ }
+ });
+ }
+
+ private void getListSharedContacts(String sharedId){
+
+ textAreaSharedWith.mask();
+
+ AppControllerExplorer.rpcWorkspaceService.getListUserSharedBySharedItem(sharedId, new AsyncCallback>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ textAreaSharedWith.unmask();
+
+ }
+
+ @Override
+ public void onSuccess(List result) {
+
+ String users = "";
+
+ for (int i = 0; i < result.size()-1; i++) {
+ users+= result.get(i).getName() + ", ";
+ }
+
+ if(result.size()>1)
+ users += result.get(result.size()-1).getName();
+
+ textAreaSharedWith.setValue(users);
+
+ textAreaSharedWith.unmask();
+ }
+ });
+ }
+
+ private String getFormattedSize(long value){
+
+ if(value>0){
+ double kb = value/1024;
+ if(kb<1)
+ kb=1;
+ return number.format(kb);
+ }
+ return "";
+
+ }
+
+
+
+}
\ No newline at end of file