Subversion Repositories eFlore/Applications.del

Rev

Rev 459 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 459 Rev 534
1
package org.tela_botanica.del.client.vues.rechercheimages.resultats;
1
package org.tela_botanica.del.client.vues.rechercheimages.resultats;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.List;
4
import java.util.List;
5
 
5
 
6
import com.google.gwt.core.client.GWT;
6
import com.google.gwt.core.client.GWT;
7
import com.google.gwt.uibinder.client.UiBinder;
7
import com.google.gwt.uibinder.client.UiBinder;
8
import com.google.gwt.uibinder.client.UiField;
8
import com.google.gwt.uibinder.client.UiField;
9
import com.google.gwt.user.client.ui.Button;
9
import com.google.gwt.user.client.ui.Button;
10
import com.google.gwt.user.client.ui.Composite;
10
import com.google.gwt.user.client.ui.Composite;
11
import com.google.gwt.user.client.ui.HTMLPanel;
11
import com.google.gwt.user.client.ui.HTMLPanel;
-
 
12
import com.google.gwt.user.client.ui.HasWidgets;
12
import com.google.gwt.user.client.ui.Panel;
13
import com.google.gwt.user.client.ui.Panel;
13
import com.google.gwt.user.client.ui.Widget;
14
import com.google.gwt.user.client.ui.Widget;
14
 
15
 
15
public class ResultatRechercheImageVue extends Composite implements ResultatRechercheImagePresenteur.Vue {
16
public class ResultatRechercheImageVue extends Composite implements ResultatRechercheImagePresenteur.Vue {
16
 
17
 
17
	@UiField
18
	@UiField
18
	Panel panneauChargement;
19
	Panel panneauChargement;
19
	private final List<Panel> panneauxImages = new ArrayList<Panel>();
20
	private final List<HasWidgets> panneauxImages = new ArrayList<HasWidgets>();
20
	private final int nbImagesPerPage = 10;
21
	private final int nbImagesPerPage = 10;
21
	private int numImage = 0;
22
	private int numImage = 0;
22
 
23
 
23
	// Annotation can be used to change the name of the associated xml file
24
	// Annotation can be used to change the name of the associated xml file
24
	// @UiTemplate("ObservationRechercheVue.ui.xml")
25
	// @UiTemplate("ObservationRechercheVue.ui.xml")
25
	interface MyUiBinder extends UiBinder<Widget, ResultatRechercheImageVue> {
26
	interface MyUiBinder extends UiBinder<Widget, ResultatRechercheImageVue> {
26
	}
27
	}
27
 
28
 
28
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
29
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
29
 
30
 
30
	@UiField
31
	@UiField
31
	Panel panneauPagination, panneauPaginationHaut;
32
	Panel panneauPagination, panneauPaginationHaut;
32
 
33
 
33
	@UiField
34
	@UiField
34
	HTMLPanel imageTable;
35
	HTMLPanel imageTable;
35
	
36
	
36
	@UiField
37
	@UiField
37
	Button triParNbVotesAscendant, triParNbVotesDescendant, triParDateAscendant, triParDateDescendant;
38
	Button triParNbVotesAscendant, triParNbVotesDescendant, triParDateAscendant, triParDateDescendant;
38
 
39
 
39
	// Constructeur
40
	// Constructeur
40
	public ResultatRechercheImageVue() {
41
	public ResultatRechercheImageVue() {
41
		initWidget(uiBinder.createAndBindUi(this));
42
		initWidget(uiBinder.createAndBindUi(this));
42
	}
43
	}
43
 
44
 
44
	/**
45
	/**
45
	 * Nettoie et remet à zéro les composants du panneau qui doivent l'être
46
	 * Nettoie et remet à zéro les composants du panneau qui doivent l'être
46
	 * */
47
	 * */
47
	public void nettoyer() {
48
	public void nettoyer() {
48
		setNumImage(0);
49
		setNumImage(0);
49
		imageTable.clear();
50
		imageTable.clear();
50
		panneauxImages.clear();
51
		panneauxImages.clear();
51
	}
52
	}
52
 
53
 
53
	public void creerPanneauxObservations(int taille) {
54
	public void creerPanneauxObservations(int taille) {
54
 
55
 
55
		panneauxImages.clear();
56
		panneauxImages.clear();
56
		for (int i = 0; i < taille; i++) {
57
		for (int i = 0; i < taille; i++) {
57
			Panel imagePanel = new HTMLPanel("");
58
			Panel imagePanel = new HTMLPanel("");
58
			panneauxImages.add(imagePanel);
59
			panneauxImages.add(imagePanel);
59
		}
60
		}
60
	}
61
	}
61
 
62
 
62
	public void afficherPanneauxObservation(List<Panel> imagesPanel) {
63
	public void afficherPanneauxObservation(List<HasWidgets> imagesPanel) {
63
 
64
 
64
		imageTable.clear();
65
		imageTable.clear();
65
		for (int i = 0; i < imagesPanel.size(); i++) {
66
		for (int i = 0; i < imagesPanel.size(); i++) {
66
			HTMLPanel panneauImage = (HTMLPanel) imagesPanel.get(i);
67
			HTMLPanel panneauImage = (HTMLPanel) imagesPanel.get(i);
67
			panneauxImages.add(panneauImage);
68
			panneauxImages.add(panneauImage);
68
			// imageTable.setWidget((i) / nbCol, (i) % nbCol, panneauImage);
69
			// imageTable.setWidget((i) / nbCol, (i) % nbCol, panneauImage);
69
			imageTable.add(panneauImage);
70
			imageTable.add(panneauImage);
70
		}
71
		}
71
 
72
 
72
	}
73
	}
73
 
74
 
74
	public void setNumImage(int numImage) {
75
	public void setNumImage(int numImage) {
75
		this.numImage = numImage;
76
		this.numImage = numImage;
76
	}
77
	}
77
 
78
 
78
	public void startChargement() {
79
	public void startChargement() {
79
		panneauChargement.setHeight((this.getOffsetHeight() - (panneauPagination.getOffsetHeight()*2))+"px");
80
		panneauChargement.setHeight((this.getOffsetHeight() - (panneauPagination.getOffsetHeight()*2))+"px");
80
		panneauChargement.setVisible(true);
81
		panneauChargement.setVisible(true);
81
	}
82
	}
82
 
83
 
83
	public void stopChargement() {
84
	public void stopChargement() {
84
		panneauChargement.setVisible(false);
85
		panneauChargement.setVisible(false);
85
	}
86
	}
86
 
87
 
87
	public HTMLPanel getImageTable() {
88
	public HTMLPanel getImageTable() {
88
		return imageTable;
89
		return imageTable;
89
	}
90
	}
90
 
91
 
91
	public int getNumImage() {
92
	public int getNumImage() {
92
		return numImage;
93
		return numImage;
93
	}
94
	}
94
 
95
 
95
	public Panel getPanneauChargement() {
96
	public Panel getPanneauChargement() {
96
		return panneauChargement;
97
		return panneauChargement;
97
	}
98
	}
98
 
99
 
99
	public Panel getPanneauPagination() {
100
	public Panel getPanneauPagination() {
100
		return panneauPagination;
101
		return panneauPagination;
101
	}
102
	}
102
	
103
	
103
	public Panel getPanneauPaginationHaut() {
104
	public Panel getPanneauPaginationHaut() {
104
		return panneauPaginationHaut;
105
		return panneauPaginationHaut;
105
	}
106
	}
106
 
107
 
107
	public int getNbImagesPerPage() {
108
	public int getNbImagesPerPage() {
108
		return nbImagesPerPage;
109
		return nbImagesPerPage;
109
	}
110
	}
110
 
111
 
111
	public List<Panel> getPanneauxImages() {
112
	public List<HasWidgets> getPanneauxImages() {
112
		return panneauxImages;
113
		return panneauxImages;
113
	}
114
	}
114
	
115
	
115
	public Button getTriParNbVotesAscendant() {
116
	public Button getTriParNbVotesAscendant() {
116
		return triParNbVotesAscendant;
117
		return triParNbVotesAscendant;
117
	}
118
	}
118
 
119
 
119
	public Button getTriParNbVotesDescendant() {
120
	public Button getTriParNbVotesDescendant() {
120
		return triParNbVotesDescendant;
121
		return triParNbVotesDescendant;
121
	}
122
	}
122
 
123
 
123
	public Button getTriParDateAscendant() {
124
	public Button getTriParDateAscendant() {
124
		return triParDateAscendant;
125
		return triParDateAscendant;
125
	}
126
	}
126
 
127
 
127
	public Button getTriParDateDescendant() {
128
	public Button getTriParDateDescendant() {
128
		return triParDateDescendant;
129
		return triParDateDescendant;
129
	}
130
	}
130
 
131
 
131
}
132
}