Removed Flash scope - Mojarra has bugs

This commit is contained in:
Tim Holloway 2022-01-07 11:45:42 -05:00
parent e859a51772
commit a76d5cb1ac
6 changed files with 25 additions and 24 deletions

View File

@ -120,10 +120,11 @@ public class AdminMainBean implements Serializable {
/** /**
* Return to last search, if any * Return to last search, if any
* No longer broken (required Maven include for annotation).
*/ */
@PostConstruct @PostConstruct
void init() { void init() {
log.info("Constructing AdminMainBean " + this); log.debug("Initializing AdminMainBean " + this);
this.setSearchText(userSession.getLastSearch()); this.setSearchText(userSession.getLastSearch());
// Clean up from any previous operations. // Clean up from any previous operations.
this.userSession.setRecipe(null); this.userSession.setRecipe(null);
@ -182,8 +183,9 @@ public class AdminMainBean implements Serializable {
*/ */
public String showRecipe() { public String showRecipe() {
long recipeId = getSearchResults().getRowData().getId(); long recipeId = getSearchResults().getRowData().getId();
JSFUtils.flashScope().put("recipeID", // Flash Scope is buggy under Mojarra plus now using session
Long.valueOf(recipeId)); // JSFUtils.flashScope().put("recipeID",
// Long.valueOf(recipeId));
userSession.setLastEdit(recipeId); userSession.setLastEdit(recipeId);
userSession.setRecipe(null); // forces loading of line userSession.setRecipe(null); // forces loading of line
// items. // items.

View File

@ -2,11 +2,8 @@ package com.mousetech.gourmetj;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@ -59,7 +56,7 @@ public class RecipeDetailBean implements Serializable {
* Default Constructor. * Default Constructor.
*/ */
public RecipeDetailBean() { public RecipeDetailBean() {
log.warn("Constructing RecipeDetail " + this); log.debug("Constructing RecipeDetail " + this);
} }
/** /**
@ -228,7 +225,8 @@ public class RecipeDetailBean implements Serializable {
*/ */
if (this.recipe == null) { if (this.recipe == null) {
Long rid = Long rid =
(Long) JSFUtils.getFlash("recipeID"); //(Long) JSFUtils.getFlash("recipeID");
userSession.getLastEdit();
if (rid != null) { if (rid != null) {
this.recipe = loadRecipe(rid); this.recipe = loadRecipe(rid);
} else { } else {
@ -1034,5 +1032,6 @@ public class RecipeDetailBean implements Serializable {
iui.setItem(this.getNewGroupName()); iui.setItem(this.getNewGroupName());
List<IngredientUI> ingUIList = this.getWrappedIngredients(); List<IngredientUI> ingUIList = this.getWrappedIngredients();
ingUIList.add(iui); ingUIList.add(iui);
this.setNewGroupName(""); // Clear for next time!
} }
} }

View File

@ -32,7 +32,7 @@
<h:form id="ftmTimeout"> <h:form id="ftmTimeout">
<p:idleMonitor <p:idleMonitor
timeout="#{userSession.sessionTimeoutInterval}" timeout="#{userSession.sessionTimeoutInterval}"
onidle="sessionExpiredConfirmation.show()" onidle="PF('sessionExpiredConfirmation').show()"
> >
<p:ajax event="idle" <p:ajax event="idle"
listener="#{userSession.sessionIdleListener}" listener="#{userSession.sessionIdleListener}"
@ -48,7 +48,7 @@
> >
<p:commandButton id="confirmRouteDel" <p:commandButton id="confirmRouteDel"
value="Ok" value="Ok"
oncomplete="sessionExpiredConfirmation.hide()" oncomplete="PF('sessionExpiredDlg').hide()"
actionListener="#{userSession.logoutAction}" actionListener="#{userSession.logoutAction}"
/> />
</p:confirmDialog> </p:confirmDialog>

View File

@ -28,6 +28,10 @@
width: 20em; width: 20em;
text-align: left; text-align: left;
} }
.groupItem {
font-weight: bold;
background-color: green;
}
</style> </style>
<h:messages id="messages" /> <h:messages id="messages" />
<p:panel id="editorPanel" <p:panel id="editorPanel"
@ -243,6 +247,7 @@
<p:inputText id="ingItem" <p:inputText id="ingItem"
size="42" size="42"
value="#{item.item}" value="#{item.item}"
styleClass="#{item.ingGroup ? 'groupItem' : ''}"
> >
</p:inputText> </p:inputText>
</p:column> </p:column>
@ -277,7 +282,7 @@
/> />
</p:inputText> </p:inputText>
</p:column> </p:column>
<p:column style="width: 2em"> <p:column style="width: 2.6em">
<f:facet name="header"> <f:facet name="header">
E E
</f:facet> </f:facet>
@ -293,7 +298,7 @@
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
Shopping Cat. Shopping Category
</f:facet> </f:facet>
<h:outputText <h:outputText
id="shopCat" id="shopCat"

View File

@ -1,4 +1,4 @@
// scrolltable.js - scroll functions for dataTable // scrolltable.js - scroll functions for dataTable
function scrollAndFocus(rootId, tableId, txtId) { function scrollAndFocus(rootId, tableId, txtId) {
scrollToBottom(rootId + ":" + tableId); scrollToBottom(rootId + ":" + tableId);
@ -46,8 +46,8 @@ function scrollToRow(pTable, selItem) {
scrollTopInPx = (selItem - 1.2) * pTable.itemHeight; scrollTopInPx = (selItem - 1.2) * pTable.itemHeight;
} }
$(pTable.jqId + " .ui-datatable-scrollable-body").animate({scrollTop:scrollTopInPx, duration: 20}, scrollTopInPx); //$(pTable.jqId + " .ui-datatable-scrollable-body").animate({scrollTop:scrollTopInPx, duration: 20}, scrollTopInPx);
$(pTable.jqId + " .ui-datatable-scrollable-body").scrollTop(scrollTopInPx);
} }
/** /**

View File

@ -36,7 +36,7 @@
/> />
</f:facet> </f:facet>
<p:row> <p:row>
<p:column id="leftCol" style="width: 80%"> <p:column id="leftCol" style="width: 75%">
<p:panelGrid columns="2"> <p:panelGrid columns="2">
<img id="bigpix" <img id="bigpix"
src="/img/picture/#{recipeDetailBean.recipe.id}" src="/img/picture/#{recipeDetailBean.recipe.id}"
@ -89,12 +89,7 @@
</p:panelGrid> </p:panelGrid>
<h:commandLink value="Edit Details" <h:commandLink value="Edit Details"
action="#{recipeDetailBean.editDescription}" action="#{recipeDetailBean.editDescription}"
>
<c:set target="#{flash}"
property="recipeID"
value="#{recipeDetailBean.recipe.id}"
/> />
</h:commandLink>
<!-- --> <!-- -->
<p:panelGrid id="pnlInstr" <p:panelGrid id="pnlInstr"
columns="1" style="width: 100%" columns="1" style="width: 100%"
@ -144,7 +139,7 @@
</p:column> </p:column>
<!-- ====== Ingredients ============================ --> <!-- ====== Ingredients ============================ -->
<p:column id="ingredientsc" <p:column id="ingredientsc"
style="width: 20%; vertical-align: top;" style="width: 25%; vertical-align: top;"
> >
<p:dataTable id="ingredients" <p:dataTable id="ingredients"
showDirectLinksArrows="true" showDirectLinksArrows="true"
@ -172,7 +167,7 @@
/> />
</p:column> </p:column>
<p:column label="Units" <p:column label="Units"
style="width: 4em" style="width: 5em"
> >
<h:outputText <h:outputText
value="#{ingredient.unit}" value="#{ingredient.unit}"