From 4721a48c311ccd856c94dd1be24b425503a8fab9 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 17 Jul 2020 13:02:54 +0200 Subject: [PATCH] Implemented improvements reported at #19600#note-4 --- .../view/windows/DialogGetInfoBootstrap.java | 127 +++++++++++++++--- .../windows/DialogGetInfoBootstrap.ui.xml | 4 +- .../user/workspace/public/workspacetree.css | 4 +- 3 files changed, 110 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.java index 7eedce6..67e68fa 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.java @@ -15,6 +15,7 @@ import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem; import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage; import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument; +import org.gcube.portlets.user.workspace.shared.PublicLink; import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync; import com.github.gwtbootstrap.client.ui.Button; @@ -23,24 +24,18 @@ import com.github.gwtbootstrap.client.ui.Label; import com.github.gwtbootstrap.client.ui.TextArea; import com.github.gwtbootstrap.client.ui.Tooltip; import com.github.gwtbootstrap.client.ui.constants.ButtonType; -import com.github.gwtbootstrap.client.ui.constants.IconSize; import com.github.gwtbootstrap.client.ui.constants.IconType; import com.github.gwtbootstrap.client.ui.constants.LabelType; import com.github.gwtbootstrap.client.ui.constants.ResizeType; -import com.github.gwtbootstrap.client.ui.resources.ButtonSize; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Style.Float; -import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.dom.client.KeyPressHandler; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.i18n.client.NumberFormat; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTML; @@ -113,6 +108,9 @@ public class DialogGetInfoBootstrap extends Composite { @UiField HTML txtMimeType; + + @UiField + ControlGroup cgTxtMimeType; @UiField ControlGroup cgThreddsSynched; @@ -185,6 +183,7 @@ public class DialogGetInfoBootstrap extends Composite { initWidget(uiBinder.createAndBindUi(this)); this.fileModel = fileModel; this.onCloseCommand = onCloseCommand; + this.cgTxtMimeType.setVisible(true); buttonClose.getElement().getStyle().setFloat(Float.RIGHT); @@ -193,23 +192,49 @@ public class DialogGetInfoBootstrap extends Composite { labelItemType.setType(LabelType.DEFAULT); //labelItemType.getElement().getStyle().setMarginLeft(10, Unit.PX); String label = null; - + GXTFolderItemTypeEnum typeEnum = fileModel.getGXTFolderItemType(); - //if the item is categorized - if (typeEnum != null) { - label = typeEnum.getLabel(); - label = label.replace("External ", ""); + //in case of folder see #19600 + if(fileModel.isDirectory()) { + + label = "Private Folder"; + + if(fileModel.isPublic()) { + //is public + label = "Public Folder"; + if(fileModel.isShared()) { + label = "Shared and Public Folder"; + } + }else { + //is not public + if(fileModel.isShared()) { + //is shared + label = "Shared Folder"; + + if(fileModel.isVreFolder()) { + label = "VRE Folder"; + } + } + } + + //hiding the type + cgTxtMimeType.setVisible(false); + + }else { + //in case of file see #19600 + if (typeEnum != null) { + //the file is categorized + label = typeEnum.getLabel(); + label = label.replace("External ", ""); - // loading gcube properties - if (typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM)) - loadGcubeItemProperties(); - - } else { - //using the type (i.e. mimetype) - label = fileModel.getType(); + } else { + //the file is NOT categorized using the default "File" + label = "File"; + } } + labelItemType.setText(label); hpItemType.add(labelItemType); @@ -245,6 +270,7 @@ public class DialogGetInfoBootstrap extends Composite { } } + //mimetype htmlSetValue(txtMimeType, fileModel.getType()); @@ -282,10 +308,67 @@ public class DialogGetInfoBootstrap extends Composite { loadACLsDescriptionForSharedFolder(fileModel.getIdentifier()); } - // is it an image? - if (typeEnum!=null && (typeEnum.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT) - || typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE))) { - loadThumbnailsForImage(); + if (typeEnum != null) { + + // is it an image? + if (typeEnum.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT) + || typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE)) { + loadThumbnailsForImage(); + } + + // is it a GCUBE-Item? + if (typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM)) { + loadGcubeItemProperties(); + } + + /* + if(typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE) || + typeEnum.equals(GXTFolderItemTypeEnum.PDF_DOCUMENT)) { + + GWT.log("The file is a PDF"); + + AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFileItemId(fileModel.getIdentifier(), false, new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + } + + @Override + public void onSuccess(PublicLink result) { + + GWT.log("The PublicLink link is: "+result); + + if(result!=null) { + +// String pdfPreview = "" +// + "

This browser does not support PDFs

" +// + "
"; +// +// String pdfPreview = ""; +// + + String pdfPreview = "" + + "" + + ""; +// + String pdfPreview = """; + + //pdfPreview = ""; + + htmlPanelImagePreview.add(new HTML(pdfPreview)); + htmlPanelImagePreview.setVisible(true); + } + } + }); + }*/ } addHandlers(); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.ui.xml b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.ui.xml index ec05019..e529cca 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.ui.xml +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfoBootstrap.ui.xml @@ -60,7 +60,7 @@ + addStyleNames="my-control-group-get-info" ui:field="cgTxtMimeType"> Type @@ -125,7 +125,7 @@ - Last Mofication + Modified diff --git a/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css b/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css index 5f22e29..d7b9258 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css +++ b/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css @@ -304,9 +304,11 @@ table.userssuggest th { .my-control-group-get-info { margin-bottom: 5px !important; + margin-left: 10px; font-size: 14px !important; font-family: Arial, serif; color: #222; + } .my-control-group-get-info .controls { @@ -315,7 +317,7 @@ table.userssuggest th { .my-control-group-get-info .control-label { width: 80px !important; - text-align: center !important; + text-align: left !important; padding-right: 10px !important; font-family: Roboto, Arial, serif !important; color: #959595;