Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 206 → Rev 210

/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/EnsembleVotesVue.java
New file
0,0 → 1,33
package org.tela_botanica.del.client.vues.plateformedetermination.vote;
 
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.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
 
public class EnsembleVotesVue extends Composite {
 
interface MyUiBinder extends UiBinder<Widget, EnsembleVotesVue> {
}
 
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
 
@UiField()
VerticalPanel panneauVotes;
 
public EnsembleVotesVue() {
initWidget(uiBinder.createAndBindUi(this));
}
 
public VerticalPanel getPanneauVotes() {
return panneauVotes;
}
 
public void setPanneauVotes(VerticalPanel panneauVotes) {
this.panneauVotes = panneauVotes;
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/barrerepartition/BarreRepartitionVoteVue.ui.xml
New file
0,0 → 1,13
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" />
<ui:style src="barreRepartitionVote.css" />
<g:HTMLPanel>
<div class="conteneurBoutonVote">
<g:PushButton ui:field="boutonOui" styleName="{style.boutonVote}" />
<g:PushButton ui:field="boutonNon" styleName="{style.boutonVote}" />
</div>
<g:HTML ui:field="barreRepartitionHtmlBrut" styleName="conteneurBarreRepartition"/>
</g:HTMLPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/barrerepartition/BarreRepartitionVotePresenteur.java
New file
0,0 → 1,83
package org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition;
 
import java.util.Date;
 
import org.tela_botanica.del.client.modeles.MoyenneVote;
import org.tela_botanica.del.client.modeles.VoteDetermination;
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
import org.tela_botanica.del.client.utils.MockDatasource;
 
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasWidgets;
 
public class BarreRepartitionVotePresenteur {
private BarreRepartitionVoteVue vue = new BarreRepartitionVoteVue();
 
private MockDatasource validationService = MockDatasource.getInstance();
private MoyenneVote moyenneVote;
public void go(HasWidgets container) {
container.add(vue);
}
 
public void afficherVotes(MoyenneVote moyenneVote) {
this.moyenneVote = moyenneVote;
vue.afficherVotes(moyenneVote.getScore(), moyenneVote.getIntituleAssocie());
gererEvenements();
}
public BarreRepartitionVoteVue getBarreRepartitionVoteVue() {
return vue;
}
public HTML getBarreRepartitionVoteVueHTML() {
return vue.getBarreRepartitionHtmlBrut();
}
public void gererEvenements() {
vue.getBoutonOui().addClickHandler(new ClickHandler() {
 
@Override
public void onClick(ClickEvent event) {
VoteDetermination vd = new VoteDetermination();
vd.setContributeur("test");
vd.setDate(new Date());
vd.setVote(1);
vd.setId("3");
vue.getBoutonOui().setEnabled(false);
vue.getBoutonNon().setEnabled(true);
moyenneVote.getPropositionAssociee().ajouterVoteDetermination(vd);
moyenneVote = CalculVoteDeterminationService.calculerVoteDetermination(moyenneVote.getPropositionAssociee());
afficherVotes(moyenneVote);
}
});
vue.getBoutonNon().addClickHandler(new ClickHandler() {
 
@Override
public void onClick(ClickEvent event) {
VoteDetermination vd = new VoteDetermination();
vd.setContributeur("test");
vd.setDate(new Date());
vd.setVote(0);
vd.setId("3");
vue.getBoutonOui().setEnabled(true);
vue.getBoutonNon().setEnabled(false);
moyenneVote.getPropositionAssociee().ajouterVoteDetermination(vd);
moyenneVote = CalculVoteDeterminationService.calculerVoteDetermination(moyenneVote.getPropositionAssociee());
afficherVotes(moyenneVote);
}
});
}
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/barrerepartition/BarreRepartitionVoteVue.java
New file
0,0 → 1,72
package org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition;
 
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.HTML;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.Widget;
 
public class BarreRepartitionVoteVue extends Composite implements IsWidget {
interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> {}
 
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
private int pourcentage = -1;
private int tailleBarre = 0;
private String nomTaxon = "";
@UiField(provided = true)
public PushButton boutonOui = new PushButton("+");
@UiField(provided = true)
public PushButton boutonNon = new PushButton("-");
@UiField(provided = true)
public HTML barreRepartitionHtmlBrut = new HTML("<div class=\"barreRepartition\"></div>");
public BarreRepartitionVoteVue() {
initWidget(uiBinder.createAndBindUi(this));
boutonNon.setWidth("20px");
boutonOui.setWidth("20px");
}
public void afficherVotes(int pourcentage, String NomTaxon) {
this.pourcentage = pourcentage;
this.nomTaxon = NomTaxon;
tailleBarre = (pourcentage > -1) ? pourcentage : 0;
String classe = "barreRepartition";
if(pourcentage == -1) {
classe = "barreRepartitionAucunVote";
}
String chaineHtml = "<div class=\"conteneurBarreRepartition\">" +
"<div class=\""+classe+"\">"+
"<div style=\"width:"+tailleBarre+"%\" class=\"elementBarreRepartition voteOui\"></div>"+
"</div>"+
"<span class=\"nomTaxonBarreRepartition\">"+nomTaxon+"</span>"+
"</div>";
barreRepartitionHtmlBrut.setHTML(chaineHtml);
}
public HTML getBarreRepartitionHtmlBrut() {
return barreRepartitionHtmlBrut;
}
public PushButton getBoutonOui() {
return boutonOui;
}
public PushButton getBoutonNon() {
return boutonNon;
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/barrerepartition/barreRepartitionVote.css
New file
0,0 → 1,0
.boutonVote {float:left;text-align: center;}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/EnsembleVotesVue.ui.xml
New file
0,0 → 1,10
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" />
<g:HTMLPanel styleName="plein">
<g:Label text="{constants.votes}" styleName="titre"/>
<g:Label text="{constants.infoVotes}" styleName="petit"/>
<g:VerticalPanel ui:field="panneauVotes" styleName="plein"/>
</g:HTMLPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/VoteProtocolePresenteur.java
New file
0,0 → 1,32
package org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole;
 
import java.util.List;
 
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.VoteProtocole;
import org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.moyenne.MoyenneVoteProtocolePresenteur;
import org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.personnel.MonVoteProtocolePresenteur;
 
import com.google.gwt.user.client.ui.HasWidgets;
 
public class VoteProtocolePresenteur {
 
private VoteProtocoleVue vue = new VoteProtocoleVue();
 
private Protocole protocole;
 
private List<VoteProtocole> validationDatas;
 
public VoteProtocolePresenteur(Protocole protocole, List<VoteProtocole> validationDatas) {
this.protocole = protocole;
this.validationDatas = validationDatas;
}
 
public void go(HasWidgets container) {
container.add(vue);
new MoyenneVoteProtocolePresenteur(protocole, validationDatas).go(vue.getMoyenneVotes());
new MonVoteProtocolePresenteur(protocole).go(vue.getMonVote());
 
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/VoteProtocoleVue.java
New file
0,0 → 1,41
package org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole;
 
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.FocusPanel;
import com.google.gwt.user.client.ui.Widget;
 
public class VoteProtocoleVue extends Composite {
 
interface MyUiBinder extends UiBinder<Widget, VoteProtocoleVue> {
}
 
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
 
@UiField
FocusPanel moyenneVotes, monVote;
 
protected VoteProtocoleVue() {
initWidget(uiBinder.createAndBindUi(this));
 
}
 
public FocusPanel getMonVote() {
return monVote;
}
 
public void setMonVote(FocusPanel monVote) {
this.monVote = monVote;
}
 
public FocusPanel getMoyenneVotes() {
return moyenneVotes;
}
 
public void setMoyenneVotes(FocusPanel moyenneVotes) {
this.moyenneVotes = moyenneVotes;
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/personnel/MonVoteProtocoleVue.ui.xml
New file
0,0 → 1,14
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
ui:generateLocales="default">
 
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" />
<g:HorizontalPanel>
<g:VerticalPanel>
<g:Label text="{constants.mon_vote}" />
<g:FocusPanel ui:field="voter" />
</g:VerticalPanel>
<g:Button ui:field="boutonVote" text="{constants.ok}"></g:Button>
</g:HorizontalPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/personnel/MonVoteProtocolePresenteur.java
New file
0,0 → 1,45
package org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.personnel;
 
import java.util.Date;
 
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.VoteProtocole;
import org.tela_botanica.del.client.utils.MockDatasource;
 
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HasWidgets;
 
public class MonVoteProtocolePresenteur {
 
private MonVoteProtocoleVue vue;
 
private Protocole protocole;
 
private MockDatasource voteService = MockDatasource.getInstance();
 
public MonVoteProtocolePresenteur(Protocole protocole) {
this.protocole = protocole;
vue = new MonVoteProtocoleVue();
}
 
public void go(HasWidgets container) {
container.add(vue);
}
 
public void gererEvenements() {
vue.getBoutonVote().addClickHandler(new ClickHandler() {
 
@Override
public void onClick(ClickEvent event) {
VoteProtocole voteProtocole = new VoteProtocole();
voteProtocole.setDate(new Date());
voteProtocole.setVote(vue.getRating().getValue());
voteProtocole.setProtocol(protocole);
 
vue.getRating();
voteService.saveVote(voteProtocole);
}
});
}
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/personnel/MonVoteProtocoleVue.java
New file
0,0 → 1,51
package org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.personnel;
 
import org.cobogw.gwt.user.client.ui.Rating;
 
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.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Widget;
 
public class MonVoteProtocoleVue extends Composite {
 
interface MyUiBinder extends UiBinder<Widget, MonVoteProtocoleVue> {
}
 
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
 
@UiField
FocusPanel voter;
@UiField
Button boutonVote;
private Rating rating = new Rating(0, 5);
 
protected MonVoteProtocoleVue() {
initWidget(uiBinder.createAndBindUi(this));
rating.setReadOnly(false);
voter.add(rating);
 
}
 
public Rating getRating() {
return rating;
}
 
public void setRating(Rating rating) {
this.rating = rating;
}
 
public Button getBoutonVote() {
return boutonVote;
}
 
public void setBoutonVote(Button boutonVote) {
this.boutonVote = boutonVote;
}
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/moyenne/MoyenneVoteProtocoleVue.ui.xml
New file
0,0 → 1,20
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
ui:generateLocales="default">
 
<ui:style src="moyenneVoteProtocole.css" />
 
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" />
<g:HorizontalPanel styleName="{style.protocole} plein">
<g:VerticalPanel styleName="{style.nomProtocole}">
<g:Label ui:field="nomProtocole" text="{constants.chargement}" styleName="gras"/>
<g:FocusPanel ui:field="moyenneVotes" />
</g:VerticalPanel>
<g:VerticalPanel styleName="{style.nbVotes} gras">
<g:Label text="Votes" />
<g:Label ui:field="nbVotes" />
</g:VerticalPanel>
<g:FocusPanel ui:field="monVote" styleName="{style.monVote} gras"/>
</g:HorizontalPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/moyenne/MoyenneVoteProtocolePresenteur.java
New file
0,0 → 1,25
package org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.moyenne;
 
import java.util.List;
 
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.VoteProtocole;
import org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.personnel.MonVoteProtocolePresenteur;
 
import com.google.gwt.user.client.ui.HasWidgets;
 
public class MoyenneVoteProtocolePresenteur {
 
private MoyenneVoteProtocoleVue view;
private Protocole protocole;
 
public MoyenneVoteProtocolePresenteur(Protocole protocole, List<VoteProtocole> validationDatas) {
view = new MoyenneVoteProtocoleVue(protocole, validationDatas);
}
 
public void go(HasWidgets container) {
container.add(view);
new MonVoteProtocolePresenteur(protocole).go(view.getMonVote());
}
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/moyenne/MoyenneVoteProtocoleVue.java
New file
0,0 → 1,58
package org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.moyenne;
 
import java.util.List;
 
import org.cobogw.gwt.user.client.ui.Rating;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.VoteProtocole;
 
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.FocusPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
 
public class MoyenneVoteProtocoleVue extends Composite {
 
interface MyUiBinder extends UiBinder<Widget, MoyenneVoteProtocoleVue> {
}
 
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
 
@UiField
FocusPanel moyenneVotes, monVote;
 
@UiField
Label nbVotes, nomProtocole;
 
protected MoyenneVoteProtocoleVue(Protocole protocole, List<VoteProtocole> validationDatas) {
initWidget(uiBinder.createAndBindUi(this));
 
nomProtocole.setText(protocole.getNom());
 
int meanVote = 0;
int nbVote = 0;
for (VoteProtocole validationData : validationDatas) {
meanVote += validationData.getVote();
nbVote++;
}
if (nbVote > 0)
meanVote /= nbVote;
Rating rating = new Rating(meanVote, 5);
rating.setReadOnly(true);
moyenneVotes.add(rating);
 
nbVotes.setText(String.valueOf(validationDatas.size()));
 
}
 
public FocusPanel getMonVote() {
return monVote;
}
 
public void setMonVote(FocusPanel monVote) {
this.monVote = monVote;
}
}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/moyenne/moyenneVoteProtocole.css
New file
0,0 → 1,3
.nomProtocole {width:250px;}
.monVote, .nbVotes {width:125px}
.protocole {padding:10px 15px 10px 15px; border:solid 1px #ddd; margin-bottom:1px}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/voteProtocole.css
New file
0,0 → 1,2
.tiers {border :solid 1px red}
.nomProtocole {border:solid 1px}
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/VoteProtocoleVue.ui.xml
New file
0,0 → 1,14
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
ui:generateLocales="default">
 
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" />
<ui:style src="voteProtocole.css" />
 
<g:HorizontalPanel>
<g:Label ui:field="nomProtocole" text="{constants.chargement}" />
<g:FocusPanel ui:field="moyenneVotes" />
<g:FocusPanel ui:field="monVote" />
</g:HorizontalPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/EnsembleVotesPresenteur.java
New file
0,0 → 1,36
package org.tela_botanica.del.client.vues.plateformedetermination.vote;
 
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.VoteProtocole;
import org.tela_botanica.del.client.utils.MockDatasource;
import org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.moyenne.MoyenneVoteProtocolePresenteur;
 
import com.google.gwt.user.client.ui.HasWidgets;
 
public class EnsembleVotesPresenteur {
 
private EnsembleVotesVue vue = new EnsembleVotesVue();
 
private MockDatasource validationService = MockDatasource.getInstance();
 
public void go(HasWidgets container) {
container.add(vue);
afficherVotes();
}
 
private void afficherVotes() {
 
String idImageCourante = CacheClient.getInstance().getImageCourante().getIdImage();
 
Protocole protocoleEsthetisme = validationService.getProtocole(Protocole.ESTHETISME);
List<VoteProtocole> observationValidationsEsthetisme = validationService.getVoteByImageAndProtocol(idImageCourante, Protocole.ESTHETISME);
new MoyenneVoteProtocolePresenteur(protocoleEsthetisme, observationValidationsEsthetisme).go(vue.getPanneauVotes());
 
Protocole protocoleIdentification = validationService.getProtocole(Protocole.IDENTIFICATION_AUTOMATIQUE);
List<VoteProtocole> observationValidationsIdentification = validationService.getVoteByImageAndProtocol(idImageCourante, Protocole.IDENTIFICATION_AUTOMATIQUE);
new MoyenneVoteProtocolePresenteur(protocoleIdentification, observationValidationsIdentification).go(vue.getPanneauVotes());
}
}