changeset 4559:7f86ab48284c

Add a small close and add project button to the project list header
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 16 Nov 2012 14:26:01 +0100
parents 9d7497f5be05
children 661102336f16
files flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java
diffstat 1 files changed, 43 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Fri Nov 16 14:25:05 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Fri Nov 16 14:26:01 2012 +0100
@@ -1,9 +1,11 @@
 package de.intevation.flys.client.client.ui;
 
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
 
 import com.smartgwt.client.types.Alignment;
 import com.smartgwt.client.types.Autofit;
@@ -33,6 +35,7 @@
 import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickHandler;
 import com.smartgwt.client.widgets.grid.events.RowContextClickEvent;
 import com.smartgwt.client.widgets.grid.events.RowContextClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 import com.smartgwt.client.widgets.menu.Menu;
 import com.smartgwt.client.widgets.menu.MenuItem;
@@ -373,13 +376,31 @@
         title.setHeight("20");
         title.setMargin(5);
         title.setWidth100();
-        title.setStyleName("fontLightSmall");
+        title.setStyleName("projectHeader");
 
-        Canvas titleWrapper = new Canvas();
-        titleWrapper.setStyleName("bgBlueDark");
+        HLayout buttonWrapper = new HLayout();
+
+        Button addButton = new Button("+");
+        addButton.setStyleName("projectsAddButton");
+        addButton.setTitle(messages.new_project());
+        addButton.setWidth("30px");
+
+        Button closeButton = new Button("X");
+        closeButton.setStyleName("projectsCloseButton");
+        closeButton.setTitle(messages.projectlist_close());
+        closeButton.setWidth("30px");
+
+        buttonWrapper.addMember(addButton);
+        buttonWrapper.addMember(closeButton);
+        buttonWrapper.setAlign(Alignment.RIGHT);
+        buttonWrapper.setAutoWidth();
+
+        HLayout titleWrapper = new HLayout();
+        titleWrapper.setStyleName("bgBlueMid");
         titleWrapper.setWidth100();
         titleWrapper.setHeight("20px");
-        titleWrapper.addChild(title);
+        titleWrapper.addMember(title);
+        titleWrapper.addMember(buttonWrapper);
 
         Canvas gridWrapper = new Canvas();
         gridWrapper.setPadding(0);
@@ -394,6 +415,24 @@
         addMember(titleWrapper);
         addMember(gridWrapper);
         addMember(filter);
+
+        addButton.addClickHandler(
+                new com.google.gwt.event.dom.client.ClickHandler() {
+
+                    @Override
+                    public void onClick(ClickEvent ev) {
+                        flys.newProject();
+                    }
+                });
+
+        closeButton.addClickHandler(
+                new com.google.gwt.event.dom.client.ClickHandler() {
+
+            @Override
+            public void onClick(ClickEvent ev) {
+                hide();
+            }
+        });
     }
 
 

http://dive4elements.wald.intevation.org