comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePairWidget.java @ 4182:ad2489b595d7

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

http://dive4elements.wald.intevation.org