bloat removal 1/3 - configurable resource keys

Sat, 23 May 2020 13:34:41 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 23 May 2020 13:34:41 +0200
changeset 77
192298f8161f
parent 76
82f71fb1758a
child 78
bb4c52bf3439

bloat removal 1/3 - configurable resource keys

src/main/java/de/uapcore/lightpit/LightPITModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/ModuleManager.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ErrorModule.java file | annotate | diff | comparison | revisions
src/main/resources/localization/error.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/error_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/language.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/language_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/projects.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/projects_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/users.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/users_de.properties file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/site.jsp file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/LightPITModule.java	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/LightPITModule.java	Sat May 23 13:34:41 2020 +0200
@@ -60,25 +60,6 @@
     String modulePath();
 
     /**
-     * Returns the properties key for the menu label.
-     * <p>
-     * Set this string to empty string, if the module should be hidden from
-     * the menu.
-     *
-     * @return the properties key
-     */
-    String menuKey() default "menuLabel";
-
-    /**
-     * Returns the properties key for the page title.
-     * <p>
-     * By default this is the same as the menu label.
-     *
-     * @return the properties key
-     */
-    String titleKey() default "menuLabel";
-
-    /**
      * If set to <code>true</code>, this module is always loaded, but never
      * visible in the menu or the Web UI module manager.
      *
@@ -103,29 +84,18 @@
      * are proxied by this object.
      */
     class ELProxy {
-        private final String bundleBaseName, modulePath, menuKey, titleKey;
+        private final String bundleBaseName, modulePath;
 
         public ELProxy(LightPITModule annotation) {
             bundleBaseName = annotation.bundleBaseName();
             modulePath = annotation.modulePath();
-            menuKey = annotation.menuKey();
-            titleKey = annotation.titleKey();
         }
 
         public String getBundleBaseName() {
             return bundleBaseName;
         }
-
-        public String getMenuKey() {
-            return menuKey;
-        }
-
         public String getModulePath() {
             return modulePath;
         }
-
-        public String getTitleKey() {
-            return titleKey;
-        }
     }
 }
--- a/src/main/java/de/uapcore/lightpit/ModuleManager.java	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/ModuleManager.java	Sat May 23 13:34:41 2020 +0200
@@ -154,7 +154,7 @@
                 .map(mod -> new MenuEntry(
                         new ResourceKey(
                                 mod.bundleBaseName(),
-                                mod.menuKey()),
+                                "menuLabel"),
                         mod.modulePath() + "/",
                         mod.defaultPriority()))
                 .sorted()
--- a/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Sat May 23 13:34:41 2020 +0200
@@ -41,7 +41,6 @@
 @LightPITModule(
         bundleBaseName = "localization.error",
         modulePath = "error",
-        titleKey = "title",
         systemModule = true
 )
 @WebServlet(
--- a/src/main/resources/localization/error.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/error.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,7 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
-title = Error
+pageTitle = Error
 
 h1 = The requested page cannot be displayed.
 errorCode = Code
--- a/src/main/resources/localization/error_de.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/error_de.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,7 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
-title = Fehler
+pageTitle = Fehler
 
 h1 = Die angeforderte Seite kann nicht angezeigt werden.
 errorCode = Fehlercode
--- a/src/main/resources/localization/language.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/language.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,6 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
+pageTitle=Language Selection
 menuLabel=Language
 
 submit = Switch language
--- a/src/main/resources/localization/language_de.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/language_de.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,6 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
+pageTitle=Sprachauswahl
 menuLabel = Sprache
 
 submit = Sprache ausw\u00e4hlen
--- a/src/main/resources/localization/projects.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/projects.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,6 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+pageTitle=Project Tracking
 menuLabel=Projects
 
 button.create=New Project
--- a/src/main/resources/localization/projects_de.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/projects_de.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,6 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+pageTitle=Projektverwaltung
 menuLabel=Projekte
 
 button.create=Neues Projekt
--- a/src/main/resources/localization/users.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/users.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,6 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+pageTitle=User Management
 menuLabel=Developer
 
 button.create=Add Developer
--- a/src/main/resources/localization/users_de.properties	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/resources/localization/users_de.properties	Sat May 23 13:34:41 2020 +0200
@@ -21,6 +21,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+pageTitle=Benutzerverwaltung
 menuLabel=Entwickler
 
 button.create=Neuer Entwickler
--- a/src/main/webapp/WEB-INF/jsp/site.jsp	Sat May 23 13:24:49 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/site.jsp	Sat May 23 13:34:41 2020 +0200
@@ -69,7 +69,7 @@
     <base href="${baseHref}">
     <title>LightPIT -
         <fmt:bundle basename="${moduleInfo.bundleBaseName}">
-            <fmt:message key="${moduleInfo.titleKey}"/>
+            <fmt:message key="pageTitle"/>
         </fmt:bundle>
     </title>
     <meta charset="UTF-8">

mercurial