Subversion Repositories eFlore/Applications.del

Rev

Rev 148 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 148 Rev 178
Line 1... Line 1...
1
package org.tela_botanica.del.client.vues.rechercheimages;
1
package org.tela_botanica.del.client.vues.rechercheimages;
Line 2... Line -...
2
 
-
 
3
import java.util.ArrayList;
-
 
4
import java.util.List;
-
 
5
 
-
 
6
import org.tela_botanica.del.client.modeles.Image;
-
 
7
 
2
 
8
import com.google.gwt.core.client.GWT;
3
import com.google.gwt.core.client.GWT;
9
import com.google.gwt.uibinder.client.UiBinder;
4
import com.google.gwt.uibinder.client.UiBinder;
10
import com.google.gwt.uibinder.client.UiField;
5
import com.google.gwt.uibinder.client.UiField;
11
import com.google.gwt.user.client.ui.Button;
6
import com.google.gwt.user.client.ui.Button;
12
import com.google.gwt.user.client.ui.Composite;
-
 
13
import com.google.gwt.user.client.ui.FlexTable;
7
import com.google.gwt.user.client.ui.Composite;
14
import com.google.gwt.user.client.ui.FlowPanel;
8
import com.google.gwt.user.client.ui.FlowPanel;
-
 
9
import com.google.gwt.user.client.ui.Label;
15
import com.google.gwt.user.client.ui.HTML;
10
import com.google.gwt.user.client.ui.ListBox;
16
import com.google.gwt.user.client.ui.Panel;
11
import com.google.gwt.user.client.ui.Panel;
17
import com.google.gwt.user.client.ui.TextBox;
12
import com.google.gwt.user.client.ui.TextBox;
18
import com.google.gwt.user.client.ui.VerticalPanel;
13
import com.google.gwt.user.client.ui.VerticalPanel;
Line 19... Line 14...
19
import com.google.gwt.user.client.ui.Widget;
14
import com.google.gwt.user.client.ui.Widget;
Line 20... Line 15...
20
 
15
 
