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.ConstantsExplorer;
|
||||
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.model.FileGridModel;
|
||||
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.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;
|
||||
|
@ -85,6 +90,9 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
@UiField
|
||||
HorizontalPanel hpHeaderDetails;
|
||||
|
||||
@UiField
|
||||
Button buttonClose;
|
||||
|
||||
@UiField
|
||||
HTMLPanel htmlPanelImagePreview;
|
||||
|
||||
|
@ -139,6 +147,9 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
@UiField
|
||||
Button buttonUpdateDescription;
|
||||
|
||||
@UiField
|
||||
Button buttonSaveDescription;
|
||||
|
||||
@UiField
|
||||
Button buttonUpdateGcubeProperties;
|
||||
|
||||
|
@ -155,17 +166,15 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
|
||||
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");
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
|
@ -177,29 +186,17 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
this.fileModel = fileModel;
|
||||
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);
|
||||
hpHeaderDetails.add(buttonClose);
|
||||
|
||||
hpItemType.add(fileModel.getIcon());
|
||||
Label labelItemType = new Label();
|
||||
labelItemType.setType(LabelType.INFO);
|
||||
labelItemType.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
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 ", "");
|
||||
|
@ -209,13 +206,25 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
loadGcubeItemProperties();
|
||||
|
||||
} else {
|
||||
//using the type (i.e. mimetype)
|
||||
label = fileModel.getType();
|
||||
}
|
||||
|
||||
labelItemType.setText(label);
|
||||
|
||||
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
|
||||
htmlSetValue(txtName, fileModel.getName());
|
||||
htmlSetValue(txtId, fileModel.getIdentifier());
|
||||
|
@ -273,14 +282,12 @@ 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();
|
||||
}
|
||||
|
||||
|
||||
addHandlers();
|
||||
}
|
||||
|
||||
|
@ -289,27 +296,46 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
*/
|
||||
private void addHandlers() {
|
||||
|
||||
txtAreaDescription.addKeyPressHandler(new KeyPressHandler() {
|
||||
buttonClose.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
|
||||
GWT.log(event.getUnicodeCharCode() + "");
|
||||
|
||||
if (event.getUnicodeCharCode() == 13) {
|
||||
txtAreaDescription.setReadOnly(true);
|
||||
Window.alert("Updating description");
|
||||
}
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
onCloseCommand.execute();
|
||||
}
|
||||
});
|
||||
|
||||
// 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() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
txtAreaDescription.setReadOnly(false);
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
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:HorizontalPanel ui:field="hpHeaderDetails"
|
||||
addStyleNames="item-details-header">
|
||||
<g:HTML>Details</g:HTML>
|
||||
<b:Button icon="REMOVE" ui:field="buttonClose" type="LINK"></b:Button>
|
||||
</g:HorizontalPanel>
|
||||
<g:HorizontalPanel ui:field="hpItemType"
|
||||
addStyleNames="item-type-style">
|
||||
|
@ -81,10 +83,14 @@
|
|||
<b:TextArea ui:field="txtAreaDescription"
|
||||
readOnly="true">
|
||||
</b:TextArea>
|
||||
<b:Tooltip text="Update the Description">
|
||||
<b:Button icon="PENCIL"
|
||||
<b:Tooltip text="Edit the Description">
|
||||
<b:Button icon="EDIT"
|
||||
ui:field="buttonUpdateDescription" type="LINK">Edit</b:Button>
|
||||
</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:ControlGroup>
|
||||
<b:ControlGroup
|
||||
|
@ -150,8 +156,8 @@
|
|||
<g:HTML ui:field="txtSharedWith">
|
||||
</g:HTML>
|
||||
<b:Tooltip text="Go to Share">
|
||||
<b:Button icon="USER"
|
||||
ui:field="buttonUpdateShare" type="LINK">Share</b:Button>
|
||||
<b:Button icon="USER" ui:field="buttonUpdateShare"
|
||||
type="LINK">Share</b:Button>
|
||||
</b:Tooltip>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
|
|
@ -357,7 +357,6 @@ table.userssuggest th {
|
|||
height: 30px;
|
||||
}
|
||||
|
||||
|
||||
.item-type-style td:first-child {
|
||||
width: 30px;
|
||||
padding-left: 5px;
|
||||
|
@ -367,6 +366,13 @@ table.userssuggest th {
|
|||
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 {
|
||||
margin-top: 15px;
|
||||
margin-left: 15px;
|
||||
|
|
Loading…
Reference in New Issue