Cleaned up top File menu
[pithos-web-client] / src / gr / grnet / pithos / web / client / TopPanel.java
index fea03dc..33a757a 100644 (file)
@@ -1,5 +1,36 @@
 /*
- * Copyright (c) 2011 Greek Research and Technology Network
+ * Copyright 2011 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
  */
 package gr.grnet.pithos.web.client;
 
@@ -31,7 +62,7 @@ public class TopPanel extends Composite {
         * An image bundle for this widgets images.
         */
        public interface Images extends ClientBundle, FileMenu.Images, EditMenu.Images,
-                       SettingsMenu.Images, GroupMenu.Images, FilePropertiesDialog.Images,
+                       SettingsMenu.Images, FilePropertiesDialog.Images,
                        HelpMenu.Images, LoadingIndicator.Images {
 
                @Source("gr/grnet/pithos/resources/exit.png")
@@ -75,21 +106,6 @@ public class TopPanel extends Composite {
        private EditMenu editMenu;
 
        /**
-        * The group menu widget.
-        */
-       private GroupMenu groupMenu;
-
-       /**
-        * The settings menu widget.
-        */
-       private SettingsMenu settingsMenu;
-
-       /**
-        * The help menu widget.
-        */
-       private HelpMenu helpMenu;
-
-       /**
         * A widget that displays a message indicating that communication with the
         * server is underway.
         */
@@ -100,13 +116,10 @@ public class TopPanel extends Composite {
         *
         * @param images the supplied images
         */
-       public TopPanel(Images images) {
-               fileMenu = new FileMenu(images);
+       public TopPanel(final Images images) {
                editMenu = new EditMenu(images);
-               groupMenu = new GroupMenu(images);
-               settingsMenu = new SettingsMenu(images);
-               helpMenu = new HelpMenu(images);
                loading = new LoadingIndicator(images);
+        loading.hide();
                HorizontalPanel outer = new HorizontalPanel();
 
                outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
@@ -126,17 +139,15 @@ public class TopPanel extends Composite {
                };
                MenuItem quitItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +
                                        AbstractImagePrototype.create(images.exit()).getHTML() + "</td><td>Quit</td></tr></table>", true, quitCommand);
-               quitItem.getElement().setId("topMenu.quit");
-               
+
                MenuItem fileItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +
                                        AbstractImagePrototype.create(images.folder()).getHTML() + "</td><td>File</td></tr></table>", true, new MenuBar(true)){
                        @Override
                        public MenuBar getSubMenu() {
-                               return fileMenu.createMenu();
+                               return new FileMenu(GSS.get(), images);
                        }
                };
-               fileItem.getElement().setId("topMenu.file");
-               
+
                MenuItem editItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +
                                        AbstractImagePrototype.create(images.edit()).getHTML() + "</td><td>Edit</td></tr></table>", true, new MenuBar(true)){
                        @Override
@@ -144,33 +155,10 @@ public class TopPanel extends Composite {
                                return editMenu.createMenu();
                        }
                };
-               editItem.getElement().setId("topMenu.edit");
-               
-               MenuItem groupItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +
-                                       AbstractImagePrototype.create(images.group()).getHTML() + "</td><td>Group</td></tr></table>", true,
-                                       groupMenu.getContextMenu());
-               groupItem.getElement().setId("topMenu.group");
-               
-               MenuItem configureItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +
-                                       AbstractImagePrototype.create(images.configure()).getHTML() + "</td><td>Settings</td></tr></table>",
-                                       true,settingsMenu.getContextMenu());
-               configureItem.getElement().setId("topMenu.settings");
-               
-               MenuItem helpItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +
-                                       AbstractImagePrototype.create(images.help()).getHTML() + "</td><td>Help</td></tr></table>", true, new MenuBar(true)){
-                       @Override
-                       public MenuBar getSubMenu() {
-                               return helpMenu.createMenu();
-                       }
-               };
-               helpItem.getElement().setId("topMenu.help");
-               
+
                menu.addItem(quitItem);
                menu.addItem(fileItem);
                menu.addItem(editItem);
-               menu.addItem(groupItem);
-               menu.addItem(configureItem);
-               menu.addItem(helpItem);
 
                outer.setSpacing(2);
                outer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
@@ -199,22 +187,4 @@ public class TopPanel extends Composite {
        public LoadingIndicator getLoading() {
                return loading;
        }
-
-       /**
-        * Retrieve the fileMenu.
-        *
-        * @return the fileMenu
-        */
-       FileMenu getFileMenu() {
-               return fileMenu;
-       }
-
-       /**
-        * Retrieve the editMenu.
-        *
-        * @return the editMenu
-        */
-       EditMenu getEditMenu() {
-               return editMenu;
-       }
 }