21
public class ImageRechercheVue extends Composite {
16
public class RechercheImageVue extends Composite {
22
 
-
 
23
	private final VerticalPanel mainPanel = new VerticalPanel();
-
 
24
	private final Panel panneauChargement = new FlowPanel();
-
 
25
	private final Panel taxaPanel = new FlowPanel();
-
 
26
	private final List<Panel> panneauxImages = new ArrayList<Panel>();
-
 
27
	private final HTML labelChargement = new HTML("<img src='img/wait.gif' />Contact du serveur du CEL...");
-
 
28
	private final HTML labelChercher = new HTML("<img src='img/search_icon.gif' />Search &nbsp;&nbsp;      taxon:");
-
 
29
	private int nbCol = 5;
-
 
Line 30... Line 17...
30
	private final int nbImagesPerPage = 10;
17
 
31
	private int numImage = 0;
18
	private final VerticalPanel mainPanel = new VerticalPanel();
32
	private final TextBox textBox = new TextBox();
19
	private final Panel panneauChargement = new FlowPanel();
33
 
20
 
Line 34... Line 21...
34
	// Annotation can be used to change the name of the associated xml file
21
	// Annotation can be used to change the name of the associated xml file
Line 35... Line 22...
35
	// @UiTemplate("ObservationRechercheVue.ui.xml")
22
	// @UiTemplate("ObservationRechercheVue.ui.xml")
36
	interface MyUiBinder extends UiBinder<Widget, ImageRechercheVue> {
23
	interface MyUiBinder extends UiBinder<Widget, RechercheImageVue> {
Line 37... Line 24...
37
	}
24
	}
38
 
25
 
Line 39... Line 26...
39
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
26
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
40
 
27
 
Line 41... Line 28...
41
	@UiField
28
	@UiField
42
	TextBox nomEspece;
29
	TextBox nomEspece;
-
 
30
 
-
 
31
	@UiField
-
 
32
	Panel panneauProtocole, panneauResultats;
Line 43... Line 33...
43
 
33
 
44
	@UiField
34
	@UiField
Line 45... Line 35...
45
	Panel panneauPagination;
35
	Button boutonChercher;
46
 
36
 
47
	@UiField
-
 
48
	Button boutonChercher;
-
 
49
 
-
 
50
	@UiField
-
 
51
	FlexTable imageTable;
-
 
52
 
-
 
53
	// Constructeur
-
 
54
	protected ImageRechercheVue() {
-
 
55
 
-
 
56
		initWidget(uiBinder.createAndBindUi(this));
-
 
57
		nomEspece.setFocus(true);
-
 
58
	}
-
 
59
 
-
 
60
	/**
-
 
61
	 * Nettoie et remet à zéro les composants du panneau qui doivent l'être
-
 
62
	 * */
-
 
63
	protected void nettoyer() {
-
 
64
		panneauPagination.clear();
-
 
65
		setNumImage(0);
-
 
66
		imageTable.clear();
-
 
67
		panneauxImages.clear();
-
 
68
	}
-
 
69
 
-
 
70
	protected void creerPanneauxObservation(List<Image> images) {
-
 
71
 
-
 
72
		for (int i = 0; i < images.size(); i++) {
-
 
73
			Panel imagePanel = new VerticalPanel();
-
 
74
			panneauxImages.add(imagePanel);
-
 
75
		}
-
 
76
 
-
 
77
	}
-
 
78
 
-
 
79
	protected void afficherPanneauxImage(int first, int last) {
-
 
80
		imageTable.clear();
-
 
81
 
-
 
82
		int positionImage = 0;
-
 
83
		for (int numImage = first; numImage < last; numImage++) {
-
 
84
			try {
-
 
85
				Panel panel = panneauxImages.get(numImage);
-
 
86
				imageTable.setWidget((positionImage) / nbCol, (positionImage) % nbCol, panel);
-
 
Line 87... Line -...
87
			} catch (Exception e) {
-
 
88
				break;
-
 
89
			}
37
	@UiField
Line 90... Line 38...
90
 
38
	Label protocoleLabel;
91
			positionImage++;
39
 
92
		}
40
	@UiField
Line 93... Line 41...
93
	}
41
	ListBox listeProtocoles;
94
 
42
 
95
	public void setNumImage(int numImage) {
43
	// Constructeur
Line 96... Line 44...
96
		this.numImage = numImage;
44
	protected RechercheImageVue() {
97
	}
45
 
98
 
46
		initWidget(uiBinder.createAndBindUi(this));
Line 99... Line 47...
99
	protected void startChargement() {
47
		nomEspece.setFocus(true);
100
		panneauChargement.setVisible(true);
48
 
101
	}
49
	}
Line 102... Line 50...
102
 
50
 
103
	protected void stopChargement() {
51
	public Panel getPanneauChargement() {
104
		panneauChargement.setVisible(false);
52
		return panneauChargement;
Line 105... Line 53...
105
	}
53
	}
106
 
54
 
107
	public FlexTable getImageTable() {
55
	public TextBox getTextBox() {
Line 108... Line 56...
108
		return imageTable;
56
		return nomEspece;
109
	}
57
	}
110
 
58
 
Line 111... Line 59...
111
	public int getNumImage() {
59
	public Panel getPanel() {
112
		return numImage;
60
		return mainPanel;
113
	}
61
	}
Line 114... Line 62...
114
 
62
 
115
	public Panel getPanneauChargement() {
63
	public Button getBoutonChercher() {
116
		return panneauChargement;
64
		return boutonChercher;
Line 117... Line 65...
117
	}
65
	}
118
 
66
 
119
	public HTML getLabelChercher() {
-
 
120
		return labelChercher;
-
 
121
	}
-
 
122
 
-
 
123
	public Panel getPanneauPagination() {
67
	public ListBox getListeProtocoles() {
124
		return panneauPagination;
68
		return listeProtocoles;