Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java @ 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 | 11c589d68f13 |
children | 65eadfe33466 |
comparison
equal
deleted
inserted
replaced
4606:6e68e83149f6 | 4607:c0a275c581fb |
---|---|
1 package de.intevation.flys.client.client.ui; | 1 package de.intevation.flys.client.client.ui; |
2 | 2 |
3 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
4 | 4 |
5 import com.smartgwt.client.types.Alignment; | |
6 import com.smartgwt.client.types.VerticalAlignment; | |
7 import com.smartgwt.client.widgets.Button; | |
5 import com.smartgwt.client.widgets.Canvas; | 8 import com.smartgwt.client.widgets.Canvas; |
9 import com.smartgwt.client.widgets.Img; | |
10 import com.smartgwt.client.widgets.Label; | |
11 import com.smartgwt.client.widgets.events.ClickEvent; | |
12 import com.smartgwt.client.widgets.events.ClickHandler; | |
13 import com.smartgwt.client.widgets.layout.HLayout; | |
14 import com.smartgwt.client.widgets.layout.LayoutSpacer; | |
15 import com.smartgwt.client.widgets.layout.VLayout; | |
16 | |
17 import de.intevation.flys.client.client.FLYS; | |
18 import de.intevation.flys.client.client.FLYSConstants; | |
6 | 19 |
7 import java.util.HashMap; | 20 import java.util.HashMap; |
8 import java.util.Map; | 21 import java.util.Map; |
9 | 22 |
10 | 23 |
23 | 36 |
24 | 37 |
25 /** A map that contains the open CollectionViews. */ | 38 /** A map that contains the open CollectionViews. */ |
26 protected Map<String, CollectionView> views; | 39 protected Map<String, CollectionView> views; |
27 | 40 |
41 /** The interface that provides the message resources. */ | |
42 private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); | |
43 | |
44 private FLYS flys; | |
28 | 45 |
29 /** | 46 /** |
30 * The default constructor creates an empty FLYSWorkspace with no | 47 * The default constructor creates an empty FLYSWorkspace with no |
31 * CollectionViews opened. | 48 * CollectionViews opened. |
32 */ | 49 */ |
33 public FLYSWorkspace() { | 50 public FLYSWorkspace(FLYS flys) { |
51 this.flys = flys; | |
34 views = new HashMap<String, CollectionView>(); | 52 views = new HashMap<String, CollectionView>(); |
35 | 53 |
36 setWidth("100%"); | 54 setWidth("100%"); |
37 setHeight("100%"); | 55 setHeight("100%"); |
56 | |
57 addBackgroundWorkspace(); | |
38 } | 58 } |
39 | 59 |
40 | 60 |
41 /** | 61 /** |
42 * This method adds a new CollectionView to this workspace and stores a | 62 * This method adds a new CollectionView to this workspace and stores a |
97 if(views.get(uuid) != null) { | 117 if(views.get(uuid) != null) { |
98 return true; | 118 return true; |
99 } | 119 } |
100 return false; | 120 return false; |
101 } | 121 } |
122 | |
123 private void addBackgroundWorkspace() { | |
124 String baseUrl = GWT.getHostPageBaseURL(); | |
125 Img bfg = new Img( | |
126 baseUrl + MESSAGES.bfgLogo()); | |
127 bfg.setWidth(150); | |
128 bfg.setHeight(100); | |
129 bfg.setLayoutAlign(Alignment.RIGHT); | |
130 | |
131 HLayout backgroundlayout = new HLayout(); | |
132 backgroundlayout.setHeight100(); | |
133 backgroundlayout.setWidth100(); | |
134 backgroundlayout.setDefaultLayoutAlign(Alignment.CENTER); | |
135 backgroundlayout.setDefaultLayoutAlign(VerticalAlignment.CENTER); | |
136 | |
137 Canvas spacer = new Canvas(); | |
138 spacer.setWidth("33%"); | |
139 | |
140 VLayout infobox = new VLayout(); | |
141 infobox.setHeight("*"); | |
142 infobox.setWidth("*"); | |
143 infobox.setDefaultLayoutAlign(Alignment.CENTER); | |
144 | |
145 Label welcome = new Label(MESSAGES.welcome()); | |
146 welcome.setAlign(Alignment.CENTER); | |
147 welcome.setStyleName("fontNormalBig"); | |
148 | |
149 Label lcreate = new Label(MESSAGES.welcome_open_or_create()); | |
150 lcreate.setStyleName("welcomeCreateText"); | |
151 lcreate.setWidth100(); | |
152 lcreate.setAlign(Alignment.CENTER); | |
153 | |
154 Button addbutton = new Button(MESSAGES.new_project()); | |
155 addbutton.setStyleName("projectsAddButton"); | |
156 addbutton.setAlign(Alignment.CENTER); | |
157 addbutton.setTitle(MESSAGES.new_project()); | |
158 addbutton.setAutoFit(true); | |
159 addbutton.addClickHandler(new ClickHandler() { | |
160 | |
161 @Override | |
162 public void onClick(ClickEvent event) { | |
163 flys.newProject(); | |
164 } | |
165 }); | |
166 | |
167 | |
168 infobox.addMember(welcome); | |
169 infobox.addMember(lcreate); | |
170 infobox.addMember(addbutton); | |
171 | |
172 backgroundlayout.addMember(spacer); | |
173 backgroundlayout.addMember(infobox); | |
174 backgroundlayout.addMember(spacer); | |
175 | |
176 addChild(backgroundlayout); | |
177 } | |
102 } | 178 } |
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 179 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |