first release for testing of #19600
This commit is contained in:
parent
239810f194
commit
ad937c9f13
|
@ -6,6 +6,7 @@ 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.interfaces.GXTFolderItemTypeEnum;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
|
@ -29,6 +30,7 @@ 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;
|
||||
|
@ -37,6 +39,7 @@ 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;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
@ -83,7 +86,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
HorizontalPanel hpHeaderDetails;
|
||||
|
||||
@UiField
|
||||
HorizontalPanel hpImagePreview;
|
||||
HTMLPanel htmlPanelImagePreview;
|
||||
|
||||
@UiField
|
||||
HTML txtName;
|
||||
|
@ -139,6 +142,9 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
@UiField
|
||||
Button buttonUpdateGcubeProperties;
|
||||
|
||||
@UiField
|
||||
Button buttonUpdateShare;
|
||||
|
||||
@UiField
|
||||
ControlGroup cgSharedWith;
|
||||
|
||||
|
@ -147,6 +153,11 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
|
||||
private FileModel fileModel;
|
||||
|
||||
private Command onCloseCommand;
|
||||
|
||||
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
|
||||
|
@ -164,6 +175,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
public DialogGetInfoBootstrap(final FileModel fileModel, final Command onCloseCommand) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.fileModel = fileModel;
|
||||
this.onCloseCommand = onCloseCommand;
|
||||
|
||||
hpHeaderDetails.add(new HTML("Details"));
|
||||
|
||||
|
@ -243,7 +255,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
if(fileModel instanceof FileGridModel) {
|
||||
FileGridModel fileGridModel = ((FileGridModel) fileModel);
|
||||
//last update
|
||||
htmlSetValue(txtLastMofication, fileGridModel.getLastModification().toString());
|
||||
htmlSetValue(txtLastMofication, dateFormatter.format(fileGridModel.getLastModification()));
|
||||
//size
|
||||
htmlSetValue(txtSize, getFormattedSize(fileGridModel.getSize()));
|
||||
}else {
|
||||
|
@ -319,6 +331,15 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
editProperties.setProperties(gCubeProperties);
|
||||
}
|
||||
});
|
||||
|
||||
buttonUpdateShare.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
AppControllerExplorer.getEventBus().fireEvent(new CreateSharedFolderEvent(fileModel, fileModel.getParentFileModel(),false));
|
||||
onCloseCommand.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -439,11 +460,11 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Date result) {
|
||||
public void onSuccess(Date dateResult) {
|
||||
removePlaceHolder(txtCreated);
|
||||
if (result != null)
|
||||
htmlSetValue(txtCreated, result.toString());
|
||||
else
|
||||
if (dateResult != null) {
|
||||
htmlSetValue(txtCreated, dateFormatter.format(dateResult));
|
||||
}else
|
||||
htmlSetValue(txtCreated, null);
|
||||
|
||||
}
|
||||
|
@ -467,11 +488,11 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Date result) {
|
||||
public void onSuccess(Date dateResult) {
|
||||
removePlaceHolder(txtLastMofication);
|
||||
if (result != null)
|
||||
htmlSetValue(txtLastMofication, result.toString());
|
||||
else
|
||||
if (dateResult != null) {
|
||||
htmlSetValue(txtLastMofication, dateFormatter.format(dateResult));
|
||||
}else
|
||||
htmlSetValue(txtLastMofication, null);
|
||||
|
||||
}
|
||||
|
@ -580,9 +601,9 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
*/
|
||||
private void loadThumbnailsForImage() {
|
||||
|
||||
hpImagePreview.setVisible(true);
|
||||
htmlPanelImagePreview.setVisible(true);
|
||||
final HTML txtLoadingPreview = new HTML();
|
||||
hpImagePreview.add(txtLoadingPreview);
|
||||
htmlPanelImagePreview.add(txtLoadingPreview);
|
||||
setPlaceholder(txtLoadingPreview, "loading preview...");
|
||||
|
||||
AppControllerExplorer.rpcWorkspaceService.getImageById(fileModel.getIdentifier(),
|
||||
|
@ -597,18 +618,18 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
|
||||
@Override
|
||||
public void onSuccess(GWTWorkspaceItem item) {
|
||||
removePlaceHolder(txtLoadingPreview);
|
||||
GWT.log("Image loaded: " + item.getName() + " label: " + item.getLabel() + " type: "
|
||||
+ fileModel.getGXTFolderItemType());
|
||||
if (fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)) {
|
||||
GWTImageDocument theItemImage = (GWTImageDocument) item;
|
||||
hpImagePreview.add(new Image(theItemImage.getThumbnailUrl()));
|
||||
hpImagePreview.setVisible(true);
|
||||
htmlPanelImagePreview.add(new Image(theItemImage.getThumbnailUrl()));
|
||||
htmlPanelImagePreview.setVisible(true);
|
||||
}else {
|
||||
GWTExternalImage theExternalImage = (GWTExternalImage) item;
|
||||
hpImagePreview.add(new Image(theExternalImage.getThumbnailUrl()));
|
||||
hpImagePreview.setVisible(true);
|
||||
htmlPanelImagePreview.add(new Image(theExternalImage.getThumbnailUrl()));
|
||||
htmlPanelImagePreview.setVisible(true);
|
||||
}
|
||||
removePlaceHolder(txtLoadingPreview);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
<g:HorizontalPanel ui:field="hpItemType"
|
||||
addStyleNames="item-type-style">
|
||||
</g:HorizontalPanel>
|
||||
<g:HorizontalPanel ui:field="hpImagePreview"
|
||||
visible="false">
|
||||
</g:HorizontalPanel>
|
||||
<g:HTMLPanel ui:field="htmlPanelImagePreview"
|
||||
visible="false" addStyleNames="preview-image-style">
|
||||
</g:HTMLPanel>
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Alert ui:field="actionAlert" close="false" type="INFO"
|
||||
visible="false">
|
||||
|
@ -81,9 +81,9 @@
|
|||
<b:TextArea ui:field="txtAreaDescription"
|
||||
readOnly="true">
|
||||
</b:TextArea>
|
||||
<b:Tooltip trigger="MANUAL" text="Update description">
|
||||
<b:Tooltip text="Update the Description">
|
||||
<b:Button icon="PENCIL"
|
||||
ui:field="buttonUpdateDescription" type="PRIMARY"></b:Button>
|
||||
ui:field="buttonUpdateDescription" type="LINK">Edit</b:Button>
|
||||
</b:Tooltip>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
@ -95,10 +95,9 @@
|
|||
<b:TextArea ui:field="txtAreaGcubeProperties"
|
||||
readOnly="true">
|
||||
</b:TextArea>
|
||||
<b:Tooltip trigger="MANUAL"
|
||||
text="Update Gcube Properties">
|
||||
<b:Tooltip text="Update the Gcube Properties">
|
||||
<b:Button icon="PENCIL"
|
||||
ui:field="buttonUpdateGcubeProperties" type="PRIMARY"></b:Button>
|
||||
ui:field="buttonUpdateGcubeProperties" type="LINK">Edit</b:Button>
|
||||
</b:Tooltip>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
@ -150,10 +149,13 @@
|
|||
<b:Controls>
|
||||
<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:Tooltip>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
|
||||
<b:Alert close="false" ui:field="errorAlert" type="ERROR"
|
||||
visible="false"></b:Alert>
|
||||
</b:Fieldset>
|
||||
|
|
|
@ -303,7 +303,7 @@ table.userssuggest th {
|
|||
}
|
||||
|
||||
.my-control-group-get-info {
|
||||
margin-bottom: 10px !important;
|
||||
margin-bottom: 5px !important;
|
||||
font-size: 14px !important;
|
||||
font-family: Arial, serif;
|
||||
color: #222;
|
||||
|
@ -328,6 +328,7 @@ table.userssuggest th {
|
|||
.my-control-group-get-info .gwt-HTML {
|
||||
padding-top: 5px;
|
||||
font-family: Roboto, Arial, serif !important;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.my-control-group-get-info .gwt-TextBox:hover {
|
||||
|
@ -335,12 +336,17 @@ table.userssuggest th {
|
|||
}
|
||||
|
||||
.my-control-group-get-info .gwt-TextArea {
|
||||
width: 250px;
|
||||
width: 260px;
|
||||
min-height: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.my-control-group-get-info .btn-link {
|
||||
margin-left: 7px !important;
|
||||
}
|
||||
|
||||
.item-type-style {
|
||||
margin-top: 10px;
|
||||
margin-top: 1px;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding-top: 5px;
|
||||
|
@ -362,7 +368,9 @@ table.userssuggest th {
|
|||
}
|
||||
|
||||
.item-details-header {
|
||||
margin: 15px;
|
||||
margin-top: 15px;
|
||||
margin-left: 15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.item-details-header td {
|
||||
|
@ -390,3 +398,14 @@ table.userssuggest th {
|
|||
display: inline-block !important;
|
||||
}
|
||||
|
||||
.preview-image-style {
|
||||
width: 95%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.preview-image-style img {
|
||||
max-width: 400px;
|
||||
|
||||
}
|
|
@ -145,17 +145,21 @@ public class ImageServlet extends HttpServlet{
|
|||
|
||||
try{
|
||||
streamDescr = wa.getThumbnailData(image.getId());
|
||||
|
||||
/*TODO
|
||||
* UNCOMMENT THIS IF YOU WANT TO ADD MORE CONTROLS
|
||||
ReusableInputStream ris = new ReusableInputStream(streamDescr.getStream());
|
||||
logger.debug("Thumbnail data has size: "+streamDescr.getSize());
|
||||
//CHECKING IF THE STREAM IS A VALID IMAGE
|
||||
/* TODO
|
||||
* ReusableInputStream ris = new ReusableInputStream(streamDescr.getStream());
|
||||
boolean isAvalidImage = isAnImage(ris, image.getName());
|
||||
if(!isAvalidImage)
|
||||
if(!isAvalidImage) {
|
||||
//CREATING THE THUMBNAIL
|
||||
logger.debug("the stream seems not be a valid image, creating the thumbnail");
|
||||
streamDescr = createThumbnailForImage(wa, image);
|
||||
else {
|
||||
}else {
|
||||
//ASSIGNING THE REUSABLE STREAM
|
||||
streamDescr = new org.gcube.common.storagehubwrapper.shared.tohl.impl.StreamDescriptor(ris, image.getName(), null, image.getMimeType());
|
||||
logger.debug("using reusable stream");
|
||||
size = streamDescr.getSize()==null?0:streamDescr.getSize();
|
||||
logger.debug("ReusableInputStream has size: "+size);
|
||||
streamDescr = new org.gcube.common.storagehubwrapper.shared.tohl.impl.StreamDescriptor(ris, image.getName(), size, streamDescr.getMimeType());
|
||||
}*/
|
||||
|
||||
|
||||
|
@ -186,8 +190,9 @@ public class ImageServlet extends HttpServlet{
|
|||
resp.setContentType(mimeType);
|
||||
|
||||
//if image/thumbnail size is 0, skipping setContentLength
|
||||
if(size!=0)
|
||||
resp.setContentLength((int)size);
|
||||
//AVOIDING TO SET IT, SOME CASES THE SIZE MISMATCH
|
||||
// if(size!=0)
|
||||
// resp.setContentLength((int)size);
|
||||
|
||||
InputStream in = streamDescr.getStream();
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class ThumbnailGenerator {
|
|||
|
||||
extension = extension.startsWith(".") ? extension : "." + extension;
|
||||
final File tempFile = File.createTempFile(filename, extension);
|
||||
//tempFile.deleteOnExit();
|
||||
tempFile.deleteOnExit();
|
||||
try (FileOutputStream out = new FileOutputStream(tempFile)) {
|
||||
IOUtils.copy(in, out);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue