From e624eae79d794834dc3b06b28acff6f6658cbc21 Mon Sep 17 00:00:00 2001 From: Tim Holloway Date: Wed, 29 Dec 2021 14:30:25 -0500 Subject: [PATCH] Print page converted --- .../com/mousetech/gourmetj/UserSession.java | 57 +++++-- .../META-INF/resources/recipeDetails.xhtml | 152 +++++++++++------- .../META-INF/resources/recipePrint.xhtml | 147 ++++++++--------- 3 files changed, 211 insertions(+), 145 deletions(-) diff --git a/src/main/java/com/mousetech/gourmetj/UserSession.java b/src/main/java/com/mousetech/gourmetj/UserSession.java index 0b31f44..f15e011 100644 --- a/src/main/java/com/mousetech/gourmetj/UserSession.java +++ b/src/main/java/com/mousetech/gourmetj/UserSession.java @@ -12,11 +12,11 @@ import com.mousetech.gourmetj.persistence.model.Recipe; public class UserSession implements Serializable { /** - * Serial version for session save/restore + * Serial version for session save/restore */ private static final long serialVersionUID = 7449440266704831598L; - + private String lastSearch = ""; /** @@ -32,7 +32,7 @@ public class UserSession implements Serializable { public void setLastSearch(String lastSearch) { this.lastSearch = lastSearch; } - + private Long lastEdit; /** @@ -48,11 +48,11 @@ public class UserSession implements Serializable { public void setLastEdit(Long lastEdit) { this.lastEdit = lastEdit; } - - //*** + + // *** /** - * Tab index to select when presenting editDetails. - * First tab is 0. + * Tab index to select when presenting editDetails. First tab + * is 0. */ private int detailTab; @@ -70,16 +70,17 @@ public class UserSession implements Serializable { this.detailTab = detailTab; } - //*** + // *** private Recipe recipe; /** * Recipe is set by the mainpage bean to a blank recipe - * before dispatching to the detailEdit page (new recipe). - * It is also set by the detail view page so that the - * detail view can be edited. + * before dispatching to the detailEdit page (new recipe). It + * is also set by the detail view page so that the detail + * view can be edited. * * In addition to detail editing, it's also used by the + * * @see PictureController. * * @return Recipe selected. @@ -94,4 +95,38 @@ public class UserSession implements Serializable { public void setRecipe(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(); + } } diff --git a/src/main/resources/META-INF/resources/recipeDetails.xhtml b/src/main/resources/META-INF/resources/recipeDetails.xhtml index dc5b1ec..8369b2e 100644 --- a/src/main/resources/META-INF/resources/recipeDetails.xhtml +++ b/src/main/resources/META-INF/resources/recipeDetails.xhtml @@ -8,72 +8,90 @@ > Gourmet Recipe Manager + - + - - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - + - + + + + @@ -107,18 +129,26 @@ - + + + + + + diff --git a/src/main/resources/META-INF/resources/recipePrint.xhtml b/src/main/resources/META-INF/resources/recipePrint.xhtml index 7b7fa35..4babe1e 100644 --- a/src/main/resources/META-INF/resources/recipePrint.xhtml +++ b/src/main/resources/META-INF/resources/recipePrint.xhtml @@ -1,87 +1,88 @@ Gourmet Recipe Manager - - - - + + + + + + + + + + + + + + + + - - - - - + + + - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + \ No newline at end of file