Updated pom version at 6.13.1

Fixed incident: https://support.d4science.org/issues/4878

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@131030 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-08-29 13:39:13 +00:00
parent db62aaa5cc
commit f29b443fd5
8 changed files with 684 additions and 287 deletions

View File

@ -184,7 +184,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
// private FileUploader fileUploader; // private FileUploader fileUploader;
public static String myLogin; public static String myLogin;
public static String myLoginFirstName; public static String myLoginFirstName;
public static boolean ckanEditorOrAdmin; public static Boolean ckanEditorOrAdmin;
//PRE-LOAD LIST OF USER FORM LIFERAY //PRE-LOAD LIST OF USER FORM LIFERAY
private UserStore userStore = new UserStore(); private UserStore userStore = new UserStore();
@ -2013,6 +2013,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public ExplorerPanel getPanel(){ public ExplorerPanel getPanel(){
this.explorerPanel = new ExplorerPanel(true, true); this.explorerPanel = new ExplorerPanel(true, true);
loadMyLogin(); loadMyLogin();
loadMyFirstName();
return this.explorerPanel; return this.explorerPanel;
} }
@ -2030,6 +2031,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
this.explorerPanel = new ExplorerPanel(instancingSmartFolder, instancingMessages, selectRootItem); this.explorerPanel = new ExplorerPanel(instancingSmartFolder, instancingMessages, selectRootItem);
this.selectRootItem=selectRootItem; this.selectRootItem=selectRootItem;
loadMyLogin(); loadMyLogin();
loadMyFirstName();
return this.explorerPanel; return this.explorerPanel;
} }
@ -2281,12 +2283,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
GWT.log("Error on loading my login is empty"); GWT.log("Error on loading my login is empty");
ConstantsExplorer.log("Error on loading my login is empty");
myLogin = ""; myLogin = "";
} }
@Override @Override
public void onSuccess(UserBean user) { public void onSuccess(UserBean user) {
ConstantsExplorer.log("UserBean is: "+user.toString());
GWT.log("My login is: "+user.getUsername()); GWT.log("My login is: "+user.getUsername());
myLogin = user.getUsername(); myLogin = user.getUsername();
myLoginFirstName = user.getFirstName(); myLoginFirstName = user.getFirstName();
@ -2296,6 +2299,28 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} }
/**
* Load my first name.
*/
private void loadMyFirstName(){
rpcWorkspaceService.getMyFirstName(new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
ConstantsExplorer.log("Error on loading my first name");
myLoginFirstName = "";
}
@Override
public void onSuccess(String firstName) {
ConstantsExplorer.log("getMyFirstName is: "+firstName);
myLoginFirstName = firstName;
}
});
}
/** /**
* Load item from workspace. * Load item from workspace.
* *

View File

@ -228,4 +228,9 @@ public class ConstantsExplorer {
public static final int HEIGHT_DIALOG_SHARE_FOLDER = 445; public static final int HEIGHT_DIALOG_SHARE_FOLDER = 445;
public static native void log(String txt) /*-{
console.log(txt)
}-*/;
} }

View File

@ -706,4 +706,9 @@ public interface GWTWorkspaceService extends RemoteService{
* @return the username of the current user * @return the username of the current user
*/ */
String getUser(); String getUser();
/**
* @return
*/
String getMyFirstName();
} }

View File

@ -696,4 +696,6 @@ public interface GWTWorkspaceServiceAsync {
*/ */
void getUser(AsyncCallback<String> callback); void getUser(AsyncCallback<String> callback);
void getMyFirstName(AsyncCallback<String> callback);
} }

View File

