# HG changeset patch # User Björn Ricks # Date 1353072361 -3600 # Node ID 7f86ab48284c4db9be88a50cd4b523f66de9dfad # Parent 9d7497f5be0566e68eb735edd03015b5441b10d7 Add a small close and add project button to the project list header diff -r 9d7497f5be05 -r 7f86ab48284c flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java --- 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(); + } + }); }