Examples of FoodItem


Examples of com.bestfit.data.FoodItem

        for (FoodItem foodItem : meal.getFoodItems()) {
          for (int i = 0; i < meal.getQuantity(foodItem); i++)
            newMeal.addFoodItem(foodItem);
          int row = newMeal.indexOfFoodItem(foodItem) + 1;
          int qty = newMeal.getQuantity(foodItem);
          final FoodItem foodItem2 = foodItem;
          FoodsFlexTable.setText(row, 0, foodItem.getName());
          FoodsFlexTable.setText(row, 1, "x" + qty);
          FoodsFlexTable.setText(row, 2,
              Double.toString((int) foodItem.getCalories() * qty));
          FoodsFlexTable.setText(
 
View Full Code Here

Examples of com.bestfit.data.FoodItem

  }

  protected void addFood() {
    try {
      FoodsFlexTable.setVisible(true);
      final FoodItem foodItem = foods.get(NewFoodItemList
          .getSelectedIndex());
      NewFoodItemList.setFocus(true);
      int row, qty;
      if (newMeal.addFoodItem(foodItem)) {
        qty = 1;
        row = FoodsFlexTable.getRowCount();
        FoodsFlexTable.setText(row, 0, foodItem.getName());
      } else {
        qty = newMeal.getQuantity(foodItem);
        row = newMeal.indexOfFoodItem(foodItem) + 1;
      }
      FoodsFlexTable.setText(row, 1, "x" + qty);
      FoodsFlexTable.setText(row, 2,
          Double.toString((int) foodItem.getCalories() * qty));
      FoodsFlexTable.setText(row, 3,
          Double.toString((int) foodItem.getFatCalories() * qty));
      FoodsFlexTable.setText(row, 4,
          Double.toString((int) foodItem.getFatGrams() * qty));
      FoodsFlexTable.setText(row, 5,
          Double.toString((int) foodItem.getCarbohydrates() * qty));
      FoodsFlexTable.setText(row, 6,
          Double.toString((int) foodItem.getProtein() * qty));
      TotalCalsTextBox.setText(Double.toString((int) newMeal
          .totalCalories()));
      Button removeFood = new Button("x");
      removeFood.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
View Full Code Here

Examples of com.bestfit.data.FoodItem

  }
 
  public void addFoodItems()
  {
    FoodItem items[] = new FoodItem[10];
    items[0] = new FoodItem("Egg, Whole, Cooked, Medium", 71, 40, 5.15, .48, 5.28);
    items[1] = new FoodItem("Egg, Whole, Cooked, Large", 81, 45, 5.86, .55, 6);
    items[2] = new FoodItem("Egg, Whole, Cooked, Extra Large", 94, 51, 6.79, .64, 6.96);
    items[3] = new FoodItem("Bacon, Medium Slice", 43, 40, 3.34, .11, 2.96);
    items[4] = new FoodItem("Pancake, Buttermilk, 5-1/2\" dia", 110, 28, 2.53, 19.25, 2.61);
    items[5] = new FoodItem("Waffle, Round, 4\" dia", 121, 36, 3.72, 19.05, 2.85);
    items[6] = new FoodItem("Bread, White, Toasted, 1 Slice", 73, 17, 1, 13.6, 2.25);
    items[7] = new FoodItem("Bread, Wheat, Toasted, 1 Slice", 76, 16, 1.02, 12.79, 4.07);
    items[8] = new FoodItem("Milk, 2%, 1 Cup", 122, 68, 4.83, 11.71, 8.05);
    items[9] = new FoodItem("Orange Juice, 1 Cup", 122, 7, .3, 28.73, 1.69);
   
    for (int i = 0; i < items.length; i++) {
      saveFoodItem(items[i]);
    }
   
View Full Code Here

Examples of com.din.din.model.entities.FoodItem

    try {
      if(!transaction.isActive()) {
        contained = true;
        transaction.begin();
      }
      FoodItem item;     
      if(system == MeasurementSystem.Imperial) {
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.bacon"));
        item.setDescription(BeanUtil.getMessage("foodItem.bacon.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.meats"));
        item.setProject(project);
        save(entityManager, item, cache);
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.icebergLettuce"));
        item.setDescription(BeanUtil.getMessage("foodItem.icebergLettuce.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.vegetables"));
        item.setProject(project);
        save(entityManager, item, cache);
   
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.tomato"));
        item.setDescription(BeanUtil.getMessage("foodItem.tomato.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.vegetables"));
        item.setProject(project);
        save(entityManager, item, cache);
   
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.mayonnaise"));
        item.setDescription(BeanUtil.getMessage("foodItem.mayonnaise.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.condiments"));
        item.setProject(project);
        save(entityManager, item, cache);
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.sandwichBread"));
        item.setDescription(BeanUtil.getMessage("foodItem.sandwichBread.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.carbohydrates"));
        item.setProject(project);
        save(entityManager, item, cache)
      } else {
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.potato"));
        item.setDescription(BeanUtil.getMessage("foodItem.potato.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.vegetables"));
        item.setProject(project);
        save(entityManager, item, cache)
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.chives"));
        item.setDescription(BeanUtil.getMessage("foodItem.chives.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.vegetables"));
        item.setProject(project);
        save(entityManager, item, cache)
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.butter"));
        item.setDescription(BeanUtil.getMessage("foodItem.butter.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.fatsOils"));
        item.setProject(project);
        save(entityManager, item, cache)
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.onion"));
        item.setDescription(BeanUtil.getMessage("foodItem.onion.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.vegetables"));
        item.setProject(project);
        save(entityManager, item, cache)
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.egg"));
        item.setDescription(BeanUtil.getMessage("foodItem.egg.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.proteins"));
        item.setProject(project);
        save(entityManager, item, cache)
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.cheddarCheese"));
        item.setDescription(BeanUtil.getMessage("foodItem.cheddarCheese.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.dairy"));
        item.setProject(project);
        save(entityManager, item, cache)
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.salt"));
        item.setDescription(BeanUtil.getMessage("foodItem.salt.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.spices"));
        item.setProject(project);
        save(entityManager, item, cache)
       
        item = new FoodItem();
        item.setName(BeanUtil.getMessage("foodItem.pepper"));
        item.setDescription(BeanUtil.getMessage("foodItem.pepper.description"));
        item.setCategory(BeanUtil.getMessage("foodItem.category.spices"));
        item.setProject(project);
        save(entityManager, item, cache);       
      }
      if(contained) {
        transaction.commit();
      }
View Full Code Here

Examples of com.din.din.model.entities.FoodItem

 
  @Override
  public synchronized String editStart() {
    String returnStr = super.editStart();
   
    FoodItem selected = getSelected();   
    if(selected == null) {
      FoodItem foodItem = new FoodItem();
      selected = foodItem;
      foodItem.setProject(getProject());
    }
    getWizard().setEntity(selected);   
    return returnStr;
  }
View Full Code Here

Examples of com.din.din.model.entities.FoodItem

      foodItemSet.clear();
      if(recipe.getRecipeItems() != null) {
        Map<Key, KeyEntity> foodItemMap = cache.get(FoodItem.class);
        for(RecipeItem item : recipe.getRecipeItems()) {
          if(foodItemMap.containsKey(item.getFoodItemKey())) {
            FoodItem foodItem = (FoodItem)foodItemMap.get(item.getFoodItemKey());
            FoodItemWrapper foodItemWrapper = new FoodItemWrapper(project, foodItem, item);
            foodItemSet.add(foodItemWrapper);
          }
        }
      } 
View Full Code Here

Examples of com.din.din.model.entities.FoodItem

    }
    }   
 
  public void onRemoveFoodItem(CloseEvent event) {
    FacesContext context = FacesContext.getCurrentInstance();
    FoodItem item = context.getApplication().evaluateExpressionGet(context, "#{foodItem}", FoodItem.class);
   
    selectedFoodItem = item;
    onRemoveFoodItem();
    }   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.