Completed [Feature #11325]

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@164757 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-03-06 13:37:32 +00:00
parent 8a39fd33b3
commit 1705d3a427
7 changed files with 44 additions and 35 deletions

View File

@ -2,11 +2,13 @@
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-20-0"
date="2018-03-01">
<Change>[Task #11127] Porting to new ws-thredds engine</Change>
<Change>[Feature #11325] Workspace: add New URL feature in the context menu of right pane</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-19-0"
date="2018-01-09">
<Change>Issue #10831, Workspace download folder tomcat temp occupation
issue</Change>
issue
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-18-0"
date="2017-09-29">

View File

@ -1589,8 +1589,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(dgu.isValidForm()){
explorerPanel.getAsycTreePanel().mask(ConstantsExplorer.VALIDATINGOPERATION,ConstantsExplorer.LOADINGSTYLE);
rpcWorkspaceService.createExternalUrl(parent, dgu.getName(), dgu.getDescription(), dgu.getUrl(), new AsyncCallback<FileModel>() {
GWT.log("parent: "+parent);
rpcWorkspaceService.createExternalUrl(parent.getIdentifier(), dgu.getName(), dgu.getDescription(), dgu.getUrl(), new AsyncCallback<FileModel>() {
@Override
public void onFailure(Throwable caught) {
@ -1602,10 +1602,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onSuccess(FileModel child) {
explorerPanel.getAsycTreePanel().addItem(parent.getIdentifier(), child, false);
explorerPanel.getAsycTreePanel().unmask();
notifySubscriber(createUrlEvent);
eventBus.fireEvent(new CompletedFileUploadEvent(parent.getIdentifier(), child.getIdentifier(), WS_UPLOAD_TYPE.File, false));
// explorerPanel.getAsycTreePanel().addItem(parent.getIdentifier(), child, false);
// explorerPanel.getAsycTreePanel().unmask();
// notifySubscriber(createUrlEvent);
}
});
}

View File

@ -197,17 +197,18 @@ public interface GWTWorkspaceService extends RemoteService{
*/
public GWTWorkspaceItem getUrlById(String identifier, boolean isInternalUrl, boolean fullDetails) throws Exception;
/**
* Creates the external url.
*
* @param parentFileModel the parent file model
* @param parentId the parent id
* @param name the name
* @param description the description
* @param url the url
* @return the file model
* @throws Exception the exception
*/
public FileModel createExternalUrl(FileModel parentFileModel, String name, String description, String url) throws Exception;
public FileModel createExternalUrl(String parentId, String name, String description, String url) throws Exception;
/**
* Sets the value in session.

View File

@ -214,16 +214,9 @@ public interface GWTWorkspaceServiceAsync {
*/
void getUrlById(String identifier, boolean isInternalUrl, boolean fullDetails, AsyncCallback<GWTWorkspaceItem> callback);
/**
* Creates the external url.
*
* @param parentFileModel the parent file model
* @param name the name
* @param description the description
* @param url the url
* @param callback the callback
*/
void createExternalUrl(FileModel parentFileModel, String name, String description, String url, AsyncCallback<FileModel> callback);
void createExternalUrl(
String parentId, String name, String description, String url,
AsyncCallback<FileModel> callback);
/**
* Sets the value in session.

View File

@ -1126,12 +1126,12 @@ public class AsyncTreePanel extends LayoutContainer {
*
* @param parentId the parent id
* @param child the child
* @param bool the bool
* @param addChildren the add children
*/
public void addItem(String parentId, FileModel child, boolean bool) {
public void addItem(String parentId, FileModel child, boolean addChildren) {
FileModel parent = getFileModelByIdentifier(parentId);
if(parent!=null)
addItem(parent,child,bool);
addItem(parent,child,addChildren);
}
@ -1140,10 +1140,10 @@ public class AsyncTreePanel extends LayoutContainer {
*
* @param parent the parent
* @param child the child
* @param bool the bool
* @param addChildren the add children
*/
private void addItem(FileModel parent, FileModel child, boolean bool) {
store.add(parent, child, bool);
private void addItem(FileModel parent, FileModel child, boolean addChildren) {
store.add(parent, child, addChildren);
}
/**

View File

@ -421,7 +421,13 @@ public class ContextMenuTree {
FileModel selected = listSelectedItems.get(0);
FileModel parent = getDirectoryOrParent(selected);
FileModel parent = selected.getParentFileModel();
if(parent==null){
if(selected.isDirectory()){
parent = selected;
}
}
//FileModel parent = getDirectoryOrParent(selected);
if(parent!=null){
eventBus.fireEvent(new CreateUrlEvent(null, parent));
@ -744,7 +750,7 @@ public class ContextMenuTree {
clearListSelectedItems();
listSelectedItems.add(0, targetFileModel);
printSelected();
//printSelected();
if(targetFileModel!=null){
@ -796,7 +802,7 @@ public class ContextMenuTree {
contextMenu.getItemByItemId(WorkspaceOperation.WEBDAV_URL.getId()).setVisible(false); //set invisible webdav url
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_FILE.getId()).setVisible(false); //set invisible upload file
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_ARCHIVE.getId()).setVisible(false); //set invisible upload archive
contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(false); //set invisible add url
//contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(false); //set invisible add url
contextMenu.getItemByItemId(WorkspaceOperation.REFRESH_FOLDER.getId()).setVisible(false); //set invisible refresh
contextMenu.showAt(posX, posY);
}
@ -808,7 +814,7 @@ public class ContextMenuTree {
private void printSelected(){
for (FileModel sel: listSelectedItems) {
System.out.println("selected " +sel.getName() );
GWT.log("selected " +sel.getName() );
}
}

View File

@ -1528,10 +1528,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#createExternalUrl(org.gcube.portlets.user.workspace.client.model.FileModel, java.lang.String, java.lang.String, java.lang.String)
*/
/**
* Creates the external url.
*
* @param parentFileModel the parent file model
* @param parentId the parent id
* @param name the name
* @param description the description
* @param url the url
@ -1539,19 +1540,23 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
* @throws Exception the exception
*/
@Override
public FileModel createExternalUrl(FileModel parentFileModel, String name, String description, String url) throws Exception {
public FileModel createExternalUrl(String parentId, String name, String description, String url) throws Exception {
try {
Workspace workspace = getWorkspace();
if(parentFileModel==null)
throw new Exception("Parent item is null");
if(parentId==null){
workspaceLogger.error("Error on creating url. Parent ID is null");
throw new Exception("Parent ID is null");
}
workspaceLogger.trace("create url in parent id: "+parentFileModel.getIdentifier());
ExternalUrl ext = workspace.createExternalUrl(name, description, url, parentFileModel.getIdentifier());
WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
workspaceLogger.trace("create url in parent id: "+parentId);
ExternalUrl ext = workspace.createExternalUrl(name, description, url, parentId);
WorkspaceItem parent = workspace.getItem(parentId); //get item from workspace
workspaceLogger.trace("parent name " + parent.getName());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
FolderModel parentFileModel = builder.buildGXTFolderModelItem((WorkspaceFolder) parent, null);
return builder.buildGXTFileModelItem(ext, parentFileModel);
} catch (Exception e) {