Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 14 → Rev 66

/src/org/tela_botanica/del/client/vues/rechercheobservations/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/rechercheobservations/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/rechercheobservations/vote/MoyenneVoteVue.java
5,17 → 5,35
import org.cobogw.gwt.user.client.ui.Rating;
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.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
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<ObservationValidation> validationDatas) {
initWidget(uiBinder.createAndBindUi(this));
 
int meanVote = 0;
int nbVote = 0;
26,19 → 44,11
}
if (nbVote > 0)
meanVote /= nbVote;
 
Panel ratePanel = new HorizontalPanel();
Rating rating = new Rating(meanVote, 5);
rating.setReadOnly(true);
voter.add(rating);
 
ratePanel.add(new HTML("Moyenne: "));
ratePanel.add(rating);
ratePanel.add(new HTML("&nbsp;&nbsp;Nb votes: "
+ validationDatas.size()));
nbVotes.setText(String.valueOf(validationDatas.size()));
 
mainPanel.add(ratePanel);
 
initWidget(mainPanel);
 
}
}