669 |
aurelien |
1 |
package org.tela_botanica.client.vues.image.filtres;
|
5 |
aperonnet |
2 |
|
|
|
3 |
import org.tela_botanica.client.image.ImageMediateur;
|
|
|
4 |
import org.tela_botanica.client.interfaces.Filtrable;
|
|
|
5 |
|
|
|
6 |
import com.google.gwt.user.client.ui.Label;
|
|
|
7 |
import com.gwtext.client.widgets.Panel;
|
|
|
8 |
import com.gwtext.client.widgets.form.Checkbox;
|
|
|
9 |
|
|
|
10 |
public class SelectionFiltreVue extends Panel implements Filtrable {
|
|
|
11 |
|
|
|
12 |
private ImageMediateur iMediateur = null;
|
|
|
13 |
|
|
|
14 |
private boolean filtreModifie = false;
|
|
|
15 |
|
|
|
16 |
private Checkbox check = null;
|
|
|
17 |
|
|
|
18 |
@SuppressWarnings("unused")
|
|
|
19 |
private SelectionFiltreVue()
|
|
|
20 |
{
|
|
|
21 |
super() ;
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
public SelectionFiltreVue(ImageMediateur im) {
|
|
|
25 |
|
|
|
26 |
super();
|
|
|
27 |
iMediateur = im ;
|
|
|
28 |
Label labelRecherche = new Label(
|
|
|
29 |
"Afficher uniquement les images dans le tampon :");
|
|
|
30 |
add(labelRecherche);
|
|
|
31 |
setBorder(false);
|
|
|
32 |
setPaddings(5);
|
|
|
33 |
|
|
|
34 |
/*
|
|
|
35 |
* combo = new ComboBox() ; String tout = "toutes les images "; String
|
|
|
36 |
* selection = "dans le tampon seulement" ; Object[][] data = new
|
|
|
37 |
* Object[2][2]; data[0][0] = 1 ; data[0][1] = tout ; data[1][0] = 2 ;
|
|
|
38 |
* data[1][1] = selection ;
|
|
|
39 |
* // creation du store qui les contient FieldDef defIdChoix = new
|
|
|
40 |
* IntegerFieldDef("id_choix"); FieldDef defNomChoix = new
|
|
|
41 |
* StringFieldDef("nom_choix");
|
|
|
42 |
*
|
|
|
43 |
* FieldDef[] defTab = {defIdChoix, defNomChoix}; RecordDef rd = new
|
|
|
44 |
* RecordDef(defTab) ;
|
|
|
45 |
*
|
|
|
46 |
* final MemoryProxy dataProxy = new MemoryProxy(data); final
|
|
|
47 |
* ArrayReader reader = new ArrayReader(rd);
|
|
|
48 |
*
|
|
|
49 |
* st = new Store(dataProxy, reader); st.load() ; combo.setStore(st) ;
|
|
|
50 |
* combo.setGrow(true) ; combo.setMode(ComboBox.LOCAL);
|
|
|
51 |
* combo.setEditable(false) ; //combo.setDisplayField("nom_choix") ;
|
|
|
52 |
* add(combo) ;
|
|
|
53 |
*/
|
|
|
54 |
|
|
|
55 |
check = new Checkbox();
|
|
|
56 |
check.setChecked(false) ;
|
|
|
57 |
add(check);
|
|
|
58 |
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
public boolean renvoyerEtatFiltre() {
|
|
|
62 |
|
|
|
63 |
return filtreModifie;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public String renvoyerNomFiltre() {
|
|
|
67 |
|
|
|
68 |
return "Filtre par tampon";
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
public String[] renvoyerValeursAFiltrer() {
|
|
|
72 |
|
|
|
73 |
if (check.getValue()) {
|
|
|
74 |
|
|
|
75 |
String[] val = { "ci_id_tampon", iMediateur.renvoyerSelection() };
|
|
|
76 |
return val;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
String[] val = { "ci_id_tampon", "" };
|
|
|
80 |
return val;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public void valider() {
|
|
|
84 |
|
|
|
85 |
filtreModifie = true;
|
|
|
86 |
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
}
|