/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationPresenteur.java |
---|
17,11 → 17,8 |
public class ObservationPresenteur { |
private final MockDatasource validationService = MockDatasource.getInstance(); |
private ObservationVue view = new ObservationVue(); |
private ObservationVue vue = new ObservationVue(); |
private final Observation observation; |
private boolean detailsOpen = false; |
public ObservationPresenteur(Observation observation) { |
29,49 → 26,44 |
} |
public void go(HasWidgets composite) { |
composite.add(view); |
view.loadImage(observation); |
loadValidationData(); |
handleEvents(); |
composite.add(vue); |
vue.loadImage(observation); |
// loadValidationData(); |
// handleEvents(); |
} |
private void loadValidationData() { |
List<ObservationValidation> observationValidationDatas = validationService |
.getValidationData(observation.getIdImage()); |
List<ObservationValidation> observationValidationDatas = validationService.getValidationData(observation.getIdImage()); |
observation.setImageCelValidationDatas(observationValidationDatas); |
new MoyenneVotePresenteur(observationValidationDatas).go(view |
.getRatePanel()); |
view.showValidationData(observationValidationDatas); |
new MoyenneVotePresenteur(observationValidationDatas).go(vue.getRatePanel()); |
vue.showValidationData(observationValidationDatas); |
} |
private void handleEvents() { |
view.getMoreDetailsHtml().addClickHandler(new ClickHandler() { |
vue.getMoreDetailsHtml().addClickHandler(new ClickHandler() { |
@Override |
public void onClick(ClickEvent event) { |
if (detailsOpen) { |
view.clearDetails(); |
vue.clearDetails(); |
} else { |
new ObservationDetailPresenteur(observation).go(view |
.getDetailsPanel()); |
view.getMoreDetailsHtml().setHTML( |
"<img src='img/icon_minus.png' />"); |
new ObservationDetailPresenteur(observation).go(vue.getDetailsPanel()); |
vue.getMoreDetailsHtml().setHTML("<img src='img/icon_minus.png' />"); |
} |
detailsOpen = !detailsOpen; |
} |
}); |
view.getProposeValidationDataHtml().addClickHandler(new ClickHandler() { |
vue.getProposeValidationDataHtml().addClickHandler(new ClickHandler() { |
@Override |
public void onClick(ClickEvent event) { |
BusEvenementiel.getInstance().fireEvent( |
new EvenementValidation(observation)); |
BusEvenementiel.getInstance().fireEvent(new EvenementValidation(observation)); |
} |
}); |
} |
/src/org/tela_botanica/del/client/vues/rechercheobservations/CopyOfObservationVue.java |
---|
New file |
0,0 → 1,79 |
package org.tela_botanica.del.client.vues.rechercheobservations; |
import java.util.List; |
import org.tela_botanica.del.client.modeles.Observation; |
import org.tela_botanica.del.client.modeles.ObservationValidation; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.HorizontalPanel; |
import com.google.gwt.user.client.ui.Image; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.VerticalPanel; |
public class CopyOfObservationVue extends Composite { |
private final Panel flowPanel = new VerticalPanel(); |
private final Panel detailsPanel = new VerticalPanel(); |
private final HTML moreDetailsHtml = new HTML("<img src='img/icon_plus.gif' alig='center'>"); |
private final Image waitImage = new Image("img/wait.gif"); |
private final HTML proposeValidationDataHtml = new HTML("<a>Cliquez ici pour proposer votre validation</a>"); |
private final HTML noValidationDataHtml = new HTML("Pas de validation actuellement."); |
private final Panel ratePanel = new HorizontalPanel(); |
protected CopyOfObservationVue() { |
flowPanel.add(waitImage); |
initWidget(flowPanel); |
} |
protected void loadImage(Observation observation) { |
flowPanel.clear(); |
flowPanel.add(new HTML(observation.getSpecies())); |
flowPanel.add(new HTML(observation.getAuteur())); |
flowPanel.add(new HTML("<a href='http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/" + observation.getNumNomenclatural() + "' target='_blank'><img src='" + observation.getUrl() + "' /img></a>")); |
flowPanel.add(moreDetailsHtml); |
flowPanel.add(detailsPanel); |
flowPanel.add(ratePanel); |
} |
protected void showValidationData(List<ObservationValidation> validationDatas) { |
if (validationDatas == null || validationDatas.size() == 0) { |
flowPanel.add(noValidationDataHtml); |
} |
flowPanel.add(proposeValidationDataHtml); |
} |
protected void clearDetails() { |
detailsPanel.clear(); |
moreDetailsHtml.setHTML("<img src='img/icon_plus.gif' >"); |
} |
public Panel getFlowPanel() { |
return flowPanel; |
} |
public Panel getDetailsPanel() { |
return detailsPanel; |
} |
public HTML getMoreDetailsHtml() { |
return moreDetailsHtml; |
} |
public HTML getNoValidationDataHtml() { |
return noValidationDataHtml; |
} |
public HTML getProposeValidationDataHtml() { |
return proposeValidationDataHtml; |
} |
public Panel getRatePanel() { |
return ratePanel; |
} |
} |
/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationVue.java |
---|
5,89 → 5,102 |
import org.tela_botanica.del.client.modeles.Observation; |
import org.tela_botanica.del.client.modeles.ObservationValidation; |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.uibinder.client.UiBinder; |
import com.google.gwt.uibinder.client.UiField; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.FlowPanel; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.HorizontalPanel; |
import com.google.gwt.user.client.ui.Image; |
import com.google.gwt.user.client.ui.Label; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.VerticalPanel; |
import com.google.gwt.user.client.ui.Widget; |
public class ObservationVue extends Composite { |
private final Panel flowPanel = new VerticalPanel(); |
// Annotation can be used to change the name of the associated xml file |
// @UiTemplate("ObservationVue.ui.xml") |
interface MyUiBinder extends UiBinder<Widget, ObservationVue> { |
} |
private final Panel detailsPanel = new VerticalPanel(); |
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); |
private final HTML moreDetailsHtml = new HTML( |
"<img src='img/icon_plus.gif' alig='center'>"); |
@UiField |
Label nomEspece, nomAuteur, nomObservateur, nomRetenu, dateObservation, famille, localite; |
private final Image waitImage = new Image("img/wait.gif"); |
@UiField |
Image imagePrincipale; |
private final HTML proposeValidationDataHtml = new HTML( |
"<a>Cliquez ici pour proposer votre validation</a>"); |
private final HTML noValidationDataHtml = new HTML( |
"Pas de validation actuellement."); |
private final Panel ratePanel = new HorizontalPanel(); |
protected ObservationVue() { |
flowPanel.add(waitImage); |
initWidget(flowPanel); |
public ObservationVue() { |
// sets listBox |
initWidget(uiBinder.createAndBindUi(this)); |
} |
protected void loadImage(Observation observation) { |
flowPanel.clear(); |
flowPanel.add(new HTML(observation.getSpecies())); |
flowPanel.add(new HTML(observation.getAuteur())); |
flowPanel.add(new HTML( |
"<a href='http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/" |
+ observation.getNumNomenclatural() |
+ "' target='_blank'><img src='" + observation.getUrl() |
+ "' /img></a>")); |
flowPanel.add(moreDetailsHtml); |
flowPanel.add(detailsPanel); |
flowPanel.add(ratePanel); |
nomEspece.setText(observation.getSpecies()); |
nomAuteur.setText(observation.getAuteur()); |
imagePrincipale.setUrl(observation.getUrl()); |
nomObservateur.setText(observation.getAuteur()); |
nomRetenu.setText(observation.getNomRetenu()); |
dateObservation.setText(observation.getDate()); |
famille.setText(observation.getFamille()); |
localite.setText(observation.getLocalite()); |
/* |
* flowPanel.clear(); flowPanel.add(new HTML(observation.getSpecies())); |
* flowPanel.add(new HTML(observation.getAuteur())); flowPanel.add(new |
* HTML("<a href='http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/" + |
* observation.getNumNomenclatural() + "' target='_blank'><img src='" + |
* observation.getUrl() + "' /img></a>")); |
* flowPanel.add(moreDetailsHtml); flowPanel.add(detailsPanel); |
* flowPanel.add(ratePanel); |
*/ |
} |
protected void showValidationData( |
List<ObservationValidation> validationDatas) { |
protected void showValidationData(List<ObservationValidation> validationDatas) { |
/* |
* if (validationDatas == null || validationDatas.size() == 0) { |
* flowPanel.add(noValidationDataHtml); } |
* flowPanel.add(proposeValidationDataHtml); |
*/ |
if (validationDatas == null || validationDatas.size() == 0) { |
flowPanel.add(noValidationDataHtml); |
} |
flowPanel.add(proposeValidationDataHtml); |
} |
protected void clearDetails() { |
detailsPanel.clear(); |
moreDetailsHtml.setHTML("<img src='img/icon_plus.gif' >"); |
/* |
* detailsPanel.clear(); |
* moreDetailsHtml.setHTML("<img src='img/icon_plus.gif' >"); |
*/ |
} |
public Panel getFlowPanel() { |
return flowPanel; |
// return flowPanel; |
return new FlowPanel(); |
} |
public Panel getDetailsPanel() { |
return detailsPanel; |
// return detailsPanel; |
return new FlowPanel(); |
} |
public HTML getMoreDetailsHtml() { |
return moreDetailsHtml; |
// return moreDetailsHtml; |
return new HTML(); |
} |
public HTML getNoValidationDataHtml() { |
return noValidationDataHtml; |
// return noValidationDataHtml; |
return new HTML(); |
} |
public HTML getProposeValidationDataHtml() { |
return proposeValidationDataHtml; |
// return proposeValidationDataHtml; |
return new HTML(); |
} |
public Panel getRatePanel() { |
return ratePanel; |
// return ratePanel; |
return new FlowPanel(); |
} |
} |
/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationRecherchePresenteur.java |
---|
1,7 → 1,5 |
package org.tela_botanica.del.client.vues.rechercheobservations; |
import java.util.ArrayList; |
import java.util.Iterator; |
import java.util.List; |
import org.tela_botanica.del.client.modeles.Observation; |
12,8 → 10,6 |
import com.google.gwt.event.dom.client.ClickEvent; |
import com.google.gwt.event.dom.client.ClickHandler; |
import com.google.gwt.user.client.ui.HasWidgets; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.VerticalPanel; |
public class ObservationRecherchePresenteur { |
33,6 → 29,8 |
@SuppressWarnings("deprecation") |
public void gererEvenements() { |
// FIXME : temporaire, juste pour débug |
chargerObservations(); |
vue.getLabelChercher().addClickHandler(new ClickHandler() { |
63,24 → 61,11 |
// TODO : créer une méthode globale pour l'application ? voir |
// superclasse présenteur ? |
// FIXME : ne s'affiche pas |
vue.startChargement(); |
vue.chargerPanneauxObservation(observations); |
// TODO : déplacer dans la vue |
List<Panel> imagePanels = new ArrayList<Panel>(); |
for (int i = 0; i < observations.size(); i++) { |
Panel imagePanel = new VerticalPanel(); |
imagePanels.add(imagePanel); |
vue.addImagePanel(imagePanel); |
} |
vue.afficherPanneauxImage(0, vue.getNbImagesPerPage()); |
Iterator<Panel> panelIterator = imagePanels.iterator(); |
for (Observation observation : observations) { |
Panel imagePanel = panelIterator.next(); |
new ObservationPresenteur(observation).go(imagePanel); |
} |
createPaginationWidget(observations.size()); |
vue.stopChargement(); |
/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationRechercheVue.java |
---|
1,8 → 1,11 |
package org.tela_botanica.del.client.vues.rechercheobservations; |
import java.util.ArrayList; |
import java.util.Iterator; |
import java.util.List; |
import org.tela_botanica.del.client.modeles.Observation; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.FlexTable; |
import com.google.gwt.user.client.ui.FlowPanel; |
70,8 → 73,20 |
panneauxImages.clear(); |
} |
protected void addImagePanel(Panel imagePanel) { |
this.panneauxImages.add(imagePanel); |
protected void chargerPanneauxObservation(List<Observation> observations) { |
List<Panel> imagePanels = new ArrayList<Panel>(); |
for (int i = 0; i < observations.size(); i++) { |
Panel imagePanel = new VerticalPanel(); |
imagePanels.add(imagePanel); |
panneauxImages.add(imagePanel); |
} |
Iterator<Panel> panelIterator = imagePanels.iterator(); |
for (Observation observation : observations) { |
Panel imagePanel = panelIterator.next(); |
new ObservationPresenteur(observation).go(imagePanel); |
} |
} |
protected void afficherPanneauxImage(int first, int last) { |
/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationVue.ui.xml |
---|
New file |
0,0 → 1,37 |
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:C="urn:import:org.cobogw.gwt.user.client.CSS"> |
<ui:with field='res' type='org.tela_botanica.del.client.Ressources'/> |
<g:HTMLPanel> |
<g:VerticalPanel> |
<g:Label ui:field="nomEspece">Nom</g:Label> |
<g:Label ui:field="nomAuteur">Auteur</g:Label> |
<g:Image ui:field="imagePrincipale" resource='{res.logo}'/> |
</g:VerticalPanel> |
<g:DisclosurePanel> |
<g:header>Plus</g:header> |
<g:VerticalPanel> |
<g:HorizontalPanel> |
<g:Label>Observateur :</g:Label> |
<g:Label ui:field="nomObservateur">Nom observateur</g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label>Nom retenu :</g:Label> |
<g:Label ui:field="nomRetenu">Nom retenu</g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label>Date :</g:Label> |
<g:Label ui:field="dateObservation">Date observation</g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label>Famille :</g:Label> |
<g:Label ui:field="famille">Famille</g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label>Localite :</g:Label> |
<g:Label ui:field="localite">Localite</g:Label> |
</g:HorizontalPanel> |
</g:VerticalPanel> |
</g:DisclosurePanel> |
</g:HTMLPanel> |
</ui:UiBinder> |