Implemented improvements reported at #19600#note-4

task/19600
Francesco Mangiacrapa 4 years ago
parent ed37efe568
commit 4721a48c31

@ -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 ", "");
// loading gcube properties
if (typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM))
loadGcubeItemProperties();
} else {
//using the type (i.e. mimetype)
label = fileModel.getType();
//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 ", "");
} 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<PublicLink>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(PublicLink result) {
GWT.log("The PublicLink link is: "+result);
if(result!=null) {
// String pdfPreview = "<object "
// + "width=\"300\" "
// + "height=\"300\" "
// + "type=\"application/pdf\" "
// + "data=\""+result.getCompleteURL()+"?#zoom=85&scrollbar=0&toolbar=0&navpanes=0\">"
// + "<p>This browser does not support PDFs</p>"
// + "</object>";
//
// String pdfPreview = "<iframe "
// + "src=\"http://docs.google.com/gview?url="+result.getCompleteURL()+"&embedded=true\" "
// + "style=\"width:90%; max-height:400px;\" frameborder=\"0\"></iframe>";
//
String pdfPreview = "<object data=\""+result.getCompleteURL()+"\" type=\"application/pdf\" width=\"250\" height=\"300\">"
+ "<iframe src=\""+result.getCompleteURL()+"\" style=\"border: none;\" width=\"100%\" height=\"100%\">"
+ "This browser does not support PDFs. Please download the PDF to view it: "
+ "<a href=\""+result.getCompleteURL()+"\">Download PDF</a></iframe>"
+ "</object>";
//
String pdfPreview = "<object data=\""+result.getCompleteURL()+"\" type=\"application/pdf\" width=\"100%\" height=\"100%\">"</object>";
//pdfPreview = "<embed src=\""+result.getCompleteURL()+"\" type=\"application/pdf\" width=\"100%\" height=\"100%\">";
htmlPanelImagePreview.add(new HTML(pdfPreview));
htmlPanelImagePreview.setVisible(true);
}
}
});
}*/
}
addHandlers();

@ -60,7 +60,7 @@
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
addStyleNames="my-control-group-get-info" ui:field="cgTxtMimeType">
<b:ControlLabel>Type</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtMimeType">
@ -125,7 +125,7 @@
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Last Mofication</b:ControlLabel>
<b:ControlLabel>Modified</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtLastMofication">
</g:HTML>

@ -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;

Loading…
Cancel
Save