ref 13226:StorageHub - Update workspace-sharing-widget to SH

https://support.d4science.org/issues/13226

Updated to StorageHub

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@177245 82a268e6-3cf1-43bd-a215-b396298e98cf
task/19600
Giancarlo Panichi 5 years ago
parent 5d06d96a4f
commit 3b414664ca

@ -1,11 +1,15 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.workspace-portlet.6-22-0"
date="2019-02-22">
<Change>Updated to StorageHub [ticket: #13226]</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet.6-21-0"
date="${buildDate}">
date="2018-11-01">
<Change>Task #13106: Provide public links for versioned files
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet.6-20-0"
date="${buildDate}">
date="2018-09-01">
<Change>Task #12604: Migrate Move operation to StorageHub
</Change>
<Change>Incident #12922: Bug fix</Change>

@ -40,21 +40,9 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype;
*/
public class GxtBottomToolBarItem extends ToolBar {
/**
*
*/
private static final String VERSIONS = "Versions";
/**
*
*/
protected static final String INFO = "Info";
/**
*
*/
protected static final String READ = "Read";
/**
*
*/
protected static final String HISTORY = "History";
private static final String EDIT_ADMINISTRATOR = "Edit Administrator/s";
@ -81,7 +69,9 @@ public class GxtBottomToolBarItem extends ToolBar{
initToolbar();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see com.extjs.gxt.ui.client.widget.Component#onLoad()
*/
@Override
@ -151,7 +141,8 @@ public class GxtBottomToolBarItem extends ToolBar{
@Override
public void componentSelected(ButtonEvent ce) {
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.SHOW, null, null, null, null));
AppController.getEventBus()
.fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.SHOW, null, null, null, null));
}
});
@ -195,13 +186,13 @@ public class GxtBottomToolBarItem extends ToolBar{
/**
* Sets the visible add administrators.
*
* @param bool the new visible add administrators
* @param bool
* the new visible add administrators
*/
private void setVisibleAddAdministrators(boolean bool) {
btnAddAdmin.setVisible(bool);
}
/**
* Reset details.
*/
@ -213,12 +204,13 @@ public class GxtBottomToolBarItem extends ToolBar{
this.txtOwner.setText("");
}
/**
* Enable info history buttons.
*
* @param selectedFile the selected file
* @param enable the enable
* @param target
* target
* @param enable
* the enable
*/
public void enableInfoHistoryButtons(FileModel target, boolean enable) {
bHistory.setEnabled(enable);
@ -228,7 +220,9 @@ public class GxtBottomToolBarItem extends ToolBar{
btnVersioning.setEnabled(false);
if (target != null) {
GXTFolderItemTypeEnum category = target.getGXTFolderItemType();
if(category!=null && (category.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE) || category.equals(GXTFolderItemTypeEnum.EXTERNAL_FILE) || category.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE)))
if (category != null && (category.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE)
|| category.equals(GXTFolderItemTypeEnum.EXTERNAL_FILE)
|| category.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE)))
btnVersioning.setEnabled(enable);
}
}
@ -236,11 +230,16 @@ public class GxtBottomToolBarItem extends ToolBar{
/**
* Sets the details.
*
* @param itemName the item name
* @param description the description
* @param dimension the dimension
* @param creationTime the creation time
* @param owner the owner
* @param itemName
* the item name
* @param description
* the description
* @param dimension
* the dimension
* @param creationTime
* the creation time
* @param owner
* the owner
*/
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner) {
@ -256,7 +255,8 @@ public class GxtBottomToolBarItem extends ToolBar{
/**
* Update acl info.
*
* @param acl the acl
* @param acl
* the acl
*/
public void updateACLInfo(WorkspaceACL acl) {
setVisibleAddAdministrators(false);
@ -271,12 +271,13 @@ public class GxtBottomToolBarItem extends ToolBar{
this.layout();
}
/**
* Update add administator info.
*
* @param loginUserLogger the login user logger
* @param acl the acl
* @param loginUserLogger
* the login user logger
* @param acl
* the acl
*/
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl) {
setVisibleAddAdministrators(false);
@ -284,7 +285,8 @@ public class GxtBottomToolBarItem extends ToolBar{
if (loginUserLogger == null || loginUserLogger.isEmpty())
MessageBox.alert("Error", "I could not get you username yet.. please try again", null);
ConstantsExplorer.log("acl isBaseSharedFolder: "+acl.isBaseSharedFolder() +", user type: "+acl.getUserType() + ", owner: "+acl.getLoginOwner() + ", acl item id: "+acl.getWorkspaceItemId());
ConstantsExplorer.log("acl isBaseSharedFolder: " + acl.isBaseSharedFolder() + ", user type: "
+ acl.getUserType() + ", owner: " + acl.getLoginOwner() + ", acl item id: " + acl.getWorkspaceItemId());
if (acl.isBaseSharedFolder()) {
if (acl.getUserType().equals(USER_TYPE.ADMINISTRATOR)) {
@ -297,7 +299,8 @@ public class GxtBottomToolBarItem extends ToolBar{
/**
* Update trash icon.
*
* @param trashIsFull the trash is full
* @param trashIsFull
* the trash is full
*/
public void updateTrashIcon(boolean trashIsFull) {
@ -310,7 +313,8 @@ public class GxtBottomToolBarItem extends ToolBar{
/**
* Update items number.
*
* @param size the size
* @param size
* the size
*/
public void updateItemsNumber(int size) {
if (size <= 0)

@ -74,8 +74,12 @@ public class TrashInfoContainer extends LayoutContainer {
this.gridDropTarget = new GridDropTarget(grid) {
/* (non-Javadoc)
* @see com.extjs.gxt.ui.client.dnd.GridDropTarget#onDragDrop(com.extjs.gxt.ui.client.event.DNDEvent)
/*
* (non-Javadoc)
*
* @see
* com.extjs.gxt.ui.client.dnd.GridDropTarget#onDragDrop(com.extjs.
* gxt.ui.client.event.DNDEvent)
*/
@Override
@ -95,7 +99,6 @@ public class TrashInfoContainer extends LayoutContainer {
super.onDragDrop(e);
}
private List<FileModel> getDragSource(DNDEvent event) {
@ -112,31 +115,47 @@ public class TrashInfoContainer extends LayoutContainer {
for (int i = 0; i < listItemsSource.size(); i++) {
if(listItemsSource.get(i) instanceof TreeStoreModel){ //DRAG FROM TREE
if (listItemsSource.get(i) instanceof TreeStoreModel) { // DRAG
// FROM
// TREE
// System.out.println("qui 1");
//
// TreeStoreModel itemSource = (TreeStoreModel) listItemsSource.get(i);
// TreeStoreModel itemSource = (TreeStoreModel)
// listItemsSource.get(i);
//
// listDraggedFile.add((FileModel) itemSource.getModel());
// listDraggedFile.add((FileModel)
// itemSource.getModel());
// sourceFileModel = (FileModel) itemSource.getModel();
// sourceFileModel = (FileModel)
// itemSource.getModel();
//
// if(sourceFileModel.getParentFileModel()!=null)
//
// System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
// System.out.println("Trash Source Name " +
// sourceFileModel.getName() + " id " +
// sourceFileModel.getIdentifier() + " end drag " +
// " Parent Name: " +
// sourceFileModel.getParentFileModel().getName() +
// "id " +
// sourceFileModel.getParentFileModel().getIdentifier());
// else
// System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
// System.out.println("Trash Source Name " +
// sourceFileModel.getName() + " id " +
// sourceFileModel.getIdentifier() + " end drag ");
}else if(listItemsSource.get(i) instanceof FileGridModel){ //DRAG FROM GRID
} else if (listItemsSource.get(i) instanceof FileGridModel) { // DRAG
// FROM
// GRID
listDraggedFile.add((FileModel) listItemsSource.get(i));
// FileGridModel fileGrid = listItemsSource.get(i);
// System.out.println("qui 2");
// System.out.println("class "+listItemsSource.get(i).getClass());
// System.out.println("class
// "+listItemsSource.get(i).getClass());
}
// System.out.println("Trash Child count: " + itemSource.getChildCount());
// System.out.println("Trash Child count: " +
// itemSource.getChildCount());
}
}
@ -183,13 +202,13 @@ public class TrashInfoContainer extends LayoutContainer {
public void componentSelected(ButtonEvent ce) {
if (checkSelection())
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.RESTORE, grid.getSelectionModel().getSelectedItems()));
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.RESTORE,
grid.getSelectionModel().getSelectedItems()));
}
});
bar.add(buttonRestore);
buttonDelete = new Button(WorkspaceTrashOperation.DELETE_PERMANENTLY.getLabel(), Resources.getIconDeleteItem());
buttonDelete.setToolTip(WorkspaceTrashOperation.DELETE_PERMANENTLY.getOperationDescription());
buttonDelete.setScale(ButtonScale.SMALL);
@ -200,13 +219,13 @@ public class TrashInfoContainer extends LayoutContainer {
public void componentSelected(ButtonEvent ce) {
if (checkSelection())
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.DELETE_PERMANENTLY, grid.getSelectionModel().getSelectedItems()));
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.DELETE_PERMANENTLY,
grid.getSelectionModel().getSelectedItems()));
}
});
bar.add(buttonDelete);
bar.add(new SeparatorMenuItem());
buttonRestoreAll = new Button(WorkspaceTrashOperation.RESTORE_ALL.getLabel(), Resources.getIconRecycle());
@ -239,7 +258,6 @@ public class TrashInfoContainer extends LayoutContainer {
bar.add(buttonEmptyTrash);
bar.add(new FillToolItem());
Button buttonRefresh = new Button(WorkspaceTrashOperation.REFRESH.getLabel(), Resources.getIconRefresh());
@ -264,10 +282,13 @@ public class TrashInfoContainer extends LayoutContainer {
ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 40);
ColumnConfig name = createSortableColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 190);
ColumnConfig type = createSortableColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 80);
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(), "Original Path", 190);
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 90);
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(),
"Original Path", 190);
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(),
"Deleted Date", 90);
deleteDate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
ColumnConfig deleteUser = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEUSER.toString(), "Deleted By", 150);
ColumnConfig deleteUser = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEUSER.toString(),
"Deleted By", 150);
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
@ -281,20 +302,22 @@ public class TrashInfoContainer extends LayoutContainer {
this.grid.setView(view);
this.grid.setContextMenu(null);
GridCellRenderer<FileModel> folderRender = new GridCellRenderer<FileModel>() {
@Override
public String render(FileModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FileModel> store, Grid<FileModel> grid) {
public String render(FileModel model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<FileModel> store, Grid<FileModel> grid) {
String val = model.get(property);
String color = "black";
if (val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())) {
// color = "#EEC900";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val
+ "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
} else {
if (val == null)
val = "";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val
+ "' style='color:" + color + "'>" + val + "</span>";
}
}
};
@ -304,7 +327,6 @@ public class TrashInfoContainer extends LayoutContainer {
GridFilters filters = new GridFilters();
filters.setLocal(true);
StringFilter nameFilter = new StringFilter(FileGridModel.NAME);
StringFilter typeFilter = new StringFilter(FileGridModel.TYPE);
DateFilter dateFilter = new DateFilter(FileTrashedModel.STOREINFO.DELETEDATE.toString());
@ -334,11 +356,8 @@ public class TrashInfoContainer extends LayoutContainer {
grid.setStyleAttribute("borderTop", "none");
cp.add(grid);
}
public void setPanelSize(int width, int height) {
if (width > 0 && height > 0 && grid != null) {
@ -371,21 +390,17 @@ public class TrashInfoContainer extends LayoutContainer {
activeButtonsOnNotEmtpy(store.getModels().size() > 0);
}
/**
* @param b
*/
private void activeButtonsOnNotEmtpy(boolean isNotEmpty) {
buttonRestoreAll.setEnabled(isNotEmpty);
buttonEmptyTrash.setEnabled(isNotEmpty);
}
/**
* @param multi
*/
protected void activeButtonOnSelection(boolean bool) {
buttonDelete.setEnabled(bool);
buttonRestore.setEnabled(bool);
}
private void updateStore(ListStore<FileTrashedModel> store) {
resetStore();
@ -396,8 +411,7 @@ public class TrashInfoContainer extends LayoutContainer {
this.grid.getStore().removeAll();
}
public ColumnConfig createSortableColumnConfig(String id, String name,
int width) {
public ColumnConfig createSortableColumnConfig(String id, String name, int width) {
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
columnConfig.setSortable(true);
@ -409,11 +423,6 @@ public class TrashInfoContainer extends LayoutContainer {
// cp.layout();
}
/**
*
* @param identifier
* @return
*/
public FileTrashedModel getFileModelByIdentifier(String identifier) {
return store.findModel(FileGridModel.IDENTIFIER, identifier);
@ -422,18 +431,17 @@ public class TrashInfoContainer extends LayoutContainer {
/**
*
* @param identifier (MANDATORY)
* @return
* @param identifier
* mandatory
* @return operation result
*/
public boolean deleteItem(String identifier) {
FileTrashedModel fileTarget = getFileModelByIdentifier(identifier);
if (fileTarget != null) {
return deleteItem(fileTarget);
}
else
} else
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store");
return false;
@ -441,8 +449,9 @@ public class TrashInfoContainer extends LayoutContainer {
/**
*
* @param fileTarget (MANDATORY)
* @return
* @param fileTarget
* (MANDATORY)
* @return operation result
*/
private boolean deleteItem(FileTrashedModel fileTarget) {
@ -455,9 +464,8 @@ public class TrashInfoContainer extends LayoutContainer {
return true;
} else
System.out.println("Record Error: file target with "
+ fileTarget.getIdentifier()
+ " identifier not exist in store");
System.out.println(
"Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store");
activeButtonsOnNotEmtpy(store.getModels().size() > 0);

@ -47,10 +47,7 @@ public class WindowTrash extends Window {
setHeading("Trash");
}
/**
*
* @return
*/
public static synchronized WindowTrash getInstance(){
if(INSTANCE==null)
INSTANCE = new WindowTrash();
@ -150,11 +147,6 @@ public class WindowTrash extends Window {
}
/**
*
* @param fileModelId
* @return
*/
public boolean deleteFileFromTrash(String fileModelId){
boolean deleted = this.trashContainers.deleteItem(fileModelId);

Loading…
Cancel
Save