double CalsPerDay = Landing.bmr + 3500
* (TargetWeight - CurrentWeight) / diff;
RootPanel root = RootPanel.get("CalPerDay");
DecoratorPanel perDayDecoratorPanel = new DecoratorPanel();
perDayDecoratorPanel.setWidth("180px");
root.add(perDayDecoratorPanel);
FlexTable cPerDayFlexTable = new FlexTable();
String message = "";
double gainedToday = Landing.mealCal
- Landing.workoutCal;
int a = (int) CalsPerDay;
message = "<b>Daily net calorie: </b></br><pre> "
+ (int)CalsPerDay + " cal/day</pre>";
message += "<b>From today's meal/workout: </b></br><pre> "
+ (int) gainedToday + " cal</pre>";
double resultCals = (int) (CalsPerDay - gainedToday);
resultCals = 0 - resultCals;
if (resultCals > a) {
int res = (int) (CalsPerDay - gainedToday);
if (res > 0) {
message += "<b>Exceeded your goal by : </b></br><pre> "
+ res + " cal</pre>";
} else {
res = 0 - res;
message += "<b>Exceeded your goal by : </b></br><pre> "
+ res + " cal</pre>";
}
} else {
if (resultCals > 0) {
message += "<b>You can eat up to: </b></br><pre> "
+ resultCals + " cal</pre>";
} else {
resultCals = 0 - resultCals;
message += "<b>You can eat up to: </b></br><pre> "
+ resultCals + " cal</pre>";
}
}
HTML html = new HTML(message);
cPerDayFlexTable.setWidget(0, 0, html);
cPerDayFlexTable.getCellFormatter().addStyleName(0, 0,
"calorieSummary");
perDayDecoratorPanel.add(cPerDayFlexTable);
}
@Override
public void onFailure(Throwable caught) {