Show only relevant toolbar buttons according to the selection in all trees
authorChristos Stathis <chstath@ebs.gr>
Mon, 30 Jan 2012 09:20:00 +0000 (11:20 +0200)
committerChristos Stathis <chstath@ebs.gr>
Mon, 30 Jan 2012 09:20:00 +0000 (11:20 +0200)
src/gr/grnet/pithos/web/client/Pithos.java
src/gr/grnet/pithos/web/client/grouptree/GroupTreeViewModel.java
src/gr/grnet/pithos/web/client/mysharedtree/MysharedTreeViewModel.java
src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.java

index c469226..dc1d52b 100644 (file)
@@ -266,6 +266,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
     
     private HTML numOfFiles;
     
+    private Toolbar toolbar;
+    
        @Override
        public void onModuleLoad() {
                if (parseUserCredentials())
@@ -310,7 +312,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
         header.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);
         header.setCellVerticalAlignment(messagePanel, HasVerticalAlignment.ALIGN_MIDDLE);
 
-        final Toolbar toolbar = new Toolbar(this);
+        toolbar = new Toolbar(this);
         header.add(toolbar);
         header.setCellHorizontalAlignment(toolbar, HasHorizontalAlignment.ALIGN_CENTER);
         header.setCellVerticalAlignment(toolbar, HasVerticalAlignment.ALIGN_MIDDLE);
@@ -349,7 +351,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
                                }
                        });
                 }
-                toolbar.showRelevantButtons();
+                showRelevantToolbarButtons();
             }
         });
         selectionModels.add(folderTreeSelectionModel);
@@ -1138,6 +1140,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
                            upload.setEnabled(false);
                            updateSharedFolder(mysharedTreeSelectionModel.getSelectedObject(), true);
                        }
+                       showRelevantToolbarButtons();
                    }
                });
                selectionModels.add(mysharedTreeSelectionModel);
@@ -1165,6 +1168,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
                            applyPermissions(otherSharedTreeSelectionModel.getSelectedObject());
                            updateOtherSharedFolder(otherSharedTreeSelectionModel.getSelectedObject(), true);
                        }
+                       showRelevantToolbarButtons();
                    }
                });
                selectionModels.add(otherSharedTreeSelectionModel);
@@ -1199,4 +1203,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
        public void setError(Throwable t) {
                error = t;
        }
+       
+       public void showRelevantToolbarButtons() {
+               toolbar.showRelevantButtons();
+       }
 }
index 8c45bb4..d354632 100644 (file)
@@ -142,6 +142,7 @@ public class GroupTreeViewModel implements TreeViewModel {
                                        app.deselectOthers(app.getGroupTreeView(), rootSelectionModel);
                                        app.showFiles(new HashSet<File>());
                                }
+                               app.showRelevantToolbarButtons();
                        }
                });
 
@@ -155,6 +156,7 @@ public class GroupTreeViewModel implements TreeViewModel {
                                        app.deselectOthers(app.getGroupTreeView(), groupSelectionModel);
                                        app.showFiles(new HashSet<File>());
                                }
+                               app.showRelevantToolbarButtons();
                        }
                });
 
@@ -168,6 +170,7 @@ public class GroupTreeViewModel implements TreeViewModel {
                                        app.deselectOthers(app.getGroupTreeView(), userSelectionModel);
                                        app.showFiles(new HashSet<File>());
                                }
+                               app.showRelevantToolbarButtons();
                        }
                });
 }
index 8e8c6ac..e453e95 100644 (file)
@@ -122,6 +122,7 @@ public class MysharedTreeViewModel implements TreeViewModel {
                        app.applyPermissions(null);
                        fetchSharedFiles(true);
                     }
+                    app.showRelevantToolbarButtons();
                 }
             });
             app.addSelectionModel(selectionModel2);
index 77a568f..6ebd7c9 100644 (file)
@@ -125,6 +125,7 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
                        app.applyPermissions(null);
                        app.showFiles(new HashSet<File>());
                     }
+                    app.showRelevantToolbarButtons();
                 }
             });
             app.addSelectionModel(selectionModel2);
@@ -161,6 +162,7 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
                                        }
                                fetchSharedFiles(username, userDataProviderMap.get(username));
                            }
+                           app.showRelevantToolbarButtons();
                        }
                    });
                    app.addSelectionModel(selectionModel3);