Subversion Repositories eFlore/Applications.del

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
261 aurelien 1
package org.tela_botanica.del.client.composants.formulaires;
2
 
450 aurelien 3
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
4
import com.google.gwt.user.client.ui.HasWidgets;
261 aurelien 5
import com.google.gwt.user.client.ui.LayoutPanel;
6
import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
7
import com.google.gwt.user.client.ui.SuggestBox;
8
import com.google.gwt.user.client.ui.SuggestOracle;
9
 
450 aurelien 10
public class AutoCompletionComboBoxVue extends LayoutPanel implements AutoCompletionComboBoxPresenteur.Vue {
261 aurelien 11
 
12
	MultiWordSuggestOracle msu = new MultiWordSuggestOracle();
13
	SuggestBox suggestions = new SuggestBox(msu);
14
 
15
	public AutoCompletionComboBoxVue() {
16
		add(suggestions);
386 aurelien 17
		//TODO: voir avec greg si la taille doit être définie ici
18
		setHeight("25px");
261 aurelien 19
		setWidth("100%");
20
	}
21
 
22
	public SuggestBox getSuggestBox() {
23
		return suggestions;
24
	}
25
 
26
	public void remplirListe(String[] listePropositions) {
27
 
28
		msu.clear();
29
		for (int i = 0; i < listePropositions.length; i++) {
30
			msu.add(listePropositions[i]);
31
		}
32
	}
33
 
450 aurelien 34
	@Override
261 aurelien 35
	public void afficherSuggestions(SuggestOracle.Request requeteOracle, SuggestOracle.Callback callBackOracle) {
36
		msu.requestSuggestions(requeteOracle, callBackOracle);
37
	}
416 gduche 38
 
450 aurelien 39
	@Override
40
	public void afficherListeDeroulante() {
41
		suggestions.showSuggestionList();
42
	}
43
 
416 gduche 44
	public void nettoyer() {
45
		suggestions.setText("");
46
	}
47
 
48
	public void setValeur(String taxon) {
49
		suggestions.setText(taxon);
50
	}
450 aurelien 51
 
52
	@Override
53
	public HasKeyPressHandlers getSuggestBoxHasKeyPressHandlers() {
54
		return suggestions;
55
	}
56
 
57
	@Override
58
	public String getValeur() {
59
		return suggestions.getText();
60
	}
61
 
62
	@Override
63
	public void ajouterVue(HasWidgets composite) {
64
		composite.add(this.asWidget());
65
	}
261 aurelien 66
}