Skip to content

Commit

Permalink
Replace div progress bars with Bootstrap progress bars
Browse files Browse the repository at this point in the history
  • Loading branch information
mbogoevici committed Jun 5, 2012
1 parent 467c16c commit 08f7669
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
Expand Up @@ -16,6 +16,7 @@

package org.jboss.jdf.example.ticketmonster.monitor.client.local;

import com.google.gwt.user.client.ui.HTML;
import org.jboss.jdf.example.ticketmonster.model.Performance;

import com.google.gwt.i18n.client.DateTimeFormat;
Expand Down Expand Up @@ -76,23 +77,21 @@ private void setBookingStatus() {
private void setProgress() {
int soldPercent = Math.round((soldTickets / (float) capacity) * 100);

if (soldPercentLabel != null) {
progressBar.remove(soldPercentLabel);
String colour;
if (soldPercent >= 100) {
colour = "progress-danger";
} else if (soldPercent > 90) {
colour = "progress-warning";
} else {
colour = "progress-success";
}
soldPercentLabel = new HTML("<div class=\"performance-status-progress progress " + colour + "\">\n" +
" <div class=\"bar\"\n" +
" style=\"width: " + soldPercent + "%;\"></div>\n" +
"</div>");

if (availablePercentLabel != null) {
progressBar.remove(availablePercentLabel);
}

soldPercentLabel = new Label();
soldPercentLabel.setStyleName("performance-status-progress-sold");
soldPercentLabel.setWidth(soldPercent + "px");

availablePercentLabel = new Label();
availablePercentLabel.setStyleName("performance-status-progress-available");
availablePercentLabel.setWidth((100 - soldPercent) + "px");

progressBar.clear();
progressBar.add(soldPercentLabel);
progressBar.add(availablePercentLabel);

}
}
12 changes: 3 additions & 9 deletions demo/src/main/webapp/resources/css/screen.css
Expand Up @@ -404,8 +404,7 @@ footer a {
margin-top: 10px;
margin-right: 5px;
margin-left: 5px;
background-color: #f5f5f5;

background-color: #ffffff;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
Expand All @@ -431,16 +430,11 @@ footer a {
padding: 0px;
}

.performance-status-progress-sold {
.performance-status-progress{
margin-left: 20px;
height: 18px;
background: #cc0000;
}

.performance-status-progress-available {
margin-right: 20px;
height: 18px;
background: #009900;
width: 120px;
}

.bot-label {
Expand Down

0 comments on commit 08f7669

Please sign in to comment.