Mercurial > dive4elements > river
comparison flys-client/src/main/java/org/dive4elements/river/client/client/ui/ContinuePanel.java @ 5834:f507086aa94b
Repaired internal references.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:31:32 +0200 |
parents | flys-client/src/main/java/de/intevation/flys/client/client/ui/ContinuePanel.java@360e22afb98b |
children | 821a02bbfb4e |
comparison
equal
deleted
inserted
replaced
5833:a2bdc0f524e8 | 5834:f507086aa94b |
---|---|
1 package de.intevation.flys.client.client.ui; | |
2 | |
3 import com.google.gwt.core.client.GWT; | |
4 | |
5 import com.smartgwt.client.widgets.Canvas; | |
6 import com.smartgwt.client.widgets.form.DynamicForm; | |
7 import com.smartgwt.client.widgets.form.fields.LinkItem; | |
8 import com.smartgwt.client.widgets.form.fields.events.ClickEvent; | |
9 import com.smartgwt.client.widgets.form.fields.events.ClickHandler; | |
10 | |
11 import de.intevation.flys.client.client.FLYSConstants; | |
12 import de.intevation.flys.client.client.event.AdvanceHandler; | |
13 import de.intevation.flys.client.shared.model.ArtifactDescription; | |
14 import de.intevation.flys.client.shared.model.Data; | |
15 import de.intevation.flys.client.shared.model.DataList; | |
16 | |
17 import java.util.ArrayList; | |
18 import java.util.List; | |
19 | |
20 | |
21 /** | |
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
23 */ | |
24 public class ContinuePanel extends AbstractUIProvider { | |
25 | |
26 private static final long serialVersionUID = -5882814816875137397L; | |
27 | |
28 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); | |
29 | |
30 protected List<AdvanceHandler> advHandlers; | |
31 | |
32 | |
33 @Override | |
34 public Canvas create(DataList dataList) { | |
35 DynamicForm form = new DynamicForm(); | |
36 form.setWidth(200); | |
37 form.setHeight(35); | |
38 | |
39 LinkItem next = new LinkItem(); | |
40 next.setShowTitle(false); | |
41 next.setLinkTitle(MSG.next()); | |
42 | |
43 final ArtifactDescription desc = artifact.getArtifactDescription(); | |
44 final String[] reachable = desc.getReachableStates(); | |
45 | |
46 next.addClickHandler(new ClickHandler() { | |
47 @Override | |
48 public void onClick(ClickEvent e) { | |
49 fireOnAdvance(reachable[0]); | |
50 } | |
51 }); | |
52 | |
53 form.setFields(next); | |
54 | |
55 return form; | |
56 } | |
57 | |
58 | |
59 @Override | |
60 public Canvas createOld(DataList dataList) { | |
61 return null; | |
62 } | |
63 | |
64 | |
65 @Override | |
66 protected Data[] getData() { | |
67 return new Data[0]; | |
68 } | |
69 | |
70 | |
71 public void addAdvanceHandler(AdvanceHandler handler) { | |
72 if (advHandlers == null) { | |
73 advHandlers = new ArrayList<AdvanceHandler>(); | |
74 } | |
75 | |
76 if (handler != null) { | |
77 advHandlers.add(handler); | |
78 } | |
79 } | |
80 | |
81 | |
82 public void fireOnAdvance(String target) { | |
83 if (advHandlers == null || advHandlers.isEmpty()) { | |
84 return; | |
85 } | |
86 | |
87 for (AdvanceHandler handler: advHandlers) { | |
88 handler.onAdvance(target); | |
89 } | |
90 } | |
91 } | |
92 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |