added download facility
This commit is contained in:
parent
ad937c9f13
commit
b86510ee92
|
@ -7,6 +7,8 @@ import java.util.Map;
|
||||||
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
|
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
|
||||||
|
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.interfaces.GXTFolderItemTypeEnum;
|
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
|
@ -19,10 +21,13 @@ import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
import com.github.gwtbootstrap.client.ui.Label;
|
import com.github.gwtbootstrap.client.ui.Label;
|
||||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
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.ButtonType;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ResizeType;
|
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.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Float;
|
import com.google.gwt.dom.client.Style.Float;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
@ -85,9 +90,12 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
HorizontalPanel hpHeaderDetails;
|
HorizontalPanel hpHeaderDetails;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button buttonClose;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel htmlPanelImagePreview;
|
HTMLPanel htmlPanelImagePreview;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTML txtName;
|
HTML txtName;
|
||||||
|
|
||||||
|
@ -138,6 +146,9 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button buttonUpdateDescription;
|
Button buttonUpdateDescription;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button buttonSaveDescription;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button buttonUpdateGcubeProperties;
|
Button buttonUpdateGcubeProperties;
|
||||||
|
@ -155,16 +166,14 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
|
|
||||||
private Command onCloseCommand;
|
private Command onCloseCommand;
|
||||||
|
|
||||||
|
private Tooltip tooltipDownload = new Tooltip("Download");
|
||||||
|
|
||||||
|
private Button buttonDownload = new Button("Download");
|
||||||
|
|
||||||
|
// private Tooltip tooltipSharebleLink = new Tooltip("Get Shareable Link");
|
||||||
|
// private Button buttonShareableLink = new Button();
|
||||||
|
|
||||||
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM yyyy, hh:mm aaa");
|
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM yyyy, hh:mm aaa");
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* textAreaSharedWith = new TextArea(); private Html htmlUsersWidget = new
|
|
||||||
* Html(); private Html htmlPropertiesWidget = new Html(); private final
|
|
||||||
* NumberFormat number = ConstantsExplorer.numberFormatterKB; // private
|
|
||||||
* TextField<String> txtGcubeItemProperties; private HorizontalPanel
|
|
||||||
* hpGcubeProperties; private DialogEditProperties editProperties = null;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new dialog get info bootstrap.
|
* Instantiates a new dialog get info bootstrap.
|
||||||
|
@ -177,29 +186,17 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
this.fileModel = fileModel;
|
this.fileModel = fileModel;
|
||||||
this.onCloseCommand = onCloseCommand;
|
this.onCloseCommand = onCloseCommand;
|
||||||
|
|
||||||
hpHeaderDetails.add(new HTML("Details"));
|
|
||||||
|
|
||||||
Button buttonClose = new Button();
|
|
||||||
buttonClose.setType(ButtonType.LINK);
|
|
||||||
buttonClose.setIcon(IconType.REMOVE);
|
|
||||||
buttonClose.addClickHandler(new ClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
onCloseCommand.execute();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonClose.getElement().getStyle().setFloat(Float.RIGHT);
|
buttonClose.getElement().getStyle().setFloat(Float.RIGHT);
|
||||||
hpHeaderDetails.add(buttonClose);
|
|
||||||
|
|
||||||
hpItemType.add(fileModel.getIcon());
|
hpItemType.add(fileModel.getIcon());
|
||||||
Label labelItemType = new Label();
|
Label labelItemType = new Label();
|
||||||
labelItemType.setType(LabelType.INFO);
|
labelItemType.setType(LabelType.DEFAULT);
|
||||||
labelItemType.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
//labelItemType.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||||
String label = null;
|
String label = null;
|
||||||
|
|
||||||
GXTFolderItemTypeEnum typeEnum = fileModel.getGXTFolderItemType();
|
GXTFolderItemTypeEnum typeEnum = fileModel.getGXTFolderItemType();
|
||||||
|
|
||||||
|
//if the item is categorized
|
||||||
if (typeEnum != null) {
|
if (typeEnum != null) {
|
||||||
label = typeEnum.getLabel();
|
label = typeEnum.getLabel();
|
||||||
label = label.replace("External ", "");
|
label = label.replace("External ", "");
|
||||||
|
@ -209,12 +206,24 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
loadGcubeItemProperties();
|
loadGcubeItemProperties();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
//using the type (i.e. mimetype)
|
||||||
label = fileModel.getType();
|
label = fileModel.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
labelItemType.setText(label);
|
labelItemType.setText(label);
|
||||||
|
|
||||||
hpItemType.add(labelItemType);
|
hpItemType.add(labelItemType);
|
||||||
|
|
||||||
|
buttonDownload.setType(ButtonType.LINK);
|
||||||
|
buttonDownload.setIcon(IconType.CLOUD_DOWNLOAD);
|
||||||
|
tooltipDownload.add(buttonDownload);
|
||||||
|
hpItemType.add(tooltipDownload);
|
||||||
|
|
||||||
|
// buttonShareableLink.setType(ButtonType.LINK);
|
||||||
|
// buttonShareableLink.setIcon(IconType.LINK);
|
||||||
|
// buttonShareableLink.set
|
||||||
|
// tooltipSharebleLink.add(buttonShareableLink);
|
||||||
|
// hpItemType.add(tooltipSharebleLink);
|
||||||
|
|
||||||
|
|
||||||
// Setting name
|
// Setting name
|
||||||
htmlSetValue(txtName, fileModel.getName());
|
htmlSetValue(txtName, fileModel.getName());
|
||||||
|
@ -273,14 +282,12 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
loadACLsDescriptionForSharedFolder(fileModel.getIdentifier());
|
loadACLsDescriptionForSharedFolder(fileModel.getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// is it an image?
|
// is it an image?
|
||||||
if (typeEnum!=null && (typeEnum.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)
|
if (typeEnum!=null && (typeEnum.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)
|
||||||
|| typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE))) {
|
|| typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE))) {
|
||||||
loadThumbnailsForImage();
|
loadThumbnailsForImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addHandlers();
|
addHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,28 +295,47 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
* Adds the handlers.
|
* Adds the handlers.
|
||||||
*/
|
*/
|
||||||
private void addHandlers() {
|
private void addHandlers() {
|
||||||
|
|
||||||
txtAreaDescription.addKeyPressHandler(new KeyPressHandler() {
|
buttonClose.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onKeyPress(KeyPressEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
onCloseCommand.execute();
|
||||||
GWT.log(event.getUnicodeCharCode() + "");
|
|
||||||
|
|
||||||
if (event.getUnicodeCharCode() == 13) {
|
|
||||||
txtAreaDescription.setReadOnly(true);
|
|
||||||
Window.alert("Updating description");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// txtAreaDescription.addKeyPressHandler(new KeyPressHandler() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onKeyPress(KeyPressEvent event) {
|
||||||
|
//
|
||||||
|
// GWT.log(event.getUnicodeCharCode() + "");
|
||||||
|
//
|
||||||
|
// if (event.getUnicodeCharCode() == 13) {
|
||||||
|
// txtAreaDescription.setReadOnly(true);
|
||||||
|
// Window.alert("Updating description");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
buttonUpdateDescription.addClickHandler(new ClickHandler() {
|
buttonUpdateDescription.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
txtAreaDescription.setReadOnly(false);
|
txtAreaDescription.setReadOnly(false);
|
||||||
txtAreaDescription.setFocus(true);
|
txtAreaDescription.setFocus(true);
|
||||||
|
buttonSaveDescription.setVisible(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonSaveDescription.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
buttonSaveDescription.setVisible(false);
|
||||||
|
txtAreaDescription.setReadOnly(true);
|
||||||
|
Window.alert("To be implemented");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -340,6 +366,16 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
onCloseCommand.execute();
|
onCloseCommand.execute();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
buttonDownload.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
AppControllerExplorer.getEventBus()
|
||||||
|
.fireEvent(new FileDownloadEvent(fileModel.getIdentifier(), fileModel.getName(),
|
||||||
|
DownloadType.SHOW, fileModel.isDirectory() || fileModel.isVreFolder(), null));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<g:HorizontalPanel ui:field="hpHeaderDetails"
|
<g:HorizontalPanel ui:field="hpHeaderDetails"
|
||||||
addStyleNames="item-details-header">
|
addStyleNames="item-details-header">
|
||||||
|
<g:HTML>Details</g:HTML>
|
||||||
|
<b:Button icon="REMOVE" ui:field="buttonClose" type="LINK"></b:Button>
|
||||||
</g:HorizontalPanel>
|
</g:HorizontalPanel>
|
||||||
<g:HorizontalPanel ui:field="hpItemType"
|
<g:HorizontalPanel ui:field="hpItemType"
|
||||||
addStyleNames="item-type-style">
|
addStyleNames="item-type-style">
|
||||||
|
@ -81,10 +83,14 @@
|
||||||
<b:TextArea ui:field="txtAreaDescription"
|
<b:TextArea ui:field="txtAreaDescription"
|
||||||
readOnly="true">
|
readOnly="true">
|
||||||
</b:TextArea>
|
</b:TextArea>
|
||||||
<b:Tooltip text="Update the Description">
|
<b:Tooltip text="Edit the Description">
|
||||||
<b:Button icon="PENCIL"
|
<b:Button icon="EDIT"
|
||||||
ui:field="buttonUpdateDescription" type="LINK">Edit</b:Button>
|
ui:field="buttonUpdateDescription" type="LINK">Edit</b:Button>
|
||||||
</b:Tooltip>
|
</b:Tooltip>
|
||||||
|
<b:Tooltip text="Save the Description">
|
||||||
|
<b:Button icon="SAVE"
|
||||||
|
ui:field="buttonSaveDescription" type="LINK" visible="false">Save</b:Button>
|
||||||
|
</b:Tooltip>
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
<b:ControlGroup
|
<b:ControlGroup
|
||||||
|
@ -150,8 +156,8 @@
|
||||||
<g:HTML ui:field="txtSharedWith">
|
<g:HTML ui:field="txtSharedWith">
|
||||||
</g:HTML>
|
</g:HTML>
|
||||||
<b:Tooltip text="Go to Share">
|
<b:Tooltip text="Go to Share">
|
||||||
<b:Button icon="USER"
|
<b:Button icon="USER" ui:field="buttonUpdateShare"
|
||||||
ui:field="buttonUpdateShare" type="LINK">Share</b:Button>
|
type="LINK">Share</b:Button>
|
||||||
</b:Tooltip>
|
</b:Tooltip>
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
|
@ -357,7 +357,6 @@ table.userssuggest th {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.item-type-style td:first-child {
|
.item-type-style td:first-child {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
|
@ -367,6 +366,13 @@ table.userssuggest th {
|
||||||
vertical-align: middle !important;
|
vertical-align: middle !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*THIS IS THE SIZE OF DOWNLOAD ICON
|
||||||
|
IN THE 'DETAILS' PANEL*/
|
||||||
|
.item-type-style td a i{
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.item-details-header {
|
.item-details-header {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
|
|
Loading…
Reference in New Issue