@ -54,15 +54,19 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.AbstractImagePrototype;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class AsyncTreePanel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Aug 29, 2016
*/ */
public class AsyncTreePanel extends LayoutContainer { public class AsyncTreePanel extends LayoutContainer {
private static final String TREE_MESSAGE_PANEL_ASYNC = "treeMessagePanelAsync"; private static final String TREE_MESSAGE_PANEL_ASYNC = "treeMessagePanelAsync";
private static final String ROOT_SUFFIX = "'s workspace"; private static final String ROOT_SUFFIX = "'s workspace";
private String myRootDisplayName = null;
// private TreeLoader<FileModel> loader; // private TreeLoader<FileModel> loader;
private TreePanel<FileModel> treePanel; private TreePanel<FileModel> treePanel;
private TreeStore<FileModel> store; private TreeStore<FileModel> store;
@ -72,12 +76,22 @@ public class AsyncTreePanel extends LayoutContainer {
private boolean isSubTreeLoaded = false; private boolean isSubTreeLoaded = false;
private boolean isSearch = false; private boolean isSearch = false;
private String scopeId = null; private String scopeId = null;
/**
* The Enum DragType.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Aug 29, 2016
*/
private enum DragType {INSERT, APPEND}; private enum DragType {INSERT, APPEND};
// private int contextMenuPosX = -1; // private int contextMenuPosX = -1;
// private int contextMenuPosY = -1; // private int contextMenuPosY = -1;
private boolean rightClick = false; private boolean rightClick = false;
/**
* Instantiates a new async tree panel.
*/
public AsyncTreePanel() { public AsyncTreePanel() {
//Init Store //Init Store
@ -141,8 +155,9 @@ public class AsyncTreePanel extends LayoutContainer {
// SET icons in tree panel // SET icons in tree panel
treePanel.setIconProvider(new ModelIconProvider<FileModel>() { treePanel.setIconProvider(new ModelIconProvider<FileModel>() {
public AbstractImagePrototype getIcon(FileModel model) { public AbstractImagePrototype getIcon(final FileModel model) {
// model.setIcon(); // model.setIcon();
ConstantsExplorer.log("getIcon Model is root?: "+model.isRoot() + " name: "+model.getName());
if (!model.isDirectory()) { if (!model.isDirectory()) {
if(model.getType()!=null) if(model.getType()!=null)
return Resources.getIconByType(model.getName(), model.getType()); return Resources.getIconByType(model.getName(), model.getType());
@ -150,7 +165,31 @@ public class AsyncTreePanel extends LayoutContainer {
return Resources.getIconByFolderItemType(model.getGXTFolderItemType()); return Resources.getIconByFolderItemType(model.getGXTFolderItemType());
} }
if (model.isRoot()) { if (model.isRoot()) {
model.setName(AppControllerExplorer.myLoginFirstName+ROOT_SUFFIX); //ConstantsExplorer.log("getIcon isRoot Model is: "+model);
if(AppControllerExplorer.myLoginFirstName==null || AppControllerExplorer.myLoginFirstName.isEmpty()){
ConstantsExplorer.log("Getting My First Name from server, into myLoginFirstName call is null yet");
AppControllerExplorer.rpcWorkspaceService.getMyFirstName(new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("Error on re-loading my login is empty");
ConstantsExplorer.log("Error on re-loading my first name is empty");
}
@Override
public void onSuccess(String firstName) {
if(firstName==null || firstName.isEmpty())
model.setName("My Workspace");
else
setRootDisplayName(model, AppControllerExplorer.myLoginFirstName+ROOT_SUFFIX, true);
}
});
}else{
setRootDisplayName(model, AppControllerExplorer.myLoginFirstName+ROOT_SUFFIX, false);
}
return Resources.getCloudDriveIcon(); return Resources.getCloudDriveIcon();
} }
@ -229,15 +268,28 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/** /**
* Sets the root display name.
* *
* * @param model the model
* @param name the name
* @param forceOverwrite the force overwrite
*/
private void setRootDisplayName(FileModel root, String name, boolean forceOverwrite){
if(myRootDisplayName==null || forceOverwrite){
myRootDisplayName = name;
root.setName(myRootDisplayName);
}
}
/**
* Status values * Status values
* ConstantsExplorer.FOLDERNOTLOAD = "notload"; * ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded"; * ConstantsExplorer.FOLDERLOADED = "loaded";
* *
* @param itemIdentifier * @param itemIdentifier the item identifier
* @param status * @param status the status
*/ */
public void changeFolderIconStatus(String itemIdentifier, String status){ public void changeFolderIconStatus(String itemIdentifier, String status){
@ -247,6 +299,12 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Load root item.
*
* @param scopeId the scope id
* @param selectRoot the select root
*/
public void loadRootItem(String scopeId, final boolean selectRoot){ public void loadRootItem(String scopeId, final boolean selectRoot){
this.scopeId = scopeId; this.scopeId = scopeId;
@ -291,6 +349,12 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Load root in store.
*
* @param root the root
* @param selectRootOnLoad the select root on load
*/
private void loadRootInStore(FolderModel root, boolean selectRootOnLoad){ private void loadRootInStore(FolderModel root, boolean selectRootOnLoad){
if(root!=null){ if(root!=null){
@ -308,6 +372,9 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Adds the drag and drop.
*/
private void addDragAndDrop() { private void addDragAndDrop() {
//Drag & Drop Event //Drag & Drop Event
@ -515,6 +582,9 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Adds the listners.
*/
private void addListners() { private void addListners() {
treePanel.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileModel>() { treePanel.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileModel>() {
@ -653,6 +723,9 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Manage context menu.
*/
private void manageContextMenu(){ private void manageContextMenu(){
System.out.println("***Event Context Menu open"); System.out.println("***Event Context Menu open");
@ -676,11 +749,24 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Reload tree level and expand folder.
*
* @param folderIdentifier the folder identifier
* @param expandFolder the expand folder
*/
public void reloadTreeLevelAndExpandFolder(String folderIdentifier, boolean expandFolder){ public void reloadTreeLevelAndExpandFolder(String folderIdentifier, boolean expandFolder){
final FolderModel folder = (FolderModel) getFileModelByIdentifier(folderIdentifier); final FolderModel folder = (FolderModel) getFileModelByIdentifier(folderIdentifier);
reloadTreeLevelAndExpandFolder(folder, expandFolder); reloadTreeLevelAndExpandFolder(folder, expandFolder);
} }
/**
* Adds the item id and expand folder.
*
* @param parent the parent
* @param itemId the item id
* @param expandFolder the expand folder
*/
public void addItemIdAndExpandFolder(final FileModel parent, String itemId, boolean expandFolder){ public void addItemIdAndExpandFolder(final FileModel parent, String itemId, boolean expandFolder){
treePanel.mask(ConstantsExplorer.VALIDATINGOPERATION,ConstantsExplorer.LOADINGSTYLE); treePanel.mask(ConstantsExplorer.VALIDATINGOPERATION,ConstantsExplorer.LOADINGSTYLE);
@ -708,6 +794,12 @@ public class AsyncTreePanel extends LayoutContainer {
}); });
} }
/**
* Reload tree level and expand folder.
*
* @param folder the folder
* @param expandFolder the expand folder
*/
private void reloadTreeLevelAndExpandFolder(final FolderModel folder, final boolean expandFolder){ private void reloadTreeLevelAndExpandFolder(final FolderModel folder, final boolean expandFolder){
AppControllerExplorer.rpcWorkspaceService.getFolderChildren(folder, new AsyncCallback<List<FileModel>>(){ AppControllerExplorer.rpcWorkspaceService.getFolderChildren(folder, new AsyncCallback<List<FileModel>>(){
@ -738,6 +830,11 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Load tree level from workspace.
*
* @param folder the folder
*/
private void loadTreeLevelFromWorkspace(final FolderModel folder){ private void loadTreeLevelFromWorkspace(final FolderModel folder){
GWT.log("Start RPC - getFolderChildren"); GWT.log("Start RPC - getFolderChildren");
// Log.info("Start RPC - getFolderChildren"); // Log.info("Start RPC - getFolderChildren");
@ -772,6 +869,12 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Adds the children to folder.
*
* @param idParent the id parent
* @param children the children
*/
public void addChildrenToFolder(String idParent, List<FileModel> children){ public void addChildrenToFolder(String idParent, List<FileModel> children){
FileModel parent = getFileModelByIdentifier(idParent); FileModel parent = getFileModelByIdentifier(idParent);
@ -780,6 +883,12 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Adds the children to folder.
*
* @param parent the parent
* @param children the children
*/
private void addChildrenToFolder(FolderModel parent, List<FileModel> children){ private void addChildrenToFolder(FolderModel parent, List<FileModel> children){
if(parent!=null){ if(parent!=null){
@ -788,6 +897,11 @@ public class AsyncTreePanel extends LayoutContainer {
} }
} }
/**
* Sets the visible rename and remove context menu.
*
* @param bool the new visible rename and remove context menu
*/
private void setVisibleRenameAndRemoveContextMenu(boolean bool){ private void setVisibleRenameAndRemoveContextMenu(boolean bool){
treePanel.getContextMenu().getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(bool); treePanel.getContextMenu().getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(bool);
@ -795,10 +909,18 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Sets the visibile get web dav url.
*
* @param bool the new visibile get web dav url
*/
private void setVisibileGetWebDavUrl(boolean bool){ private void setVisibileGetWebDavUrl(boolean bool){
treePanel.getContextMenu().getItemByItemId(WorkspaceOperation.WEBDAV_URL.getId()).setVisible(bool); treePanel.getContextMenu().getItemByItemId(WorkspaceOperation.WEBDAV_URL.getId()).setVisible(bool);
} }
/**
* Sets the alphanumeric store sorter.
*/
private void setAlphanumericStoreSorter(){ private void setAlphanumericStoreSorter(){
// Sorting files // Sorting files
@ -826,6 +948,11 @@ public class AsyncTreePanel extends LayoutContainer {
} }
//TODO for debug //TODO for debug
/**
* Printing tree level.
*
* @param item the item
*/
private void printingTreeLevel(FileModel item){ private void printingTreeLevel(FileModel item){
List<FileModel> children = treePanel.getStore().getChildren(item); List<FileModel> children = treePanel.getStore().getChildren(item);
@ -844,21 +971,34 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/** /**
* Gets the file model by identifier.
* *
* @param identifier * @param identifier the identifier
* @return * @return the file model by identifier
*/ */
public FileModel getFileModelByIdentifier(String identifier){ public FileModel getFileModelByIdentifier(String identifier){
return treePanel.getStore().findModel(ConstantsExplorer.IDENTIFIER, identifier); return treePanel.getStore().findModel(ConstantsExplorer.IDENTIFIER, identifier);
} }
/**
* Gets the children number.
*
* @param identifier the identifier
* @return the children number
*/
public int getChildrenNumber(String identifier){ public int getChildrenNumber(String identifier){
FolderModel fileModel = (FolderModel) getFileModelByIdentifier(identifier); FolderModel fileModel = (FolderModel) getFileModelByIdentifier(identifier);
return getChildrenNumber(fileModel); return getChildrenNumber(fileModel);
} }
/**
* Gets the children number.
*
* @param folder the folder
* @return the children number
*/
private int getChildrenNumber(FolderModel folder){ private int getChildrenNumber(FolderModel folder){
return store.getChildCount(folder); return store.getChildCount(folder);
@ -866,9 +1006,10 @@ public class AsyncTreePanel extends LayoutContainer {
/** /**
* Delete item.
* *
* @param identifier (MANDATORY) * @param identifier (MANDATORY)
* @return * @return true, if successful
*/ */
public boolean deleteItem(String identifier) { public boolean deleteItem(String identifier) {
@ -885,10 +1026,12 @@ public class AsyncTreePanel extends LayoutContainer {
/** /**
* Rename item.
* *
* @param fileTarget (MANDATORY) * @param fileTarget (MANDATORY)
* @param newName (MANDATORY) * @param newName (MANDATORY)
* @param extension OPTIONAL - string or null * @param extension OPTIONAL - string or null
* @return true, if successful
*/ */
private boolean renameItem(FileModel fileTarget, String newName, String extension) { private boolean renameItem(FileModel fileTarget, String newName, String extension) {
@ -913,10 +1056,12 @@ public class AsyncTreePanel extends LayoutContainer {
/** /**
* Rename item.
* *
* @param fileTarget (MANDATORY) * @param identifier the identifier
* @param newName (MANDATORY) * @param newName (MANDATORY)
* @param extension OPTIONAL - string or null * @param extension OPTIONAL - string or null
* @return true, if successful
*/ */
public boolean renameItem(String identifier, String newName, String extension) { public boolean renameItem(String identifier, String newName, String extension) {
@ -929,9 +1074,10 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/** /**
* Delete item.
* *
* @param fileTarget (MANDATORY) * @param fileTarget (MANDATORY)
* @return * @return true, if successful
*/ */
private boolean deleteItem(FileModel fileTarget) { private boolean deleteItem(FileModel fileTarget) {
@ -952,6 +1098,13 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Adds the item.
*
* @param parentId the parent id
* @param child the child
* @param bool the bool
*/
public void addItem(String parentId, FileModel child, boolean bool) { public void addItem(String parentId, FileModel child, boolean bool) {
FileModel parent = getFileModelByIdentifier(parentId); FileModel parent = getFileModelByIdentifier(parentId);
if(parent!=null) if(parent!=null)
@ -959,13 +1112,21 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/**
* Adds the item.
*
* @param parent the parent
* @param child the child
* @param bool the bool
*/
private void addItem(FileModel parent, FileModel child, boolean bool) { private void addItem(FileModel parent, FileModel child, boolean bool) {
store.add(parent, child, bool); store.add(parent, child, bool);
} }
/** /**
* Sets the expand tree level.
* *
* @param parent * @param parent the parent
* @param bool expand true/false * @param bool expand true/false
*/ */
private void setExpandTreeLevel(FileModel parent, boolean bool) { private void setExpandTreeLevel(FileModel parent, boolean bool) {
@ -973,9 +1134,10 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/** /**
* Checks if is expanded.
* *
* @param identifier * @param identifier the identifier
* @return * @return true, if is expanded
*/ */
public boolean isExpanded(String identifier){ public boolean isExpanded(String identifier){
@ -991,6 +1153,12 @@ public class AsyncTreePanel extends LayoutContainer {
return treePanel.isExpanded(fileTarget); return treePanel.isExpanded(fileTarget);
} }
/**
* Sets the expand tree level.
*
* @param identifier the identifier
* @param bool the bool
*/
public void setExpandTreeLevel(String identifier, boolean bool) { public void setExpandTreeLevel(String identifier, boolean bool) {
FileModel item = getFileModelByIdentifier(identifier); FileModel item = getFileModelByIdentifier(identifier);
if(item!=null) if(item!=null)
@ -998,9 +1166,10 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/** /**
* Select item.
* *
* @param identifier * @param identifier the identifier
* @return * @return true, if successful
*/ */
public boolean selectItem(String identifier){ public boolean selectItem(String identifier){
@ -1012,6 +1181,12 @@ public class AsyncTreePanel extends LayoutContainer {
return false; return false;
} }
/**
* Re select item.
*
* @param identifier the identifier
* @return true, if successful
*/
public boolean reSelectItem(String identifier){ public boolean reSelectItem(String identifier){
FileModel fileTarget = getFileModelByIdentifier(identifier); FileModel fileTarget = getFileModelByIdentifier(identifier);
@ -1023,6 +1198,12 @@ public class AsyncTreePanel extends LayoutContainer {
return false; return false;
} }
/**
* Select item.
*
* @param fileTarget the file target
* @return true, if successful
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
private boolean selectItem(FileModel fileTarget){ private boolean selectItem(FileModel fileTarget){
@ -1033,27 +1214,45 @@ public class AsyncTreePanel extends LayoutContainer {
return false; return false;
} }
/**
* Checks if is sub tree loaded.
*
* @return true, if is sub tree loaded
*/
public boolean isSubTreeLoaded() { public boolean isSubTreeLoaded() {
return isSubTreeLoaded; return isSubTreeLoaded;
} }
/**
* Sets the sub tree loaded.
*
* @param isSubTreeLoaded the new sub tree loaded
*/
public void setSubTreeLoaded(boolean isSubTreeLoaded) { public void setSubTreeLoaded(boolean isSubTreeLoaded) {
this.isSubTreeLoaded = isSubTreeLoaded; this.isSubTreeLoaded = isSubTreeLoaded;
} }
/** /**
* Select root by default * Select root by default.
*/ */
public void removeAllAndRecoveryRoot(){ public void removeAllAndRecoveryRoot(){
store.removeAll(); store.removeAll();
loadRootItem(scopeId,true); loadRootItem(scopeId,true);
} }
/**
* Removes the all and recovery root.
*
* @param selectRoot the select root
*/
public void removeAllAndRecoveryRoot(boolean selectRoot){ public void removeAllAndRecoveryRoot(boolean selectRoot){
store.removeAll(); store.removeAll();
loadRootItem(scopeId,selectRoot); loadRootItem(scopeId,selectRoot);
} }
/**
* Select root item.
*/
public void selectRootItem(){ public void selectRootItem(){
FileModel selectedItem = treePanel.getSelectionModel().getSelectedItem(); FileModel selectedItem = treePanel.getSelectionModel().getSelectedItem();
if(selectedItem!=null) if(selectedItem!=null)
@ -1062,17 +1261,32 @@ public class AsyncTreePanel extends LayoutContainer {
treePanel.getSelectionModel().select(store.getRootItems().get(0), true); //select root item treePanel.getSelectionModel().select(store.getRootItems().get(0), true); //select root item
} }
/**
* Deselect item.
*
* @param identifier the identifier
*/
public void deselectItem(String identifier){ public void deselectItem(String identifier){
FileModel fileTarget = getFileModelByIdentifier(identifier); FileModel fileTarget = getFileModelByIdentifier(identifier);
if(fileTarget!=null) if(fileTarget!=null)
treePanel.getSelectionModel().deselect(fileTarget); treePanel.getSelectionModel().deselect(fileTarget);
} }
/**
* Deselect item.
*
* @param fileTarget the file target
*/
public void deselectItem(FileModel fileTarget){ public void deselectItem(FileModel fileTarget){
if(fileTarget!=null) if(fileTarget!=null)
treePanel.getSelectionModel().deselect(fileTarget); treePanel.getSelectionModel().deselect(fileTarget);
} }
/**
* Gets the selected file model item.
*
* @return the selected file model item
*/
public FileModel getSelectedFileModelItem(){ public FileModel getSelectedFileModelItem(){
FileModel selectedItem = treePanel.getSelectionModel().getSelectedItem(); FileModel selectedItem = treePanel.getSelectionModel().getSelectedItem();
if(selectedItem!=null) if(selectedItem!=null)
@ -1081,28 +1295,59 @@ public class AsyncTreePanel extends LayoutContainer {
return store.getRootItems().get(0); //return root item return store.getRootItems().get(0); //return root item
} }
/**
* Checks if is search.
*
* @return true, if is search
*/
public boolean isSearch() { public boolean isSearch() {
return isSearch; return isSearch;
} }
/**
* Sets the search.
*
* @param isSearch the new search
*/
public void setSearch(boolean isSearch) { public void setSearch(boolean isSearch) {
System.out.println("***Set Search: " + isSearch); System.out.println("***Set Search: " + isSearch);
this.isSearch = isSearch; this.isSearch = isSearch;
} }
/**
* Sets the size tree panel.
*
* @param width the width
* @param height the height
*/
public void setSizeTreePanel(int width, int height){ public void setSizeTreePanel(int width, int height){
treePanel.setSize(width, height); treePanel.setSize(width, height);
} }
/**
* Gets the context menu tree.
*
* @return the context menu tree
*/
public ContextMenuTree getContextMenuTree() { public ContextMenuTree getContextMenuTree() {
return contextMenuTree; return contextMenuTree;
} }
/**
* Sets the header tree visible.
*
* @param bool the new header tree visible
*/
public void setHeaderTreeVisible(boolean bool){ public void setHeaderTreeVisible(boolean bool){
cp.setHeaderVisible(bool); cp.setHeaderVisible(bool);
} }
/**
* Gets the root item.
*
* @return the root item
*/
public FileModel getRootItem(){ public FileModel getRootItem(){
return treePanel.getStore().getRootItems().get(0); return treePanel.getStore().getRootItems().get(0);
} }

View File

@ -542,6 +542,7 @@ public class GWTWorkspaceBuilder {
// startTime = System.currentTimeMillis(); // startTime = System.currentTimeMillis();
for (WorkspaceItem item : listItems){ for (WorkspaceItem item : listItems){
logger.debug("item: "+item.getName()+ "is root? " +item.isRoot());
listFileModel.add(buildGXTFileModelItem(item,parentFolderModel)); listFileModel.add(buildGXTFileModelItem(item,parentFolderModel));
} }

View File

@ -2672,7 +2672,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
LiferayUserManager l = new LiferayUserManager(); LiferayUserManager l = new LiferayUserManager();
GCubeUser user = l.getUserByUsername(username); GCubeUser user = l.getUserByUsername(username);
workspaceLogger.info("My login first name is: "+user.getFirstName());
firstName = user.getFirstName(); firstName = user.getFirstName();
lastName = user.getLastName(); lastName = user.getLastName();
email = user.getEmail(); email = user.getEmail();
@ -2687,9 +2686,39 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} }
} }
return new UserBean(username, firstName, lastName, email, publishRights);
UserBean us = new UserBean(username, firstName, lastName, email, publishRights);
workspaceLogger.info("Returning myLogin: "+us);
return us;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getMyLogin()
*/
@Override
public String getMyFirstName(){
ASLSession asl = WsUtil.getAslSession(this.getThreadLocalRequest().getSession());
String username = asl.getUsername();
String firstName = "";
if (isWithinPortal() && username.compareTo(WsUtil.TEST_USER) != 0) {
try {
LiferayUserManager l = new LiferayUserManager();
GCubeUser user = l.getUserByUsername(username);
workspaceLogger.info("My login first name is: "+user.getFirstName());
firstName = user.getFirstName();
}catch (UserManagementSystemException e) {
workspaceLogger.error("UserManagementSystemException for username: "+username);
}
catch (UserRetrievalFault e) {
workspaceLogger.error("UserRetrievalFault for username: "+username);
}
}
return firstName;
}
/** /**
* Update acl for vr eby group name. * Update acl for vr eby group name.
* *

View File

@ -2,60 +2,145 @@ package org.gcube.portlets.user.workspace.shared;
import java.io.Serializable; import java.io.Serializable;
@SuppressWarnings("serial")
public class UserBean implements Serializable { public class UserBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6779963164440480883L;
private String username; private String username;
private String firstName; private String firstName;
private String lastName; private String lastName;
private String email; private String email;
private Boolean cataloguePermission; private Boolean cataloguePermission;
public UserBean(String username, String firstName, String lastName,
String email, Boolean cataloguePermission) {
super();
this.cataloguePermission = cataloguePermission;
this.username = username;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
public UserBean() { public UserBean() {
} }
public String getUsername() {
return username; public UserBean(String username, String firstName, String lastName, String email, Boolean cataloguePermission) {
}
public void setUsername(String username) {
this.username = username; this.username = username;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName; this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName; this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email; this.email = email;
}
public Boolean hasCataloguePermission() {
return cataloguePermission;
}
public void setCataloguePermission(Boolean cataloguePermission) {
this.cataloguePermission = cataloguePermission; this.cataloguePermission = cataloguePermission;
} }
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @return the firstName
*/
public String getFirstName() {
return firstName;
}
/**
* @return the lastName
*/
public String getLastName() {
return lastName;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @return the cataloguePermission
*/
public Boolean getCataloguePermission() {
return cataloguePermission;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @param firstName the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @param cataloguePermission the cataloguePermission to set
*/
public void setCataloguePermission(Boolean cataloguePermission) {
this.cataloguePermission = cataloguePermission;
}
public Boolean hasCataloguePermission() {
return cataloguePermission;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
return "UserBean [username=" + username + ", firstName=" + firstName
+ ", lastName=" + lastName + ", email=" + email StringBuilder builder = new StringBuilder();
+ ", cataloguePermission=" + cataloguePermission + "]"; builder.append("UserBean [username=");
builder.append(username);
builder.append(", firstName=");
builder.append(firstName);
builder.append(", lastName=");
builder.append(lastName);
builder.append(", email=");
builder.append(email);
builder.append(", cataloguePermission=");
builder.append(cataloguePermission);
builder.append("]");
return builder.toString();
} }
} }