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>
|
<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"
|
<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>Task #13106: Provide public links for versioned files
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.workspace-portlet.6-20-0"
|
<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>Task #12604: Migrate Move operation to StorageHub
|
||||||
</Change>
|
</Change>
|
||||||
<Change>Incident #12922: Bug fix</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
|
* @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";
|
private static final String VERSIONS = "Versions";
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected static final String INFO = "Info";
|
protected static final String INFO = "Info";
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected static final String READ = "Read";
|
protected static final String READ = "Read";
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected static final String HISTORY = "History";
|
protected static final String HISTORY = "History";
|
||||||
private static final String EDIT_ADMINISTRATOR = "Edit Administrator/s";
|
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.
|
* Instantiates a new gxt bottom tool bar item.
|
||||||
*/
|
*/
|
||||||
public GxtBottomToolBarItem(){
|
public GxtBottomToolBarItem() {
|
||||||
super();
|
super();
|
||||||
initToolbar();
|
initToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.extjs.gxt.ui.client.widget.Component#onLoad()
|
* @see com.extjs.gxt.ui.client.widget.Component#onLoad()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,7 +83,7 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
/**
|
/**
|
||||||
* Inits the toolbar.
|
* Inits the toolbar.
|
||||||
*/
|
*/
|
||||||
private void initToolbar(){
|
private void initToolbar() {
|
||||||
|
|
||||||
btnGetTrash = new Button("Trash");
|
btnGetTrash = new Button("Trash");
|
||||||
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
||||||
|
@ -151,14 +141,15 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
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);
|
btnAddAdmin = new Button(EDIT_ADMINISTRATOR);
|
||||||
//TODO CHANGE ICON
|
// TODO CHANGE ICON
|
||||||
btnAddAdmin.setIcon(Resources.getIconManageAdministrator());
|
btnAddAdmin.setIcon(Resources.getIconManageAdministrator());
|
||||||
// btnAddAdmin.setIcon(Resources.getIconAddAdministrator());
|
// btnAddAdmin.setIcon(Resources.getIconAddAdministrator());
|
||||||
btnAddAdmin.setScale(ButtonScale.MEDIUM);
|
btnAddAdmin.setScale(ButtonScale.MEDIUM);
|
||||||
btnAddAdmin.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
btnAddAdmin.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@ -195,17 +186,17 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
/**
|
/**
|
||||||
* Sets the visible add administrators.
|
* 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);
|
btnAddAdmin.setVisible(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset details.
|
* Reset details.
|
||||||
*/
|
*/
|
||||||
public void resetDetails(){
|
public void resetDetails() {
|
||||||
|
|
||||||
this.txtDimension.setText("");
|
this.txtDimension.setText("");
|
||||||
this.txtCreationTime.setText("");
|
this.txtCreationTime.setText("");
|
||||||
|
@ -213,22 +204,25 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
this.txtOwner.setText("");
|
this.txtOwner.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable info history buttons.
|
* Enable info history buttons.
|
||||||
*
|
*
|
||||||
* @param selectedFile the selected file
|
* @param target
|
||||||
* @param enable the enable
|
* target
|
||||||
|
* @param enable
|
||||||
|
* the enable
|
||||||
*/
|
*/
|
||||||
public void enableInfoHistoryButtons(FileModel target, boolean enable){
|
public void enableInfoHistoryButtons(FileModel target, boolean enable) {
|
||||||
bHistory.setEnabled(enable);
|
bHistory.setEnabled(enable);
|
||||||
bRead.setEnabled(enable);
|
bRead.setEnabled(enable);
|
||||||
btnGetInfo.setEnabled(enable);
|
btnGetInfo.setEnabled(enable);
|
||||||
|
|
||||||
btnVersioning.setEnabled(false);
|
btnVersioning.setEnabled(false);
|
||||||
if(target!=null){
|
if (target != null) {
|
||||||
GXTFolderItemTypeEnum category = target.getGXTFolderItemType();
|
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);
|
btnVersioning.setEnabled(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,13 +230,18 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
/**
|
/**
|
||||||
* Sets the details.
|
* Sets the details.
|
||||||
*
|
*
|
||||||
* @param itemName the item name
|
* @param itemName
|
||||||
* @param description the description
|
* the item name
|
||||||
* @param dimension the dimension
|
* @param description
|
||||||
* @param creationTime the creation time
|
* the description
|
||||||
* @param owner the owner
|
* @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();
|
this.resetDetails();
|
||||||
|
|
||||||
|
@ -256,12 +255,13 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
/**
|
/**
|
||||||
* Update acl info.
|
* Update acl info.
|
||||||
*
|
*
|
||||||
* @param acl the acl
|
* @param acl
|
||||||
|
* the acl
|
||||||
*/
|
*/
|
||||||
public void updateACLInfo(WorkspaceACL acl){
|
public void updateACLInfo(WorkspaceACL acl) {
|
||||||
setVisibleAddAdministrators(false);
|
setVisibleAddAdministrators(false);
|
||||||
|
|
||||||
if(acl==null){
|
if (acl == null) {
|
||||||
aclDivInfo.updateInfo(null, null);
|
aclDivInfo.updateInfo(null, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -271,23 +271,25 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
this.layout();
|
this.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update add administator info.
|
* Update add administator info.
|
||||||
*
|
*
|
||||||
* @param loginUserLogger the login user logger
|
* @param loginUserLogger
|
||||||
* @param acl the acl
|
* the login user logger
|
||||||
|
* @param acl
|
||||||
|
* the acl
|
||||||
*/
|
*/
|
||||||
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl){
|
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl) {
|
||||||
setVisibleAddAdministrators(false);
|
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);
|
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.isBaseSharedFolder()) {
|
||||||
if(acl.getUserType().equals(USER_TYPE.ADMINISTRATOR)){
|
if (acl.getUserType().equals(USER_TYPE.ADMINISTRATOR)) {
|
||||||
setVisibleAddAdministrators(true);
|
setVisibleAddAdministrators(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,11 +299,12 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
/**
|
/**
|
||||||
* Update trash icon.
|
* 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());
|
btnGetTrash.setIcon(Resources.getTrashFull());
|
||||||
else
|
else
|
||||||
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
||||||
|
@ -310,15 +313,16 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
/**
|
/**
|
||||||
* Update items number.
|
* Update items number.
|
||||||
*
|
*
|
||||||
* @param size the size
|
* @param size
|
||||||
|
* the size
|
||||||
*/
|
*/
|
||||||
public void updateItemsNumber(int size) {
|
public void updateItemsNumber(int size) {
|
||||||
if(size<=0)
|
if (size <= 0)
|
||||||
labelItemsNumber.setText("No Items");
|
labelItemsNumber.setText("No Items");
|
||||||
else if(size==1)
|
else if (size == 1)
|
||||||
labelItemsNumber.setText("1 Item");
|
labelItemsNumber.setText("1 Item");
|
||||||
else if(size>1)
|
else if (size > 1)
|
||||||
labelItemsNumber.setText(size +" Items");
|
labelItemsNumber.setText(size + " Items");
|
||||||
|
|
||||||
hpItemsNumber.layout();
|
hpItemsNumber.layout();
|
||||||
}
|
}
|
||||||
|
@ -326,21 +330,21 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
/**
|
/**
|
||||||
* Sets the items number to center.
|
* Sets the items number to center.
|
||||||
*/
|
*/
|
||||||
public void setItemsNumberToCenter(){
|
public void setItemsNumberToCenter() {
|
||||||
|
|
||||||
if(this.isRendered()){
|
if (this.isRendered()) {
|
||||||
String width = this.getElement().getStyle().getWidth();
|
String width = this.getElement().getStyle().getWidth();
|
||||||
width = width.replace("px", "");
|
width = width.replace("px", "");
|
||||||
try{
|
try {
|
||||||
long intWidth = Long.parseLong(width);
|
long intWidth = Long.parseLong(width);
|
||||||
intWidth = intWidth/2-30; //calculate the center
|
intWidth = intWidth / 2 - 30; // calculate the center
|
||||||
intWidth = intWidth-60*3; //previous buttons
|
intWidth = intWidth - 60 * 3; // previous buttons
|
||||||
GWT.log("refreshSize width is "+width);
|
GWT.log("refreshSize width is " + width);
|
||||||
// hpItemsNumber.setWidth(intWidth+"px");
|
// hpItemsNumber.setWidth(intWidth+"px");
|
||||||
hpItemsNumber.setStyleAttribute("margin-left", intWidth+"px");
|
hpItemsNumber.setStyleAttribute("margin-left", intWidth + "px");
|
||||||
hpItemsNumber.layout();
|
hpItemsNumber.layout();
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GWT.log("width is not a long "+e);
|
GWT.log("width is not a long " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
private ContentPanel cp;
|
private ContentPanel cp;
|
||||||
private GroupingStore<FileTrashedModel> store = new GroupingStore<FileTrashedModel>();
|
private GroupingStore<FileTrashedModel> store = new GroupingStore<FileTrashedModel>();
|
||||||
private ListStore<FileTrashedModel> typeStoreOperation = new ListStore<FileTrashedModel>();
|
private ListStore<FileTrashedModel> typeStoreOperation = new ListStore<FileTrashedModel>();
|
||||||
private GridDropTarget gridDropTarget;
|
private GridDropTarget gridDropTarget;
|
||||||
private Button buttonDelete;
|
private Button buttonDelete;
|
||||||
private Button buttonRestore;
|
private Button buttonRestore;
|
||||||
private Button buttonRestoreAll;
|
private Button buttonRestoreAll;
|
||||||
|
@ -63,7 +63,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
initContentPanel();
|
initContentPanel();
|
||||||
initGrid();
|
initGrid();
|
||||||
createToolBar();
|
createToolBar();
|
||||||
// initDropTarget();
|
// initDropTarget();
|
||||||
activeButtonOnSelection(false);
|
activeButtonOnSelection(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,19 +72,23 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
*/
|
*/
|
||||||
private void initDropTarget() {
|
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
|
@Override
|
||||||
protected void onDragDrop(DNDEvent e) {
|
protected void onDragDrop(DNDEvent e) {
|
||||||
// TODO Auto-generated method stub
|
// 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) {
|
for (FileModel fileModel : listFileModel) {
|
||||||
fileModel.setIcon();
|
fileModel.setIcon();
|
||||||
|
@ -95,55 +99,70 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
super.onDragDrop(e);
|
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());
|
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");
|
// 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)
|
//
|
||||||
//
|
// 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 " +
|
||||||
// System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
|
// 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
|
||||||
}else if(listItemsSource.get(i) instanceof FileGridModel){ //DRAG FROM GRID
|
// FROM
|
||||||
|
// GRID
|
||||||
|
|
||||||
listDraggedFile.add((FileModel) listItemsSource.get(i));
|
listDraggedFile.add((FileModel) listItemsSource.get(i));
|
||||||
// FileGridModel fileGrid = listItemsSource.get(i);
|
// FileGridModel fileGrid = listItemsSource.get(i);
|
||||||
// System.out.println("qui 2");
|
// 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());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return listDraggedFile;
|
return listDraggedFile;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initContentPanel() {
|
private void initContentPanel() {
|
||||||
|
@ -158,9 +177,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
add(cp);
|
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);
|
MessageBox.info("Attention", "You must pick at least one item", null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +191,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
ToolBar bar = new ToolBar();
|
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.setToolTip(WorkspaceTrashOperation.RESTORE.getOperationDescription());
|
||||||
buttonRestore.setScale(ButtonScale.SMALL);
|
buttonRestore.setScale(ButtonScale.SMALL);
|
||||||
buttonRestore.setIconAlign(IconAlign.TOP);
|
buttonRestore.setIconAlign(IconAlign.TOP);
|
||||||
|
@ -182,15 +201,15 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
if(checkSelection())
|
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);
|
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.setToolTip(WorkspaceTrashOperation.DELETE_PERMANENTLY.getOperationDescription());
|
||||||
buttonDelete.setScale(ButtonScale.SMALL);
|
buttonDelete.setScale(ButtonScale.SMALL);
|
||||||
buttonDelete.setIconAlign(IconAlign.TOP);
|
buttonDelete.setIconAlign(IconAlign.TOP);
|
||||||
|
@ -199,17 +218,17 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
if(checkSelection())
|
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(buttonDelete);
|
||||||
|
|
||||||
|
|
||||||
bar.add(new SeparatorMenuItem());
|
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.setToolTip(WorkspaceTrashOperation.RESTORE_ALL.getOperationDescription());
|
||||||
buttonRestoreAll.setScale(ButtonScale.SMALL);
|
buttonRestoreAll.setScale(ButtonScale.SMALL);
|
||||||
buttonRestoreAll.setIconAlign(IconAlign.TOP);
|
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.setToolTip(WorkspaceTrashOperation.EMPTY_TRASH.getOperationDescription());
|
||||||
buttonEmptyTrash.setScale(ButtonScale.SMALL);
|
buttonEmptyTrash.setScale(ButtonScale.SMALL);
|
||||||
buttonEmptyTrash.setIconAlign(IconAlign.TOP);
|
buttonEmptyTrash.setIconAlign(IconAlign.TOP);
|
||||||
|
@ -239,10 +258,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
bar.add(buttonEmptyTrash);
|
bar.add(buttonEmptyTrash);
|
||||||
|
|
||||||
|
|
||||||
bar.add(new FillToolItem());
|
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.setToolTip(WorkspaceTrashOperation.REFRESH.getOperationDescription());
|
||||||
buttonRefresh.setScale(ButtonScale.SMALL);
|
buttonRefresh.setScale(ButtonScale.SMALL);
|
||||||
buttonRefresh.setIconAlign(IconAlign.TOP);
|
buttonRefresh.setIconAlign(IconAlign.TOP);
|
||||||
|
@ -264,12 +282,15 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 40);
|
ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 40);
|
||||||
ColumnConfig name = createSortableColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 190);
|
ColumnConfig name = createSortableColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 190);
|
||||||
ColumnConfig type = createSortableColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 80);
|
ColumnConfig type = createSortableColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 80);
|
||||||
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(), "Original Path", 190);
|
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(),
|
||||||
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 90);
|
"Original Path", 190);
|
||||||
|
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(),
|
||||||
|
"Deleted Date", 90);
|
||||||
deleteDate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
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;
|
final ColumnModel columnModel = cm;
|
||||||
|
|
||||||
|
@ -281,30 +302,31 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
this.grid.setView(view);
|
this.grid.setView(view);
|
||||||
this.grid.setContextMenu(null);
|
this.grid.setContextMenu(null);
|
||||||
|
|
||||||
|
|
||||||
GridCellRenderer<FileModel> folderRender = new GridCellRenderer<FileModel>() {
|
GridCellRenderer<FileModel> folderRender = new GridCellRenderer<FileModel>() {
|
||||||
@Override
|
@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,
|
||||||
String val = model.get(property);
|
ListStore<FileModel> store, Grid<FileModel> grid) {
|
||||||
String color = "black";
|
String val = model.get(property);
|
||||||
|
String color = "black";
|
||||||
|
|
||||||
if(val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())){
|
if (val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())) {
|
||||||
// color = "#EEC900";
|
// 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
|
||||||
}else{
|
+ "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
|
||||||
if(val==null)
|
} else {
|
||||||
val = "";
|
if (val == null)
|
||||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
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();
|
GridFilters filters = new GridFilters();
|
||||||
filters.setLocal(true);
|
filters.setLocal(true);
|
||||||
|
|
||||||
|
|
||||||
StringFilter nameFilter = new StringFilter(FileGridModel.NAME);
|
StringFilter nameFilter = new StringFilter(FileGridModel.NAME);
|
||||||
StringFilter typeFilter = new StringFilter(FileGridModel.TYPE);
|
StringFilter typeFilter = new StringFilter(FileGridModel.TYPE);
|
||||||
DateFilter dateFilter = new DateFilter(FileTrashedModel.STOREINFO.DELETEDATE.toString());
|
DateFilter dateFilter = new DateFilter(FileTrashedModel.STOREINFO.DELETEDATE.toString());
|
||||||
|
@ -320,7 +342,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent<FileTrashedModel> se) {
|
public void selectionChanged(SelectionChangedEvent<FileTrashedModel> se) {
|
||||||
|
|
||||||
boolean selection = grid.getSelectionModel().getSelectedItems().size()>0;
|
boolean selection = grid.getSelectionModel().getSelectedItems().size() > 0;
|
||||||
activeButtonOnSelection(selection);
|
activeButtonOnSelection(selection);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -334,11 +356,8 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
grid.setStyleAttribute("borderTop", "none");
|
grid.setStyleAttribute("borderTop", "none");
|
||||||
cp.add(grid);
|
cp.add(grid);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setPanelSize(int width, int height) {
|
public void setPanelSize(int width, int height) {
|
||||||
|
|
||||||
if (width > 0 && height > 0 && grid != null) {
|
if (width > 0 && height > 0 && grid != null) {
|
||||||
|
@ -361,31 +380,27 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
for (FileTrashedModel fileTrashedModel : trashFiles) {
|
for (FileTrashedModel fileTrashedModel : trashFiles) {
|
||||||
fileTrashedModel.setIcon();
|
fileTrashedModel.setIcon();
|
||||||
// GWT.log("TrashFile: "+fileTrashedModel);
|
// GWT.log("TrashFile: "+fileTrashedModel);
|
||||||
// //Workaround remove this
|
// //Workaround remove this
|
||||||
// if(fileTrashedModel.isDirectory())
|
// if(fileTrashedModel.isDirectory())
|
||||||
// fileTrashedModel.setFolderItemType(GXTFolderItemTypeEnum.FOLDER);
|
// fileTrashedModel.setFolderItemType(GXTFolderItemTypeEnum.FOLDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
store.add(trashFiles);
|
store.add(trashFiles);
|
||||||
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
activeButtonsOnNotEmtpy(store.getModels().size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param b
|
|
||||||
*/
|
|
||||||
private void activeButtonsOnNotEmtpy(boolean isNotEmpty) {
|
private void activeButtonsOnNotEmtpy(boolean isNotEmpty) {
|
||||||
buttonRestoreAll.setEnabled(isNotEmpty);
|
buttonRestoreAll.setEnabled(isNotEmpty);
|
||||||
buttonEmptyTrash.setEnabled(isNotEmpty);
|
buttonEmptyTrash.setEnabled(isNotEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param multi
|
|
||||||
*/
|
|
||||||
protected void activeButtonOnSelection(boolean bool) {
|
protected void activeButtonOnSelection(boolean bool) {
|
||||||
buttonDelete.setEnabled(bool);
|
buttonDelete.setEnabled(bool);
|
||||||
buttonRestore.setEnabled(bool);
|
buttonRestore.setEnabled(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStore(ListStore<FileTrashedModel> store) {
|
private void updateStore(ListStore<FileTrashedModel> store) {
|
||||||
|
|
||||||
resetStore();
|
resetStore();
|
||||||
|
@ -396,8 +411,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
this.grid.getStore().removeAll();
|
this.grid.getStore().removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColumnConfig createSortableColumnConfig(String id, String name,
|
public ColumnConfig createSortableColumnConfig(String id, String name, int width) {
|
||||||
int width) {
|
|
||||||
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
|
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
|
||||||
columnConfig.setSortable(true);
|
columnConfig.setSortable(true);
|
||||||
|
|
||||||
|
@ -409,40 +423,35 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
// cp.layout();
|
// cp.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public FileTrashedModel getFileModelByIdentifier(String identifier) {
|
||||||
*
|
|
||||||
* @param identifier
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public FileTrashedModel getFileModelByIdentifier(String identifier){
|
|
||||||
|
|
||||||
return store.findModel(FileGridModel.IDENTIFIER, identifier);
|
return store.findModel(FileGridModel.IDENTIFIER, identifier);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param identifier (MANDATORY)
|
* @param identifier
|
||||||
* @return
|
* mandatory
|
||||||
|
* @return operation result
|
||||||
*/
|
*/
|
||||||
public boolean deleteItem(String identifier) {
|
public boolean deleteItem(String identifier) {
|
||||||
|
|
||||||
FileTrashedModel fileTarget = getFileModelByIdentifier(identifier);
|
FileTrashedModel fileTarget = getFileModelByIdentifier(identifier);
|
||||||
|
|
||||||
|
if (fileTarget != null) {
|
||||||
if(fileTarget!=null){
|
|
||||||
return deleteItem(fileTarget);
|
return deleteItem(fileTarget);
|
||||||
}
|
} else
|
||||||
else
|
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store");
|
||||||
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param fileTarget (MANDATORY)
|
* @param fileTarget
|
||||||
* @return
|
* (MANDATORY)
|
||||||
|
* @return operation result
|
||||||
*/
|
*/
|
||||||
private boolean deleteItem(FileTrashedModel fileTarget) {
|
private boolean deleteItem(FileTrashedModel fileTarget) {
|
||||||
|
|
||||||
|
@ -455,11 +464,10 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
System.out.println("Record Error: file target with "
|
System.out.println(
|
||||||
+ fileTarget.getIdentifier()
|
"Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store");
|
||||||
+ " identifier not exist in store");
|
|
||||||
|
|
||||||
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
activeButtonsOnNotEmtpy(store.getModels().size() > 0);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -469,7 +477,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
*
|
*
|
||||||
* @return the number of items contained into trash
|
* @return the number of items contained into trash
|
||||||
*/
|
*/
|
||||||
public int trashSize(){
|
public int trashSize() {
|
||||||
return store.getCount();
|
return store.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,7 @@ public class WindowTrash extends Window {
|
||||||
setHeading("Trash");
|
setHeading("Trash");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static synchronized WindowTrash getInstance(){
|
public static synchronized WindowTrash getInstance(){
|
||||||
if(INSTANCE==null)
|
if(INSTANCE==null)
|
||||||
INSTANCE = new WindowTrash();
|
INSTANCE = new WindowTrash();
|
||||||
|
@ -150,11 +147,6 @@ public class WindowTrash extends Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param fileModelId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean deleteFileFromTrash(String fileModelId){
|
public boolean deleteFileFromTrash(String fileModelId){
|
||||||
boolean deleted = this.trashContainers.deleteItem(fileModelId);
|
boolean deleted = this.trashContainers.deleteItem(fileModelId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue