Mercurial > dive4elements > river
changeset 4607:c0a275c581fb
Add a welcome screen to the workspace background
If the workspace background is visible a welcome message is shown and the user
is able to create a new project via a button.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 30 Nov 2012 10:18:32 +0100 |
parents | 6e68e83149f6 |
children | 7a9aa2e52a3a |
files | flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java |
diffstat | 2 files changed, 78 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Fri Nov 30 10:16:36 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Fri Nov 30 10:18:32 2012 +0100 @@ -158,7 +158,7 @@ header.setCurrentUser(user); projectList = new ProjectList(FLYS.this, user); - workspace = new FLYSWorkspace(); + workspace = new FLYSWorkspace(FLYS.this); view.setProjectList(projectList); view.setFLYSWorkspace(workspace);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Fri Nov 30 10:16:36 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Fri Nov 30 10:18:32 2012 +0100 @@ -2,7 +2,20 @@ import com.google.gwt.core.client.GWT; +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.types.VerticalAlignment; +import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Img; +import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.events.ClickEvent; +import com.smartgwt.client.widgets.events.ClickHandler; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.LayoutSpacer; +import com.smartgwt.client.widgets.layout.VLayout; + +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.client.FLYSConstants; import java.util.HashMap; import java.util.Map; @@ -25,16 +38,23 @@ /** A map that contains the open CollectionViews. */ protected Map<String, CollectionView> views; + /** The interface that provides the message resources. */ + private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); + + private FLYS flys; /** * The default constructor creates an empty FLYSWorkspace with no * CollectionViews opened. */ - public FLYSWorkspace() { + public FLYSWorkspace(FLYS flys) { + this.flys = flys; views = new HashMap<String, CollectionView>(); setWidth("100%"); setHeight("100%"); + + addBackgroundWorkspace(); } @@ -99,5 +119,61 @@ } return false; } + + private void addBackgroundWorkspace() { + String baseUrl = GWT.getHostPageBaseURL(); + Img bfg = new Img( + baseUrl + MESSAGES.bfgLogo()); + bfg.setWidth(150); + bfg.setHeight(100); + bfg.setLayoutAlign(Alignment.RIGHT); + + HLayout backgroundlayout = new HLayout(); + backgroundlayout.setHeight100(); + backgroundlayout.setWidth100(); + backgroundlayout.setDefaultLayoutAlign(Alignment.CENTER); + backgroundlayout.setDefaultLayoutAlign(VerticalAlignment.CENTER); + + Canvas spacer = new Canvas(); + spacer.setWidth("33%"); + + VLayout infobox = new VLayout(); + infobox.setHeight("*"); + infobox.setWidth("*"); + infobox.setDefaultLayoutAlign(Alignment.CENTER); + + Label welcome = new Label(MESSAGES.welcome()); + welcome.setAlign(Alignment.CENTER); + welcome.setStyleName("fontNormalBig"); + + Label lcreate = new Label(MESSAGES.welcome_open_or_create()); + lcreate.setStyleName("welcomeCreateText"); + lcreate.setWidth100(); + lcreate.setAlign(Alignment.CENTER); + + Button addbutton = new Button(MESSAGES.new_project()); + addbutton.setStyleName("projectsAddButton"); + addbutton.setAlign(Alignment.CENTER); + addbutton.setTitle(MESSAGES.new_project()); + addbutton.setAutoFit(true); + addbutton.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + flys.newProject(); + } + }); + + + infobox.addMember(welcome); + infobox.addMember(lcreate); + infobox.addMember(addbutton); + + backgroundlayout.addMember(spacer); + backgroundlayout.addMember(infobox); + backgroundlayout.addMember(spacer); + + addChild(backgroundlayout); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :