GSS.java changes to show user's selection in browser's address
[pithos] / src / gr / ebs / gss / client / GSS.java
1 /*
2  * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd. This file is part
3  * of GSS. GSS is free software: you can redistribute it and/or modify it under
4  * the terms of the GNU General Public License as published by the Free Software
5  * Foundation, either version 3 of the License, or (at your option) any later
6  * version. GSS is distributed in the hope that it will be useful, but WITHOUT
7  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
9  * details. You should have received a copy of the GNU General Public License
10  * along with GSS. If not, see <http://www.gnu.org/licenses/>.
11  */
12 package gr.ebs.gss.client;
13
14 import gr.ebs.gss.client.clipboard.Clipboard;
15 import gr.ebs.gss.client.dnd.DnDFocusPanel;
16 import gr.ebs.gss.client.dnd.DnDSimpleFocusPanel;
17 import gr.ebs.gss.client.rest.GetCommand;
18 import gr.ebs.gss.client.rest.RestException;
19 import gr.ebs.gss.client.rest.resource.FileResource;
20 import gr.ebs.gss.client.rest.resource.FolderResource;
21 import gr.ebs.gss.client.rest.resource.TrashResource;
22 import gr.ebs.gss.client.rest.resource.UserResource;
23
24 import java.util.Iterator;
25 import java.util.List;
26
27 import com.allen_sauer.gwt.dnd.client.DragContext;
28 import com.allen_sauer.gwt.dnd.client.PickupDragController;
29 import com.allen_sauer.gwt.dnd.client.VetoDragException;
30 import com.google.gwt.core.client.EntryPoint;
31 import com.google.gwt.core.client.GWT;
32 import com.google.gwt.event.logical.shared.ResizeEvent;
33 import com.google.gwt.event.logical.shared.ResizeHandler;
34 import com.google.gwt.event.logical.shared.SelectionEvent;
35 import com.google.gwt.event.logical.shared.SelectionHandler;
36 import com.google.gwt.resources.client.ClientBundle;
37 import com.google.gwt.resources.client.ImageResource;
38 import com.google.gwt.user.client.Command;
39 import com.google.gwt.user.client.Cookies;
40 import com.google.gwt.user.client.DOM;
41 import com.google.gwt.user.client.DeferredCommand;
42 import com.google.gwt.user.client.History;
43 import com.google.gwt.user.client.Window;
44 import com.google.gwt.user.client.ui.AbsolutePanel;
45 import com.google.gwt.user.client.ui.AbstractImagePrototype;
46 import com.google.gwt.user.client.ui.DecoratedTabPanel;
47 import com.google.gwt.user.client.ui.DockPanel;
48 import com.google.gwt.user.client.ui.HTML;
49 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
50 import com.google.gwt.user.client.ui.HasVerticalAlignment;
51 import com.google.gwt.user.client.ui.HorizontalSplitPanel;
52 import com.google.gwt.user.client.ui.Label;
53 import com.google.gwt.user.client.ui.RootPanel;
54 import com.google.gwt.user.client.ui.TabPanel;
55 import com.google.gwt.user.client.ui.TreeItem;
56 import com.google.gwt.user.client.ui.VerticalPanel;
57 import com.google.gwt.user.client.ui.Widget;
58
59 /**
60  * Entry point classes define <code>onModuleLoad()</code>.
61  */
62 public class GSS implements EntryPoint, ResizeHandler {
63
64         /**
65          * A constant that denotes the completion of an IncrementalCommand.
66          */
67         public static final boolean DONE = false;
68
69         public static final int VISIBLE_FILE_COUNT = 100;
70
71         /**
72          * Instantiate an application-level image bundle. This object will provide
73          * programmatic access to all the images needed by widgets.
74          */
75         private static Images images = (Images) GWT.create(Images.class);
76
77         private GlassPanel glassPanel = new GlassPanel();
78
79         /**
80          * An aggregate image bundle that pulls together all the images for this
81          * application into a single bundle.
82          */
83         public interface Images extends ClientBundle, TopPanel.Images, StatusPanel.Images, FileMenu.Images, EditMenu.Images, SettingsMenu.Images, GroupMenu.Images, FilePropertiesDialog.Images, MessagePanel.Images, FileList.Images, SearchResults.Images, Search.Images, Groups.Images, Folders.Images {
84
85                 @Source("gr/ebs/gss/resources/document.png")
86                 ImageResource folders();
87
88                 @Source("gr/ebs/gss/resources/edit_group_22.png")
89                 ImageResource groups();
90
91                 @Source("gr/ebs/gss/resources/search.png")
92                 ImageResource search();
93         }
94
95         /**
96          * The single GSS instance.
97          */
98         private static GSS singleton;
99
100         /**
101          * Gets the singleton GSS instance.
102          *
103          * @return the GSS object
104          */
105         public static GSS get() {
106                 if (GSS.singleton == null)
107                         GSS.singleton = new GSS();
108                 return GSS.singleton;
109         }
110
111         /**
112          * The Application Clipboard implementation;
113          */
114         private Clipboard clipboard = new Clipboard();
115
116         private UserResource currentUserResource;
117
118         /**
119          * The top panel that contains the menu bar.
120          */
121         private TopPanel topPanel;
122
123         /**
124          * The panel that contains the various system messages.
125          */
126         private MessagePanel messagePanel = new MessagePanel(GSS.images);
127
128         /**
129          * The bottom panel that contains the status bar.
130          */
131         private StatusPanel statusPanel = new StatusPanel(GSS.images);
132
133         /**
134          * The top right panel that displays the logged in user details
135          */
136         private UserDetailsPanel userDetailsPanel = new UserDetailsPanel();
137
138         /**
139          * The file list widget.
140          */
141         private FileList fileList;
142
143         /**
144          * The group list widget.
145          */
146         private Groups groups = new Groups(images);
147
148         /**
149          * The search result widget.
150          */
151         private SearchResults searchResults;
152
153         /**
154          * The tab panel that occupies the right side of the screen.
155          */
156         private TabPanel inner = new DecoratedTabPanel();
157
158         /**
159          * The split panel that will contain the left and right panels.
160          */
161         private HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
162
163         /**
164          * The horizontal panel that will contain the search and status panels.
165          */
166         private DockPanel searchStatus = new DockPanel();
167
168         /**
169          * The search widget.
170          */
171         private Search search;
172
173         /**
174          * The widget that displays the tree of folders.
175          */
176         private Folders folders = new Folders(images);
177
178         /**
179          * The currently selected item in the application, for use by the Edit menu
180          * commands. Potential types are Folder, File, User and Group.
181          */
182         private Object currentSelection;
183
184         /**
185          * The authentication token of the current user.
186          */
187         private String token;
188
189         /**
190          * The WebDAV password of the current user
191          */
192         private String webDAVPassword;
193
194         private PickupDragController dragController;
195
196         public void onModuleLoad() {
197                 // Initialize the singleton before calling the constructors of the
198                 // various widgets that might call GSS.get().
199                 singleton = this;
200                 RootPanel.get().add(glassPanel, 0, 0);
201                 parseUserCredentials();
202                 dragController = new PickupDragController(RootPanel.get(), false) {
203
204                         @Override
205                         public void previewDragStart() throws VetoDragException {
206                                 super.previewDragStart();
207                                 if (context.selectedWidgets.isEmpty())
208                                         throw new VetoDragException();
209
210                                 if (context.draggable != null)
211                                         if (context.draggable instanceof DnDFocusPanel) {
212                                                 DnDFocusPanel toDrop = (DnDFocusPanel) context.draggable;
213                                                 // prevent drag and drop for trashed files and for
214                                                 // unselected tree items
215                                                 if (toDrop.getFiles() != null && folders.isTrashItem(folders.getCurrent()))
216                                                         throw new VetoDragException();
217                                                 else if (toDrop.getItem() != null && !toDrop.getItem().equals(folders.getCurrent()))
218                                                         throw new VetoDragException();
219                                                 else if (toDrop.getItem() != null && !toDrop.getItem().isDraggable())
220                                                         throw new VetoDragException();
221
222                                         } else if (context.draggable instanceof DnDSimpleFocusPanel) {
223                                                 DnDSimpleFocusPanel toDrop = (DnDSimpleFocusPanel) context.draggable;
224                                                 // prevent drag and drop for trashed files and for
225                                                 // unselected tree items
226                                                 if (toDrop.getFiles() != null && folders.isTrashItem(folders.getCurrent()))
227                                                         throw new VetoDragException();
228                                         }
229                         }
230
231                         @Override
232                         protected Widget newDragProxy(DragContext aContext) {
233                                 AbsolutePanel container = new AbsolutePanel();
234                                 DOM.setStyleAttribute(container.getElement(), "overflow", "visible");
235                                 for (Iterator iterator = aContext.selectedWidgets.iterator(); iterator.hasNext();) {
236                                         HTML html = null;
237                                         Widget widget = (Widget) iterator.next();
238                                         if (widget instanceof DnDFocusPanel) {
239                                                 DnDFocusPanel book = (DnDFocusPanel) widget;
240                                                 html = book.cloneHTML();
241                                         } else if (widget instanceof DnDSimpleFocusPanel) {
242                                                 DnDSimpleFocusPanel book = (DnDSimpleFocusPanel) widget;
243                                                 html = book.cloneHTML();
244                                         }
245                                         if (html == null)
246                                                 container.add(new Label("Drag ME"));
247                                         else
248                                                 container.add(html);
249                                 }
250                                 return container;
251                         }
252                 };
253                 dragController.setBehaviorDragProxy(true);
254                 dragController.setBehaviorMultipleSelection(false);
255                 topPanel = new TopPanel(GSS.images);
256                 topPanel.setWidth("100%");
257
258                 messagePanel.setWidth("100%");
259                 messagePanel.setVisible(false);
260
261                 search = new Search(images);
262                 searchStatus.add(search, DockPanel.WEST);
263                 searchStatus.add(userDetailsPanel, DockPanel.EAST);
264                 searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
265                 searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE);
266                 searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE);
267                 searchStatus.setWidth("100%");
268
269                 fileList = new FileList(images);
270
271                 searchResults = new SearchResults(images);
272
273                 // Inner contains the various lists.
274                 inner.setAnimationEnabled(true);
275                 inner.getTabBar().addStyleName("gss-MainTabBar");
276                 inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom");
277                 inner.add(fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);
278
279                 inner.add(groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true);
280                 inner.add(searchResults, createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"), true);
281                 inner.setWidth("100%");
282                 inner.selectTab(0);
283
284                 inner.addSelectionHandler(new SelectionHandler<Integer>() {
285
286                         @Override
287                         public void onSelection(SelectionEvent<Integer> event) {
288                                 int tabIndex = event.getSelectedItem();
289                                 switch (tabIndex) {
290                                         case 0:
291                                                 fileList.clearSelectedRows();
292                                                 fileList.updateCurrentlyShowingStats();
293                                                 History.newItem("Files");
294                                                 break;
295                                         case 1:
296                                                 groups.updateCurrentlyShowingStats();
297                                                 History.newItem("Groups");
298                                                 break;
299                                         case 2:
300                                                 searchResults.clearSelectedRows();
301                                                 searchResults.updateCurrentlyShowingStats();
302                                                 History.newItem("Search");
303                                                 break;
304                                 }
305                         }
306                 });
307 //              History.addValueChangeHandler(new ValueChangeHandler<String>() {
308 //
309 //                      public void onValueChange(ValueChangeEvent<String> event) {
310 //                              String historyToken = event.getValue();
311 //                              try {
312 //                                      if (historyToken.equals("Files"))
313 //                                              inner.selectTab(1);
314 //                                      else if (historyToken.equals("Groups"))
315 //                                              inner.selectTab(2);
316 //                                      else if (historyToken.equals("Search Results"))
317 //                                              inner.selectTab(3);
318 //                                      else
319 //                                              inner.selectTab(0);
320 //                              } catch (IndexOutOfBoundsException e) {
321 //                                      inner.selectTab(0);
322 //                              }
323 //                      }
324 //              });
325
326                 // Add the left and right panels to the split panel.
327                 splitPanel.setLeftWidget(folders);
328                 splitPanel.setRightWidget(inner);
329                 splitPanel.setSplitPosition("25%");
330                 splitPanel.setSize("100%", "100%");
331                 splitPanel.addStyleName("gss-splitPanel");
332
333                 // Create a dock panel that will contain the menu bar at the top,
334                 // the shortcuts to the left, the status bar at the bottom and the
335                 // right panel taking the rest.
336                 VerticalPanel outer = new VerticalPanel();
337                 outer.add(topPanel);
338                 outer.add(searchStatus);
339                 outer.add(messagePanel);
340                 outer.add(splitPanel);
341                 outer.add(statusPanel);
342                 outer.setWidth("100%");
343                 outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);
344
345                 outer.setSpacing(4);
346
347                 // Hook the window resize event, so that we can adjust the UI.
348                 Window.addResizeHandler(this);
349                 // Clear out the window's built-in margin, because we want to take
350                 // advantage of the entire client area.
351                 Window.setMargin("0px");
352                 // Finally, add the outer panel to the RootPanel, so that it will be
353                 // displayed.
354                 RootPanel.get().add(outer);
355                 // Call the window resized handler to get the initial sizes setup. Doing
356                 // this in a deferred command causes it to occur after all widgets'
357                 // sizes have been computed by the browser.
358                 DeferredCommand.addCommand(new Command() {
359
360                         public void execute() {
361                                 onWindowResized(Window.getClientHeight());
362                         }
363                 });
364         }
365
366         /**
367          * Fetches the User object for the specified username.
368          *
369          * @param username the username of the user
370          */
371         private void fetchUser(final String username) {
372                 String path = getApiPath() + username + "/";
373                 GetCommand<UserResource> getUserCommand = new GetCommand<UserResource>(UserResource.class, username, path, null) {
374
375                         @Override
376                         public void onComplete() {
377                                 currentUserResource = getResult();
378                                 final String announcement = currentUserResource.getAnnouncement();
379                                 if (announcement != null)
380                                         DeferredCommand.addCommand(new Command() {
381
382                                                 public void execute() {
383                                                         displayInformation(announcement);
384                                                 }
385                                         });
386                         }
387
388                         @Override
389                         public void onError(Throwable t) {
390                                 GWT.log("Fetching user error", t);
391                                 if (t instanceof RestException)
392                                         GSS.get().displayError("No user found:" + ((RestException) t).getHttpStatusText());
393                                 else
394                                         GSS.get().displayError("System error fetching user data:" + t.getMessage());
395                                 authenticateUser();
396                         }
397                 };
398                 DeferredCommand.addCommand(getUserCommand);
399         }
400
401         /**
402          * Parse and store the user credentials to the appropriate fields.
403          */
404         private void parseUserCredentials() {
405                 Configuration conf = (Configuration) GWT.create(Configuration.class);
406                 String cookie = conf.authCookie();
407                 String auth = Cookies.getCookie(cookie);
408                 String domain = Window.Location.getHostName();
409                 String path = Window.Location.getPath();
410                 Cookies.setCookie(cookie, "", null, domain, path, false);
411                 if (auth == null) {
412                         authenticateUser();
413                         // Redundant, but silences warnings about possible auth NPE, below.
414                         return;
415                 }
416                 int sepIndex = auth.indexOf(conf.cookieSeparator());
417                 if (sepIndex == -1)
418                         authenticateUser();
419                 token = auth.substring(sepIndex + 1, auth.length());
420                 final String username = auth.substring(0, sepIndex);
421                 if (username == null)
422                         authenticateUser();
423
424                 refreshWebDAVPassword();
425
426                 DeferredCommand.addCommand(new Command() {
427
428                         public void execute() {
429                                 fetchUser(username);
430                         }
431                 });
432         }
433
434         /**
435          * Redirect the user to the login page for authentication.
436          */
437         protected void authenticateUser() {
438                 Configuration conf = (Configuration) GWT.create(Configuration.class);
439                 Window.Location.assign(conf.loginUrl() + "?next=" + GWT.getModuleBaseURL());
440         }
441
442         /**
443          * Redirect the user to the logout page.
444          */
445         void logout() {
446                 Configuration conf = (Configuration) GWT.create(Configuration.class);
447                 Window.Location.assign(conf.logoutUrl());
448         }
449
450         /**
451          * Creates an HTML fragment that places an image & caption together, for use
452          * in a group header.
453          *
454          * @param imageProto an image prototype for an image
455          * @param caption the group caption
456          * @return the header HTML fragment
457          */
458         private String createHeaderHTML(AbstractImagePrototype imageProto, String caption) {
459                 String captionHTML = "<table class='caption' cellpadding='0' " + "cellspacing='0'>" + "<tr><td class='lcaption'>" + imageProto.getHTML() + "</td><td class='rcaption'><b style='white-space:nowrap'>&nbsp;" + caption + "</b></td></tr></table>";
460                 return captionHTML;
461         }
462
463         private void onWindowResized(int height) {
464                 // Adjust the split panel to take up the available room in the window.
465                 int newHeight = height - splitPanel.getAbsoluteTop() - 44;
466                 if (newHeight < 1)
467                         newHeight = 1;
468                 splitPanel.setHeight("" + newHeight);
469         }
470
471         @Override
472         public void onResize(ResizeEvent event) {
473                 int height = event.getHeight();
474                 onWindowResized(height);
475         }
476
477         public boolean isFileListShowing() {
478                 int tab = inner.getTabBar().getSelectedTab();
479                 if (tab == 0)
480                         return true;
481                 return false;
482         }
483
484         public boolean isSearchResultsShowing() {
485                 int tab = inner.getTabBar().getSelectedTab();
486                 if (tab == 2)
487                         return true;
488                 return false;
489         }
490
491         /**
492          * Make the user list visible.
493          */
494         public void showUserList() {
495                 inner.selectTab(1);
496         }
497
498         /**
499          * Make the file list visible.
500          */
501         public void showFileList() {
502                 fileList.updateFileCache(false, true /*clear selection*/);
503                 inner.selectTab(0);
504         }
505
506         /**
507          * Make the file list visible.
508          *
509          * @param update
510          */
511         public void showFileList(boolean update) {
512                 TreeItem currentFolder = getFolders().getCurrent();
513                 if (currentFolder != null) {
514                         List<FileResource> files = null;
515                         Object cachedObject = currentFolder.getUserObject();
516                         if (cachedObject instanceof FolderResource) {
517                                 FolderResource folder = (FolderResource) cachedObject;
518                                 files = folder.getFiles();
519                         } else if (cachedObject instanceof TrashResource) {
520                                 TrashResource folder = (TrashResource) cachedObject;
521                                 files = folder.getFiles();
522                         }
523                         if (files != null)
524                                 getFileList().setFiles(files);
525                 }
526                 fileList.updateFileCache(update, true /*clear selection*/);
527                 inner.selectTab(0);
528         }
529
530         /**
531          * Make the search results visible.
532          *
533          * @param query the search query string
534          */
535         public void showSearchResults(String query) {
536                 searchResults.updateFileCache(query);
537                 searchResults.updateCurrentlyShowingStats();
538                 inner.selectTab(2);
539         }
540
541         /**
542          * Display the 'loading' indicator.
543          */
544         public void showLoadingIndicator() {
545                 topPanel.getLoading().setVisible(true);
546         }
547
548         /**
549          * Hide the 'loading' indicator.
550          */
551         public void hideLoadingIndicator() {
552                 topPanel.getLoading().setVisible(false);
553         }
554
555         /**
556          * A native JavaScript method to reach out to the browser's window and
557          * invoke its resizeTo() method.
558          *
559          * @param x the new width
560          * @param y the new height
561          */
562         public static native void resizeTo(int x, int y) /*-{
563                                                                                                                 $wnd.resizeTo(x,y);
564                                                                                                                 }-*/;
565
566         /**
567          * A helper method that returns true if the user's list is currently visible
568          * and false if it is hidden.
569          *
570          * @return true if the user list is visible
571          */
572         public boolean isUserListVisible() {
573                 return inner.getTabBar().getSelectedTab() == 1;
574         }
575
576         /**
577          * Display an error message.
578          *
579          * @param msg the message to display
580          */
581         public void displayError(String msg) {
582                 messagePanel.displayError(msg);
583         }
584
585         /**
586          * Display a warning message.
587          *
588          * @param msg the message to display
589          */
590         public void displayWarning(String msg) {
591                 messagePanel.displayWarning(msg);
592         }
593
594         /**
595          * Display an informational message.
596          *
597          * @param msg the message to display
598          */
599         public void displayInformation(String msg) {
600                 messagePanel.displayInformation(msg);
601         }
602
603         /**
604          * Retrieve the folders.
605          *
606          * @return the folders
607          */
608         public Folders getFolders() {
609                 return folders;
610         }
611
612         /**
613          * Retrieve the search.
614          *
615          * @return the search
616          */
617         Search getSearch() {
618                 return search;
619         }
620
621         /**
622          * Retrieve the currentSelection.
623          *
624          * @return the currentSelection
625          */
626         public Object getCurrentSelection() {
627                 return currentSelection;
628         }
629
630         /**
631          * Modify the currentSelection.
632          *
633          * @param newCurrentSelection the currentSelection to set
634          */
635         public void setCurrentSelection(Object newCurrentSelection) {
636                 currentSelection = newCurrentSelection;
637         }
638
639         /**
640          * Retrieve the groups.
641          *
642          * @return the groups
643          */
644         public Groups getGroups() {
645                 return groups;
646         }
647
648         /**
649          * Retrieve the fileList.
650          *
651          * @return the fileList
652          */
653         public FileList getFileList() {
654                 return fileList;
655         }
656
657         public SearchResults getSearchResults() {
658                 return searchResults;
659         }
660
661         /**
662          * Retrieve the topPanel.
663          *
664          * @return the topPanel
665          */
666         TopPanel getTopPanel() {
667                 return topPanel;
668         }
669
670         /**
671          * Retrieve the clipboard.
672          *
673          * @return the clipboard
674          */
675         public Clipboard getClipboard() {
676                 return clipboard;
677         }
678
679         public StatusPanel getStatusPanel() {
680                 return statusPanel;
681         }
682
683         /**
684          * Retrieve the userDetailsPanel.
685          *
686          * @return the userDetailsPanel
687          */
688         public UserDetailsPanel getUserDetailsPanel() {
689                 return userDetailsPanel;
690         }
691
692         /**
693          * Retrieve the dragController.
694          *
695          * @return the dragController
696          */
697         public PickupDragController getDragController() {
698                 return dragController;
699         }
700
701         public String getToken() {
702                 return token;
703         }
704
705         public String getWebDAVPassword() {
706                 return webDAVPassword;
707         }
708
709         public void removeGlassPanel() {
710                 glassPanel.removeFromParent();
711         }
712
713         /**
714          * Retrieve the currentUserResource.
715          *
716          * @return the currentUserResource
717          */
718         public UserResource getCurrentUserResource() {
719                 return currentUserResource;
720         }
721
722         /**
723          * Modify the currentUserResource.
724          *
725          * @param newUser the new currentUserResource
726          */
727         public void setCurrentUserResource(UserResource newUser) {
728                 currentUserResource = newUser;
729         }
730
731         public static native void preventIESelection() /*-{
732                                                                                                         $doc.body.onselectstart = function () { return false; };
733                                                                                                         }-*/;
734
735         public static native void enableIESelection() /*-{
736                                                                                                         if ($doc.body.onselectstart != null)
737                                                                                                         $doc.body.onselectstart = null;
738                                                                                                         }-*/;
739
740         /**
741          * @return the absolute path of the API root URL
742          */
743         public String getApiPath() {
744                 Configuration conf = (Configuration) GWT.create(Configuration.class);
745                 return GWT.getModuleBaseURL() + conf.apiPath();
746         }
747
748         public void refreshWebDAVPassword() {
749                 Configuration conf = (Configuration) GWT.create(Configuration.class);
750                 String domain = Window.Location.getHostName();
751                 String path = Window.Location.getPath();
752                 String cookie = conf.webdavCookie();
753                 webDAVPassword = Cookies.getCookie(cookie);
754                 Cookies.setCookie(cookie, "", null, domain, path, false);
755         }
756
757 }