-/*\r
- * Copyright 2007, 2008, 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.core.client.GWT;\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.Composite;\r
-import com.google.gwt.user.client.ui.HTML;\r
-import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
-import com.google.gwt.user.client.ui.HasVerticalAlignment;\r
-import com.google.gwt.user.client.ui.HorizontalPanel;\r
-import com.google.gwt.user.client.ui.ImageBundle;\r
-import com.google.gwt.user.client.ui.MenuBar;\r
-import com.google.gwt.user.client.ui.MenuItem;\r
-\r
-/**\r
- * The top panel, which contains the menu bar icons and the user name.\r
- */\r
-public class TopPanel extends Composite {\r
-\r
- /**\r
- * A constant that denotes the completion of an IncrementalCommand.\r
- */\r
- public static final boolean DONE = false;\r
-\r
- /**\r
- * An image bundle for this widgets images.\r
- */\r
- public interface Images extends ImageBundle, FileMenu.Images, EditMenu.Images,\r
- SettingsMenu.Images, GroupMenu.Images, FilePropertiesDialog.Images,\r
- HelpMenu.Images {\r
-\r
- @Resource("gr/ebs/gss/resources/exit.png")\r
- AbstractImagePrototype exit();\r
-\r
- @Resource("gr/ebs/gss/resources/folder_blue.png")\r
- AbstractImagePrototype folder();\r
-\r
- @Resource("gr/ebs/gss/resources/edit.png")\r
- AbstractImagePrototype edit();\r
-\r
- @Resource("gr/ebs/gss/resources/edit_group.png")\r
- AbstractImagePrototype group();\r
-\r
- @Resource("gr/ebs/gss/resources/configure.png")\r
- AbstractImagePrototype configure();\r
-\r
- @Resource("gr/ebs/gss/resources/help.png")\r
- AbstractImagePrototype help();\r
-\r
- @Resource("gr/ebs/gss/resources/pithos-logo.png")\r
- AbstractImagePrototype gssLogo();\r
-\r
- @Resource("gr/ebs/gss/resources/grnet-logo.png")\r
- AbstractImagePrototype grnetLogo();\r
- }\r
-\r
- /**\r
- * The menu bar widget.\r
- */\r
- private MenuBar menu;\r
-\r
- /**\r
- * The file menu widget.\r
- */\r
- private FileMenu fileMenu;\r
-\r
- /**\r
- * The edit menu widget.\r
- */\r
- private EditMenu editMenu;\r
-\r
- /**\r
- * The group menu widget.\r
- */\r
- private GroupMenu groupMenu;\r
-\r
- /**\r
- * The settings menu widget.\r
- */\r
- private SettingsMenu settingsMenu;\r
-\r
- /**\r
- * The help menu widget.\r
- */\r
- private HelpMenu helpMenu;\r
-\r
- /**\r
- * The constructor for the top panel.\r
- *\r
- * @param images the supplied images\r
- */\r
- public TopPanel(Images images) {\r
- fileMenu = new FileMenu(images);\r
- editMenu = new EditMenu(images);\r
- groupMenu = new GroupMenu(images);\r
- settingsMenu = new SettingsMenu(images);\r
- helpMenu = new HelpMenu(images);\r
- HorizontalPanel outer = new HorizontalPanel();\r
-\r
- outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);\r
-\r
- menu = new MenuBar();\r
- menu.setWidth("100%");\r
- menu.setAutoOpen(false);\r
- menu.setAnimationEnabled(true);\r
- menu.setStyleName("toolbarmenu");\r
-\r
- Command quitCommand = new Command(){\r
- public void execute() {\r
- QuitDialog dlg = new QuitDialog();\r
- dlg.center();\r
- }\r
- };\r
- MenuItem quitItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +\r
- images.exit().getHTML() + "</td><td>Quit</td></tr></table>", true, quitCommand);\r
- MenuItem fileItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +\r
- images.folder().getHTML() + "</td><td>File</td></tr></table>", true, new MenuBar(true)){\r
- @Override\r
- public MenuBar getSubMenu() {\r
- return fileMenu.createMenu();\r
- }\r
- };\r
- MenuItem editItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +\r
- images.edit().getHTML() + "</td><td>Edit</td></tr></table>", true, new MenuBar(true)){\r
- @Override\r
- public MenuBar getSubMenu() {\r
- return editMenu.createMenu();\r
- }\r
- };\r
- MenuItem groupItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +\r
- images.group().getHTML() + "</td><td>Group</td></tr></table>", true,\r
- groupMenu.getContextMenu());\r
- MenuItem configureItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +\r
- images.configure().getHTML() + "</td><td>Settings</td></tr></table>",\r
- true,settingsMenu.getContextMenu());\r
- MenuItem helpItem = new MenuItem("<table style='font-size: 100%'><tr><td>" +\r
- images.help().getHTML() + "</td><td>Help</td></tr></table>", true, new MenuBar(true)){\r
- @Override\r
- public MenuBar getSubMenu() {\r
- return helpMenu.createMenu();\r
- }\r
- };\r
- menu.addItem(quitItem);\r
- menu.addItem(fileItem);\r
- menu.addItem(editItem);\r
- menu.addItem(groupItem);\r
- menu.addItem(configureItem);\r
- menu.addItem(helpItem);\r
-\r
- outer.setSpacing(2);\r
- outer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);\r
- outer.setCellVerticalAlignment(menu, HasVerticalAlignment.ALIGN_MIDDLE);\r
- outer.add(menu);\r
- outer.setStyleName("toolbar");\r
-\r
- Configuration conf = (Configuration) GWT.create(Configuration.class);\r
- HTML logos = new HTML("<table><tr><td><a href='" + conf.serviceHome() +\r
- "' target='gss'>" + images.gssLogo().getHTML() +\r
- "</a><a href='http://www.grnet.gr/' " + "target='grnet'>" +\r
- images.grnetLogo().getHTML()+"</a></td></tr></table>");\r
- outer.add(logos);\r
-\r
- outer.setCellHorizontalAlignment(logos, HasHorizontalAlignment.ALIGN_RIGHT);\r
-\r
- initWidget(outer);\r
- }\r
-\r
- /**\r
- * Retrieve the fileMenu.\r
- *\r
- * @return the fileMenu\r
- */\r
- FileMenu getFileMenu() {\r
- return fileMenu;\r
- }\r
-\r
- /**\r
- * Retrieve the editMenu.\r
- *\r
- * @return the editMenu\r
- */\r
- EditMenu getEditMenu() {\r
- return editMenu;\r
- }\r
-}\r
+/*
+ * Copyright 2007, 2008, 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.core.client.GWT;
+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.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.MenuBar;
+import com.google.gwt.user.client.ui.MenuItem;
+
+/**
+ * The top panel, which contains the menu bar icons and the user name.
+ */
+public class TopPanel extends Composite {
+
+ /**
+ * A constant that denotes the completion of an IncrementalCommand.
+ */
+ public static final boolean DONE = false;
+
+ /**
+ * An image bundle for this widgets images.
+ */
+ public interface Images extends ClientBundle, FileMenu.Images, EditMenu.Images,
+ SettingsMenu.Images, GroupMenu.Images, FilePropertiesDialog.Images,
+ HelpMenu.Images, LoadingIndicator.Images {
+
+ @Source("gr/ebs/gss/resources/exit.png")
+ ImageResource exit();
+
+ @Source("gr/ebs/gss/resources/folder_blue.png")
+ ImageResource folder();
+
+ @Source("gr/ebs/gss/resources/edit.png")
+ ImageResource edit();
+
+ @Source("gr/ebs/gss/resources/edit_group.png")
+ ImageResource group();
+
+ @Source("gr/ebs/gss/resources/configure.png")
+ ImageResource configure();
+
+ @Source("gr/ebs/gss/resources/help.png")
+ ImageResource help();
+
+ @Source("gr/ebs/gss/resources/pithos-logo.png")
+ ImageResource gssLogo();
+
+ @Source("gr/ebs/gss/resources/grnet-logo.png")
+ ImageResource grnetLogo();
+ }
+
+ /**
+ * The menu bar widget.
+ */
+ private MenuBar menu;
+
+ /**
+ * The file menu widget.
+ */
+ private FileMenu fileMenu;
+
+ /**
+ * The edit menu widget.
+ */
+ 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.
+ */
+ private LoadingIndicator loading;
+
+ /**
+ * The constructor for the top panel.
+ *
+ * @param images the supplied images
+ */
+ public TopPanel(Images images) {
+ fileMenu = new FileMenu(images);
+ editMenu = new EditMenu(images);
+ groupMenu = new GroupMenu(images);
+ settingsMenu = new SettingsMenu(images);
+ helpMenu = new HelpMenu(images);
+ loading = new LoadingIndicator(images);
+ HorizontalPanel outer = new HorizontalPanel();
+
+ outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+
+ menu = new MenuBar();
+ menu.setWidth("100%");
+ menu.setAutoOpen(false);
+ menu.setAnimationEnabled(true);
+ menu.setStyleName("toolbarmenu");
+
+ Command quitCommand = new Command(){
+ @Override
+ public void execute() {
+ QuitDialog dlg = new QuitDialog();
+ dlg.center();
+ }
+ };
+ 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();
+ }
+ };
+ 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
+ public MenuBar getSubMenu() {
+ 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);
+ outer.setCellVerticalAlignment(menu, HasVerticalAlignment.ALIGN_MIDDLE);
+ outer.add(menu);
+ outer.setStyleName("toolbar");
+
+ outer.add(loading);
+
+ Configuration conf = (Configuration) GWT.create(Configuration.class);
+ HTML logos = new HTML("<table><tr><td><a href='" + conf.serviceHome() +
+ "' target='gss'>" + AbstractImagePrototype.create(images.gssLogo()).getHTML() +
+ "</a><a href='http://www.grnet.gr/' " + "target='grnet'>" +
+ AbstractImagePrototype.create(images.grnetLogo()).getHTML()+"</a></td></tr></table>");
+ outer.add(logos);
+
+ outer.setCellHorizontalAlignment(logos, HasHorizontalAlignment.ALIGN_RIGHT);
+
+ initWidget(outer);
+ }
+
+
+ /**
+ * Retrieve the loading.
+ *
+ * @return the loading
+ */
+ 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;
+ }
+}