New file |
0,0 → 1,138 |
package org.tela_botanica.del.client.vues.rechercheobservations; |
|
import java.util.ArrayList; |
import java.util.List; |
|
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.FlexTable; |
import com.google.gwt.user.client.ui.FlowPanel; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
import com.google.gwt.user.client.ui.HorizontalPanel; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.TextBox; |
import com.google.gwt.user.client.ui.VerticalPanel; |
|
public class ObservationRechercheVue extends Composite { |
|
private final VerticalPanel mainPanel = new VerticalPanel(); |
|
private final Panel loadPanel = new FlowPanel(); |
|
private final Panel taxaPanel = new FlowPanel(); |
|
private final FlexTable imageTable = new FlexTable(); |
|
private final Panel paginationPanel = new HorizontalPanel(); |
|
private final List<Panel> imagePanels = new ArrayList<Panel>(); |
|
private final HTML contactingServerHTML = new HTML( |
"<img src='img/wait.gif' />Contact du serveur du CEL..."); |
|
private final HTML searchHtml = new HTML( |
"<img src='img/search_icon.gif' />Search taxon:"); |
|
private int nbCol = 5; |
|
private final int nbImagesPerPage = 10; |
|
private int numImage = 0; |
|
public Panel getPanel() { |
return mainPanel; |
} |
|
private final TextBox textBox = new TextBox(); |
|
public TextBox getTextBox() { |
return textBox; |
} |
|
protected ObservationRechercheVue() { |
|
textBox.setText("apifera"); |
textBox.setFocus(true); |
|
mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); |
mainPanel.setSize("100%", "100%"); |
|
Panel textBoxPanel = new HorizontalPanel(); |
textBoxPanel.add(searchHtml); |
textBoxPanel.add(textBox); |
|
Panel searchPanel = new VerticalPanel(); |
searchPanel.add(new HTML("Rechercher une image")); |
searchPanel.add(textBoxPanel); |
searchPanel |
.add(new HTML( |
"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")); |
searchPanel.add(loadPanel); |
|
taxaPanel.add(imageTable); |
|
mainPanel.add(searchPanel); |
mainPanel.add(paginationPanel); |
mainPanel.add(taxaPanel); |
|
initWidget(mainPanel); |
} |
|
protected void addImagePanel(Panel imagePanel) { |
this.imagePanels.add(imagePanel); |
} |
|
protected void showImagePanels(int first, int last) { |
imageTable.clear(); |
|
int positionImage = 0; |
for (int numImage = first; numImage < last; numImage++) { |
try { |
Panel panel = imagePanels.get(numImage); |
imageTable.setWidget((positionImage) / nbCol, (positionImage) |
% nbCol, panel); |
} catch (Exception e) { |
break; |
} |
|
positionImage++; |
} |
} |
|
public FlexTable getImageTable() { |
return imageTable; |
} |
|
public int getNumImage() { |
return numImage; |
} |
|
public void setNumImage(int numImage) { |
this.numImage = numImage; |
} |
|
public Panel getLoadPanel() { |
return loadPanel; |
} |
|
public HTML getSearchHtml() { |
return searchHtml; |
} |
|
public Panel getPaginationPanel() { |
return paginationPanel; |
} |
|
public int getNbImagesPerPage() { |
return nbImagesPerPage; |
} |
|
public List<Panel> getImagePanels() { |
return imagePanels; |
} |
|
public HTML getContactingServerHTML() { |
return contactingServerHTML; |
} |
|
} |