9 |
benjamin |
1 |
package org.tela_botanica.del.client.vues.searchobservations;
|
|
|
2 |
|
|
|
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.List;
|
|
|
5 |
|
|
|
6 |
import com.google.gwt.user.client.ui.Composite;
|
|
|
7 |
import com.google.gwt.user.client.ui.FlexTable;
|
|
|
8 |
import com.google.gwt.user.client.ui.FlowPanel;
|
|
|
9 |
import com.google.gwt.user.client.ui.HTML;
|
|
|
10 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
|
|
11 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
|
12 |
import com.google.gwt.user.client.ui.Panel;
|
|
|
13 |
import com.google.gwt.user.client.ui.TextBox;
|
|
|
14 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
|
15 |
|
|
|
16 |
public class ObservationSearchView extends Composite {
|
|
|
17 |
|
|
|
18 |
private final VerticalPanel mainPanel = new VerticalPanel();
|
|
|
19 |
|
|
|
20 |
private final Panel loadPanel = new FlowPanel();
|
|
|
21 |
|
|
|
22 |
private final Panel taxaPanel = new FlowPanel();
|
|
|
23 |
|
|
|
24 |
private final FlexTable imageTable = new FlexTable();
|
|
|
25 |
|
|
|
26 |
private final Panel paginationPanel = new HorizontalPanel();
|
|
|
27 |
|
|
|
28 |
private final List<Panel> imagePanels = new ArrayList<Panel>();
|
|
|
29 |
|
|
|
30 |
private final HTML contactingServerHTML = new HTML(
|
|
|
31 |
"<img src='img/wait.gif' />Contact du serveur du CEL...");
|
|
|
32 |
|
|
|
33 |
private final HTML searchHtml = new HTML(
|
|
|
34 |
"<img src='img/search_icon.gif' />Search taxon:");
|
|
|
35 |
|
|
|
36 |
private int nbCol = 5;
|
|
|
37 |
|
|
|
38 |
private final int nbImagesPerPage = 10;
|
|
|
39 |
|
|
|
40 |
private int numImage = 0;
|
|
|
41 |
|
|
|
42 |
public Panel getPanel() {
|
|
|
43 |
return mainPanel;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
private final TextBox textBox = new TextBox();
|
|
|
47 |
|
|
|
48 |
public TextBox getTextBox() {
|
|
|
49 |
return textBox;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
protected ObservationSearchView() {
|
|
|
53 |
|
|
|
54 |
textBox.setText("apifera");
|
|
|
55 |
textBox.setFocus(true);
|
|
|
56 |
|
|
|
57 |
mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
|
|
58 |
mainPanel.setSize("100%", "100%");
|
|
|
59 |
|
|
|
60 |
Panel textBoxPanel = new HorizontalPanel();
|
|
|
61 |
textBoxPanel.add(searchHtml);
|
|
|
62 |
textBoxPanel.add(textBox);
|
|
|
63 |
|
|
|
64 |
Panel searchPanel = new VerticalPanel();
|
|
|
65 |
searchPanel.add(new HTML("Rechercher une image"));
|
|
|
66 |
searchPanel.add(textBoxPanel);
|
|
|
67 |
searchPanel
|
|
|
68 |
.add(new HTML(
|
12 |
gduche |
69 |
"Entrez un nom de genre ou d'espèce, un nom de commune, un numéro de departement, l'email d'un utilisateur ou un mot-clef"));
|
9 |
benjamin |
70 |
searchPanel.add(loadPanel);
|
|
|
71 |
|
|
|
72 |
taxaPanel.add(imageTable);
|
|
|
73 |
|
|
|
74 |
mainPanel.add(searchPanel);
|
|
|
75 |
mainPanel.add(paginationPanel);
|
|
|
76 |
mainPanel.add(taxaPanel);
|
|
|
77 |
|
|
|
78 |
initWidget(mainPanel);
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
protected void addImagePanel(Panel imagePanel) {
|
|
|
82 |
this.imagePanels.add(imagePanel);
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
protected void showImagePanels(int first, int last) {
|
|
|
86 |
imageTable.clear();
|
|
|
87 |
|
|
|
88 |
int positionImage = 0;
|
|
|
89 |
for (int numImage = first; numImage < last; numImage++) {
|
|
|
90 |
try {
|
|
|
91 |
Panel panel = imagePanels.get(numImage);
|
|
|
92 |
imageTable.setWidget((positionImage) / nbCol, (positionImage)
|
|
|
93 |
% nbCol, panel);
|
|
|
94 |
} catch (Exception e) {
|
|
|
95 |
break;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
positionImage++;
|
|
|
99 |
}
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public FlexTable getImageTable() {
|
|
|
103 |
return imageTable;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
public int getNumImage() {
|
|
|
107 |
return numImage;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public void setNumImage(int numImage) {
|
|
|
111 |
this.numImage = numImage;
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
public Panel getLoadPanel() {
|
|
|
115 |
return loadPanel;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
public HTML getSearchHtml() {
|
|
|
119 |
return searchHtml;
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
public Panel getPaginationPanel() {
|
|
|
123 |
return paginationPanel;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
public int getNbImagesPerPage() {
|
|
|
127 |
return nbImagesPerPage;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
public List<Panel> getImagePanels() {
|
|
|
131 |
return imagePanels;
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
public HTML getContactingServerHTML() {
|
|
|
135 |
return contactingServerHTML;
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
}
|