/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocol/MoyenneVoteProtocoleVue.java |
---|
File deleted |
/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocol/MoyenneVoteProtocoleVue.ui.xml |
---|
File deleted |
/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocol/MoyenneVoteProtocolePresenteur.java |
---|
File deleted |
/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; |
} |
} |
/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); |
} |
}); |
} |
} |
/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; |
} |
} |
/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/personnel/MonVoteProtocoleVue.ui.xml |
---|
New file |
0,0 → 1,19 |
<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:HTMLPanel> |
<g:HorizontalPanel> |
<g:FocusPanel ui:field="voter" /> |
<g:Label text="{constants.mon_vote}" /> |
<g:Button ui:field="boutonVote" text="{constants.ok}"></g:Button> |
</g:HorizontalPanel> |
</g:HTMLPanel> |
</ui:UiBinder> |
/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:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" /> |
<g:HTMLPanel> |
<g:HorizontalPanel> |
<g:Label ui:field="nomProtocole" text="{constants.chargement}" /> |
<g:FocusPanel ui:field="moyenneVotes" /> |
<g:Label text="Votes :" /> |
<g:Label ui:field="nbVotes" /> |
<g:FocusPanel ui:field="monVote" /> |
</g:HorizontalPanel> |
</g:HTMLPanel> |
</ui:UiBinder> |
/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.ObservationValidation; |
import org.tela_botanica.del.client.modeles.Protocole; |
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<ObservationValidation> validationDatas) { |
view = new MoyenneVoteProtocoleVue(protocole, validationDatas); |
} |
public void go(HasWidgets container) { |
container.add(view); |
new MonVoteProtocolePresenteur(protocole).go(view.getMonVote()); |
} |
} |
/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/moyenne/MoyenneVoteProtocoleVue.java |
---|
New file |
0,0 → 1,59 |
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.ObservationValidation; |
import org.tela_botanica.del.client.modeles.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.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<ObservationValidation> validationDatas) { |
initWidget(uiBinder.createAndBindUi(this)); |
nomProtocole.setText(protocole.getNom()); |
int meanVote = 0; |
int nbVote = 0; |
for (ObservationValidation 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; |
} |
} |
/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/protocole/VoteProtocoleVue.ui.xml |
---|
New file |
0,0 → 1,18 |
<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:HTMLPanel> |
<g:HorizontalPanel> |
<g:Label ui:field="nomProtocole" text="{constants.chargement}" /> |
<g:FocusPanel ui:field="moyenneVotes" /> |
<g:FocusPanel ui:field="monVote" /> |
</g:HorizontalPanel> |
</g:HTMLPanel> |
</ui:UiBinder> |
/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.ObservationValidation; |
import org.tela_botanica.del.client.modeles.Protocole; |
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<ObservationValidation> validationDatas; |
public VoteProtocolePresenteur(Protocole protocole, List<ObservationValidation> 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()); |
} |
} |
/src/org/tela_botanica/del/client/vues/plateformedetermination/vote/EnsembleVotesPresenteur.java |
---|
3,11 → 3,10 |
import java.util.List; |
import org.tela_botanica.del.client.cache.CacheClient; |
import org.tela_botanica.del.client.i18n.I18n; |
import org.tela_botanica.del.client.modeles.ObservationValidation; |
import org.tela_botanica.del.client.modeles.Protocole; |
import org.tela_botanica.del.client.utils.MockDatasource; |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.protocol.MoyenneVoteProtocolePresenteur; |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.moyenne.MoyenneVoteProtocolePresenteur; |
import com.google.gwt.user.client.ui.HasWidgets; |
25,11 → 24,13 |
private void afficherVotes() { |
String idImageCourante = CacheClient.getInstance().getCurrentObservation().getIdImage(); |
Protocole protocoleEsthetisme = validationService.getProtocole(Protocole.ESTHETISME); |
List<ObservationValidation> observationValidationsEsthetisme = validationService.getValidationDataByImageAndProtocol(idImageCourante, Protocole.ESTHETISME); |
new MoyenneVoteProtocolePresenteur(I18n.getVocabulary().protocole_esthetisme(), observationValidationsEsthetisme).go(vue.getPanneauVotes()); |
new MoyenneVoteProtocolePresenteur(protocoleEsthetisme, observationValidationsEsthetisme).go(vue.getPanneauVotes()); |
Protocole protocoleIdentification = validationService.getProtocole(Protocole.IDENTIFICATION_AUTOMATIQUE); |
List<ObservationValidation> observationValidationsIdentification = validationService.getValidationDataByImageAndProtocol(idImageCourante, Protocole.IDENTIFICATION_AUTOMATIQUE); |
new MoyenneVoteProtocolePresenteur(I18n.getVocabulary().protocole_identification_auto(), observationValidationsIdentification).go(vue.getPanneauVotes()); |
new MoyenneVoteProtocolePresenteur(protocoleIdentification, observationValidationsIdentification).go(vue.getPanneauVotes()); |
} |
} |