|
|
|
@ -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,9 +90,12 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
@UiField
|
|
|
|
|
HorizontalPanel hpHeaderDetails;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
Button buttonClose;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
HTMLPanel htmlPanelImagePreview;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
HTML txtName;
|
|
|
|
|
|
|
|
|
@ -138,6 +146,9 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
Button buttonUpdateDescription;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
Button buttonSaveDescription;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
Button buttonUpdateGcubeProperties;
|
|
|
|
@ -155,16 +166,14 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
|
|
|
|
|
private Command onCloseCommand;
|
|
|
|
|
|
|
|
|
|
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM yyyy, hh:mm aaa");
|
|
|
|
|
private Tooltip tooltipDownload = new Tooltip("Download");
|
|
|
|
|
|
|
|
|
|
private Button buttonDownload = new Button("Download");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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;
|
|
|
|
|
*/
|
|
|
|
|
// private Tooltip tooltipSharebleLink = new Tooltip("Get Shareable Link");
|
|
|
|
|
// private Button buttonShareableLink = new Button();
|
|
|
|
|
|
|
|
|
|
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM yyyy, hh:mm aaa");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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,12 +206,24 @@ 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());
|
|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -288,28 +295,47 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
* Adds the handlers.
|
|
|
|
|
*/
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|