From 8818969564fcfb6a66f3021274b5f3af67972f9b Mon Sep 17 00:00:00 2001 From: Tim Holloway Date: Wed, 5 Jan 2022 23:36:03 -0500 Subject: [PATCH] FINALLY got the theme selection to work (THEY LIED!!!) --- README.md | 4 ++-- application.properties | 9 +++++++-- .../mousetech/gourmetj/SpringPrimeFacesApplication.java | 9 +++++++-- src/main/resources/META-INF/resources/application.yml | 3 --- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index aac0541..aab4c1f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ components that it depended on and unfortunately he has not had the time to repair the the app after recent upgrades (including Python 3 and Gnome library) changes broke it. Java is not only "write once/run anywhere", but also was designed for an environment -where changes should not break esisting Java apps. Hence the port. It was easier +where changes should not break existing Java apps. Hence the port. It was easier than trying to learn all the new external resources used by the Python version, make detailed repairs and wait for it to break again. @@ -21,7 +21,7 @@ shopping categories. The ultimate intent is to provide all functions that the or You must have Maven installed on your system to build a copy of the app from scratch. You must have Java 11 or later installed on your -system to run Maven and to runn the app. +system to run Maven and to run the app. This project can be built on the command line using the ``mvn clean install`` command if you have Maven installed in diff --git a/application.properties b/application.properties index 3a41120..5b4f5d8 100644 --- a/application.properties +++ b/application.properties @@ -1,6 +1,11 @@ -joinfaces.jsf.project-stage=development -joinfaces.primefaces.theme=bluesky +#joinfaces.jsf.project-stage=development +# They lied. This doesn't work: +joinfaces.primefaces.theme=cupertino +joinfaces.jsf.webapp-resources-directory=/resources +# This works. Note that ONLY THE FIRST theme set will work unless +# you delete the old primefaces.THEME from ServletContext +server.servlet.context-parameters.primefaces.THEME=omega spring.thymeleaf.enabled=false server.error.whitelabel.enabled=false diff --git a/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java b/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java index f445f93..0dfb77e 100644 --- a/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java +++ b/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java @@ -3,6 +3,8 @@ package com.mousetech.gourmetj; import javax.servlet.ServletContext; import javax.servlet.ServletException; +import org.primefaces.application.resource.PrimeResourceHandler; +import org.primefaces.renderkit.HeadRenderer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; @@ -31,8 +33,11 @@ public class SpringPrimeFacesApplication { @Override public void onStartup(ServletContext servletContext) throws ServletException { - servletContext.setInitParameter( - "primefaces.THEME", "afternoon"); + /* Note that we cannot set theme here since it was + * already set earlier. Default value is "aristo". + */ +// servletContext.setInitParameter( +// "primefaces.THEME", "bluesky"); servletContext.setInitParameter( "javax.faces.FACELETS_SKIP_COMMENTS", "true"); diff --git a/src/main/resources/META-INF/resources/application.yml b/src/main/resources/META-INF/resources/application.yml index f2e2a48..4ef1393 100644 --- a/src/main/resources/META-INF/resources/application.yml +++ b/src/main/resources/META-INF/resources/application.yml @@ -6,6 +6,3 @@ spring: ddl-auto: none database-platform: org.sqlite.hibernate.dialect.SQLiteDialect -jsf: - primefaces: - theme: bluesky