Subversion Repositories eFlore/Applications.del

Rev

Rev 1165 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1151 aurelien 1
package org.tela_botanica.del.client.composants.motsclesimages;
2
 
1165 aurelien 3
import java.util.Iterator;
4
import java.util.List;
5
 
6
import org.tela_botanica.del.client.utils.StringUtils;
7
 
1151 aurelien 8
import com.google.gwt.core.client.GWT;
1239 gduche 9
import com.google.gwt.event.dom.client.HasClickHandlers;
1151 aurelien 10
import com.google.gwt.uibinder.client.UiBinder;
11
import com.google.gwt.uibinder.client.UiField;
1239 gduche 12
import com.google.gwt.user.client.ui.Button;
1151 aurelien 13
import com.google.gwt.user.client.ui.Composite;
1165 aurelien 14
import com.google.gwt.user.client.ui.HTML;
1151 aurelien 15
import com.google.gwt.user.client.ui.HasWidgets;
1239 gduche 16
import com.google.gwt.user.client.ui.Image;
1165 aurelien 17
import com.google.gwt.user.client.ui.InlineHTML;
1151 aurelien 18
import com.google.gwt.user.client.ui.Panel;
19
import com.google.gwt.user.client.ui.Widget;
20
 
21
public class MotsClesImageVue extends Composite  implements MotsClesImagePresenteur.Vue {
22
 
23
	@UiField
1239 gduche 24
	Panel motsCles, motsClesCel, saisieMotsCles, zoneIconesMotsCles;
25
 
26
	@UiField
27
	Image image;
1151 aurelien 28
 
29
	@UiField
1239 gduche 30
	Button validerMotsCles;
1165 aurelien 31
 
1151 aurelien 32
	interface MyUiBinder extends UiBinder<Widget, MotsClesImageVue> {
33
 
34
	}
35
 
36
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
37
 
38
	public MotsClesImageVue() {
39
		// sets listBox
40
		initWidget(uiBinder.createAndBindUi(this));
41
	}
1162 aurelien 42
 
43
	@Override
44
	public void viderZoneMotsCles() {
45
		motsCles.clear();
46
	}
1151 aurelien 47
 
48
	@Override
1162 aurelien 49
	public HasWidgets getZoneMotsCles() {
50
		return motsCles;
1151 aurelien 51
	}
52
 
53
	@Override
1165 aurelien 54
	public HasWidgets getZoneMotsClesCel() {
55
		return motsClesCel;
56
	}
57
 
58
	@Override
1151 aurelien 59
	public HasWidgets getZoneSaisieMotsCles() {
60
		return saisieMotsCles;
61
	}
1165 aurelien 62
 
63
	@Override
64
	public void afficherMotsClesCel(List<String> motsClesCelImages, List<String> motsClesCelAFiltrer) {
65
		for (Iterator<String> iterator = motsClesCelImages.iterator(); iterator
66
				.hasNext();) {
67
			String mot = (String) iterator.next();
68
			String motNormalise = StringUtils.normaliser(mot);
69
			if(!mot.trim().isEmpty() && motsClesCelAFiltrer.contains(StringUtils.normaliser(motNormalise))) {
70
				HTML motCle = new InlineHTML(mot);
71
				motCle.setStyleName("motCleCel");
72
				motsClesCel.add(motCle);
1239 gduche 73
 
1165 aurelien 74
			}
75
		}
76
	}
1239 gduche 77
 
78
	@Override
79
	public void setImage(String url) {
80
		image.setUrl(url);
81
	}
82
 
83
	@Override
84
	public HasWidgets getZoneIconesMotsCles() {
85
		return zoneIconesMotsCles;
86
	}
87
 
88
	public HasClickHandlers getValiderMotCles() {
89
		return validerMotsCles;
90
	}
1151 aurelien 91
}