src/java/de/uapcore/lightpit/LightPITModule.java

changeset 11
737ab27e37b3
parent 10
89e3e6e28b69
child 18
a94b172c3a93
     1.1 --- a/src/java/de/uapcore/lightpit/LightPITModule.java	Sat Dec 16 20:19:28 2017 +0100
     1.2 +++ b/src/java/de/uapcore/lightpit/LightPITModule.java	Sun Dec 17 01:45:28 2017 +0100
     1.3 @@ -71,7 +71,60 @@
     1.4      
     1.5      /**
     1.6       * Returns the properties key for the menu label.
     1.7 -     * @return the properties key relative to the base name
     1.8 +     * @return the properties key
     1.9       */
    1.10      String menuKey() default "menuLabel";
    1.11 +    
    1.12 +    /**
    1.13 +     * Returns the properties key for the page title.
    1.14 +     * 
    1.15 +     * By default this is the same as the menu label.
    1.16 +     * 
    1.17 +     * @return the properties key
    1.18 +     */
    1.19 +    String titleKey() default "menuLabel";
    1.20 +    
    1.21 +    /**
    1.22 +     * Class representing the annotation.
    1.23 +     * This is necessary, because the EL resolver cannot deal with
    1.24 +     * annotation objects.
    1.25 +     * 
    1.26 +     * Note, that only the properties which are interesting for the JSP pages
    1.27 +     * are proxied by this object.
    1.28 +     */
    1.29 +    public static class ELProxy {
    1.30 +        private final String bundleBaseName, modulePath, menuKey, titleKey;
    1.31 +        
    1.32 +        public static ELProxy convert(LightPITModule annotation) {
    1.33 +            return new ELProxy(
    1.34 +                    annotation.bundleBaseName(),
    1.35 +                    annotation.modulePath(),
    1.36 +                    annotation.menuKey(),
    1.37 +                    annotation.titleKey()
    1.38 +            );
    1.39 +        }
    1.40 +
    1.41 +        private ELProxy(String bundleBaseName, String modulePath, String menuKey, String titleKey) {
    1.42 +            this.bundleBaseName = bundleBaseName;
    1.43 +            this.modulePath = modulePath;
    1.44 +            this.menuKey = menuKey;
    1.45 +            this.titleKey = titleKey;
    1.46 +        }
    1.47 +
    1.48 +        public String getBundleBaseName() {
    1.49 +            return bundleBaseName;
    1.50 +        }
    1.51 +
    1.52 +        public String getMenuKey() {
    1.53 +            return menuKey;
    1.54 +        }
    1.55 +
    1.56 +        public String getModulePath() {
    1.57 +            return modulePath;
    1.58 +        }
    1.59 +
    1.60 +        public String getTitleKey() {
    1.61 +            return titleKey;
    1.62 +        }
    1.63 +    }
    1.64  }

mercurial