|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
@ -146,6 +152,11 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
HTML txtSharedWith;
|
|
|
|
|
|
|
|
|
|
private FileModel fileModel;
|
|
|
|
|
|
|
|
|
|
private Command onCloseCommand;
|
|
|
|
|
|
|
|
|
|
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM yyyy, hh:mm aaa");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* textAreaSharedWith = new TextArea(); private Html htmlUsersWidget = new
|
|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|