package com.mousetech.gourmetj; import java.util.ArrayList; import java.util.List; import jakarta.enterprise.context.ApplicationScoped; import jakarta.faces.model.SelectItem; import jakarta.inject.Named; /** * Appplication-scope data (mostly constants) * * @author timh * @since Feb 1, 2024 */ @Named @ApplicationScoped public class AppBean { public AppBean() { // TODO Auto-generated constructor stub } private List searchTypeList; /** * @return the searchTypeList * @see RecipeSearchType * Used by main.xhtml */ public List getSearchTypeList() { if (searchTypeList == null) { searchTypeList = loadSearchTypeList(); } return searchTypeList; } private List loadSearchTypeList() { List list = new ArrayList(5); list.add(new SelectItem(RecipeSearchType.rst_BY_NAME.ordinal(), "Title")); list.add(new SelectItem(RecipeSearchType.rst_BY_CATEGORY.ordinal(), "Category")); list.add(new SelectItem(RecipeSearchType.rst_BY_CUISINE.ordinal(), "Cuisine")); list.add( new SelectItem(RecipeSearchType.rst_BY_INGREDIENT.ordinal(), "Ingredient")); return list; } }