diff flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java @ 28:dfdb927b137d

Improved the main menu - added further buttons (clickable labels). flys-client/trunk@1428 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 08 Mar 2011 16:20:34 +0000
parents 2da6be38d8b6
children a361ce81abcf
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java	Tue Mar 08 15:15:59 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java	Tue Mar 08 16:20:34 2011 +0000
@@ -2,8 +2,7 @@
 
 import com.google.gwt.core.client.GWT;
 
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.types.Alignment;
 import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.events.ClickEvent;
 import com.smartgwt.client.widgets.events.ClickHandler;
@@ -31,11 +30,20 @@
     /** The label that displays the current logged in user. */
     protected Label userText;
 
-    /** The label that displays the title of the application. */
-    protected Label titleText;
+    /** The button to log the current user out.*/
+    protected Label logout;
 
     /** The button to add new projects.*/
-    protected Button newCollection;
+    protected Label newProject;
+
+    /** The button to open the project list.*/
+    protected Label projectList;
+
+    /** The button to switch between the english and german version.*/
+    protected Label language;
+
+    /** The button to open an info panel.*/
+    protected Label info;
 
     /**
      * The default constructor for creating a new MainMenu.
@@ -43,17 +51,48 @@
     public MainMenu(FLYS flys) {
         this.flys     = flys;
 
-        userText      = new Label(messages.user(messages.guest()));
-        titleText     = new Label(messages.title());
-        newCollection = new Button(messages.new_project());
+        userText    = new Label(messages.user(messages.guest()));
+        newProject  = new Label(messages.new_project());
+        projectList = new Label(messages.manage_projects());
+        logout      = new Label(messages.logout());
+        language    = new Label(messages.switch_language());
+        info        = new Label(messages.info());
 
-        newCollection.addClickHandler(new ClickHandler() {
+        newProject.addClickHandler(new ClickHandler() {
             public void onClick(ClickEvent event) {
                 GWT.log("Clicked 'New Project' button.");
                 createNewProject();
             }
         });
 
+        projectList.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                GWT.log("Clicked 'Open ProjectList' button.");
+                getFlys().getProjectList().show();
+            }
+        });
+
+        logout.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                GWT.log("Clicked 'logout' button.");
+                GWT.log("IMPLEMENT the 'logout' function.");
+            }
+        });
+
+        language.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                GWT.log("Clicked 'language' button.");
+                GWT.log("IMPLEMENT the 'switch language' function.");
+            }
+        });
+
+        info.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                GWT.log("Clicked 'info' button.");
+                GWT.log("IMPLEMENT the 'open info panel' function.");
+            }
+        });
+
         init();
     }
 
@@ -65,22 +104,48 @@
      */
     protected void init() {
         setWidth100();
-        setHeight("40px");
+        setHeight("35px");
         setBorder("1px solid #808080");
         setBackgroundColor("#C3D9FF");
-        setLayoutMargin(10);
-
-        titleText.setWidth("7%");
+        setLayoutMargin(5);
 
-        Canvas buttonWrapper = new Canvas();
-        buttonWrapper.setWidth("*");
-        buttonWrapper.addChild(newCollection);
+        HLayout leftPanel = new HLayout();
+        leftPanel.setWidth("80%");
+        leftPanel.setMembersMargin(5);
+        leftPanel.addMember(newProject);
+        leftPanel.addMember(projectList);
 
-        userText.setWidth("20%");
+        userText.setAlign(Alignment.RIGHT);
+        logout.setAlign(Alignment.RIGHT);
+        info.setAlign(Alignment.RIGHT);
+        language.setAlign(Alignment.RIGHT);
 
-        addMember(titleText);
-        addMember(buttonWrapper);
-        addMember(userText);
+        userText.setWidth(200);
+        logout.setWidth(70);
+        info.setWidth(40);
+        language.setWidth(70);
+
+        HLayout rightPanel = new HLayout();
+        rightPanel.setAlign(Alignment.RIGHT);
+        rightPanel.setMembersMargin(3);
+        rightPanel.setLayoutRightMargin(5);
+        rightPanel.addMember(userText);
+        rightPanel.addMember(logout);
+        rightPanel.addMember(language);
+        rightPanel.addMember(info);
+
+        addMember(leftPanel);
+        addMember(rightPanel);
+    }
+
+
+    /**
+     * Returns the FLYS instance stored in this class.
+     *
+     * @return the flys instance.
+     */
+    protected FLYS getFlys() {
+        return flys;
     }
 
 

http://dive4elements.wald.intevation.org