parent
e4da9a6a71
commit
ce0f354f9a
11 changed files with 640 additions and 321 deletions
@ -0,0 +1,106 @@ |
|||||||
|
package com.mousetech.gourmetj; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import javax.annotation.PostConstruct; |
||||||
|
import javax.faces.event.AjaxBehaviorEvent; |
||||||
|
import javax.faces.view.ViewScoped; |
||||||
|
import javax.inject.Inject; |
||||||
|
import javax.inject.Named; |
||||||
|
|
||||||
|
import org.primefaces.event.SelectEvent; |
||||||
|
|
||||||
|
import com.mousetech.gourmetj.persistence.dao.ShopcatRepository; |
||||||
|
import com.mousetech.gourmetj.persistence.model.Shopcat; |
||||||
|
|
||||||
|
@Named |
||||||
|
@ViewScoped |
||||||
|
public class EditShopcatBean implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
*/ |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
private String ingkey; |
||||||
|
|
||||||
|
private String shopcatName; |
||||||
|
|
||||||
|
private String shopcatSuggestion; |
||||||
|
|
||||||
|
private List<String> shopcatSuggestionList; |
||||||
|
|
||||||
|
@Inject |
||||||
|
ShopcatRepository shopcatRepository; |
||||||
|
|
||||||
|
/** |
||||||
|
* Default Constructor. |
||||||
|
*/ |
||||||
|
public EditShopcatBean() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@PostConstruct |
||||||
|
public void init() { |
||||||
|
this.shopcatSuggestionList = this.shopcatRepository |
||||||
|
.findDistinctCategoryNative(); |
||||||
|
// // Get ingkey from Flash scope
|
||||||
|
// ingkey = (String) JSFUtils.getFlash("ingkey");
|
||||||
|
// Shopcat scat = this.shopcatRepository
|
||||||
|
// .findShopcatByIngkey(ingkey);
|
||||||
|
// if (scat != null) {
|
||||||
|
// this.setShopcatName(scat.getShopcategory());
|
||||||
|
// }
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return the shopcatName |
||||||
|
*/ |
||||||
|
public String getShopcatName() { |
||||||
|
return shopcatName; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param shopcatName the shopcatName to set |
||||||
|
*/ |
||||||
|
public void setShopcatName(String shopcatName) { |
||||||
|
this.shopcatName = shopcatName; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return the shopcatSuggestion |
||||||
|
*/ |
||||||
|
public String getShopcatSuggestion() { |
||||||
|
return shopcatSuggestion; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param shopcatSuggestion the shopcatSuggestion to set |
||||||
|
*/ |
||||||
|
public void setShopcatSuggestion(String shopcatSuggestion) { |
||||||
|
this.shopcatSuggestion = shopcatSuggestion; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return the ingkey |
||||||
|
*/ |
||||||
|
public String getIngkey() { |
||||||
|
return ingkey; |
||||||
|
} |
||||||
|
|
||||||
|
public void setIngkey(String ingkey) { |
||||||
|
this.ingkey = ingkey; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return the shopcatSuggestionList |
||||||
|
*/ |
||||||
|
public List<String> getShopcatSuggestionList() { |
||||||
|
return shopcatSuggestionList; |
||||||
|
} |
||||||
|
|
||||||
|
public void ajaxShopcatSuggest(AjaxBehaviorEvent event) { |
||||||
|
this.shopcatName = this.shopcatSuggestion; |
||||||
|
} |
||||||
|
} |
@ -1,30 +1,36 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<ui:composition xmlns:f="http://xmlns.jcp.org/jsf/core" |
<!DOCTYPE html> |
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" |
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html" |
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core" |
||||||
xmlns:ui="http://java.sun.com/jsf/facelets" |
xmlns:ui="http://java.sun.com/jsf/facelets" |
||||||
xmlns:h="http://java.sun.com/jsf/html" |
xmlns:p="http://primefaces.org/ui" |
||||||
xmlns:tc="http://myfaces.apache.org/tobago/component" |
|
||||||
> |
> |
||||||
<f:view> |
<head></head> |
||||||
<h:head> |
<body> |
||||||
<title><ui:insert name="title">Gourmet Recipe Manager (web version)</ui:insert></title> |
<ui:composition> |
||||||
<link rel="icon" type="image/vnd.microsoft.icon" |
<f:view> |
||||||
href="#{pageContext.contextPath}/favicon.ico" |
<h:head> |
||||||
/> |
<title><ui:insert name="title">Gourmet Recipe Manager (web version)</ui:insert></title> |
||||||
|
<link rel="icon" type="image/vnd.microsoft.icon" |
||||||
<h:outputStylesheet name="css/style.css" /> |
href="#{pageContext.contextPath}/favicon.ico" |
||||||
</h:head> |
/> |
||||||
<h:body> |
<h:outputStylesheet name="css/style.css" /> |
||||||
<h1> |
</h:head> |
||||||
<ui:insert name="title">Gourmet Recipe Manager (web version)</ui:insert> |
<h:body> |
||||||
</h1> |
<h1> |
||||||
<ui:insert name="content"> |
<ui:insert name="title">Gourmet Recipe Manager (web version)</ui:insert> |
||||||
<ui:include src="content.xhtml" /> |
</h1> |
||||||
</ui:insert> |
<ui:insert name="content"> |
||||||
|
<ui:include src="content.xhtml" /> |
||||||
|
</ui:insert> |
||||||
|
|
||||||
(C) 2021 Tim Holloway, Licensed under the <a |
(C) 2021 Tim Holloway, Licensed under the <a |
||||||
href="http://www.apache.org/licenses/LICENSE-2.0" |
href="http://www.apache.org/licenses/LICENSE-2.0" |
||||||
>Apache License, Version 2.0</a>. |
>Apache License, Version 2.0</a>. |
||||||
<p>Based on Gourmet Recipe Manager by T. Hinkle</p> |
<p>Based on Gourmet Recipe Manager by T. Hinkle</p> |
||||||
</h:body> |
</h:body> |
||||||
</f:view> |
</f:view> |
||||||
</ui:composition> |
</ui:composition> |
||||||
|
</body> |
||||||
|
</html> |
@ -0,0 +1,61 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" |
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html" |
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core" |
||||||
|
xmlns:ui="http://java.sun.com/jsf/facelets" |
||||||
|
xmlns:p="http://primefaces.org/ui" |
||||||
|
> |
||||||
|
|
||||||
|
<h:head> |
||||||
|
<title>Shopping Category</title> |
||||||
|
<style type="text/css"> |
||||||
|
html { |
||||||
|
font-size: 14px; |
||||||
|
} |
||||||
|
</style> |
||||||
|
</h:head> |
||||||
|
|
||||||
|
<h:body> |
||||||
|
<ui:component> |
||||||
|
<h:form id="frmShopcat"> |
||||||
|
<p:panelGrid columns="1"> |
||||||
|
<div>Ingredient key: |
||||||
|
#{editShopcatBean.ingkey} |
||||||
|
</div> |
||||||
|
<p:outputLabel for="@next" |
||||||
|
value="Category Name" /> |
||||||
|
<p:inputText id="ctlShopcat" |
||||||
|
value="#{editShopcatBean.shopcatName}" |
||||||
|
> |
||||||
|
</p:inputText> |
||||||
|
<h:outputText |
||||||
|
value="suggestion:" /> |
||||||
|
<p:selectOneMenu |
||||||
|
id="ctlShopcatMenu" |
||||||
|
value="#{editShopcatBean.shopcatSuggestion}" |
||||||
|
> |
||||||
|
<f:selectItems |
||||||
|
value="#{editShopcatBean.shopcatSuggestionList}" /> |
||||||
|
<p:ajax event="change" |
||||||
|
listener="#{editShopcatBean.ajaxShopcatSuggest}" |
||||||
|
update="ctlShopcat" /> |
||||||
|
</p:selectOneMenu> |
||||||
|
<p:panelGrid columns="2" |
||||||
|
style="width: 100%" |
||||||
|
> |
||||||
|
<p:commandButton |
||||||
|
id="scDlgOK" value="OK" |
||||||
|
style="width: 6em" |
||||||
|
action="#{recipeDetailBean.doUpdateShopcat}" |
||||||
|
update="form1:tabGroupClient:ingredientTable" |
||||||
|
oncomplete="PF('editShopcatDlg').hide()" /> |
||||||
|
<p:commandButton |
||||||
|
id="scDlgCan" value="Cancel" |
||||||
|
style="width: 6em" |
||||||
|
onclick="PF('editShopcatDlg').hide()" /> |
||||||
|
</p:panelGrid> |
||||||
|
</p:panelGrid> |
||||||
|
</h:form> |
||||||
|
</ui:component> |
||||||
|
</h:body> |
||||||
|
</html> |
@ -0,0 +1,9 @@ |
|||||||
|
<html> |
||||||
|
<head> |
||||||
|
<title>ERROR</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<h1>Uh-oh!</h1> |
||||||
|
An error happened. |
||||||
|
</body> |
||||||
|
</html> |
Loading…
Reference in new issue