changeset 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 e4155a6833a9
children 44c63e7fd0d0
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages_en.properties flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java
diffstat 6 files changed, 127 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Mar 08 15:15:59 2011 +0000
+++ b/flys-client/ChangeLog	Tue Mar 08 16:20:34 2011 +0000
@@ -1,3 +1,17 @@
+2011-03-08  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSMessages_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSMessages_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSMessages.java: Added
+	  i18n strings used in the menu panel.
+
+	* src/main/java/de/intevation/flys/client/client/FLYS.java: Added a method
+	  to retrieve the project list.
+
+	* src/main/java/de/intevation/flys/client/client/ui/MainMenu.java: Added
+	  further buttons (labels with ClickHandler) to switch the language,
+	  logout the current user or open an info panel.
+
 2011-03-08  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/images/flys_logo.gif,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Tue Mar 08 15:15:59 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Tue Mar 08 16:20:34 2011 +0000
@@ -128,6 +128,14 @@
 
 
     /**
+     * Returns the project list.
+     */
+    public ProjectList getProjectList() {
+        return projectList;
+    }
+
+
+    /**
      * This method creates a new CollectionView and adds it to the workspace.
      */
     public void newProject() {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages.java	Tue Mar 08 15:15:59 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages.java	Tue Mar 08 16:20:34 2011 +0000
@@ -23,6 +23,18 @@
     @DefaultMessage("Projects")
     String projects();
 
+    @DefaultMessage("Manage Projects")
+    String manage_projects();
+
+    @DefaultMessage("Logout")
+    String logout();
+
+    @DefaultMessage("German")
+    String switch_language();
+
+    @DefaultMessage("Info")
+    String info();
+
     @DefaultMessage("No existing projects found.")
     String no_projects();
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages_de.properties	Tue Mar 08 15:15:59 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages_de.properties	Tue Mar 08 16:20:34 2011 +0000
@@ -2,7 +2,11 @@
 fullname = Flusshydrologische Software
 user = Benutzer: ''{0}''
 guest = Gast
+logout = Abmelden
 projects = Berechnungen
+manage_projects = Projekte verwalten
+switch_language = Englisch
+info = Info
 no_projects = Keine alten Berechnungen gefunden.
 load_projects = Lade Berechnungen...
 date_format = dd.MM.yyyy
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages_en.properties	Tue Mar 08 15:15:59 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSMessages_en.properties	Tue Mar 08 16:20:34 2011 +0000
@@ -2,7 +2,11 @@
 fullname = Flusshydrologische Software
 user = User: ''{0}''
 guest = guest
+logout = Logout
 projects = Calculations
+manage_projects = Manage Projects
+switch_language = German
+info = Info
 no_projects = No existing calculations found.
 load_projects = Load calculations...
 date_format = yyyy-MM-dd
--- 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