[Dive4elements-commits] [PATCH 09 of 11] Add a welcome screen to the workspace background
Wald Commits
scm-commit at wald.intevation.org
Fri Nov 30 12:02:14 CET 2012
# HG changeset patch
# User Björn Ricks <bjoern.ricks at intevation.de>
# Date 1354267112 -3600
# Node ID c0a275c581fbf6b9fd6792b3d8ae949b5e095a49
# Parent 6e68e83149f643720a9678552c65a2fb4bcec034
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.
diff -r 6e68e83149f6 -r c0a275c581fb flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java
--- 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);
diff -r 6e68e83149f6 -r c0a275c581fb flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java
--- 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 :
More information about the Dive4elements-commits
mailing list