Print page converted
This commit is contained in:
parent
50a07f0f6d
commit
e624eae79d
|
@ -12,11 +12,11 @@ import com.mousetech.gourmetj.persistence.model.Recipe;
|
||||||
public class UserSession implements Serializable {
|
public class UserSession implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serial version for session save/restore
|
* Serial version for session save/restore
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID =
|
private static final long serialVersionUID =
|
||||||
7449440266704831598L;
|
7449440266704831598L;
|
||||||
|
|
||||||
private String lastSearch = "";
|
private String lastSearch = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ public class UserSession implements Serializable {
|
||||||
public void setLastSearch(String lastSearch) {
|
public void setLastSearch(String lastSearch) {
|
||||||
this.lastSearch = lastSearch;
|
this.lastSearch = lastSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long lastEdit;
|
private Long lastEdit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,11 +48,11 @@ public class UserSession implements Serializable {
|
||||||
public void setLastEdit(Long lastEdit) {
|
public void setLastEdit(Long lastEdit) {
|
||||||
this.lastEdit = lastEdit;
|
this.lastEdit = lastEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//***
|
// ***
|
||||||
/**
|
/**
|
||||||
* Tab index to select when presenting editDetails.
|
* Tab index to select when presenting editDetails. First tab
|
||||||
* First tab is 0.
|
* is 0.
|
||||||
*/
|
*/
|
||||||
private int detailTab;
|
private int detailTab;
|
||||||
|
|
||||||
|
@ -70,16 +70,17 @@ public class UserSession implements Serializable {
|
||||||
this.detailTab = detailTab;
|
this.detailTab = detailTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
//***
|
// ***
|
||||||
private Recipe recipe;
|
private Recipe recipe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recipe is set by the mainpage bean to a blank recipe
|
* Recipe is set by the mainpage bean to a blank recipe
|
||||||
* before dispatching to the detailEdit page (new recipe).
|
* before dispatching to the detailEdit page (new recipe). It
|
||||||
* It is also set by the detail view page so that the
|
* is also set by the detail view page so that the detail
|
||||||
* detail view can be edited.
|
* view can be edited.
|
||||||
*
|
*
|
||||||
* In addition to detail editing, it's also used by the
|
* In addition to detail editing, it's also used by the
|
||||||
|
*
|
||||||
* @see PictureController.
|
* @see PictureController.
|
||||||
*
|
*
|
||||||
* @return Recipe selected.
|
* @return Recipe selected.
|
||||||
|
@ -94,4 +95,38 @@ public class UserSession implements Serializable {
|
||||||
public void setRecipe(Recipe recipe) {
|
public void setRecipe(Recipe recipe) {
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ====
|
||||||
|
public String formatTime(Long ltime) {
|
||||||
|
if (ltime == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
int time = ltime.intValue();
|
||||||
|
int dd, hh, mm, ss;
|
||||||
|
ss = time % 60;
|
||||||
|
time /= 60;
|
||||||
|
mm = time % 60;
|
||||||
|
time /= 60;
|
||||||
|
hh = time % 24;
|
||||||
|
dd = time / 24;
|
||||||
|
StringBuffer sb = new StringBuffer(20);
|
||||||
|
if (dd > 0) {
|
||||||
|
sb.append(dd).append("d ");
|
||||||
|
}
|
||||||
|
if (hh > 0) {
|
||||||
|
sb.append(hh).append("h ");
|
||||||
|
}
|
||||||
|
if (mm > 0) {
|
||||||
|
sb.append(mm);
|
||||||
|
if ((ss == 0) && (hh == 0)) {
|
||||||
|
sb.append(" minutes");
|
||||||
|
} else {
|
||||||
|
sb.append("min. ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ss > 0) {
|
||||||
|
sb.append(dd).append("sec. ");
|
||||||
|
}
|
||||||
|
return sb.toString().trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,72 +8,90 @@
|
||||||
>
|
>
|
||||||
<ui:define name="title">Gourmet Recipe Manager</ui:define>
|
<ui:define name="title">Gourmet Recipe Manager</ui:define>
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
|
<style>
|
||||||
|
.recipeTitle {
|
||||||
|
font-size: larger;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
font-size: large;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-panelgrid-cell {
|
||||||
|
border-width: 0;
|
||||||
|
border-style: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<h:messages />
|
<h:messages />
|
||||||
<h:form id="form1">
|
<h:form id="form1">
|
||||||
<p:panelGrid label="#{recipeDetailBean.recipe.title}"
|
<p:panelGrid label="#{recipeDetailBean.recipe.title}"
|
||||||
columns="1"
|
columns="1"
|
||||||
>
|
>
|
||||||
<p:panelGrid >
|
<p:panelGrid>
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText
|
<h:outputText styleClass="recipeTitle"
|
||||||
value="#{recipeDetailBean.recipe.title}"
|
value="#{recipeDetailBean.recipe.title}"
|
||||||
/>
|
/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<p:row>
|
<p:row>
|
||||||
<p:column id="leftCol" style="width: 80%">
|
<p:column id="leftCol" style="width: 80%">
|
||||||
|
<img id="bigpix"
|
||||||
<img id="bigpix"
|
src="/img/picture/#{recipeDetailBean.recipe.id}"
|
||||||
src="/img/picture/#{recipeDetailBean.recipe.id}"
|
/>
|
||||||
|
<p:panelGrid columns="2">
|
||||||
|
<p:commandButton value="<- Back"
|
||||||
|
styleClass="ui-button-arrow-left"
|
||||||
|
action="main.jsf"
|
||||||
|
immediate="true"
|
||||||
/>
|
/>
|
||||||
<p:panelGrid columns="2">
|
<p:commandButton value="Print"
|
||||||
<p:button value="<- Back"
|
action="recipePrint.jsf"
|
||||||
action="main"
|
styleClass="ui-button-print"
|
||||||
/>
|
immediate="true"
|
||||||
<p:button value="Print"
|
/>
|
||||||
action="recipePrint"
|
<p:outputLabel for="@next"
|
||||||
/>
|
value="Categories:"
|
||||||
<p:outputLabel for="@next"
|
/>
|
||||||
value="Categories:"
|
<h:outputText label="Category: "
|
||||||
/>
|
value="#{adminMainBean.formatCategories(recipeDetailBean.recipe)}"
|
||||||
<h:outputText
|
/>
|
||||||
label="Category: "
|
<p:outputLabel for="@next"
|
||||||
value="#{adminMainBean.formatCategories(recipeDetailBean.recipe)}"
|
value="Cuisine:"
|
||||||
/>
|
/>
|
||||||
<p:outputLabel for="@next"
|
<h:outputText label="Cuisine: "
|
||||||
value="Cuisine:"
|
value="#{recipeDetailBean.recipe.cuisine}"
|
||||||
/>
|
/>
|
||||||
<h:outputText
|
<p:outputLabel for="@next"
|
||||||
label="Cuisine: "
|
value="Prep Time:"
|
||||||
value="#{recipeDetailBean.recipe.cuisine}"
|
/>
|
||||||
/>
|
<h:outputText label="Prep Time: "
|
||||||
<p:outputLabel for="@next"
|
value="#{userSession.formatTime(recipeDetailBean.recipe.preptime)}"
|
||||||
value="Prep Time:"
|
/>
|
||||||
/>
|
<p:outputLabel for="@next"
|
||||||
<h:outputText
|
value="Cook Time:"
|
||||||
label="Prep Time: "
|
/>
|
||||||
value="#{recipeDetailBean.recipe.preptime}"
|
<h:outputText label="Cook Time: "
|
||||||
/>
|
value="#{userSession.formatTime(recipeDetailBean.recipe.cooktime)}"
|
||||||
<p:outputLabel for="@next"
|
/>
|
||||||
value="Cook Time:"
|
</p:panelGrid>
|
||||||
/>
|
<h:commandLink value="Edit Details"
|
||||||
<h:outputText
|
action="#{recipeDetailBean.editDescription}"
|
||||||
label="Cook Time: "
|
|
||||||
value="#{recipeDetailBean.recipe.cooktime}"
|
|
||||||
/>
|
|
||||||
</p:panelGrid>
|
|
||||||
<h:commandLink
|
|
||||||
value="Edit Details"
|
|
||||||
action="#{recipeDetailBean.editDescription}"
|
|
||||||
>
|
|
||||||
<c:set target="#{flash}"
|
|
||||||
property="recipeID"
|
|
||||||
value="#{recipeDetailBean.recipe.id}"
|
|
||||||
/>
|
|
||||||
</h:commandLink>
|
|
||||||
<!-- -->
|
|
||||||
<p:panelGrid label="Instructions"
|
|
||||||
columns="1"
|
|
||||||
>
|
>
|
||||||
|
<c:set target="#{flash}"
|
||||||
|
property="recipeID"
|
||||||
|
value="#{recipeDetailBean.recipe.id}"
|
||||||
|
/>
|
||||||
|
</h:commandLink>
|
||||||
|
<!-- -->
|
||||||
|
<p:panelGrid columns="1">
|
||||||
|
<f:facet name="header">
|
||||||
|
<h:outputText
|
||||||
|
styleClass="subtitle"
|
||||||
|
value="Instructions"
|
||||||
|
/>
|
||||||
|
</f:facet>
|
||||||
<h:outputText id="instructions"
|
<h:outputText id="instructions"
|
||||||
escape="false"
|
escape="false"
|
||||||
value="#{recipeDetailBean.instructions}"
|
value="#{recipeDetailBean.instructions}"
|
||||||
|
@ -83,9 +101,13 @@
|
||||||
action="#{recipeDetailBean.editInstructions}"
|
action="#{recipeDetailBean.editInstructions}"
|
||||||
/>
|
/>
|
||||||
</p:panelGrid>
|
</p:panelGrid>
|
||||||
<p:panelGrid label="Notes"
|
<p:panelGrid columns="1">
|
||||||
columns="1"
|
<f:facet name="header">
|
||||||
>
|
<h:outputText
|
||||||
|
styleClass="subtitle"
|
||||||
|
value="Notes"
|
||||||
|
/>
|
||||||
|
</f:facet>
|
||||||
<h:outputText escape="false"
|
<h:outputText escape="false"
|
||||||
value="#{recipeDetailBean.modifications}"
|
value="#{recipeDetailBean.modifications}"
|
||||||
/>
|
/>
|
||||||
|
@ -107,18 +129,26 @@
|
||||||
</p:column>
|
</p:column>
|
||||||
<!-- ====== Ingredients ============================ -->
|
<!-- ====== Ingredients ============================ -->
|
||||||
<p:column id="ingredientsc"
|
<p:column id="ingredientsc"
|
||||||
style="width: 20%"
|
style="width: 20%; vertical-align: top;"
|
||||||
>
|
>
|
||||||
<h:commandLink
|
|
||||||
value="Edit Ingredients"
|
|
||||||
style="vertical-align: top"
|
|
||||||
action="#{recipeDetailBean.editIngredients}"
|
|
||||||
/>
|
|
||||||
<p:dataTable id="ingredients"
|
<p:dataTable id="ingredients"
|
||||||
showDirectLinksArrows="true"
|
showDirectLinksArrows="true"
|
||||||
value="#{recipeDetailBean.ingredients}"
|
value="#{recipeDetailBean.ingredients}"
|
||||||
var="ingredient"
|
var="ingredient"
|
||||||
>
|
>
|
||||||
|
<f:facet name="header">
|
||||||
|
<h:outputText
|
||||||
|
styleClass="subtitle"
|
||||||
|
value="Ingredients"
|
||||||
|
/>
|
||||||
|
</f:facet>
|
||||||
|
<f:facet name="footer">
|
||||||
|
<h:commandLink
|
||||||
|
value="Edit Ingredients"
|
||||||
|
style="vertical-align: top"
|
||||||
|
action="#{recipeDetailBean.editIngredients}"
|
||||||
|
/>
|
||||||
|
</f:facet>
|
||||||
<p:column label="Amt"
|
<p:column label="Amt"
|
||||||
style="width: 4em; text-align: right"
|
style="width: 4em; text-align: right"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,87 +1,88 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ui:composition template="/WEB-INF/layout/layout.xhtml"
|
<ui:composition template="/WEB-INF/layout/layout.xhtml"
|
||||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
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:tc="http://myfaces.apache.org/tobago/component"
|
xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jstl"
|
||||||
>
|
>
|
||||||
<!-- Print Recipe -->
|
<!-- Print Recipe -->
|
||||||
<ui:define name="title">Gourmet Recipe Manager</ui:define>
|
<ui:define name="title">Gourmet Recipe Manager</ui:define>
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<tc:messages />
|
<h:messages />
|
||||||
<tc:section level="2"
|
<img id="bigpix"
|
||||||
label="#{recipeDetailBean.recipe.title}"
|
SRC="/img/picture/#{recipeDetailBean.recipe.id}"
|
||||||
>
|
/>
|
||||||
<tc:flexLayout columns="auto 6em auto">
|
<p:button value="<- Back" action="main" />
|
||||||
<tc:image id="bigpix"
|
<p:panelGrid columns="2">
|
||||||
value="/gourmetj/img/picture/#{recipeDetailBean.recipe.id}"
|
<h:outputLabel for="@next" value="Category: " />
|
||||||
|
<h:outputText
|
||||||
|
value="#{adminMainBean.formatCategories(recipeDetailBean.recipe)}"
|
||||||
|
/>
|
||||||
|
<h:outputLabel for="@next" value="Cuisine: " />
|
||||||
|
<h:outputText
|
||||||
|
value="#{recipeDetailBean.recipe.cuisine}"
|
||||||
|
/>
|
||||||
|
<h:outputLabel for="@next" value="Prep Time: " />
|
||||||
|
<h:outputText
|
||||||
|
value="#{userSession.formatTime(recipeDetailBean.recipe.preptime)}"
|
||||||
|
/>
|
||||||
|
<h:outputLabel for="@next" value="Cook Time: " />
|
||||||
|
<h:outputText label="Cook Time: "
|
||||||
|
value="#{userSession.formatTime(recipeDetailBean.recipe.cooktime)}"
|
||||||
|
/>
|
||||||
|
</p:panelGrid>
|
||||||
|
<!-- -->
|
||||||
|
<p:panelGrid columns="1" id="ingredientsc">
|
||||||
|
<f:facet name="header">
|
||||||
|
<h:outputText styleClass="subtitle"
|
||||||
|
value="Ingredients"
|
||||||
/>
|
/>
|
||||||
<tc:button label="<- Back" action="main">
|
</f:facet>
|
||||||
<tc:style width="5em" height="2em"/>
|
<p:dataTable id="ingredients"
|
||||||
</tc:button>
|
showDirectLinksArrows="true"
|
||||||
<tc:gridLayout columns="15em 15em">
|
value="#{recipeDetailBean.ingredients}"
|
||||||
<tc:out label="Category: "
|
var="ingredient"
|
||||||
value="#{adminMainBean.formatCategories(recipeDetailBean.recipe)}"
|
>
|
||||||
|
<p:column label="Amt" style="text-align: right">
|
||||||
|
<h:outputText
|
||||||
|
value="#{ingredient.displayAmount}"
|
||||||
/>
|
/>
|
||||||
<tc:out label="Cuisine: "
|
</p:column>
|
||||||
value="#{recipeDetailBean.recipe.cuisine}"
|
<p:column label="Units">
|
||||||
|
<h:outputText value="#{ingredient.unit}" />
|
||||||
|
</p:column>
|
||||||
|
<p:column label="Item">
|
||||||
|
<h:outputText value="#{ingredient.item}" />
|
||||||
|
</p:column>
|
||||||
|
<p:column label="Optional" align="center">
|
||||||
|
<p:selectBooleanCheckbox readonly="true"
|
||||||
|
value="#{ingredient.optionalCB}"
|
||||||
/>
|
/>
|
||||||
<tc:out label="Prep Time: "
|
</p:column>
|
||||||
value="#{recipeDetailBean.recipe.preptime}"
|
</p:dataTable>
|
||||||
/>
|
</p:panelGrid>
|
||||||
<tc:out label="Cook Time: "
|
<h:outputText
|
||||||
value="#{recipeDetailBean.recipe.preptime}"
|
value="Recipe ID: #{recipeDetailBean.recipe.id}"
|
||||||
/>
|
/>
|
||||||
</tc:gridLayout>
|
<p:panelGrid columns="1">
|
||||||
</tc:flexLayout>
|
<f:facet name="header">
|
||||||
|
<h:outputText styleClass="subtitle"
|
||||||
|
value="Instructions"
|
||||||
|
/>
|
||||||
|
</f:facet>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<tc:section id="ingredientsc" label="Ingredients">
|
<h:outputText id="instructions" escape="false"
|
||||||
<tc:sheet id="ingredients"
|
value="#{recipeDetailBean.instructions}"
|
||||||
showDirectLinksArrows="true"
|
/>
|
||||||
value="#{recipeDetailBean.ingredients}"
|
</p:panelGrid>
|
||||||
var="ingredient"
|
<p:panelGrid columns="1">
|
||||||
>
|
<f:facet name="header">
|
||||||
<tc:row>
|
<h:outputText styleClass="subtitle" value="Notes" />
|
||||||
<tc:style
|
</f:facet>
|
||||||
customClass="#{item.ingGroup ? 'stGroup' : ''}"
|
<h:outputText escape="false"
|
||||||
/>
|
value="#{recipeDetailBean.modifications}"
|
||||||
</tc:row>
|
/>
|
||||||
<tc:column label="Amt" align="right">
|
</p:panelGrid>
|
||||||
<tc:out
|
|
||||||
value="#{ingredient.displayAmount}"
|
|
||||||
/>
|
|
||||||
</tc:column>
|
|
||||||
<tc:column label="Units">
|
|
||||||
<tc:out value="#{ingredient.unit}" />
|
|
||||||
</tc:column>
|
|
||||||
<tc:column label="Item">
|
|
||||||
<tc:out value="#{ingredient.item}" />
|
|
||||||
</tc:column>
|
|
||||||
<tc:column label="Optional" align="center">
|
|
||||||
<tc:selectBooleanCheckbox readonly="true"
|
|
||||||
value="#{ingredient.optional}"
|
|
||||||
/>
|
|
||||||
</tc:column>
|
|
||||||
</tc:sheet>
|
|
||||||
<tc:out
|
|
||||||
value="Recipe ID: #{recipeDetailBean.recipe.id}"
|
|
||||||
/>
|
|
||||||
</tc:section>
|
|
||||||
<tc:segmentLayout medium="7seg 5seg">
|
|
||||||
<tc:panel id="summ">
|
|
||||||
<!-- -->
|
|
||||||
<tc:box label="Instructions">
|
|
||||||
<tc:out id="instructions" escape="false"
|
|
||||||
value="#{recipeDetailBean.instructions}"
|
|
||||||
/>
|
|
||||||
</tc:box>
|
|
||||||
<tc:box label="Notes">
|
|
||||||
<tc:out escape="false"
|
|
||||||
value="#{recipeDetailBean.modifications}"
|
|
||||||
/>
|
|
||||||
</tc:box>
|
|
||||||
</tc:panel>
|
|
||||||
</tc:segmentLayout>
|
|
||||||
</tc:section>
|
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
Loading…
Reference in New Issue
Block a user