/src/org/tela_botanica/del/client/vues/rechercheimages/vote/DetailVoteVue.java |
---|
New file |
0,0 → 1,28 |
package org.tela_botanica.del.client.vues.rechercheimages.vote; |
import java.util.List; |
import org.tela_botanica.del.client.modeles.VoteProtocole; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.VerticalPanel; |
public class DetailVoteVue extends Composite { |
private Panel mainPanel = new VerticalPanel(); |
protected DetailVoteVue(List<VoteProtocole> validationDatas) { |
for (VoteProtocole imageCelValidationData : validationDatas) { |
mainPanel.add(new HTML("Vote " + imageCelValidationData.getVote() |
+ " par " + imageCelValidationData.getContributeur())); |
} |
initWidget(mainPanel); |
} |
} |
/src/org/tela_botanica/del/client/vues/rechercheimages/vote/moyenne.css |
---|
New file |
0,0 → 1,3 |
.moyenne {} |
.petit {font-size:11px; color:#AAA} |
.voter {position:absolute; margin-top:65px; margin-left:20px;} |
/src/org/tela_botanica/del/client/vues/rechercheimages/vote/MoyenneVoteVue.ui.xml |
---|
New file |
0,0 → 1,10 |
<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="moyenne.css" /> |
<g:HTMLPanel styleName="{style.moyenne}"> |
<g:HorizontalPanel styleName="{style.voter}"><g:FocusPanel ui:field="voter"/><g:Label text="Votes :" styleName="{style.petit}"/><g:Label ui:field="nbVotes" styleName="{style.petit}"/></g:HorizontalPanel> |
</g:HTMLPanel> |
</ui:UiBinder> |
/src/org/tela_botanica/del/client/vues/rechercheimages/vote/MoyenneVotePresenteur.java |
---|
New file |
0,0 → 1,20 |
package org.tela_botanica.del.client.vues.rechercheimages.vote; |
import java.util.List; |
import org.tela_botanica.del.client.modeles.VoteProtocole; |
import com.google.gwt.user.client.ui.HasWidgets; |
public class MoyenneVotePresenteur { |
private MoyenneVoteVue view; |
public MoyenneVotePresenteur(List<VoteProtocole> validationDatas) { |
view = new MoyenneVoteVue(validationDatas); |
} |
public void go(HasWidgets container) { |
container.add(view); |
} |
} |
/src/org/tela_botanica/del/client/vues/rechercheimages/vote/MoyenneVoteVue.java |
---|
New file |
0,0 → 1,54 |
package org.tela_botanica.del.client.vues.rechercheimages.vote; |
import java.util.List; |
import org.cobogw.gwt.user.client.ui.Rating; |
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.Panel; |
import com.google.gwt.user.client.ui.VerticalPanel; |
import com.google.gwt.user.client.ui.Widget; |
public class MoyenneVoteVue extends Composite { |
// Annotation can be used to change the name of the associated xml file |
// @UiTemplate("MoyenneVoteVue.ui.xml") |
interface MyUiBinder extends UiBinder<Widget, MoyenneVoteVue> { |
} |
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); |
private Panel mainPanel = new VerticalPanel(); |
@UiField |
FocusPanel voter; |
@UiField |
Label nbVotes; |
protected MoyenneVoteVue(List<VoteProtocole> validationDatas) { |
initWidget(uiBinder.createAndBindUi(this)); |
int meanVote = 0; |
int nbVote = 0; |
for (VoteProtocole imageCelValidationData : validationDatas) { |
meanVote += imageCelValidationData.getVote(); |
nbVote++; |
} |
if (nbVote > 0) |
meanVote /= nbVote; |
Rating rating = new Rating(meanVote, 5); |
rating.setReadOnly(true); |
voter.add(rating); |
nbVotes.setText(String.valueOf(validationDatas.size())); |
} |
} |
/src/org/tela_botanica/del/client/vues/rechercheimages/vote/DetailVotePresenteur.java |
---|
New file |
0,0 → 1,20 |
package org.tela_botanica.del.client.vues.rechercheimages.vote; |
import java.util.List; |
import org.tela_botanica.del.client.modeles.VoteProtocole; |
import com.google.gwt.user.client.ui.HasWidgets; |
public class DetailVotePresenteur { |
private DetailVoteVue view; |
public DetailVotePresenteur(List<VoteProtocole> validationDatas) { |
view = new DetailVoteVue(validationDatas); |
} |
public void go(HasWidgets container) { |
container.add(view); |
} |
} |