package gr.ebs.gss.client;
import gr.ebs.gss.client.clipboard.Clipboard;
+import gr.ebs.gss.client.commands.GetUserCommand;
import gr.ebs.gss.client.rest.GetCommand;
import gr.ebs.gss.client.rest.RestException;
import gr.ebs.gss.client.rest.resource.FileResource;
import gr.ebs.gss.client.rest.resource.FolderResource;
+import gr.ebs.gss.client.rest.resource.OtherUserResource;
+import gr.ebs.gss.client.rest.resource.OthersResource;
import gr.ebs.gss.client.rest.resource.RestResource;
+import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
import gr.ebs.gss.client.rest.resource.TrashResource;
import gr.ebs.gss.client.rest.resource.UserResource;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Cookies;
+import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.DeferredCommand;
+import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Tree;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
/**
* The tab panel that occupies the right side of the screen.
*/
- private TabPanel inner = new DecoratedTabPanel();
+ private TabPanel inner = new DecoratedTabPanel(){
+
+ public void onBrowserEvent(com.google.gwt.user.client.Event event) {
+ if (DOM.eventGetType(event) == Event.ONCONTEXTMENU){
+ if(isFileListShowing()){
+ getFileList().showContextMenu(event);
+ }
+ }
+ };
+ };
/**
* The split panel that will contain the left and right panels.
searchResults = new SearchResults(images);
// Inner contains the various lists.
+ inner.sinkEvents(Event.ONCONTEXTMENU);
inner.setAnimationEnabled(true);
inner.getTabBar().addStyleName("gss-MainTabBar");
inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom");
inner.add(fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);
-
+
inner.add(groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true);
inner.add(searchResults, createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"), true);
//inner.add(new CellTreeView(images), createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true);
splitPanel.setSplitPosition("25%");
splitPanel.setSize("100%", "100%");
splitPanel.addStyleName("gss-splitPanel");
-
+
// Create a dock panel that will contain the menu bar at the top,
// the shortcuts to the left, the status bar at the bottom and the
// right panel taking the rest.
@Override
public void onComplete() {
+
currentUserResource = getResult();
final String announcement = currentUserResource.getAnnouncement();
if (announcement != null)
RestResource currentFolder = getTreeView().getSelection();
GWT.log("SELECTED:"+currentFolder);
if(currentFolder!=null){
+ GWT.log("SELECTED:"+currentFolder.getClass());
+ List<FileResource> files = null;
+ if (currentFolder instanceof RestResourceWrapper) {
+ RestResourceWrapper folder = (RestResourceWrapper) currentFolder;
+ files = folder.getResource().getFiles();
+ } else if (currentFolder instanceof TrashResource) {
+ TrashResource folder = (TrashResource) currentFolder;
+ files = folder.getFiles();
+ }
+ else if(currentFolder instanceof OthersResource){
+ files = new ArrayList<FileResource>();
+ }
+ else if(currentFolder instanceof OtherUserResource){
+ files = ((OtherUserResource)currentFolder).getFiles();
+ }
+ if (files != null)
+ getFileList().setFiles(files);
+ }
+ fileList.updateFileCache(update, true /*clear selection*/);
+ inner.selectTab(0);
+ }
+
+ public void showFileList(RestResource r,boolean update) {
+ /*TreeItem currentFolder = getFolders().getCurrent();
+ if (currentFolder != null) {
List<FileResource> files = null;
- if (currentFolder instanceof FolderResource) {
- FolderResource folder = (FolderResource) currentFolder;
+ Object cachedObject = currentFolder.getUserObject();
+ if (cachedObject instanceof FolderResource) {
+ FolderResource folder = (FolderResource) cachedObject;
files = folder.getFiles();
+ } else if (cachedObject instanceof TrashResource) {
+ TrashResource folder = (TrashResource) cachedObject;
+ files = folder.getFiles();
+ }
+ if (files != null)
+ getFileList().setFiles(files);
+ }*/
+ RestResource currentFolder = r;
+ GWT.log("SELECTED:"+currentFolder);
+ if(currentFolder!=null){
+ List<FileResource> files = null;
+ if (currentFolder instanceof RestResourceWrapper) {
+ RestResourceWrapper folder = (RestResourceWrapper) currentFolder;
+ files = folder.getResource().getFiles();
} else if (currentFolder instanceof TrashResource) {
TrashResource folder = (TrashResource) currentFolder;
files = folder.getFiles();
public String findUserFullName(String _userName){
return userFullNameMap.get(_userName);
}
-
+ public String getUserFullName(String _userName) {
+
+ if (GSS.get().findUserFullName(_userName) == null)
+ //if there is no userFullName found then the map fills with the given _userName,
+ //so userFullName = _userName
+ GSS.get().putUserToMap(_userName, _userName);
+ else if(GSS.get().findUserFullName(_userName).indexOf('@') != -1){
+ //if the userFullName = _userName the GetUserCommand updates the userFullName in the map
+ GetUserCommand guc = new GetUserCommand(_userName);
+ guc.execute();
+ }
+ return GSS.get().findUserFullName(_userName);
+ }
/**
* Retrieve the treeView.
*
}
public void onResourceUpdate(RestResource resource){
- if(resource instanceof FolderResource){
+ if(resource instanceof RestResourceWrapper){
if(getTreeView().getSelection()!=null&&getTreeView().getSelection().getUri().equals(resource.getUri()))
- showFileList(true);
+ showFileList(resource,true);
}
}
+
+
}