Removed all static references to the Pithos class
[pithos-web-client] / src / gr / grnet / pithos / web / client / CellTreeView.java
1 /*
2  * Copyright 2011 GRNET S.A. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or
5  * without modification, are permitted provided that the following
6  * conditions are met:
7  *
8  *   1. Redistributions of source code must retain the above
9  *      copyright notice, this list of conditions and the following
10  *      disclaimer.
11  *
12  *   2. Redistributions in binary form must reproduce the above
13  *      copyright notice, this list of conditions and the following
14  *      disclaimer in the documentation and/or other materials
15  *      provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * The views and conclusions contained in the software and
31  * documentation are those of the authors and should not be
32  * interpreted as representing official policies, either expressed
33  * or implied, of GRNET S.A.
34  */
35 package gr.grnet.pithos.web.client;
36
37 import gr.grnet.pithos.web.client.CellTreeViewModel.ClearSelection;
38 import gr.grnet.pithos.web.client.rest.GetCommand;
39 import gr.grnet.pithos.web.client.rest.RestException;
40 import gr.grnet.pithos.web.client.rest.resource.FolderResource;
41 import gr.grnet.pithos.web.client.rest.resource.MyFolderResource;
42 import gr.grnet.pithos.web.client.rest.resource.OtherUserResource;
43 import gr.grnet.pithos.web.client.rest.resource.OthersFolderResource;
44 import gr.grnet.pithos.web.client.rest.resource.OthersResource;
45 import gr.grnet.pithos.web.client.rest.resource.RestResource;
46 import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
47 import gr.grnet.pithos.web.client.rest.resource.SharedResource;
48 import gr.grnet.pithos.web.client.rest.resource.TrashFolderResource;
49 import gr.grnet.pithos.web.client.rest.resource.TrashResource;
50 import gr.grnet.pithos.web.client.rest.resource.UserResource;
51 import gwtquery.plugins.droppable.client.gwt.DragAndDropCellTree;
52
53 import java.util.Arrays;
54
55 import com.google.gwt.core.client.GWT;
56 import com.google.gwt.resources.client.ClientBundle;
57 import com.google.gwt.resources.client.ImageResource;
58 import com.google.gwt.resources.client.ImageResource.ImageOptions;
59 import com.google.gwt.user.cellview.client.CellTree;
60 import com.google.gwt.user.cellview.client.TreeNode;
61 import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
62 import com.google.gwt.user.client.DeferredCommand;
63 import com.google.gwt.user.client.Event;
64 import com.google.gwt.user.client.IncrementalCommand;
65 import com.google.gwt.user.client.ui.Composite;
66 import com.google.gwt.user.client.ui.Tree;
67 import com.google.gwt.view.client.ProvidesKey;
68 import com.google.gwt.view.client.SelectionChangeEvent;
69 import com.google.gwt.view.client.SingleSelectionModel;
70 import com.google.gwt.view.client.TreeViewModel;
71 import com.google.gwt.view.client.SelectionChangeEvent.Handler;
72 import com.google.gwt.view.client.TreeViewModel.NodeInfo;
73
74
75 public class CellTreeView extends Composite{
76         public static final boolean DONE = false;
77     private Pithos app;
78         Images images;
79         
80         SingleSelectionModel<RestResource> selectionModel = new SingleSelectionModel<RestResource>(new ProvidesKey<RestResource>() {
81
82                 @Override
83                 public Object getKey(RestResource item) {
84                         return item.getClass().getName()+":"+item.getUri();
85                 }});
86         FolderContextMenu menu;
87         
88         
89         MyFolderResource myFolders=null;
90         TrashResource trash = null;
91         SharedResource myshared = null;
92         OthersResource others = null;
93         
94         CellTreeViewModel model;
95         CellTreeViewUtils utils;
96         
97         public interface Images extends ClientBundle,Tree.Resources, FolderContextMenu.Images {
98
99         @Source("gr/grnet/pithos/resources/folder_home.png")
100         ImageResource home();
101
102         @Source("gr/grnet/pithos/resources/folder_yellow.png")
103         ImageResource folderYellow();
104
105         @Source("gr/grnet/pithos/resources/mimetypes/document.png")
106         ImageResource document();
107
108         @Source("gr/grnet/pithos/resources/internet.png")
109         ImageResource othersShared();
110
111         @Source("gr/grnet/pithos/resources/edit_user.png")
112         ImageResource myShared();
113
114         @Source("gr/grnet/pithos/resources/folder_user.png")
115         ImageResource sharedFolder();
116
117         @Source("gr/grnet/pithos/resources/trashcan_empty.png")
118         ImageResource trash();
119         }
120         DragAndDropCellTree tree;
121         /*public interface BasicResources extends CellTree.BasicResources{
122                 @ImageOptions(flipRtl = true)
123             @Source("cellTreeLoadingBasic.gif")
124             ImageResource cellTreeLoading();
125                 
126                 @Source({"GssCellTreeBasic.css"})
127             CellTree.Style cellTreeStyle();
128         }*/
129         public interface BasicResources extends CellTree.Resources {
130
131             @ImageOptions(flipRtl = true)
132             @Source("cellTreeClosedItem.gif")
133             ImageResource cellTreeClosedItem();
134
135             @ImageOptions(flipRtl = true)
136             @Source("cellTreeLoadingBasic.gif")
137             ImageResource cellTreeLoading();
138
139             @ImageOptions(flipRtl = true)
140             @Source("cellTreeOpenItem.gif")
141             ImageResource cellTreeOpenItem();
142
143             //@Source({CellTree.Style.DEFAULT_CSS,"GssCellTreeBasic.css"})
144             @Source({"GssCellTreeBasic.css"})
145             CellTree.Style cellTreeStyle();
146           }
147         /**
148          * 
149          */
150         public CellTreeView(Pithos _app, final Images _images) {
151         this.app = _app;
152                 images = _images;
153                 model = new CellTreeViewModel(app, images,selectionModel);
154             /*
155              * Create the tree using the model. We use <code>null</code> as the default
156              * value of the root node. The default value will be passed to
157              * CustomTreeModel#getNodeInfo();
158              */
159                 CellTree.Resources res = GWT.create(BasicResources.class);
160             tree = new DragAndDropCellTree(model,null, res){
161                 @Override
162                 public void onBrowserEvent(Event event) {
163                         // TODO Auto-generated method stub
164                         super.onBrowserEvent(event);
165                 }
166             };
167             utils=new CellTreeViewUtils(tree);
168             tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
169             /*tree.addOpenHandler(new OpenHandler<TreeNode>() {
170                         
171                         @Override
172                         public void onOpen(OpenEvent<TreeNode> event) {
173                                 Window.alert("[NODE OPENED]"+event.getTarget());
174                                 
175                         }
176                 });
177             tree.addOverDroppableHandler(new OverDroppableEventHandler() {
178                         
179                         @Override
180                         public void onOverDroppable(OverDroppableEvent event) {
181                                 GWT.log("OVER:"+event);
182                                 
183                         }
184                 });
185             tree.addAttachHandler(new AttachEvent.Handler() {
186                         
187                         @Override
188                         public void onAttachOrDetach(AttachEvent event) {
189                                 GWT.log("ATTACH:"+event.getSource());
190                                 
191                         }
192                 });*/
193             Handler selectionHandler = new SelectionChangeEvent.Handler() { 
194             @Override 
195             public void onSelectionChange(com.google.gwt.view.client.SelectionChangeEvent event) {
196                 NodeInfo<RestResource> nodeInfo = (NodeInfo<RestResource>) getModel().getNodeInfo(selectionModel.getSelectedObject());
197                 if(nodeInfo==null || nodeInfo.getValueUpdater()==null){
198                         app.showFileList(getSelection());
199                 }
200                 else
201                         nodeInfo.getValueUpdater().update(selectionModel.getSelectedObject());
202                 app.setCurrentSelection(selectionModel.getSelectedObject());
203                 
204                 
205             }
206         };
207         selectionModel.addSelectionChangeHandler(selectionHandler);
208             sinkEvents(Event.ONCONTEXTMENU);
209                 sinkEvents(Event.ONMOUSEUP);
210             initWidget(tree);
211             FolderResource loadingResource = new FolderResource("loading");
212             loadingResource.setName("Loading....");
213             loadingResource.setShared(false);
214             RestResourceWrapper loading = new RestResourceWrapper(loadingResource);
215             model.getRootNodes().setList(Arrays.asList((RestResource)loading));
216                 
217             DeferredCommand.addCommand(new IncrementalCommand() {
218
219                         @Override
220                         public boolean execute() {
221                                 return fetchRootFolders();
222                         }
223                 });
224         }
225         
226         public void updateNode(RestResource resource){
227                 NodeInfo<RestResource> nodeInfo = (NodeInfo<RestResource>) getModel().getNodeInfo(resource);
228                 
229                 if(nodeInfo!=null){
230                 if(nodeInfo.getValueUpdater()==null){}
231                 else
232                         nodeInfo.getValueUpdater().update(resource);
233         }
234         }
235         
236         public void updateNodeChildren(final RestResource resource){
237                 
238                 if(resource instanceof RestResourceWrapper){
239                         boolean updated=false;
240                         if(((RestResourceWrapper)resource).getResource().getFolders().size()==0){
241                                 if(((RestResourceWrapper)resource).getResource().getParentURI().equals(getMyFolders().getUri())){
242                                         updateNodeChildren(getMyFolders().getUri());
243                                         return;
244                                 }
245                                 if(model.getMymap().get(((RestResourceWrapper)resource).getResource().getParentURI())!=null){
246                                         model.getMymap().get(((RestResourceWrapper)resource).getResource().getParentURI()).refresh(null);
247                                         updated=true;
248                                 }
249                                 if(model.getOthersmap().get(((RestResourceWrapper)resource).getResource().getParentURI())!=null){
250                                         model.getOthersmap().get(((RestResourceWrapper)resource).getResource().getParentURI()).refresh(null);
251                                         updated=true;
252                                 }
253                                 if(model.getSharedmap().get(((RestResourceWrapper)resource).getResource().getParentURI())!=null){
254                                         model.getSharedmap().get(((RestResourceWrapper)resource).getResource().getParentURI()).refresh(null);
255                                         updated=true;
256                                 }
257                                 if(updated){
258                                         if(utils.doesSharedNodeContainsResourceIn1stLevel(resource.getUri())){
259                                                 updateMySharedNode();
260                                         }
261                                         else if(tree.getRootTreeNode().isChildOpen(2)){
262                                                 utils.refreshNodeContainingResource(tree.getRootTreeNode().setChildOpen(2,true),resource.getUri());
263                                         }
264                                         //return;
265                                 }
266                         }
267                 }
268                 
269                 utils.refreshNodeContainingResource(resource);
270                 if(utils.doesSharedNodeContainsResourceIn1stLevel(resource.getUri())){
271                         updateMySharedNode();
272                 }
273                 else if(tree.getRootTreeNode().isChildOpen(2)){
274                         GWT.log("REFRESH THE OTHER WAY 2:"+resource);
275                         utils.refreshNodeContainingResource(tree.getRootTreeNode().setChildOpen(2,true),resource.getUri());
276                 }
277                 
278         }
279         public void updateNodeChildrenForRemove(final String resource){
280                 GWT.log("********************************");
281                 GWT.log("[UPDATENODECHILDREN]"+resource);
282                 GWT.log("********************************");
283                 boolean updated=false;
284                 TreeNode node=null;
285                 TreeNode sharedNode=null;
286                 if(tree.getRootTreeNode().isChildOpen(0)){
287                         node = utils.getNodeContainingResource2(tree.getRootTreeNode().setChildOpen(0,true), resource);
288                 }
289                         GWT.log("CHECK NODE1:"+node+" "+resource);
290                 
291                         if(tree.getRootTreeNode().isChildOpen(2)){
292                                 GWT.log("CHECK NODE2:"+node);
293                                 if(node==null)
294                                         node = utils.getNodeContainingResource2(tree.getRootTreeNode().setChildOpen(2,true), resource);
295                                 
296                         }
297                 if(node==null)
298                         if(tree.getRootTreeNode().isChildOpen(3)){
299                                 GWT.log("CHECK NODE3:"+node);
300                                 node = utils.getNodeContainingResource2(tree.getRootTreeNode().setChildOpen(3,true), resource);
301                 }
302                 if(node != null && node.getValue() instanceof RestResourceWrapper){
303                         GWT.log("*********************"+((RestResourceWrapper) node.getValue()).getResource().getFolders().size());
304                         RestResourceWrapper wrapper  = (RestResourceWrapper) node.getValue();
305                         if(wrapper.getResource().countNotDeletedSubfolders()==1||wrapper.getResource().countNotDeletedSubfolders()==0){
306                                 updateNodeChildren(((RestResourceWrapper) node.getValue()).getResource().getParentURI());
307                                 if(((RestResourceWrapper) node.getValue()).getResource().getParentURI().equals(myFolders.getUri())){
308                                         if(utils.doesSharedNodeContainsResourceIn1stLevel(resource)||utils.doesSharedNodeContainsResourceIn2ndLevel(resource)){
309                                                 updateMySharedNode();
310                                         }
311                                 }
312                                                         
313                         }
314                         else
315                                 updateNodeChildren(((RestResource) node.getValue()).getUri());
316                         return;
317                 }
318                 updateNodeChildren(resource);
319         }
320         public void updateNodeChildren(final String resource){
321                 
322                         
323                 GWT.log("REFRESH THE OTHER WAY");
324                 utils.refreshNodeContainingResource(resource);
325                 if(utils.doesSharedNodeContainsResourceIn1stLevel(resource)||utils.doesSharedNodeContainsResourceIn2ndLevel(resource)){
326                         GWT.log("REFRESH THE OTHER WAY 1:"+resource);
327                         updateMySharedNode();
328                 }
329                 else if(tree.getRootTreeNode().isChildOpen(2)){
330                         GWT.log("REFRESH THE OTHER WAY 2:"+resource);
331                         utils.refreshNodeContainingResource(tree.getRootTreeNode().setChildOpen(2,true),resource);
332                 }
333         }
334         
335         protected void showPopup(final int x, final int y) {
336                 if (selectionModel.getSelectedObject() == null)
337                         return;
338                 if (menu != null)
339                         menu.hide();
340 //              menu = new FolderContextMenu(images);
341 //              menu.setPopupPosition(x, y);
342 //              menu.show();
343         }
344         private boolean init=false;
345         public boolean fetchRootFolders() {
346                 UserResource userResource = app.getCurrentUserResource();
347                 if (userResource == null)
348                         return !DONE;
349                 if(!init){
350                         final String path = userResource.getFilesPath();
351                         GetCommand<FolderResource> gf = new GetCommand<FolderResource>(app, FolderResource.class, path, null) {
352         
353                                 @Override
354                                 public void onComplete() {
355                                         myFolders = new MyFolderResource(getResult());
356                                         //selectionModel.setSelected(myFolders, true);
357                                         //rootNodes.setList(Arrays.asList((RestResource)rootResource));
358                                         //tree.getRootTreeNode().setChildOpen(0, true);
359                                 }
360         
361                                 @Override
362                                 public void onError(Throwable t) {
363                                         GWT.log("Error fetching root folder", t);
364                                         app.displayError("Unable to fetch root folder");
365                                 }
366         
367                         };
368                         DeferredCommand.addCommand(gf);
369                         DeferredCommand.addCommand(new GetCommand<TrashResource>(app, TrashResource.class, app.getCurrentUserResource().getTrashPath(), null) {
370                                 @Override
371                                 public void onComplete() {
372                                         trash = getResult();
373                                 }
374
375                                 @Override
376                                 public void onError(Throwable t) {
377                                         if(t instanceof RestException){
378                                                 int statusCode = ((RestException)t).getHttpStatusCode();
379                                                 // On IE status code 1223 may be returned instead of 204.
380                                                 if(statusCode == 204 || statusCode == 1223){
381                                                         trash = new TrashResource(app.getCurrentUserResource().getTrashPath());
382                                         }
383                                         else{
384                                                 GWT.log("", t);
385                                                 app.displayError("Unable to fetch trash folder:"+t.getMessage());
386                                                 trash = new TrashResource(app.getCurrentUserResource().getTrashPath());
387                                         }
388                                 }
389                         }
390                         });
391                         GetCommand<SharedResource> gs = new GetCommand<SharedResource>(app, SharedResource.class, userResource.getSharedPath(), null) {
392
393                                 @Override
394                                 public void onComplete() {
395                                         myshared=getResult();
396                                 }
397
398                                 @Override
399                                 public void onError(Throwable t) {
400                                         GWT.log("Error fetching Shared Root folder", t);
401                                         app.displayError("Unable to fetch Shared Root folder");
402                                 }
403                         };
404                         DeferredCommand.addCommand(gs);
405                         GetCommand<OthersResource> go = new GetCommand<OthersResource>(app, OthersResource.class,
406                                                 userResource.getOthersPath(), null) {
407
408                                 @Override
409                                 public void onComplete() {
410                                         others = getResult();
411                                 }
412
413                                 @Override
414                                 public void onError(Throwable t) {
415                                         GWT.log("Error fetching Others Root folder", t);
416                                         app.displayError("Unable to fetch Others Root folder");
417                                 }
418                         };
419                         DeferredCommand.addCommand(go);
420                 }
421                 if(myFolders==null||trash==null||myshared==null||others==null)
422                         return !DONE;
423                 model.getRootNodes().setList(Arrays.asList((RestResource)myFolders,(RestResource)trash,(RestResource)myshared,(RestResource)others));
424                 tree.getRootTreeNode().setChildOpen(0, true);
425                 selectionModel.setSelected(myFolders, true);
426                 return DONE;
427         }
428
429         public Images getImages() {
430                 return images;
431         }
432         
433         
434         public void updateTrashNode(){
435                 DeferredCommand.addCommand(new GetCommand<TrashResource>(app, TrashResource.class, app.getCurrentUserResource().getTrashPath(), null) {
436                         @Override
437                         public void onComplete() {
438                                 trash = getResult();
439                                 boolean trashIsOpen = tree.getRootTreeNode().isChildOpen(1);
440                                 model.getRootNodes().getList().set(1, trash);
441                                 model.getRootNodes().refresh();
442                                 tree.getRootTreeNode().setChildOpen(1, true);
443                         }
444
445                         @Override
446                         public void onError(Throwable t) {
447                                 if(t instanceof RestException){
448                                         int statusCode = ((RestException)t).getHttpStatusCode();
449                                         // On IE status code 1223 may be returned instead of 204.
450                                         if(statusCode == 204 || statusCode == 1223){
451                                                 trash = new TrashResource(app.getCurrentUserResource().getTrashPath());
452                                                 model.getRootNodes().getList().set(1, trash);
453                                                 //model.getRootNodes().refresh();
454                                 }
455                                 else{
456                                         GWT.log("", t);
457                                         app.displayError("Unable to fetch trash folder:"+t.getMessage());
458                                         trash = new TrashResource(app.getCurrentUserResource().getTrashPath());
459                                         model.getRootNodes().getList().set(1, trash);
460                                         //model.getRootNodes().refresh();
461                                 }
462                         }
463                 }
464                 });
465         }
466         
467         public void updateRootNode(){
468                 final String path = app.getCurrentUserResource().getFilesPath();
469                 GetCommand<FolderResource> gf = new GetCommand<FolderResource>(app, FolderResource.class, path, null) {
470
471                         @Override
472                         public void onComplete() {
473                                 myFolders = new MyFolderResource(getResult());
474                                 model.getRootNodes().getList().set(0, myFolders);
475                                 model.getRootNodes().refresh();
476                                 tree.getRootTreeNode().setChildOpen(0, true);
477                                 
478                         }
479
480                         @Override
481                         public void onError(Throwable t) {
482                                 GWT.log("Error fetching root folder", t);
483                                 app.displayError("Unable to fetch root folder");
484                         }
485
486                 };
487                 DeferredCommand.addCommand(gf);
488         }
489         
490         public void updateMySharedNode(){
491                 GetCommand<SharedResource> gs = new GetCommand<SharedResource>(app, SharedResource.class, app.getCurrentUserResource().getSharedPath(), null) {
492
493                         @Override
494                         public void onComplete() {
495                                 myshared=getResult();
496                                 model.getRootNodes().getList().set(2, myshared);
497                         }
498
499                         @Override
500                         public void onError(Throwable t) {
501                                 GWT.log("Error fetching Shared Root folder", t);
502                                 app.displayError("Unable to fetch Shared Root folder");
503                         }
504                 };
505                 DeferredCommand.addCommand(gs);
506         }
507         
508         public void updateOtherNode(){
509                 GetCommand<OthersResource> go = new GetCommand<OthersResource>(app, OthersResource.class,
510                                         app.getCurrentUserResource().getOthersPath(), null) {
511
512                         @Override
513                         public void onComplete() {
514                                 others = getResult();
515                                 model.getRootNodes().getList().set(3, others);
516                         }
517
518                         @Override
519                         public void onError(Throwable t) {
520                                 GWT.log("Error fetching Others Root folder", t);
521                                 app.displayError("Unable to fetch Others Root folder");
522                         }
523                 };
524                 DeferredCommand.addCommand(go);
525         }
526         
527         
528         public RestResource getSelection(){
529                 return selectionModel.getSelectedObject();
530         }
531         
532         public void clearSelection(){
533                 if(app.getCurrentSelection().equals(getSelection()))
534                         app.setCurrentSelection(null);
535                 selectionModel.setSelected(getSelection(), false);
536         }
537         
538         
539         /**
540          * Retrieve the myFolders.
541          *
542          * @return the myFolders
543          */
544         public MyFolderResource getMyFolders() {
545                 return myFolders;
546         }
547         
548         
549         /**
550          * Retrieve the myshared.
551          *
552          * @return the myshared
553          */
554         public SharedResource getMyshared() {
555                 return myshared;
556         }
557         
558         
559         /**
560          * Retrieve the trash.
561          *
562          * @return the trash
563          */
564         public TrashResource getTrash() {
565                 return trash;
566         }
567         
568         
569         /**
570          * Retrieve the others.
571          *
572          * @return the others
573          */
574         public OthersResource getOthers() {
575                 return others;
576         }
577         
578         
579         /**
580          * Retrieve the model.
581          *
582          * @return the model
583          */
584         public TreeViewModel getModel() {
585                 return model;
586         }
587         
588         
589         
590         /**
591          * Retrieve the utils.
592          *
593          * @return the utils
594          */
595         public CellTreeViewUtils getUtils() {
596                 return utils;
597         }
598         
599         public interface RefreshHandler{
600                 void onRefresh();               
601         }
602         
603         
604         public boolean isTrashOrTrashFolderSelected(){
605                 return (getSelection() instanceof TrashResource) || (getSelection() instanceof TrashFolderResource);
606         }
607         
608         public OtherUserResource getOtherUserResourceOfOtherFolder(OthersFolderResource res){
609                 TreeNode n = utils.getNodeContainingResource(tree.getRootTreeNode().setChildOpen(3, true), res);
610                 
611                 if(n!=null){
612                         if(n.getValue() instanceof OtherUserResource)
613                                 return (OtherUserResource) n.getValue();
614                         TreeNode parent = n.getParent();
615                         
616                         while (parent!=null){
617                                 if(parent.getValue() instanceof OtherUserResource)
618                                         return (OtherUserResource) parent.getValue();
619                                 parent = parent.getParent();
620                         }
621                 }
622                 return null;
623         }
624         
625         public void refreshCurrentNode(boolean clearSelection){
626                 NodeInfo<RestResource> nodeInfo = (NodeInfo<RestResource>) getModel().getNodeInfo(selectionModel.getSelectedObject());
627         if(nodeInfo==null || nodeInfo.getValueUpdater()==null){
628                 app.showFileList(getSelection(),clearSelection);
629         }
630         else{
631                 if(!clearSelection)
632                         ((ClearSelection)nodeInfo.getValueUpdater()).setClearSelection(clearSelection);
633                 nodeInfo.getValueUpdater().update(selectionModel.getSelectedObject());
634         }
635         }
636         
637 }