* @param questionId
* @param showVotes
* @return
*/
public PollsAjax.VoteAnswer displayPollResults(String questionId, boolean showVotes) {
PollsAPI pollsAPI = APILocator.getPollAPI();
NumberFormat numberFormat = NumberFormat.getNumberInstance();
NumberFormat percentFormat = NumberFormat.getPercentInstance();
StringBuffer htmlResult = new StringBuffer(512);
htmlResult.ensureCapacity(128);
int totalVotes = pollsAPI.getTotalVotes(questionId);
PollsQuestion question = pollsAPI.getQuestion(questionId);
List choices = pollsAPI.getChoices(questionId);
htmlResult.append("<div id='result" + questionId + "'>");
//htmlResult.append("<h2>" + question.getDescription() + "</h2>");
htmlResult.append("<table class='poll-result-table'>");
for (int i = 0; i < choices.size(); i++) {
PollsChoice choice = (PollsChoice) choices.get(i);
int choiceVotes = pollsAPI.getChoiceVotes(questionId, choice
.getChoiceId());
double votesPercent = 0.0;
if (totalVotes > 0) {
votesPercent = (double) choiceVotes / totalVotes;