Since WebDriver instance is common for both FileUtils and FolderUtils a new class...
[pithos] / src / gr / ebs / gss / client / HelpMenu.java
index 79b7649..c499f08 100644 (file)
-/*\r
- * Copyright 2009 Electronic Business Systems Ltd.\r
- *\r
- * This file is part of GSS.\r
- *\r
- * GSS is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * GSS is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with GSS.  If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package gr.ebs.gss.client;\r
-\r
-import com.google.gwt.event.dom.client.ClickEvent;\r
-import com.google.gwt.event.dom.client.ClickHandler;\r
-import com.google.gwt.resources.client.ClientBundle;\r
-import com.google.gwt.resources.client.ImageResource;\r
-import com.google.gwt.user.client.Command;\r
-import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
-import com.google.gwt.user.client.ui.MenuBar;\r
-import com.google.gwt.user.client.ui.PopupPanel;\r
-\r
-/**\r
- * The 'Help' menu implementation.\r
- */\r
-public class HelpMenu extends PopupPanel implements ClickHandler {\r
-\r
-       /**\r
-        * The widget's images.\r
-        */\r
-       private final Images images;\r
-\r
-       private MenuBar contextMenu  = new MenuBar(true);\r
-\r
-       /**\r
-        * An image bundle for this widget's images.\r
-        */\r
-       public interface Images extends ClientBundle{\r
-               @Source("gr/ebs/gss/resources/khelpcenter.png")\r
-               ImageResource userGuide();\r
-\r
-               @Source("gr/ebs/gss/resources/linewidth.png")\r
-               ImageResource terms();\r
-\r
-               @Source("gr/ebs/gss/resources/bell.png")\r
-               ImageResource reportAbuse();\r
-\r
-               @Source("gr/ebs/gss/resources/info.png")\r
-               ImageResource about();\r
-\r
-               @Source("gr/ebs/gss/resources/edit_add.png")\r
-               ImageResource upgradeQuota();\r
-       }\r
-\r
-       /**\r
-        * The widget's constructor.\r
-        *\r
-        * @param newImages the image bundle passed on by the parent object\r
-        */\r
-       public HelpMenu(final Images newImages) {\r
-               // The popup's constructor's argument is a boolean specifying that it\r
-               // auto-close itself when the user clicks outside of it.\r
-               super(true);\r
-               setAnimationEnabled(true);\r
-               images = newImages;\r
-               createMenu();\r
-               add(contextMenu);\r
-       }\r
-\r
-       public void onClick(ClickEvent event) {\r
-               HelpMenu menu = new HelpMenu(images);\r
-               int left = event.getRelativeElement().getAbsoluteLeft();\r
-               int top = event.getRelativeElement().getAbsoluteTop() + event.getRelativeElement().getOffsetHeight();\r
-               menu.setPopupPosition(left, top);\r
-               menu.show();\r
-       }\r
-\r
-       public MenuBar createMenu() {\r
-               contextMenu.clearItems();\r
-               contextMenu.setAutoOpen(false);\r
-               Command hideCommand = new Command() {\r
-                       public void execute() {\r
-                               hide();\r
-                       }\r
-               };\r
-               Command aboutCommand = new Command(){\r
-                       public void execute() {\r
-                               AboutDialog dlg = new AboutDialog();\r
-                               dlg.center();\r
-                       }\r
-               };\r
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.userGuide()).getHTML() + "&nbsp;<a class='hidden-link' " +\r
-                                       "href='/userguide/el' target='_blank'>User Guide</a></span>", true, hideCommand);\r
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.terms()).getHTML() + "&nbsp;<a class='hidden-link' " +\r
-                                       "href='/terms' target='_blank'>Terms &amp; Conditions</a></span>", true, hideCommand);\r
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.reportAbuse()).getHTML() + "&nbsp;<a class='hidden-link' " +\r
-                               "href='/report-abuse' target='_blank'>Report abuse</a></span>", true, hideCommand);\r
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.upgradeQuota()).getHTML() + "&nbsp;<a class='hidden-link' " +\r
-                                       "href='/pithos/coupon' target='_blank'>Upgrade quota</a></span>", true, hideCommand);\r
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.about()).getHTML() + "&nbsp;About</span>", true, aboutCommand);\r
-               return contextMenu;\r
-       }\r
-\r
-}\r
+/*
+ * Copyright 2009 Electronic Business Systems Ltd.
+ *
+ * This file is part of GSS.
+ *
+ * GSS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package gr.ebs.gss.client;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
+import com.google.gwt.user.client.ui.MenuBar;
+import com.google.gwt.user.client.ui.MenuItem;
+import com.google.gwt.user.client.ui.PopupPanel;
+
+/**
+ * The 'Help' menu implementation.
+ */
+public class HelpMenu extends PopupPanel implements ClickHandler {
+
+       /**
+        * The widget's images.
+        */
+       private final Images images;
+
+       private MenuBar contextMenu  = new MenuBar(true);
+
+       /**
+        * An image bundle for this widget's images.
+        */
+       public interface Images extends ClientBundle{
+               @Source("gr/ebs/gss/resources/khelpcenter.png")
+               ImageResource userGuide();
+
+               @Source("gr/ebs/gss/resources/linewidth.png")
+               ImageResource terms();
+
+               @Source("gr/ebs/gss/resources/bell.png")
+               ImageResource reportAbuse();
+
+               @Source("gr/ebs/gss/resources/bug.png")
+               ImageResource reportBug();
+
+               @Source("gr/ebs/gss/resources/info.png")
+               ImageResource about();
+
+               @Source("gr/ebs/gss/resources/edit_add.png")
+               ImageResource upgradeQuota();
+       }
+
+       /**
+        * The widget's constructor.
+        *
+        * @param newImages the image bundle passed on by the parent object
+        */
+       public HelpMenu(final Images newImages) {
+               // The popup's constructor's argument is a boolean specifying that it
+               // auto-close itself when the user clicks outside of it.
+               super(true);
+               setAnimationEnabled(true);
+               images = newImages;
+               createMenu();
+               add(contextMenu);
+       }
+
+       @Override
+       public void onClick(ClickEvent event) {
+               HelpMenu menu = new HelpMenu(images);
+               int left = event.getRelativeElement().getAbsoluteLeft();
+               int top = event.getRelativeElement().getAbsoluteTop() + event.getRelativeElement().getOffsetHeight();
+               menu.setPopupPosition(left, top);
+               menu.show();
+       }
+
+       public MenuBar createMenu() {
+               contextMenu.clearItems();
+               contextMenu.setAutoOpen(false);
+               Command hideCommand = new Command() {
+                       @Override
+                       public void execute() {
+                               hide();
+                       }
+               };
+               Command aboutCommand = new Command(){
+                       @Override
+                       public void execute() {
+                               AboutDialog dlg = new AboutDialog();
+                               dlg.center();
+                       }
+               };
+               MenuItem userGuideItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.userGuide()).getHTML() + "&nbsp;<a class='hidden-link' " +
+                                       "href='/userguide/el' target='_blank'>User Guide</a></span>", true, hideCommand);
+               contextMenu.addItem(userGuideItem);
+               userGuideItem.getElement().setId("topMenu.help.userGuide");
+               
+               MenuItem termsItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.terms()).getHTML() + "&nbsp;<a class='hidden-link' " +
+                                       "href='/terms' target='_blank'>Terms &amp; Conditions</a></span>", true, hideCommand);
+               termsItem.getElement().setId("topMenu.help.terms");
+               contextMenu.addItem(termsItem);
+               
+               MenuItem reportAbuseItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.reportAbuse()).getHTML() + "&nbsp;<a class='hidden-link' " +
+                                       "href='/report-abuse' target='_blank'>Report abuse</a></span>", true, hideCommand);
+               reportAbuseItem.getElement().setId("topMenu.help.reportAbuse");
+               contextMenu.addItem(reportAbuseItem);
+               
+               MenuItem upgradeQuotaItem= new MenuItem("<span>" + AbstractImagePrototype.create(images.upgradeQuota()).getHTML() + "&nbsp;<a class='hidden-link' " +
+                                       "href='/pithos/coupon' target='_blank'>Upgrade quota</a></span>", true, hideCommand);
+               upgradeQuotaItem.getElement().setId("topMenu.help.upgradeQuota");
+               contextMenu.addItem(upgradeQuotaItem);
+               
+               MenuItem reportBugItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.reportBug()).getHTML() + "&nbsp;<a class='hidden-link' " +
+                                       "href='http://code.google.com/p/gss/issues/list' target='_blank'>Report bug</a></span>", true, hideCommand);
+               reportBugItem.getElement().setId("topMenu.help.reportBug");
+               contextMenu.addItem(reportBugItem);
+                               
+               MenuItem aboutItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.about()).getHTML() + "&nbsp;About</span>", true, aboutCommand);
+               aboutItem.getElement().setId("topMenu.help.about");
+               contextMenu.addItem(aboutItem);
+               return contextMenu;
+       }
+
+}