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
This commit is contained in:
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>
|
||||
|
|
|
@ -38,23 +38,11 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
|||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||
*/
|
||||
public class GxtBottomToolBarItem extends ToolBar{
|
||||
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";
|
||||
|
||||
|
@ -76,12 +64,14 @@ public class GxtBottomToolBarItem extends ToolBar{
|
|||
/**
|
||||
* Instantiates a new gxt bottom tool bar item.
|
||||
*/
|
||||
public GxtBottomToolBarItem(){
|
||||
public GxtBottomToolBarItem() {
|
||||
super();
|
||||
initToolbar();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.extjs.gxt.ui.client.widget.Component#onLoad()
|
||||
*/
|
||||
@Override
|
||||
|
@ -93,7 +83,7 @@ public class GxtBottomToolBarItem extends ToolBar{
|
|||
/**
|
||||
* Inits the toolbar.
|
||||
*/
|
||||
private void initToolbar(){
|
||||
private void initToolbar() {
|
||||
|
||||
btnGetTrash = new Button("Trash");
|
||||
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
||||
|
@ -151,14 +141,15 @@ 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));
|
||||
}
|
||||
});
|
||||
|
||||
btnAddAdmin = new Button(EDIT_ADMINISTRATOR);
|
||||
//TODO CHANGE ICON
|
||||
// TODO CHANGE ICON
|
||||
btnAddAdmin.setIcon(Resources.getIconManageAdministrator());
|
||||
// btnAddAdmin.setIcon(Resources.getIconAddAdministrator());
|
||||
// btnAddAdmin.setIcon(Resources.getIconAddAdministrator());
|
||||
btnAddAdmin.setScale(ButtonScale.MEDIUM);
|
||||
btnAddAdmin.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
||||
|
@ -195,17 +186,17 @@ 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){
|
||||
private void setVisibleAddAdministrators(boolean bool) {
|
||||
btnAddAdmin.setVisible(bool);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset details.
|
||||
*/
|
||||
public void resetDetails(){
|
||||
public void resetDetails() {
|
||||
|
||||
this.txtDimension.setText("");
|
||||
this.txtCreationTime.setText("");
|
||||
|
@ -213,22 +204,25 @@ 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){
|
||||
public void enableInfoHistoryButtons(FileModel target, boolean enable) {
|
||||
bHistory.setEnabled(enable);
|
||||
bRead.setEnabled(enable);
|
||||
btnGetInfo.setEnabled(enable);
|
||||
|
||||
btnVersioning.setEnabled(false);
|
||||
if(target!=null){
|
||||
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,13 +230,18 @@ 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){
|
||||
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner) {
|
||||
|
||||
this.resetDetails();
|
||||
|
||||
|
@ -256,12 +255,13 @@ public class GxtBottomToolBarItem extends ToolBar{
|
|||
/**
|
||||
* Update acl info.
|
||||
*
|
||||
* @param acl the acl
|
||||
* @param acl
|
||||
* the acl
|
||||
*/
|
||||
public void updateACLInfo(WorkspaceACL acl){
|
||||
public void updateACLInfo(WorkspaceACL acl) {
|
||||
setVisibleAddAdministrators(false);
|
||||
|
||||
if(acl==null){
|
||||
if (acl == null) {
|
||||
aclDivInfo.updateInfo(null, null);
|
||||
return;
|
||||
}
|
||||
|
@ -271,23 +271,25 @@ 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){
|
||||
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl) {
|
||||
setVisibleAddAdministrators(false);
|
||||
|
||||
if(loginUserLogger==null || loginUserLogger.isEmpty())
|
||||
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)){
|
||||
if (acl.isBaseSharedFolder()) {
|
||||
if (acl.getUserType().equals(USER_TYPE.ADMINISTRATOR)) {
|
||||
setVisibleAddAdministrators(true);
|
||||
}
|
||||
}
|
||||
|
@ -297,11 +299,12 @@ 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){
|
||||
public void updateTrashIcon(boolean trashIsFull) {
|
||||
|
||||
if(trashIsFull)
|
||||
if (trashIsFull)
|
||||
btnGetTrash.setIcon(Resources.getTrashFull());
|
||||
else
|
||||
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
||||
|
@ -310,15 +313,16 @@ public class GxtBottomToolBarItem extends ToolBar{
|
|||
/**
|
||||
* Update items number.
|
||||
*
|
||||
* @param size the size
|
||||
* @param size
|
||||
* the size
|
||||
*/
|
||||
public void updateItemsNumber(int size) {
|
||||
if(size<=0)
|
||||
if (size <= 0)
|
||||
labelItemsNumber.setText("No Items");
|
||||
else if(size==1)
|
||||
else if (size == 1)
|
||||
labelItemsNumber.setText("1 Item");
|
||||
else if(size>1)
|
||||
labelItemsNumber.setText(size +" Items");
|
||||
else if (size > 1)
|
||||
labelItemsNumber.setText(size + " Items");
|
||||
|
||||
hpItemsNumber.layout();
|
||||
}
|
||||
|
@ -326,21 +330,21 @@ public class GxtBottomToolBarItem extends ToolBar{
|
|||
/**
|
||||
* Sets the items number to center.
|
||||
*/
|
||||
public void setItemsNumberToCenter(){
|
||||
public void setItemsNumberToCenter() {
|
||||
|
||||
if(this.isRendered()){
|
||||
if (this.isRendered()) {
|
||||
String width = this.getElement().getStyle().getWidth();
|
||||
width = width.replace("px", "");
|
||||
try{
|
||||
try {
|
||||
long intWidth = Long.parseLong(width);
|
||||
intWidth = intWidth/2-30; //calculate the center
|
||||
intWidth = intWidth-60*3; //previous buttons
|
||||
GWT.log("refreshSize width is "+width);
|
||||
// hpItemsNumber.setWidth(intWidth+"px");
|
||||
hpItemsNumber.setStyleAttribute("margin-left", intWidth+"px");
|
||||
intWidth = intWidth / 2 - 30; // calculate the center
|
||||
intWidth = intWidth - 60 * 3; // previous buttons
|
||||
GWT.log("refreshSize width is " + width);
|
||||
// hpItemsNumber.setWidth(intWidth+"px");
|
||||
hpItemsNumber.setStyleAttribute("margin-left", intWidth + "px");
|
||||
hpItemsNumber.layout();
|
||||
}catch (Exception e) {
|
||||
GWT.log("width is not a long "+e);
|
||||
} catch (Exception e) {
|
||||
GWT.log("width is not a long " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
private ContentPanel cp;
|
||||
private GroupingStore<FileTrashedModel> store = new GroupingStore<FileTrashedModel>();
|
||||
private ListStore<FileTrashedModel> typeStoreOperation = new ListStore<FileTrashedModel>();
|
||||
private GridDropTarget gridDropTarget;
|
||||
private GridDropTarget gridDropTarget;
|
||||
private Button buttonDelete;
|
||||
private Button buttonRestore;
|
||||
private Button buttonRestoreAll;
|
||||
|
@ -63,7 +63,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
initContentPanel();
|
||||
initGrid();
|
||||
createToolBar();
|
||||
// initDropTarget();
|
||||
// initDropTarget();
|
||||
activeButtonOnSelection(false);
|
||||
}
|
||||
|
||||
|
@ -72,19 +72,23 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
*/
|
||||
private void initDropTarget() {
|
||||
|
||||
this.gridDropTarget = new GridDropTarget(grid){
|
||||
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
|
||||
protected void onDragDrop(DNDEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
List<FileModel> listFileModel = getDragSource(e);
|
||||
List<FileModel> listFileModel = getDragSource(e);
|
||||
|
||||
List<String> ids = new ArrayList<String>();
|
||||
List<String> ids = new ArrayList<String>();
|
||||
|
||||
for (FileModel fileModel : listFileModel) {
|
||||
fileModel.setIcon();
|
||||
|
@ -95,55 +99,70 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
|
||||
super.onDragDrop(e);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<FileModel> getDragSource(DNDEvent event){
|
||||
private List<FileModel> getDragSource(DNDEvent event) {
|
||||
|
||||
List<FileModel> listDraggedFile = new ArrayList<FileModel>();
|
||||
List<FileModel> listDraggedFile = new ArrayList<FileModel>();
|
||||
|
||||
if(event.getData() != null){
|
||||
if (event.getData() != null) {
|
||||
|
||||
List<BaseModelData> listItemsSource = event.getData();
|
||||
List<BaseModelData> listItemsSource = event.getData();
|
||||
|
||||
System.out.println("Trash - Number of move " + listItemsSource.size());
|
||||
|
||||
// FileModel sourceFileModel = null; //for print
|
||||
// FileModel sourceFileModel = null; //for print
|
||||
|
||||
for(int i=0; i<listItemsSource.size(); i++){
|
||||
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);
|
||||
//
|
||||
// listDraggedFile.add((FileModel) itemSource.getModel());
|
||||
// System.out.println("qui 1");
|
||||
//
|
||||
// TreeStoreModel itemSource = (TreeStoreModel)
|
||||
// listItemsSource.get(i);
|
||||
//
|
||||
// listDraggedFile.add((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());
|
||||
// else
|
||||
// System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
|
||||
// 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());
|
||||
// else
|
||||
// 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());
|
||||
// FileGridModel fileGrid = listItemsSource.get(i);
|
||||
// System.out.println("qui 2");
|
||||
// System.out.println("class
|
||||
// "+listItemsSource.get(i).getClass());
|
||||
}
|
||||
// System.out.println("Trash Child count: " + itemSource.getChildCount());
|
||||
// System.out.println("Trash Child count: " +
|
||||
// itemSource.getChildCount());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return listDraggedFile;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
private void initContentPanel() {
|
||||
|
@ -158,9 +177,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
add(cp);
|
||||
}
|
||||
|
||||
private boolean checkSelection(){
|
||||
private boolean checkSelection() {
|
||||
|
||||
if(grid.getSelectionModel().getSelectedItems().size()==0){
|
||||
if (grid.getSelectionModel().getSelectedItems().size() == 0) {
|
||||
MessageBox.info("Attention", "You must pick at least one item", null);
|
||||
return false;
|
||||
}
|
||||
|
@ -172,7 +191,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
|
||||
ToolBar bar = new ToolBar();
|
||||
|
||||
buttonRestore = new Button(WorkspaceTrashOperation.RESTORE.getLabel(),Resources.getIconUndo());
|
||||
buttonRestore = new Button(WorkspaceTrashOperation.RESTORE.getLabel(), Resources.getIconUndo());
|
||||
buttonRestore.setToolTip(WorkspaceTrashOperation.RESTORE.getOperationDescription());
|
||||
buttonRestore.setScale(ButtonScale.SMALL);
|
||||
buttonRestore.setIconAlign(IconAlign.TOP);
|
||||
|
@ -182,15 +201,15 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
if(checkSelection())
|
||||
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.RESTORE, grid.getSelectionModel().getSelectedItems()));
|
||||
if (checkSelection())
|
||||
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.RESTORE,
|
||||
grid.getSelectionModel().getSelectedItems()));
|
||||
}
|
||||
});
|
||||
|
||||
bar.add(buttonRestore);
|
||||
|
||||
|
||||
buttonDelete = new Button(WorkspaceTrashOperation.DELETE_PERMANENTLY.getLabel(),Resources.getIconDeleteItem());
|
||||
buttonDelete = new Button(WorkspaceTrashOperation.DELETE_PERMANENTLY.getLabel(), Resources.getIconDeleteItem());
|
||||
buttonDelete.setToolTip(WorkspaceTrashOperation.DELETE_PERMANENTLY.getOperationDescription());
|
||||
buttonDelete.setScale(ButtonScale.SMALL);
|
||||
buttonDelete.setIconAlign(IconAlign.TOP);
|
||||
|
@ -199,17 +218,17 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
if(checkSelection())
|
||||
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.DELETE_PERMANENTLY, grid.getSelectionModel().getSelectedItems()));
|
||||
if (checkSelection())
|
||||
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());
|
||||
buttonRestoreAll = new Button(WorkspaceTrashOperation.RESTORE_ALL.getLabel(), Resources.getIconRecycle());
|
||||
buttonRestoreAll.setToolTip(WorkspaceTrashOperation.RESTORE_ALL.getOperationDescription());
|
||||
buttonRestoreAll.setScale(ButtonScale.SMALL);
|
||||
buttonRestoreAll.setIconAlign(IconAlign.TOP);
|
||||
|
@ -222,9 +241,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
}
|
||||
});
|
||||
|
||||
//bar.add(buttonRestoreAll);
|
||||
// bar.add(buttonRestoreAll);
|
||||
|
||||
buttonEmptyTrash = new Button(WorkspaceTrashOperation.EMPTY_TRASH.getLabel(),Resources.getTrashEmpty());
|
||||
buttonEmptyTrash = new Button(WorkspaceTrashOperation.EMPTY_TRASH.getLabel(), Resources.getTrashEmpty());
|
||||
buttonEmptyTrash.setToolTip(WorkspaceTrashOperation.EMPTY_TRASH.getOperationDescription());
|
||||
buttonEmptyTrash.setScale(ButtonScale.SMALL);
|
||||
buttonEmptyTrash.setIconAlign(IconAlign.TOP);
|
||||
|
@ -239,10 +258,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
|
||||
bar.add(buttonEmptyTrash);
|
||||
|
||||
|
||||
bar.add(new FillToolItem());
|
||||
|
||||
Button buttonRefresh = new Button(WorkspaceTrashOperation.REFRESH.getLabel(),Resources.getIconRefresh());
|
||||
Button buttonRefresh = new Button(WorkspaceTrashOperation.REFRESH.getLabel(), Resources.getIconRefresh());
|
||||
buttonRefresh.setToolTip(WorkspaceTrashOperation.REFRESH.getOperationDescription());
|
||||
buttonRefresh.setScale(ButtonScale.SMALL);
|
||||
buttonRefresh.setIconAlign(IconAlign.TOP);
|
||||
|
@ -264,12 +282,15 @@ 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));
|
||||
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
||||
|
||||
final ColumnModel columnModel = cm;
|
||||
|
||||
|
@ -281,30 +302,31 @@ 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) {
|
||||
String val = model.get(property);
|
||||
String color = "black";
|
||||
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>";
|
||||
}else{
|
||||
if(val==null)
|
||||
val = "";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
||||
}
|
||||
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>";
|
||||
} else {
|
||||
if (val == null)
|
||||
val = "";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val
|
||||
+ "' style='color:" + color + "'>" + val + "</span>";
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
type.setRenderer(folderRender);
|
||||
type.setRenderer(folderRender);
|
||||
|
||||
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());
|
||||
|
@ -320,7 +342,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent<FileTrashedModel> se) {
|
||||
|
||||
boolean selection = grid.getSelectionModel().getSelectedItems().size()>0;
|
||||
boolean selection = grid.getSelectionModel().getSelectedItems().size() > 0;
|
||||
activeButtonOnSelection(selection);
|
||||
}
|
||||
});
|
||||
|
@ -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) {
|
||||
|
@ -361,31 +380,27 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
|
||||
for (FileTrashedModel fileTrashedModel : trashFiles) {
|
||||
fileTrashedModel.setIcon();
|
||||
// GWT.log("TrashFile: "+fileTrashedModel);
|
||||
// //Workaround remove this
|
||||
// if(fileTrashedModel.isDirectory())
|
||||
// fileTrashedModel.setFolderItemType(GXTFolderItemTypeEnum.FOLDER);
|
||||
// GWT.log("TrashFile: "+fileTrashedModel);
|
||||
// //Workaround remove this
|
||||
// if(fileTrashedModel.isDirectory())
|
||||
// fileTrashedModel.setFolderItemType(GXTFolderItemTypeEnum.FOLDER);
|
||||
}
|
||||
|
||||
store.add(trashFiles);
|
||||
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
||||
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,40 +423,35 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
// cp.layout();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param identifier
|
||||
* @return
|
||||
*/
|
||||
public FileTrashedModel getFileModelByIdentifier(String identifier){
|
||||
public FileTrashedModel getFileModelByIdentifier(String identifier) {
|
||||
|
||||
return store.findModel(FileGridModel.IDENTIFIER, identifier);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param identifier (MANDATORY)
|
||||
* @return
|
||||
*
|
||||
* @param identifier
|
||||
* mandatory
|
||||
* @return operation result
|
||||
*/
|
||||
public boolean deleteItem(String identifier) {
|
||||
|
||||
FileTrashedModel fileTarget = getFileModelByIdentifier(identifier);
|
||||
|
||||
|
||||
if(fileTarget!=null){
|
||||
if (fileTarget != null) {
|
||||
return deleteItem(fileTarget);
|
||||
}
|
||||
else
|
||||
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
|
||||
} else
|
||||
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fileTarget (MANDATORY)
|
||||
* @return
|
||||
* @param fileTarget
|
||||
* (MANDATORY)
|
||||
* @return operation result
|
||||
*/
|
||||
private boolean deleteItem(FileTrashedModel fileTarget) {
|
||||
|
||||
|
@ -455,11 +464,10 @@ 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);
|
||||
activeButtonsOnNotEmtpy(store.getModels().size() > 0);
|
||||
|
||||
return false;
|
||||
|
||||
|
@ -469,7 +477,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
*
|
||||
* @return the number of items contained into trash
|
||||
*/
|
||||
public int trashSize(){
|
||||
public int trashSize() {
|
||||
return store.getCount();
|
||||
}
|
||||
|
||||
|
|
|
@ -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…
Reference in New Issue