Statistics
| Branch: | Tag: | Revision:

root / web_client / src / gr / grnet / pithos / web / client / CellTreeView.java @ ab1eb3f8

History | View | Annotate | Download (19.8 kB)

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