comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePairWidget.java @ 4183:1755a1bfe5ce

Merged
author Christian Lins <christian.lins@intevation.de>
date Fri, 19 Oct 2012 09:20:52 +0200
parents ad2489b595d7
children 5e6e89f19a37
comparison
equal deleted inserted replaced
4182:ad2489b595d7 4183:1755a1bfe5ce
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.widgets.Button; 5 import com.smartgwt.client.widgets.Button;
6
7 import com.smartgwt.client.widgets.layout.VLayout;
8 import com.smartgwt.client.widgets.layout.HLayout;
9
10 import com.smartgwt.client.widgets.events.ClickHandler;
6 import com.smartgwt.client.widgets.events.ClickEvent; 11 import com.smartgwt.client.widgets.events.ClickEvent;
7 import com.smartgwt.client.widgets.events.ClickHandler; 12
8 import com.smartgwt.client.widgets.grid.ListGrid; 13 import com.smartgwt.client.widgets.grid.ListGrid;
9 import com.smartgwt.client.widgets.layout.HLayout; 14
10 import com.smartgwt.client.widgets.layout.VLayout; 15 import de.intevation.flys.client.shared.model.Artifact;
16 import de.intevation.flys.client.shared.model.User;
17 import de.intevation.flys.client.shared.model.ToLoad;
11 18
12 import de.intevation.flys.client.client.FLYSConstants; 19 import de.intevation.flys.client.client.FLYSConstants;
13 import de.intevation.flys.client.shared.model.Artifact;
14 import de.intevation.flys.client.shared.model.Recommendation;
15 import de.intevation.flys.client.shared.model.ToLoad;
16 import de.intevation.flys.client.shared.model.User;
17
18 import java.util.List;
19 20
20 21
21 /** 22 /**
22 * Widget showing two Datacages and a add-this-button. 23 * Widget showing two Datacages and a add-this-button.
23 * Insert a record into a listgrid when add-this-button clicked. 24 * Insert a record into a listgrid when add-this-button clicked.
92 */ 93 */
93 public void plusClicked() { 94 public void plusClicked() {
94 ToLoad toLoad1 = firstDatacageWidget.getSelection(); 95 ToLoad toLoad1 = firstDatacageWidget.getSelection();
95 ToLoad toLoad2 = secondDatacageWidget.getSelection(); 96 ToLoad toLoad2 = secondDatacageWidget.getSelection();
96 97
98 // TODO further sanitize (toRecommendations.length)
97 if (toLoad1 == null || toLoad2 == null) { 99 if (toLoad1 == null || toLoad2 == null) {
98 return; 100 return;
99 } 101 }
100 102
101 List<Recommendation> toLoad1Rec = toLoad1.toRecommendations(); 103 grid.addData(new RecommendationPairRecord(
102 List<Recommendation> toLoad2Rec = toLoad2.toRecommendations(); 104 toLoad1.toRecommendations().get(0),
103 105 toLoad2.toRecommendations().get(0)));
104 if (toLoad1Rec.size() <= 0 || toLoad2Rec.size() <= 0) {
105 return;
106 }
107
108 grid.addData(new RecommendationPairRecord(toLoad1Rec.get(0), toLoad2Rec.get(0)));
109 } 106 }
110 } 107 }
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 108 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org