Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/ContinuePanel.java @ 4221:480de0dbca8e
Extended location input helper.
The locationpicker has now an attribute whether the input is distance or
location to display one or two clickable columns.
Replaced the record click handler with cell click handler.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 23 Oct 2012 13:17:20 +0200 |
parents | 360e22afb98b |
children |
rev | line source |
---|---|
785
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.smartgwt.client.widgets.Canvas; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import com.smartgwt.client.widgets.form.DynamicForm; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import com.smartgwt.client.widgets.form.fields.LinkItem; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import com.smartgwt.client.widgets.form.fields.events.ClickEvent; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import com.smartgwt.client.widgets.form.fields.events.ClickHandler; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
790
diff
changeset
|
11 import de.intevation.flys.client.client.FLYSConstants; |
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
790
diff
changeset
|
12 import de.intevation.flys.client.client.event.AdvanceHandler; |
785
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.client.shared.model.ArtifactDescription; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.client.shared.model.Data; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.client.shared.model.DataList; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
790
diff
changeset
|
17 import java.util.ArrayList; |
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
790
diff
changeset
|
18 import java.util.List; |
785
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 */ |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class ContinuePanel extends AbstractUIProvider { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
790
diff
changeset
|
26 private static final long serialVersionUID = -5882814816875137397L; |
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
790
diff
changeset
|
27 |
785
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 protected List<AdvanceHandler> advHandlers; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 @Override |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public Canvas create(DataList dataList) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 DynamicForm form = new DynamicForm(); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 form.setWidth(200); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 form.setHeight(35); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 LinkItem next = new LinkItem(); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 next.setShowTitle(false); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 next.setLinkTitle(MSG.next()); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 final ArtifactDescription desc = artifact.getArtifactDescription(); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 final String[] reachable = desc.getReachableStates(); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 next.addClickHandler(new ClickHandler() { |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
790
diff
changeset
|
47 @Override |
785
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 public void onClick(ClickEvent e) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 fireOnAdvance(reachable[0]); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 }); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 form.setFields(next); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 return form; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 @Override |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 public Canvas createOld(DataList dataList) { |
790
3fa8583434b2
Made stepping forward/backword much smoother in the parameter list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
785
diff
changeset
|
61 return null; |
785
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 @Override |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 protected Data[] getData() { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 return new Data[0]; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 public void addAdvanceHandler(AdvanceHandler handler) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 if (advHandlers == null) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 advHandlers = new ArrayList<AdvanceHandler>(); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 if (handler != null) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 advHandlers.add(handler); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 public void fireOnAdvance(String target) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 if (advHandlers == null || advHandlers.isEmpty()) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 return; |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 for (AdvanceHandler handler: advHandlers) { |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 handler.onAdvance(target); |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
3ae0facd4cab
Added a panel that lets users step to a next state without feeding the current artifact with new data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |